diff --git a/.eslintrc b/.eslintrc index ed3e98bc..3b5aff93 100644 --- a/.eslintrc +++ b/.eslintrc @@ -21,6 +21,7 @@ "eslint-plugin-import-helpers", "@typescript-eslint" ], + "ignorePatterns": ["**/util/inj-types/**"], "rules": { // Possible Problems "array-callback-return": [ diff --git a/components/Pages/Dashboard/Dashboard.tsx b/components/Pages/Dashboard/Dashboard.tsx index 7aca34cc..5eccb011 100644 --- a/components/Pages/Dashboard/Dashboard.tsx +++ b/components/Pages/Dashboard/Dashboard.tsx @@ -1,16 +1,15 @@ import React, { FC, useEffect } from 'react' + import { HStack, Text, VStack } from '@chakra-ui/react' import Loader from 'components/Loader' import { Header } from 'components/Pages/Dashboard/Header' import { StatsTable } from 'components/Pages/Dashboard/StatsTable' import { usePrices } from 'hooks/usePrices' -import { fetchSupply } from 'libs/fetchSupply' import { useRecoilState } from 'recoil' -import { getBondingAPRsAPI } from 'services/useAPI' import { dashboardDataState } from 'state/dashboardDataState' import { getChainLogoUrlByName } from 'util/getChainLogoUrlByName' -import { getDashboardData } from 'util/getDashboardData' - import { useGetDailyBuybacks } from './hooks/useGetDailyBuybacks' + +import { useGetDashboardDataAPI } from './hooks/getDashboardDataAPI' export type DashboardData = { logoUrl: string @@ -22,20 +21,15 @@ export type DashboardData = { } export const Dashboard: FC = () => { const [dashboardState, setDashboardDataState] = useRecoilState(dashboardDataState) - const { data: buybackData, isLoading } = useGetDailyBuybacks() + const { data: dashboardData, isLoading } = useGetDashboardDataAPI() const prices = usePrices() useEffect(() => { const fetchDashboardData = async () => { - let [circulatingWhaleSupply, mockData, aprs]: any = await Promise.all([ - fetchSupply(), - getDashboardData(), - getBondingAPRsAPI(), - ]) - circulatingWhaleSupply = circulatingWhaleSupply?.circulating / (10 ** 6) || 0 - const marketCap = circulatingWhaleSupply * (prices?.WHALE || 0) - const mappedDashboardData = mockData.map((data) => { - const apr = aprs[data.chainName].bondingAPR - const buyback = buybackData.find(buybackData=> buybackData.chainName === data.chainName)?.buyback + const circulatingWhaleSupply = dashboardData.supply?.circulating / (10 ** 6) || 0 + const marketCap = circulatingWhaleSupply * (prices?.WHALE || 0) || 0 + const mappedDashboardData = dashboardData.dashboardData?.map((data) => { + const apr = dashboardData.bondingInfos[data.chainName]?.bondingAPR + const buyback = dashboardData.bondingInfos[data.chainName]?.buyback return ({ logoUrl: getChainLogoUrlByName(data.chainName), chainName: data.chainName, @@ -50,7 +44,7 @@ export const Dashboard: FC = () => { data: mappedDashboardData, whalePrice: prices?.WHALE ? prices.WHALE : 0, marketCap: marketCap ? marketCap : 0, - isInitialized: prices?.WHALE !== 0 && marketCap !== 0, + isInitialized: prices?.WHALE !== 0 && circulatingWhaleSupply !== 0 && marketCap !== 0 && dashboardData.dashboardData?.length > 0, }) } if (!dashboardState.isInitialized) { @@ -59,7 +53,7 @@ export const Dashboard: FC = () => { }, [prices, dashboardState.isInitialized, isLoading]) return - {dashboardState.isInitialized &&
} + {dashboardState.isInitialized &&
} {!dashboardState.isInitialized && ( { alignItems="center"> )} - {dashboardState.isInitialized && } - {dashboardState.isInitialized && {`Total Daily Dex Buybacks: ${dashboardState.data.reduce((acc, data) => acc + data.buyback, 0).toFixed(2)} WHALE`}} + {dashboardState.isInitialized && } + {dashboardState.isInitialized && {`Total Daily Dex Buybacks: ${dashboardState.data?.reduce((acc, data) => acc + data.buyback, 0).toFixed(2)} WHALE`}} } diff --git a/components/Pages/Dashboard/hooks/getDashboardDataAPI.ts b/components/Pages/Dashboard/hooks/getDashboardDataAPI.ts new file mode 100644 index 00000000..1926043e --- /dev/null +++ b/components/Pages/Dashboard/hooks/getDashboardDataAPI.ts @@ -0,0 +1,58 @@ +import { useMemo } from 'react' +import { useQueries } from 'react-query' + +import { fetchSupply } from 'libs/fetchSupply' +import { debounce } from 'lodash' +import { getBondingAPRsAPI } from 'services/useAPI' +import { getDashboardData } from 'util/getDashboardData' + +export const useGetDashboardDataAPI = () => { + const debouncedRefetch = useMemo(() => debounce((refetchFunc) => refetchFunc(), 500), + []) + + const queries = useQueries([ + { + queryKey: ['WHALEsupply'], + queryFn: () => fetchSupply(), + refetchOnMount: 'always', + refetchInterval: 180000 + }, + { + queryKey: ['dashBoardData'], + queryFn: () => getDashboardData(), + refetchOnMount: 'always', + refetchInterval: 180000 + }, + { + queryKey: ['bondingInfos'], + queryFn: () => getBondingAPRsAPI(), + refetchOnMount: 'always', + refetchInterval: 180000 + }, + ]) + + const isLoading = useMemo(() => queries.some((query) => ( + query.isLoading || (!query.data && query.data !== 0) + )), + [queries]) + + const refetchAll = () => { + queries.forEach((query) => { + debouncedRefetch(query.refetch) + }) + } + + const data = useMemo(() => { + const supply = queries[0].data + const dashboardData = queries[1].data + const bondingInfos = queries[2].data + + return { supply, + dashboardData, + bondingInfos } + }, [queries]) + + return { data, + isLoading, + refetch: refetchAll } +} diff --git a/components/Pages/Dashboard/hooks/useGetDailyBuybacks.ts b/components/Pages/Dashboard/hooks/useGetDailyBuybacks.ts deleted file mode 100644 index 3d572d2b..00000000 --- a/components/Pages/Dashboard/hooks/useGetDailyBuybacks.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { useMemo } from 'react' -import { useQueries } from 'react-query' - -import { Config, useConfig } from 'components/Pages/Bonding/hooks/useDashboardData' -import { getDailyBuybacks } from 'components/Pages/Dashboard/hooks/getDailyBuybacks' -import { ChainId, WalletChainName } from 'constants/index' -import { useClients } from 'hooks/useClients' -import { debounce } from 'lodash' -import { useRecoilValue } from 'recoil' -import { chainState } from 'state/chainState' - -export const useGetDailyBuybacks = () => { - const { network } = useRecoilValue(chainState) - const debouncedRefetch = useMemo(() => debounce((refetchFunc) => refetchFunc(), 500), - []) - const migalooConfig: Config = useConfig(network, ChainId.migaloo) - const terraConfig: Config = useConfig(network, ChainId.terra) - const junoConfig: Config = useConfig(network, ChainId.juno) - const seiConfig: Config = useConfig(network, ChainId.sei) - const injectiveConfig: Config = useConfig(network, ChainId.injective) - const chihuahuaConfig: Config = useConfig(network, ChainId.chihuahua) - const terracConfig: Config = useConfig(network, ChainId.terrac) - const osmosisConfig: Config = useConfig(network, ChainId.osmosis) - - const { cosmWasmClient: migalooClient } = useClients(WalletChainName.migaloo) - const { cosmWasmClient: terraClient } = useClients(WalletChainName.terra) - const { cosmWasmClient: junoClient } = useClients(WalletChainName.juno) - const { cosmWasmClient: seiClient } = useClients(WalletChainName.sei) - const { cosmWasmClient: injectiveClient } = useClients(WalletChainName.injective) - const { cosmWasmClient: chihuahuaClient } = useClients(WalletChainName.chihuahua) - const { cosmWasmClient: terracClient } = useClients(WalletChainName.terrac) - const { cosmWasmClient: osmosisClient } = useClients(WalletChainName.osmosis) - - const queries = useQueries([ - { - queryKey: ['migalooBuyback', network, migalooConfig], - queryFn: () => getDailyBuybacks(migalooConfig, migalooClient), - enabled: Boolean(migalooClient) && Boolean(migalooConfig), - refetchOnMount: false, - }, - { - queryKey: ['terraBuyback', network, terraConfig], - queryFn: () => getDailyBuybacks(terraConfig, terraClient), - enabled: Boolean(terraClient) && Boolean(terraConfig), - refetchOnMount: false, - }, - { - queryKey: ['junoBuyback', network, junoConfig], - queryFn: () => getDailyBuybacks(junoConfig, junoClient), - enabled: Boolean(junoClient) && Boolean(junoConfig), - refetchOnMount: false, - }, - { - queryKey: ['seiBuyback', network, seiConfig], - queryFn: () => getDailyBuybacks(seiConfig, seiClient), - enabled: Boolean(seiClient) && Boolean(seiConfig), - refetchOnMount: false, - }, - { - queryKey: ['injectiveBuyback', network, injectiveConfig], - queryFn: () => getDailyBuybacks(injectiveConfig, injectiveClient), - enabled: Boolean(injectiveClient) && Boolean(injectiveConfig), - refetchOnMount: false, - }, - { - queryKey: ['chihuahuaBuyback', network, chihuahuaConfig], - queryFn: () => getDailyBuybacks(chihuahuaConfig, chihuahuaClient), - enabled: Boolean(chihuahuaClient) && Boolean(chihuahuaConfig), - refetchOnMount: false, - }, - { - queryKey: ['terracBuyback', network, terracConfig], - queryFn: () => getDailyBuybacks(terracConfig, terracClient), - enabled: Boolean(terracClient) && Boolean(terracConfig), - refetchOnMount: false, - }, - { - queryKey: ['osmosisBuyback', network, osmosisConfig], - queryFn: () => getDailyBuybacks(osmosisConfig, osmosisClient), - enabled: Boolean(osmosisConfig) && Boolean(osmosisClient), - refetchOnMount: false, - }, - ]) - - const isLoading = useMemo(() => queries.some((query) => ( - query.isLoading || (!query.data && query.data !== 0) - )), - [queries]) - - const refetchAll = () => { - queries.forEach((query) => { - debouncedRefetch(query.refetch) - }) - } - - const data = useMemo(() => { - const migalooBuyback = queries[0].data - const terraBuyback = queries[1].data - const junoBuyback = queries[2].data - const seiBuyback = queries[3].data - const injectiveBuyback = queries[4].data - const chihuahuaBuyback = queries[5].data - const terracBuyback = queries[6].data - const osmosisBuyback = queries[7].data - - - return [ - { chainName: WalletChainName.migaloo, - buyback: migalooBuyback }, - { chainName: WalletChainName.terra, - buyback: terraBuyback }, - { chainName: WalletChainName.juno, - buyback: junoBuyback }, - { chainName: WalletChainName.sei, - buyback: seiBuyback }, - { chainName: WalletChainName.injective, - buyback: injectiveBuyback }, - { chainName: WalletChainName.chihuahua, - buyback: chihuahuaBuyback }, - { chainName: WalletChainName.terrac, - buyback: terracBuyback }, - { chainName: WalletChainName.osmosis, - buyback: osmosisBuyback }, - ] - }, [queries]) - - return { data, - isLoading, - refetch: refetchAll } -} diff --git a/components/Wallet/ChainSelect/ChainList/ChainItem.tsx b/components/Wallet/ChainSelect/ChainList/ChainItem.tsx index 9a7d98b3..ded985d7 100644 --- a/components/Wallet/ChainSelect/ChainList/ChainItem.tsx +++ b/components/Wallet/ChainSelect/ChainList/ChainItem.tsx @@ -11,12 +11,11 @@ const ChainItem = ({ onClose, active, walletConnected, - walletType, }) => { const queryClient = useQueryClient() return ( To access this chain, you must add it to your wallet. - ) : !walletConnected && chain.chainName?.includes('Injective') && walletType !== 'station-extension' ? ( - - Injective with Station not supported. Please try Keplr or Leap. ) : null } bg="transparent" diff --git a/components/Wallet/Modal/WalletConnectButton.tsx b/components/Wallet/Modal/WalletConnectButton.tsx index 91c8a3f5..25c07e53 100644 --- a/components/Wallet/Modal/WalletConnectButton.tsx +++ b/components/Wallet/Modal/WalletConnectButton.tsx @@ -63,9 +63,6 @@ export const WalletConnectButton = ({ onCloseModal, connect, walletType }: Props console.error(`${chainId} not activated`) handleChainActivationError(chainName, toast); } - if (walletType === WalletType.terraExtension && chainName.includes('injective')) { - error = true - } } if (!error) { connect() diff --git a/components/Wallet/Modal/WalletModal.tsx b/components/Wallet/Modal/WalletModal.tsx index 3916b84a..2cdb1034 100644 --- a/components/Wallet/Modal/WalletModal.tsx +++ b/components/Wallet/Modal/WalletModal.tsx @@ -39,12 +39,18 @@ export const WalletModal = ({ isOpen, setOpen, walletRepo }) => { } } - const shouldRenderButton = (wallet: { walletName: string, isModeExtension: boolean }) => { + const shouldRenderButton = (wallet: { walletName: WalletType, isModeExtension: boolean }) => { const { walletName } = wallet const okxchains = ['osmosis-1', 'juno-1', 'pacific-1', 'injective-1'] const inAppLeap = isMobile && window.leap && window.leap.mode === 'mobile-web' const inAppKeplr = isMobile && window.keplr && window.keplr.mode === 'mobile-web' && !inAppLeap - const inj = chainId.includes('injective') && (walletName === WalletType.keplrExtension || walletName === WalletType.leapExtension || walletName === WalletType.ninjiExtension || walletName === WalletType.okxwallet) + const inj = chainId.includes('injective') && [ + WalletType.terraExtension, + WalletType.keplrExtension, + WalletType.leapExtension, + WalletType.ninjiExtension, + WalletType.okxwallet, + ].includes(walletName); if (walletName === WalletType.okxwallet && !okxchains.includes(chainId)) { return false } diff --git a/components/Wallet/Wallet.tsx b/components/Wallet/Wallet.tsx index a97a0329..ceb3cc98 100644 --- a/components/Wallet/Wallet.tsx +++ b/components/Wallet/Wallet.tsx @@ -110,27 +110,19 @@ const Wallet = () => { }; filterChains().then(async ([chainNames, ids]) => { if (chainNames.includes('injective')) { - if (walletType !== WalletType.terraExtension) { - try { - await walletWindowConnection.getKey(ChainId.injective) - } catch { - console.error('Injective not activated'); - const injIndex = chainNames.indexOf('injective') - if (injIndex !== -1) { - chainNames.splice(injIndex, 1) - ids.splice(injIndex, 1) - } - } - } else { + try { + await walletWindowConnection.getKey(ChainId.injective) + } catch { + console.error('Injective not activated'); const injIndex = chainNames.indexOf('injective') if (injIndex !== -1) { chainNames.splice(injIndex, 1) ids.splice(injIndex, 1) } } + setWalletChains(chainNames) + setCurrentConnectedChainIds(ids) } - setWalletChains(chainNames) - setCurrentConnectedChainIds(ids) }); } else if (walletChains.length === 0) { setCurrentConnectedChainIds(Object.values(ACTIVE_NETWORKS[currentChainState.network])) diff --git a/constants/settings.ts b/constants/settings.ts index a708b658..121a9c05 100644 --- a/constants/settings.ts +++ b/constants/settings.ts @@ -12,6 +12,6 @@ export const POOL_INFO_BASE_URL = export const COSMOS_KIT_WALLET_KEY = 'cosmos-kit@2:core//current-wallet' -export const API_URLS = ['https://fd60qhijvtes7do71ou6moc14s.ingress.pcgameservers.com'] +export const API_URLS = ['https://fd60qhijvtes7do71ou6moc14s.ingress.pcgameservers.com', 'https://9c0pbpbijhepr6ijm4lk85uiuc.ingress.europlots.com'] export const ADV_MEMO = 'app.whitewhale.money' diff --git a/hooks/useClients.ts b/hooks/useClients.ts index 1c6572c7..32ac3b14 100644 --- a/hooks/useClients.ts +++ b/hooks/useClients.ts @@ -1,8 +1,15 @@ import { useQueries } from 'react-query' +import { GeneratedType, Registry } from '@cosmjs/proto-signing'; +import { AminoTypes } from '@cosmjs/stargate'; import { useChain } from '@cosmos-kit/react-lite' import { InjectiveStargate } from '@injectivelabs/sdk-ts' -import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'; +import { + cosmosAminoConverters, + cosmosProtoRegistry, + cosmwasmAminoConverters, + cosmwasmProtoRegistry, +} from 'util/inj-types'; export const useClients = (walletChainName: string) => { const { @@ -10,8 +17,7 @@ export const useClients = (walletChainName: string) => { getSigningCosmWasmClient, isWalletConnected, setDefaultSignOptions, - wallet, - getOfflineSignerDirect, getOfflineSigner } = useChain(walletChainName) + wallet, getOfflineSigner } = useChain(walletChainName) if (isWalletConnected && wallet?.name !== 'station-extension') { try { setDefaultSignOptions({ @@ -36,15 +42,24 @@ export const useClients = (walletChainName: string) => { queryKey: ['injectiveSigningClient'], queryFn: async () => { try { - let offlineSigner - if (wallet.name.includes('okx')) { - offlineSigner = await getOfflineSigner() - } else { - offlineSigner = await getOfflineSignerDirect() - } - const client = await InjectiveStargate.InjectiveSigningStargateClient.connectWithSigner('https://sentry.tm.injective.network:443', - offlineSigner) - client.registry.register('/cosmwasm.wasm.v1.MsgExecuteContract', MsgExecuteContract) + const offlineSigner: any = await getOfflineSigner() + const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [ + ...cosmosProtoRegistry, + ...cosmwasmProtoRegistry, + ]; + const aminoConverters = { + ...cosmosAminoConverters, + ...cosmwasmAminoConverters, + }; + const registry = new Registry(protoRegistry); + const aminoTypes = new AminoTypes(aminoConverters); + const client = await InjectiveStargate.InjectiveSigningStargateClient.connectWithSigner( + 'https://sentry.tm.injective.network:443', + offlineSigner, { + registry, + aminoTypes, + }, + ) return client } catch { return null diff --git a/libs/fetchSupply.tsx b/libs/fetchSupply.tsx index 54adf6ef..cb5b4479 100644 --- a/libs/fetchSupply.tsx +++ b/libs/fetchSupply.tsx @@ -7,7 +7,7 @@ export type FetchSupplyResponse = { const url = '/api/cors?url=https://apex.migaloo.zone/api/supply' export const fetchSupply = async (): Promise => { - const response = await fetchWithTimeout(`${await getFastestAPI()}/apex/supply`, 1000) || await fetch(url) + const response = await fetchWithTimeout(`${await getFastestAPI()}/apex/supply`, 10000) || await fetch(url) let data = await response.json() data = data?.data ? data.data : data return data diff --git a/package.json b/package.json index 415177fb..e6afcf12 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "next dev", "build": "git rev-parse HEAD | xargs -I '{}' echo '{\"version\": \"{}\"}' > app_version.json && next build", + "prep-build": "next build", "start": "next start", "lint": "npx eslint . --fix", "unimported": "npx unimported", diff --git a/public/mainnet/migaloo-1/pools_list.json b/public/mainnet/migaloo-1/pools_list.json index 66cd4b64..c4f24b51 100644 --- a/public/mainnet/migaloo-1/pools_list.json +++ b/public/mainnet/migaloo-1/pools_list.json @@ -494,7 +494,7 @@ ], "swap_address": "migaloo1ke0krjh5v3emzv5wdut6q7l0gednv7cx7naxqweae44jz8cxxq9srhy6dz", "lp_token": "factory/migaloo1ke0krjh5v3emzv5wdut6q7l0gednv7cx7naxqweae44jz8cxxq9srhy6dz/uLP", - "staking_address": "", + "staking_address": "migaloo1kwdf63gwzhdwyy7hmmn67p3dex57e5ek4na8g27hvd7kn9cj7nmqgsxyz7", "rewards_tokens": [] }, { diff --git a/public/mainnet/osmosis-1/pools_list.json b/public/mainnet/osmosis-1/pools_list.json index 4fe830b4..17c5f37a 100644 --- a/public/mainnet/osmosis-1/pools_list.json +++ b/public/mainnet/osmosis-1/pools_list.json @@ -274,7 +274,7 @@ "OSMO" ], "displayName": "bOSMO-OSMO", - "displayLogo1": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/bosmo.png", + "displayLogo1": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/bOSMO.png", "displayLogo2": "/logos/osmo.svg", "pool_assets": [ { @@ -283,7 +283,7 @@ "symbol": "bOSMO", "name": "bOSMO", "decimals": 6, - "logoURI": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/bosmo.png", + "logoURI": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/bOSMO.png", "tags": [ "native" ], diff --git a/services/useAPI.ts b/services/useAPI.ts index 1707f01d..b01ceb78 100644 --- a/services/useAPI.ts +++ b/services/useAPI.ts @@ -74,7 +74,7 @@ export const getRandomRPC = async (chainNameId: string) => { export const getHealthyRestEndpoints = async (chainNameId: string) => { try { - const response = await fetchWithTimeout(`${await getFastestAPI()}/api/rests/${chainNameId}`, 1000); + const response = await fetchWithTimeout(`${await getFastestAPI()}/api/rests/${chainNameId}`); const json = await response.json(); if (json?.data !== 'Chain not found') { return json?.data @@ -99,10 +99,10 @@ export const getRandomREST = async (chainNameId: string) => { export const getPricesAPI = async (ids: Array) => { try { - let response = await fetchWithTimeout(`${await getFastestAPI()}/api/prices`, 1000) + let response = await fetchWithTimeout(`${await getFastestAPI()}/api/prices`) let res = await response.text() while (!response.ok) { - response = await fetchWithTimeout(`${await getFastestAPI()}/api/prices`, 1000) + response = await fetchWithTimeout(`${await getFastestAPI()}/api/prices`) res = await response.text() } const json = JSON.parse(res) @@ -142,7 +142,7 @@ export const createEndpointOptions = (chains: any) => { export const getGasPricesAPI = async () => { try { - const response = await fetchWithTimeout(`${await getFastestAPI()}/api/gasprices`, 1000) + const response = await fetchWithTimeout(`${await getFastestAPI()}/api/gasprices`) const json = await response.json() return json?.data || {} } catch (error) { @@ -153,7 +153,7 @@ export const getGasPricesAPI = async () => { export const getPairAprAndDailyVolumeAPI = async (chain_name: string) => { try { - const response = await fetchWithTimeout(`${await getFastestAPI()}/api/pools/${chain_name}`, 5000) + const response = await fetchWithTimeout(`${await getFastestAPI()}/api/pools/${chain_name}`, 50000) const json = await response.json() return json?.data || null } catch (error) { @@ -164,7 +164,7 @@ export const getPairAprAndDailyVolumeAPI = async (chain_name: string) => { export const getBondingAPRsAPI = async () => { try { - const response = await fetchWithTimeout(`${await getFastestAPI()}/apex/bonding/aprs`, 10000) + const response = await fetchWithTimeout(`${await getFastestAPI()}/apex/bonding/aprs`, 50000) const json = await response.json() return json?.data || null } catch (error) { diff --git a/util/getDashboardData.ts b/util/getDashboardData.ts index 82edefe9..35acdc76 100644 --- a/util/getDashboardData.ts +++ b/util/getDashboardData.ts @@ -1,7 +1,7 @@ import { ENIGMA_URL } from 'constants/index' import { fetchWithTimeout, getFastestAPI } from 'services/useAPI'; -interface ChainInfoResponse { +export interface ChainInfoResponse { chainName: string; tvl: number; volume24h: number diff --git a/util/inj-types/amino/amino.ts b/util/inj-types/amino/amino.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/util/inj-types/amino/amino.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/util/inj-types/amino/bundle.ts b/util/inj-types/amino/bundle.ts new file mode 100644 index 00000000..d9ebdd1f --- /dev/null +++ b/util/inj-types/amino/bundle.ts @@ -0,0 +1,4 @@ +import * as _0 from "./amino"; +export const amino = { + ..._0 +}; \ No newline at end of file diff --git a/util/inj-types/binary.ts b/util/inj-types/binary.ts new file mode 100644 index 00000000..db62c68b --- /dev/null +++ b/util/inj-types/binary.ts @@ -0,0 +1,534 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.5.0 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright (c) 2016, Daniel Wirtz All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of its author, nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- + +// Code generated by the command line utilities is owned by the owner +// of the input file used when generating it. This code is not +// standalone and requires a support library to be linked with it. This +// support library is itself covered by the above license. + +import { utf8Length, utf8Read, utf8Write } from "./utf8"; +import { + int64ToString, + readInt32, + readUInt32, + uInt64ToString, + varint32read, + varint64read, + writeVarint32, + writeVarint64, + int64FromString, + int64Length, + writeFixed32, + writeByte, + zzDecode, + zzEncode, +} from "./varint"; + +export enum WireType { + Varint = 0, + + Fixed64 = 1, + + Bytes = 2, + + Fixed32 = 5, +} + +// Reader +export interface IBinaryReader { + buf: Uint8Array; + pos: number; + type: number; + len: number; + tag(): [number, WireType, number]; + skip(length?: number): this; + skipType(wireType: number): this; + uint32(): number; + int32(): number; + sint32(): number; + fixed32(): number; + sfixed32(): number; + int64(): bigint; + uint64(): bigint; + sint64(): bigint; + fixed64(): bigint; + sfixed64(): bigint; + float(): number; + double(): number; + bool(): boolean; + bytes(): Uint8Array; + string(): string; +} + +export class BinaryReader implements IBinaryReader { + buf: Uint8Array; + pos: number; + type: number; + len: number; + + assertBounds(): void { + if (this.pos > this.len) throw new RangeError("premature EOF"); + } + + constructor(buf?: ArrayLike) { + this.buf = buf ? new Uint8Array(buf) : new Uint8Array(0); + this.pos = 0; + this.type = 0; + this.len = this.buf.length; + } + + tag(): [number, WireType, number] { + const tag = this.uint32(), + fieldNo = tag >>> 3, + wireType = tag & 7; + if (fieldNo <= 0 || wireType < 0 || wireType > 5) + throw new Error( + "illegal tag: field no " + fieldNo + " wire type " + wireType + ); + return [fieldNo, wireType, tag]; + } + + skip(length?: number) { + if (typeof length === "number") { + if (this.pos + length > this.len) throw indexOutOfRange(this, length); + this.pos += length; + } else { + do { + if (this.pos >= this.len) throw indexOutOfRange(this); + } while (this.buf[this.pos++] & 128); + } + return this; + } + + skipType(wireType: number) { + switch (wireType) { + case WireType.Varint: + this.skip(); + break; + case WireType.Fixed64: + this.skip(8); + break; + case WireType.Bytes: + this.skip(this.uint32()); + break; + case 3: + while ((wireType = this.uint32() & 7) !== 4) { + this.skipType(wireType); + } + break; + case WireType.Fixed32: + this.skip(4); + break; + + /* istanbul ignore next */ + default: + throw Error("invalid wire type " + wireType + " at offset " + this.pos); + } + return this; + } + + uint32(): number { + return varint32read.bind(this)(); + } + + int32(): number { + return this.uint32() | 0; + } + + sint32(): number { + const num = this.uint32(); + return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding + } + + fixed32(): number { + const val = readUInt32(this.buf, this.pos); + this.pos += 4; + return val; + } + + sfixed32(): number { + const val = readInt32(this.buf, this.pos); + this.pos += 4; + return val; + } + + int64(): bigint { + const [lo, hi] = varint64read.bind(this)(); + return BigInt(int64ToString(lo, hi)); + } + + uint64(): bigint { + const [lo, hi] = varint64read.bind(this)(); + return BigInt(uInt64ToString(lo, hi)); + } + + sint64(): bigint { + let [lo, hi] = varint64read.bind(this)(); + // zig zag + [lo, hi] = zzDecode(lo, hi); + return BigInt(int64ToString(lo, hi)); + } + + fixed64(): bigint { + const lo = this.sfixed32(); + const hi = this.sfixed32(); + return BigInt(uInt64ToString(lo, hi)); + } + sfixed64(): bigint { + const lo = this.sfixed32(); + const hi = this.sfixed32(); + return BigInt(int64ToString(lo, hi)); + } + + float(): number { + throw new Error("float not supported"); + } + + double(): number { + throw new Error("double not supported"); + } + + bool(): boolean { + const [lo, hi] = varint64read.bind(this)(); + return lo !== 0 || hi !== 0; + } + + bytes(): Uint8Array { + const len = this.uint32(), + start = this.pos; + this.pos += len; + this.assertBounds(); + return this.buf.subarray(start, start + len); + } + + string(): string { + const bytes = this.bytes(); + return utf8Read(bytes, 0, bytes.length); + } +} + +// Writer +export interface IBinaryWriter { + len: number; + head: IOp; + tail: IOp; + states: State | null; + finish(): Uint8Array; + fork(): IBinaryWriter; + reset(): IBinaryWriter; + ldelim(): IBinaryWriter; + tag(fieldNo: number, type: WireType): IBinaryWriter; + uint32(value: number): IBinaryWriter; + int32(value: number): IBinaryWriter; + sint32(value: number): IBinaryWriter; + int64(value: string | number | bigint): IBinaryWriter; + uint64: (value: string | number | bigint) => IBinaryWriter; + sint64(value: string | number | bigint): IBinaryWriter; + fixed64(value: string | number | bigint): IBinaryWriter; + sfixed64: (value: string | number | bigint) => IBinaryWriter; + bool(value: boolean): IBinaryWriter; + fixed32(value: number): IBinaryWriter; + sfixed32: (value: number) => IBinaryWriter; + float(value: number): IBinaryWriter; + double(value: number): IBinaryWriter; + bytes(value: Uint8Array): IBinaryWriter; + string(value: string): IBinaryWriter; +} + +interface IOp { + len: number; + next?: IOp; + proceed(buf: Uint8Array | number[], pos: number): void; +} + +class Op implements IOp { + fn?: ((val: T, buf: Uint8Array | number[], pos: number) => void) | null; + len: number; + val: T; + next?: IOp; + + constructor( + fn: + | (( + val: T, + buf: Uint8Array | number[], + pos: number + ) => void | undefined | null) + | null, + len: number, + val: T + ) { + this.fn = fn; + this.len = len; + this.val = val; + } + + proceed(buf: Uint8Array | number[], pos: number) { + if (this.fn) { + this.fn(this.val, buf, pos); + } + } +} + +class State { + head: IOp; + tail: IOp; + len: number; + next: State | null; + + constructor(writer: BinaryWriter) { + this.head = writer.head; + this.tail = writer.tail; + this.len = writer.len; + this.next = writer.states; + } +} + +export class BinaryWriter implements IBinaryWriter { + len = 0; + head: IOp; + tail: IOp; + states: State | null; + + constructor() { + this.head = new Op(null, 0, 0); + this.tail = this.head; + this.states = null; + } + + static create() { + return new BinaryWriter(); + } + + static alloc(size: number): Uint8Array | number[] { + if (typeof Uint8Array !== "undefined") { + return pool( + (size) => new Uint8Array(size), + Uint8Array.prototype.subarray + )(size); + } else { + return new Array(size); + } + } + + private _push( + fn: (val: T, buf: Uint8Array | number[], pos: number) => void, + len: number, + val: T + ) { + this.tail = this.tail.next = new Op(fn, len, val); + this.len += len; + return this; + } + + finish(): Uint8Array { + let head = this.head.next, + pos = 0; + const buf = BinaryWriter.alloc(this.len); + while (head) { + head.proceed(buf, pos); + pos += head.len; + head = head.next; + } + return buf as Uint8Array; + } + + fork(): BinaryWriter { + this.states = new State(this); + this.head = this.tail = new Op(null, 0, 0); + this.len = 0; + return this; + } + + reset(): BinaryWriter { + if (this.states) { + this.head = this.states.head; + this.tail = this.states.tail; + this.len = this.states.len; + this.states = this.states.next; + } else { + this.head = this.tail = new Op(null, 0, 0); + this.len = 0; + } + return this; + } + + ldelim(): BinaryWriter { + const head = this.head, + tail = this.tail, + len = this.len; + this.reset().uint32(len); + if (len) { + this.tail.next = head.next; // skip noop + this.tail = tail; + this.len += len; + } + return this; + } + + tag(fieldNo: number, type: WireType): BinaryWriter { + return this.uint32(((fieldNo << 3) | type) >>> 0); + } + + uint32(value: number): BinaryWriter { + this.len += (this.tail = this.tail.next = + new Op( + writeVarint32, + (value = value >>> 0) < 128 + ? 1 + : value < 16384 + ? 2 + : value < 2097152 + ? 3 + : value < 268435456 + ? 4 + : 5, + value + )).len; + return this; + } + + int32(value: number): BinaryWriter { + return value < 0 + ? this._push(writeVarint64, 10, int64FromString(value.toString())) // 10 bytes per spec + : this.uint32(value); + } + + sint32(value: number): BinaryWriter { + return this.uint32(((value << 1) ^ (value >> 31)) >>> 0); + } + + int64(value: string | number | bigint): BinaryWriter { + const { lo, hi } = int64FromString(value.toString()); + return this._push(writeVarint64, int64Length(lo, hi), { lo, hi }); + } + + // uint64 is the same with int64 + uint64 = BinaryWriter.prototype.int64; + + sint64(value: string | number | bigint): BinaryWriter { + let { lo, hi } = int64FromString(value.toString()); + // zig zag + [lo, hi] = zzEncode(lo, hi); + return this._push(writeVarint64, int64Length(lo, hi), { lo, hi }); + } + + fixed64(value: string | number | bigint): BinaryWriter { + const { lo, hi } = int64FromString(value.toString()); + return this._push(writeFixed32, 4, lo)._push(writeFixed32, 4, hi); + } + + // sfixed64 is the same with fixed64 + sfixed64 = BinaryWriter.prototype.fixed64; + + bool(value: boolean): BinaryWriter { + return this._push(writeByte, 1, value ? 1 : 0); + } + + fixed32(value: number): BinaryWriter { + return this._push(writeFixed32, 4, value >>> 0); + } + + // sfixed32 is the same with fixed32 + sfixed32 = BinaryWriter.prototype.fixed32; + + float(value: number): BinaryWriter { + throw new Error("float not supported" + value); + } + + double(value: number): BinaryWriter { + throw new Error("double not supported" + value); + } + + bytes(value: Uint8Array): BinaryWriter { + const len = value.length >>> 0; + if (!len) return this._push(writeByte, 1, 0); + return this.uint32(len)._push(writeBytes, len, value); + } + + string(value: string): BinaryWriter { + const len = utf8Length(value); + return len + ? this.uint32(len)._push(utf8Write, len, value) + : this._push(writeByte, 1, 0); + } +} + +function writeBytes( + val: Uint8Array | number[], + buf: Uint8Array | number[], + pos: number +) { + if (typeof Uint8Array !== "undefined") { + (buf as Uint8Array).set(val, pos); + } else { + for (let i = 0; i < val.length; ++i) buf[pos + i] = val[i]; + } +} + +function pool( + alloc: (size: number) => Uint8Array, + slice: (begin?: number, end?: number) => Uint8Array, + size?: number +): (size: number) => Uint8Array { + const SIZE = size || 8192; + const MAX = SIZE >>> 1; + let slab: Uint8Array | null = null; + let offset = SIZE; + return function pool_alloc(size): Uint8Array { + if (size < 1 || size > MAX) return alloc(size); + if (offset + size > SIZE) { + slab = alloc(SIZE); + offset = 0; + } + const buf: Uint8Array = slice.call(slab, offset, (offset += size)); + if (offset & 7) + // align to 32 bit + offset = (offset | 7) + 1; + return buf; + }; +} + +function indexOutOfRange(reader: BinaryReader, writeLength?: number) { + return RangeError( + "index out of range: " + + reader.pos + + " + " + + (writeLength || 1) + + " > " + + reader.len + ); +} diff --git a/util/inj-types/cosmos/app/runtime/v1alpha1/module.ts b/util/inj-types/cosmos/app/runtime/v1alpha1/module.ts new file mode 100644 index 00000000..db4ff975 --- /dev/null +++ b/util/inj-types/cosmos/app/runtime/v1alpha1/module.ts @@ -0,0 +1,345 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object for the runtime module. */ +export interface Module { + /** app_name is the name of the app. */ + appName: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + beginBlockers: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + endBlockers: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + initGenesis: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + exportGenesis: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + overrideStoreKeys: StoreKeyConfig[]; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.app.runtime.v1alpha1.Module"; + value: Uint8Array; +} +/** Module is the config object for the runtime module. */ +export interface ModuleAmino { + /** app_name is the name of the app. */ + app_name?: string; + /** + * begin_blockers specifies the module names of begin blockers + * to call in the order in which they should be called. If this is left empty + * no begin blocker will be registered. + */ + begin_blockers?: string[]; + /** + * end_blockers specifies the module names of the end blockers + * to call in the order in which they should be called. If this is left empty + * no end blocker will be registered. + */ + end_blockers?: string[]; + /** + * init_genesis specifies the module names of init genesis functions + * to call in the order in which they should be called. If this is left empty + * no init genesis function will be registered. + */ + init_genesis?: string[]; + /** + * export_genesis specifies the order in which to export module genesis data. + * If this is left empty, the init_genesis order will be used for export genesis + * if it is specified. + */ + export_genesis?: string[]; + /** + * override_store_keys is an optional list of overrides for the module store keys + * to be used in keeper construction. + */ + override_store_keys?: StoreKeyConfigAmino[]; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object for the runtime module. */ +export interface ModuleSDKType { + app_name: string; + begin_blockers: string[]; + end_blockers: string[]; + init_genesis: string[]; + export_genesis: string[]; + override_store_keys: StoreKeyConfigSDKType[]; +} +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfig { + /** name of the module to override the store key of */ + moduleName: string; + /** the kv store key to use instead of the module name. */ + kvStoreKey: string; +} +export interface StoreKeyConfigProtoMsg { + typeUrl: "/cosmos.app.runtime.v1alpha1.StoreKeyConfig"; + value: Uint8Array; +} +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfigAmino { + /** name of the module to override the store key of */ + module_name?: string; + /** the kv store key to use instead of the module name. */ + kv_store_key?: string; +} +export interface StoreKeyConfigAminoMsg { + type: "cosmos-sdk/StoreKeyConfig"; + value: StoreKeyConfigAmino; +} +/** + * StoreKeyConfig may be supplied to override the default module store key, which + * is the module name. + */ +export interface StoreKeyConfigSDKType { + module_name: string; + kv_store_key: string; +} +function createBaseModule(): Module { + return { + appName: "", + beginBlockers: [], + endBlockers: [], + initGenesis: [], + exportGenesis: [], + overrideStoreKeys: [] + }; +} +export const Module = { + typeUrl: "/cosmos.app.runtime.v1alpha1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.appName !== "") { + writer.uint32(10).string(message.appName); + } + for (const v of message.beginBlockers) { + writer.uint32(18).string(v!); + } + for (const v of message.endBlockers) { + writer.uint32(26).string(v!); + } + for (const v of message.initGenesis) { + writer.uint32(34).string(v!); + } + for (const v of message.exportGenesis) { + writer.uint32(42).string(v!); + } + for (const v of message.overrideStoreKeys) { + StoreKeyConfig.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.appName = reader.string(); + break; + case 2: + message.beginBlockers.push(reader.string()); + break; + case 3: + message.endBlockers.push(reader.string()); + break; + case 4: + message.initGenesis.push(reader.string()); + break; + case 5: + message.exportGenesis.push(reader.string()); + break; + case 6: + message.overrideStoreKeys.push(StoreKeyConfig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.appName = object.appName ?? ""; + message.beginBlockers = object.beginBlockers?.map(e => e) || []; + message.endBlockers = object.endBlockers?.map(e => e) || []; + message.initGenesis = object.initGenesis?.map(e => e) || []; + message.exportGenesis = object.exportGenesis?.map(e => e) || []; + message.overrideStoreKeys = object.overrideStoreKeys?.map(e => StoreKeyConfig.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.app_name !== undefined && object.app_name !== null) { + message.appName = object.app_name; + } + message.beginBlockers = object.begin_blockers?.map(e => e) || []; + message.endBlockers = object.end_blockers?.map(e => e) || []; + message.initGenesis = object.init_genesis?.map(e => e) || []; + message.exportGenesis = object.export_genesis?.map(e => e) || []; + message.overrideStoreKeys = object.override_store_keys?.map(e => StoreKeyConfig.fromAmino(e)) || []; + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.app_name = message.appName === "" ? undefined : message.appName; + if (message.beginBlockers) { + obj.begin_blockers = message.beginBlockers.map(e => e); + } else { + obj.begin_blockers = message.beginBlockers; + } + if (message.endBlockers) { + obj.end_blockers = message.endBlockers.map(e => e); + } else { + obj.end_blockers = message.endBlockers; + } + if (message.initGenesis) { + obj.init_genesis = message.initGenesis.map(e => e); + } else { + obj.init_genesis = message.initGenesis; + } + if (message.exportGenesis) { + obj.export_genesis = message.exportGenesis.map(e => e); + } else { + obj.export_genesis = message.exportGenesis; + } + if (message.overrideStoreKeys) { + obj.override_store_keys = message.overrideStoreKeys.map(e => e ? StoreKeyConfig.toAmino(e) : undefined); + } else { + obj.override_store_keys = message.overrideStoreKeys; + } + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.app.runtime.v1alpha1.Module", + value: Module.encode(message).finish() + }; + } +}; +function createBaseStoreKeyConfig(): StoreKeyConfig { + return { + moduleName: "", + kvStoreKey: "" + }; +} +export const StoreKeyConfig = { + typeUrl: "/cosmos.app.runtime.v1alpha1.StoreKeyConfig", + aminoType: "cosmos-sdk/StoreKeyConfig", + encode(message: StoreKeyConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + if (message.kvStoreKey !== "") { + writer.uint32(18).string(message.kvStoreKey); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StoreKeyConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKeyConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moduleName = reader.string(); + break; + case 2: + message.kvStoreKey = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + message.moduleName = object.moduleName ?? ""; + message.kvStoreKey = object.kvStoreKey ?? ""; + return message; + }, + fromAmino(object: StoreKeyConfigAmino): StoreKeyConfig { + const message = createBaseStoreKeyConfig(); + if (object.module_name !== undefined && object.module_name !== null) { + message.moduleName = object.module_name; + } + if (object.kv_store_key !== undefined && object.kv_store_key !== null) { + message.kvStoreKey = object.kv_store_key; + } + return message; + }, + toAmino(message: StoreKeyConfig): StoreKeyConfigAmino { + const obj: any = {}; + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; + obj.kv_store_key = message.kvStoreKey === "" ? undefined : message.kvStoreKey; + return obj; + }, + fromAminoMsg(object: StoreKeyConfigAminoMsg): StoreKeyConfig { + return StoreKeyConfig.fromAmino(object.value); + }, + toAminoMsg(message: StoreKeyConfig): StoreKeyConfigAminoMsg { + return { + type: "cosmos-sdk/StoreKeyConfig", + value: StoreKeyConfig.toAmino(message) + }; + }, + fromProtoMsg(message: StoreKeyConfigProtoMsg): StoreKeyConfig { + return StoreKeyConfig.decode(message.value); + }, + toProto(message: StoreKeyConfig): Uint8Array { + return StoreKeyConfig.encode(message).finish(); + }, + toProtoMsg(message: StoreKeyConfig): StoreKeyConfigProtoMsg { + return { + typeUrl: "/cosmos.app.runtime.v1alpha1.StoreKeyConfig", + value: StoreKeyConfig.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/app/v1alpha1/module.ts b/util/inj-types/cosmos/app/v1alpha1/module.ts new file mode 100644 index 00000000..fd942e54 --- /dev/null +++ b/util/inj-types/cosmos/app/v1alpha1/module.ts @@ -0,0 +1,454 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** 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. It is required to make debugging + * of configuration errors easier for users. + */ + 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[]; +} +export interface ModuleDescriptorProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor"; + value: Uint8Array; +} +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptorAmino { + /** + * go_import names the package that should be imported by an app to load the + * module in the runtime module registry. It is required to make debugging + * of configuration errors easier for users. + */ + 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?: PackageReferenceAmino[]; + /** + * 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?: MigrateFromInfoAmino[]; +} +export interface ModuleDescriptorAminoMsg { + type: "cosmos-sdk/ModuleDescriptor"; + value: ModuleDescriptorAmino; +} +/** ModuleDescriptor describes an app module. */ +export interface ModuleDescriptorSDKType { + go_import: string; + use_package: PackageReferenceSDKType[]; + 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 files containing the + * text "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; +} +export interface PackageReferenceProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.PackageReference"; + value: Uint8Array; +} +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReferenceAmino { + /** 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 files containing the + * text "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; +} +export interface PackageReferenceAminoMsg { + type: "cosmos-sdk/PackageReference"; + value: PackageReferenceAmino; +} +/** PackageReference is a reference to a protobuf package used by a module. */ +export interface PackageReferenceSDKType { + name: string; + 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; +} +export interface MigrateFromInfoProtoMsg { + typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo"; + value: Uint8Array; +} +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfoAmino { + /** + * 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; +} +export interface MigrateFromInfoAminoMsg { + type: "cosmos-sdk/MigrateFromInfo"; + value: MigrateFromInfoAmino; +} +/** + * MigrateFromInfo is information on a module version that a newer module + * can migrate from. + */ +export interface MigrateFromInfoSDKType { + module: string; +} +function createBaseModuleDescriptor(): ModuleDescriptor { + return { + goImport: "", + usePackage: [], + canMigrateFrom: [] + }; +} +export const ModuleDescriptor = { + typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor", + aminoType: "cosmos-sdk/ModuleDescriptor", + encode(message: ModuleDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ModuleDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: ModuleDescriptorAmino): ModuleDescriptor { + const message = createBaseModuleDescriptor(); + if (object.go_import !== undefined && object.go_import !== null) { + message.goImport = object.go_import; + } + message.usePackage = object.use_package?.map(e => PackageReference.fromAmino(e)) || []; + message.canMigrateFrom = object.can_migrate_from?.map(e => MigrateFromInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { + const obj: any = {}; + obj.go_import = message.goImport === "" ? undefined : message.goImport; + if (message.usePackage) { + obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); + } else { + obj.use_package = message.usePackage; + } + if (message.canMigrateFrom) { + obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e) : undefined); + } else { + obj.can_migrate_from = message.canMigrateFrom; + } + return obj; + }, + fromAminoMsg(object: ModuleDescriptorAminoMsg): ModuleDescriptor { + return ModuleDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: ModuleDescriptor): ModuleDescriptorAminoMsg { + return { + type: "cosmos-sdk/ModuleDescriptor", + value: ModuleDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleDescriptorProtoMsg): ModuleDescriptor { + return ModuleDescriptor.decode(message.value); + }, + toProto(message: ModuleDescriptor): Uint8Array { + return ModuleDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ModuleDescriptor): ModuleDescriptorProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.ModuleDescriptor", + value: ModuleDescriptor.encode(message).finish() + }; + } +}; +function createBasePackageReference(): PackageReference { + return { + name: "", + revision: 0 + }; +} +export const PackageReference = { + typeUrl: "/cosmos.app.v1alpha1.PackageReference", + aminoType: "cosmos-sdk/PackageReference", + encode(message: PackageReference, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.revision !== 0) { + writer.uint32(16).uint32(message.revision); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PackageReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): PackageReference { + const message = createBasePackageReference(); + message.name = object.name ?? ""; + message.revision = object.revision ?? 0; + return message; + }, + fromAmino(object: PackageReferenceAmino): PackageReference { + const message = createBasePackageReference(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.revision !== undefined && object.revision !== null) { + message.revision = object.revision; + } + return message; + }, + toAmino(message: PackageReference): PackageReferenceAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.revision = message.revision === 0 ? undefined : message.revision; + return obj; + }, + fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { + return PackageReference.fromAmino(object.value); + }, + toAminoMsg(message: PackageReference): PackageReferenceAminoMsg { + return { + type: "cosmos-sdk/PackageReference", + value: PackageReference.toAmino(message) + }; + }, + fromProtoMsg(message: PackageReferenceProtoMsg): PackageReference { + return PackageReference.decode(message.value); + }, + toProto(message: PackageReference): Uint8Array { + return PackageReference.encode(message).finish(); + }, + toProtoMsg(message: PackageReference): PackageReferenceProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.PackageReference", + value: PackageReference.encode(message).finish() + }; + } +}; +function createBaseMigrateFromInfo(): MigrateFromInfo { + return { + module: "" + }; +} +export const MigrateFromInfo = { + typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo", + aminoType: "cosmos-sdk/MigrateFromInfo", + encode(message: MigrateFromInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MigrateFromInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): MigrateFromInfo { + const message = createBaseMigrateFromInfo(); + message.module = object.module ?? ""; + return message; + }, + fromAmino(object: MigrateFromInfoAmino): MigrateFromInfo { + const message = createBaseMigrateFromInfo(); + if (object.module !== undefined && object.module !== null) { + message.module = object.module; + } + return message; + }, + toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { + const obj: any = {}; + obj.module = message.module === "" ? undefined : message.module; + return obj; + }, + fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { + return MigrateFromInfo.fromAmino(object.value); + }, + toAminoMsg(message: MigrateFromInfo): MigrateFromInfoAminoMsg { + return { + type: "cosmos-sdk/MigrateFromInfo", + value: MigrateFromInfo.toAmino(message) + }; + }, + fromProtoMsg(message: MigrateFromInfoProtoMsg): MigrateFromInfo { + return MigrateFromInfo.decode(message.value); + }, + toProto(message: MigrateFromInfo): Uint8Array { + return MigrateFromInfo.encode(message).finish(); + }, + toProtoMsg(message: MigrateFromInfo): MigrateFromInfoProtoMsg { + return { + typeUrl: "/cosmos.app.v1alpha1.MigrateFromInfo", + value: MigrateFromInfo.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/module/v1/module.ts b/util/inj-types/cosmos/auth/module/v1/module.ts new file mode 100644 index 00000000..ebcede09 --- /dev/null +++ b/util/inj-types/cosmos/auth/module/v1/module.ts @@ -0,0 +1,247 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object for the auth module. */ +export interface Module { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32Prefix: string; + /** module_account_permissions are module account permissions. */ + moduleAccountPermissions: ModuleAccountPermission[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.auth.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object for the auth module. */ +export interface ModuleAmino { + /** bech32_prefix is the bech32 account prefix for the app. */ + bech32_prefix?: string; + /** module_account_permissions are module account permissions. */ + module_account_permissions?: ModuleAccountPermissionAmino[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object for the auth module. */ +export interface ModuleSDKType { + bech32_prefix: string; + module_account_permissions: ModuleAccountPermissionSDKType[]; + authority: string; +} +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermission { + /** account is the name of the module. */ + account: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions: string[]; +} +export interface ModuleAccountPermissionProtoMsg { + typeUrl: "/cosmos.auth.module.v1.ModuleAccountPermission"; + value: Uint8Array; +} +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermissionAmino { + /** account is the name of the module. */ + account?: string; + /** + * permissions are the permissions this module has. Currently recognized + * values are minter, burner and staking. + */ + permissions?: string[]; +} +export interface ModuleAccountPermissionAminoMsg { + type: "cosmos-sdk/ModuleAccountPermission"; + value: ModuleAccountPermissionAmino; +} +/** ModuleAccountPermission represents permissions for a module account. */ +export interface ModuleAccountPermissionSDKType { + account: string; + permissions: string[]; +} +function createBaseModule(): Module { + return { + bech32Prefix: "", + moduleAccountPermissions: [], + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.auth.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + for (const v of message.moduleAccountPermissions) { + ModuleAccountPermission.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.authority !== "") { + writer.uint32(26).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bech32Prefix = reader.string(); + break; + case 2: + message.moduleAccountPermissions.push(ModuleAccountPermission.decode(reader, reader.uint32())); + break; + case 3: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.bech32Prefix = object.bech32Prefix ?? ""; + message.moduleAccountPermissions = object.moduleAccountPermissions?.map(e => ModuleAccountPermission.fromPartial(e)) || []; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.bech32_prefix !== undefined && object.bech32_prefix !== null) { + message.bech32Prefix = object.bech32_prefix; + } + message.moduleAccountPermissions = object.module_account_permissions?.map(e => ModuleAccountPermission.fromAmino(e)) || []; + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; + if (message.moduleAccountPermissions) { + obj.module_account_permissions = message.moduleAccountPermissions.map(e => e ? ModuleAccountPermission.toAmino(e) : undefined); + } else { + obj.module_account_permissions = message.moduleAccountPermissions; + } + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.auth.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; +function createBaseModuleAccountPermission(): ModuleAccountPermission { + return { + account: "", + permissions: [] + }; +} +export const ModuleAccountPermission = { + typeUrl: "/cosmos.auth.module.v1.ModuleAccountPermission", + aminoType: "cosmos-sdk/ModuleAccountPermission", + encode(message: ModuleAccountPermission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + for (const v of message.permissions) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccountPermission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccountPermission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + case 2: + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + message.account = object.account ?? ""; + message.permissions = object.permissions?.map(e => e) || []; + return message; + }, + fromAmino(object: ModuleAccountPermissionAmino): ModuleAccountPermission { + const message = createBaseModuleAccountPermission(); + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + message.permissions = object.permissions?.map(e => e) || []; + return message; + }, + toAmino(message: ModuleAccountPermission): ModuleAccountPermissionAmino { + const obj: any = {}; + obj.account = message.account === "" ? undefined : message.account; + if (message.permissions) { + obj.permissions = message.permissions.map(e => e); + } else { + obj.permissions = message.permissions; + } + return obj; + }, + fromAminoMsg(object: ModuleAccountPermissionAminoMsg): ModuleAccountPermission { + return ModuleAccountPermission.fromAmino(object.value); + }, + toAminoMsg(message: ModuleAccountPermission): ModuleAccountPermissionAminoMsg { + return { + type: "cosmos-sdk/ModuleAccountPermission", + value: ModuleAccountPermission.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleAccountPermissionProtoMsg): ModuleAccountPermission { + return ModuleAccountPermission.decode(message.value); + }, + toProto(message: ModuleAccountPermission): Uint8Array { + return ModuleAccountPermission.encode(message).finish(); + }, + toProtoMsg(message: ModuleAccountPermission): ModuleAccountPermissionProtoMsg { + return { + typeUrl: "/cosmos.auth.module.v1.ModuleAccountPermission", + value: ModuleAccountPermission.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/auth.ts b/util/inj-types/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..4dd1e700 --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,557 @@ +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } 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 { + $typeUrl?: "/cosmos.auth.v1beta1.BaseAccount"; + address: string; + pubKey?: Any; + accountNumber: bigint; + sequence: bigint; +} +export interface BaseAccountProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount"; + value: Uint8Array; +} +/** + * 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 BaseAccountAmino { + address?: string; + pub_key?: AnyAmino; + account_number?: string; + sequence?: string; +} +export interface BaseAccountAminoMsg { + type: "cosmos-sdk/BaseAccount"; + value: BaseAccountAmino; +} +/** + * 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 { + $typeUrl?: "/cosmos.auth.v1beta1.BaseAccount"; + address: string; + pub_key?: AnySDKType; + account_number: bigint; + sequence: bigint; +} +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + $typeUrl?: "/cosmos.auth.v1beta1.ModuleAccount"; + baseAccount?: BaseAccount; + name: string; + permissions: string[]; +} +export interface ModuleAccountProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount"; + value: Uint8Array; +} +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccountAmino { + base_account?: BaseAccountAmino; + name?: string; + permissions?: string[]; +} +export interface ModuleAccountAminoMsg { + type: "cosmos-sdk/ModuleAccount"; + value: ModuleAccountAmino; +} +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccountSDKType { + $typeUrl?: "/cosmos.auth.v1beta1.ModuleAccount"; + base_account?: BaseAccountSDKType; + name: string; + permissions: string[]; +} +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} +export interface ModuleCredentialProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential"; + value: Uint8Array; +} +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredentialAmino { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + module_name?: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivation_keys?: string[]; +} +export interface ModuleCredentialAminoMsg { + type: "cosmos-sdk/ModuleCredential"; + value: ModuleCredentialAmino; +} +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredentialSDKType { + module_name: string; + derivation_keys: Uint8Array[]; +} +/** Params defines the parameters for the auth module. */ +export interface Params { + maxMemoCharacters: bigint; + txSigLimit: bigint; + txSizeCostPerByte: bigint; + sigVerifyCostEd25519: bigint; + sigVerifyCostSecp256k1: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the auth module. */ +export interface ParamsAmino { + max_memo_characters?: string; + tx_sig_limit?: string; + tx_size_cost_per_byte?: string; + sig_verify_cost_ed25519?: string; + sig_verify_cost_secp256k1?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/auth/Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the auth module. */ +export interface ParamsSDKType { + max_memo_characters: bigint; + tx_sig_limit: bigint; + tx_size_cost_per_byte: bigint; + sig_verify_cost_ed25519: bigint; + sig_verify_cost_secp256k1: bigint; +} +function createBaseBaseAccount(): BaseAccount { + return { + $typeUrl: "/cosmos.auth.v1beta1.BaseAccount", + address: "", + pubKey: undefined, + accountNumber: BigInt(0), + sequence: BigInt(0) + }; +} +export const BaseAccount = { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount", + aminoType: "cosmos-sdk/BaseAccount", + encode(message: BaseAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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 !== BigInt(0)) { + writer.uint32(24).uint64(message.accountNumber); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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(); + break; + case 4: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): 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 ? BigInt(object.accountNumber.toString()) : BigInt(0); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BaseAccountAmino): BaseAccount { + const message = createBaseBaseAccount(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = Any.fromAmino(object.pub_key); + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: BaseAccount): BaseAccountAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { + return BaseAccount.fromAmino(object.value); + }, + toAminoMsg(message: BaseAccount): BaseAccountAminoMsg { + return { + type: "cosmos-sdk/BaseAccount", + value: BaseAccount.toAmino(message) + }; + }, + fromProtoMsg(message: BaseAccountProtoMsg): BaseAccount { + return BaseAccount.decode(message.value); + }, + toProto(message: BaseAccount): Uint8Array { + return BaseAccount.encode(message).finish(); + }, + toProtoMsg(message: BaseAccount): BaseAccountProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount", + value: BaseAccount.encode(message).finish() + }; + } +}; +function createBaseModuleAccount(): ModuleAccount { + return { + $typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", + baseAccount: undefined, + name: "", + permissions: [] + }; +} +export const ModuleAccount = { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", + aminoType: "cosmos-sdk/ModuleAccount", + encode(message: ModuleAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: ModuleAccountAmino): ModuleAccount { + const message = createBaseModuleAccount(); + if (object.base_account !== undefined && object.base_account !== null) { + message.baseAccount = BaseAccount.fromAmino(object.base_account); + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.permissions = object.permissions?.map(e => e) || []; + return message; + }, + toAmino(message: ModuleAccount): ModuleAccountAmino { + const obj: any = {}; + obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; + obj.name = message.name === "" ? undefined : message.name; + if (message.permissions) { + obj.permissions = message.permissions.map(e => e); + } else { + obj.permissions = message.permissions; + } + return obj; + }, + fromAminoMsg(object: ModuleAccountAminoMsg): ModuleAccount { + return ModuleAccount.fromAmino(object.value); + }, + toAminoMsg(message: ModuleAccount): ModuleAccountAminoMsg { + return { + type: "cosmos-sdk/ModuleAccount", + value: ModuleAccount.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleAccountProtoMsg): ModuleAccount { + return ModuleAccount.decode(message.value); + }, + toProto(message: ModuleAccount): Uint8Array { + return ModuleAccount.encode(message).finish(); + }, + toProtoMsg(message: ModuleAccount): ModuleAccountProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", + value: ModuleAccount.encode(message).finish() + }; + } +}; +function createBaseModuleCredential(): ModuleCredential { + return { + moduleName: "", + derivationKeys: [] + }; +} +export const ModuleCredential = { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential", + aminoType: "cosmos-sdk/ModuleCredential", + encode(message: ModuleCredential, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moduleName = reader.string(); + break; + case 2: + message.derivationKeys.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map(e => e) || []; + return message; + }, + fromAmino(object: ModuleCredentialAmino): ModuleCredential { + const message = createBaseModuleCredential(); + if (object.module_name !== undefined && object.module_name !== null) { + message.moduleName = object.module_name; + } + message.derivationKeys = object.derivation_keys?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: ModuleCredential): ModuleCredentialAmino { + const obj: any = {}; + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; + if (message.derivationKeys) { + obj.derivation_keys = message.derivationKeys.map(e => base64FromBytes(e)); + } else { + obj.derivation_keys = message.derivationKeys; + } + return obj; + }, + fromAminoMsg(object: ModuleCredentialAminoMsg): ModuleCredential { + return ModuleCredential.fromAmino(object.value); + }, + toAminoMsg(message: ModuleCredential): ModuleCredentialAminoMsg { + return { + type: "cosmos-sdk/ModuleCredential", + value: ModuleCredential.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleCredentialProtoMsg): ModuleCredential { + return ModuleCredential.decode(message.value); + }, + toProto(message: ModuleCredential): Uint8Array { + return ModuleCredential.encode(message).finish(); + }, + toProtoMsg(message: ModuleCredential): ModuleCredentialProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential", + value: ModuleCredential.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + maxMemoCharacters: BigInt(0), + txSigLimit: BigInt(0), + txSizeCostPerByte: BigInt(0), + sigVerifyCostEd25519: BigInt(0), + sigVerifyCostSecp256k1: BigInt(0) + }; +} +export const Params = { + typeUrl: "/cosmos.auth.v1beta1.Params", + aminoType: "cosmos-sdk/x/auth/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxMemoCharacters !== BigInt(0)) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (message.txSigLimit !== BigInt(0)) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (message.txSizeCostPerByte !== BigInt(0)) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== BigInt(0)) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== BigInt(0)) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(); + break; + case 2: + message.txSigLimit = reader.uint64(); + break; + case 3: + message.txSizeCostPerByte = reader.uint64(); + break; + case 4: + message.sigVerifyCostEd25519 = reader.uint64(); + break; + case 5: + message.sigVerifyCostSecp256k1 = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.maxMemoCharacters = object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null ? BigInt(object.maxMemoCharacters.toString()) : BigInt(0); + message.txSigLimit = object.txSigLimit !== undefined && object.txSigLimit !== null ? BigInt(object.txSigLimit.toString()) : BigInt(0); + message.txSizeCostPerByte = object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null ? BigInt(object.txSizeCostPerByte.toString()) : BigInt(0); + message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null ? BigInt(object.sigVerifyCostEd25519.toString()) : BigInt(0); + message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null ? BigInt(object.sigVerifyCostSecp256k1.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.max_memo_characters !== undefined && object.max_memo_characters !== null) { + message.maxMemoCharacters = BigInt(object.max_memo_characters); + } + if (object.tx_sig_limit !== undefined && object.tx_sig_limit !== null) { + message.txSigLimit = BigInt(object.tx_sig_limit); + } + if (object.tx_size_cost_per_byte !== undefined && object.tx_size_cost_per_byte !== null) { + message.txSizeCostPerByte = BigInt(object.tx_size_cost_per_byte); + } + if (object.sig_verify_cost_ed25519 !== undefined && object.sig_verify_cost_ed25519 !== null) { + message.sigVerifyCostEd25519 = BigInt(object.sig_verify_cost_ed25519); + } + if (object.sig_verify_cost_secp256k1 !== undefined && object.sig_verify_cost_secp256k1 !== null) { + message.sigVerifyCostSecp256k1 = BigInt(object.sig_verify_cost_secp256k1); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/auth/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/genesis.ts b/util/inj-types/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 00000000..e534fa5f --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,115 @@ +import { Params, ParamsAmino, ParamsSDKType } from "./auth"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** GenesisState defines the auth module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the auth module's genesis state. */ +export interface GenesisStateAmino { + /** params defines all the parameters of the module. */ + params: ParamsAmino; + /** accounts are the accounts present at genesis. */ + accounts?: AnyAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the auth module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + accounts: AnySDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + params: Params.fromPartial({}), + accounts: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmos.auth.v1beta1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.accounts = object.accounts?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.accounts = message.accounts; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/query.lcd.ts b/util/inj-types/cosmos/auth/v1beta1/query.lcd.ts new file mode 100644 index 00000000..decb8f66 --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/query.lcd.ts @@ -0,0 +1,94 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryAccountsRequest, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountResponseSDKType, QueryAccountAddressByIDRequest, QueryAccountAddressByIDResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsResponseSDKType, QueryModuleAccountByNameRequest, QueryModuleAccountByNameResponseSDKType, Bech32PrefixRequest, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesResponseSDKType, QueryAccountInfoRequest, QueryAccountInfoResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Accounts returns all the existing accounts. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. + + Since: cosmos-sdk 0.43 */ + accounts = async (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. */ + account = async (params: QueryAccountRequest): Promise => { + const endpoint = `cosmos/auth/v1beta1/accounts/${params.address}`; + return await this.req.get(endpoint); + }; + /* AccountAddressByID returns account address based on account number. + + Since: cosmos-sdk 0.46.2 */ + accountAddressByID = async (params: QueryAccountAddressByIDRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.accountId !== "undefined") { + options.params.account_id = params.accountId; + } + const endpoint = `cosmos/auth/v1beta1/address_by_id/${params.id}`; + return await this.req.get(endpoint, options); + }; + /* Params queries all parameters. */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `cosmos/auth/v1beta1/params`; + return await this.req.get(endpoint); + }; + /* ModuleAccounts returns all the existing module accounts. + + Since: cosmos-sdk 0.46 */ + moduleAccounts = async (_params: QueryModuleAccountsRequest = {}): Promise => { + const endpoint = `cosmos/auth/v1beta1/module_accounts`; + return await this.req.get(endpoint); + }; + /* ModuleAccountByName returns the module account info by module name */ + moduleAccountByName = async (params: QueryModuleAccountByNameRequest): Promise => { + const endpoint = `cosmos/auth/v1beta1/module_accounts/${params.name}`; + return await this.req.get(endpoint); + }; + /* Bech32Prefix queries bech32Prefix + + Since: cosmos-sdk 0.46 */ + bech32Prefix = async (_params: Bech32PrefixRequest = {}): Promise => { + const endpoint = `cosmos/auth/v1beta1/bech32`; + return await this.req.get(endpoint); + }; + /* AddressBytesToString converts Account Address bytes to string + + Since: cosmos-sdk 0.46 */ + addressBytesToString = async (params: AddressBytesToStringRequest): Promise => { + const endpoint = `cosmos/auth/v1beta1/bech32/${params.addressBytes}`; + return await this.req.get(endpoint); + }; + /* AddressStringToBytes converts Address string to bytes + + Since: cosmos-sdk 0.46 */ + addressStringToBytes = async (params: AddressStringToBytesRequest): Promise => { + const endpoint = `cosmos/auth/v1beta1/bech32/${params.addressString}`; + return await this.req.get(endpoint); + }; + /* AccountInfo queries account info which is common to all account types. + + Since: cosmos-sdk 0.47 */ + accountInfo = async (params: QueryAccountInfoRequest): Promise => { + const endpoint = `cosmos/auth/v1beta1/account_info/${params.address}`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/auth/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..bd98e21a --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/query.rpc.Query.ts @@ -0,0 +1,179 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryAccountAddressByIDRequest, QueryAccountAddressByIDResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, QueryModuleAccountByNameRequest, QueryModuleAccountByNameResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse, QueryAccountInfoRequest, QueryAccountInfoResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Accounts returns all the existing accounts. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.43 + */ + accounts(request?: QueryAccountsRequest): Promise; + /** Account returns account details based on address. */ + account(request: QueryAccountRequest): Promise; + /** + * AccountAddressByID returns account address based on account number. + * + * Since: cosmos-sdk 0.46.2 + */ + accountAddressByID(request: QueryAccountAddressByIDRequest): Promise; + /** Params queries all parameters. */ + params(request?: QueryParamsRequest): Promise; + /** + * ModuleAccounts returns all the existing module accounts. + * + * Since: cosmos-sdk 0.46 + */ + moduleAccounts(request?: QueryModuleAccountsRequest): Promise; + /** ModuleAccountByName returns the module account info by module name */ + moduleAccountByName(request: QueryModuleAccountByNameRequest): Promise; + /** + * Bech32Prefix queries bech32Prefix + * + * Since: cosmos-sdk 0.46 + */ + bech32Prefix(request?: Bech32PrefixRequest): Promise; + /** + * AddressBytesToString converts Account Address bytes to string + * + * Since: cosmos-sdk 0.46 + */ + addressBytesToString(request: AddressBytesToStringRequest): Promise; + /** + * AddressStringToBytes converts Address string to bytes + * + * Since: cosmos-sdk 0.46 + */ + addressStringToBytes(request: AddressStringToBytesRequest): Promise; + /** + * AccountInfo queries account info which is common to all account types. + * + * Since: cosmos-sdk 0.47 + */ + accountInfo(request: QueryAccountInfoRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Accounts returns all the existing accounts. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. + + Since: cosmos-sdk 0.43 */ + accounts = async (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 BinaryReader(data))); + }; + /* Account returns account details based on address. */ + account = async (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 BinaryReader(data))); + }; + /* AccountAddressByID returns account address based on account number. + + Since: cosmos-sdk 0.46.2 */ + accountAddressByID = async (request: QueryAccountAddressByIDRequest): Promise => { + const data = QueryAccountAddressByIDRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "AccountAddressByID", data); + return promise.then(data => QueryAccountAddressByIDResponse.decode(new BinaryReader(data))); + }; + /* Params queries all parameters. */ + params = async (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 BinaryReader(data))); + }; + /* ModuleAccounts returns all the existing module accounts. + + Since: cosmos-sdk 0.46 */ + moduleAccounts = async (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 BinaryReader(data))); + }; + /* ModuleAccountByName returns the module account info by module name */ + moduleAccountByName = async (request: QueryModuleAccountByNameRequest): Promise => { + const data = QueryModuleAccountByNameRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "ModuleAccountByName", data); + return promise.then(data => QueryModuleAccountByNameResponse.decode(new BinaryReader(data))); + }; + /* Bech32Prefix queries bech32Prefix + + Since: cosmos-sdk 0.46 */ + bech32Prefix = async (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 BinaryReader(data))); + }; + /* AddressBytesToString converts Account Address bytes to string + + Since: cosmos-sdk 0.46 */ + addressBytesToString = async (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 BinaryReader(data))); + }; + /* AddressStringToBytes converts Address string to bytes + + Since: cosmos-sdk 0.46 */ + addressStringToBytes = async (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 BinaryReader(data))); + }; + /* AccountInfo queries account info which is common to all account types. + + Since: cosmos-sdk 0.47 */ + accountInfo = async (request: QueryAccountInfoRequest): Promise => { + const data = QueryAccountInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "AccountInfo", data); + return promise.then(data => QueryAccountInfoResponse.decode(new BinaryReader(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); + }, + accountAddressByID(request: QueryAccountAddressByIDRequest): Promise { + return queryService.accountAddressByID(request); + }, + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + }, + moduleAccounts(request?: QueryModuleAccountsRequest): Promise { + return queryService.moduleAccounts(request); + }, + moduleAccountByName(request: QueryModuleAccountByNameRequest): Promise { + return queryService.moduleAccountByName(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); + }, + accountInfo(request: QueryAccountInfoRequest): Promise { + return queryService.accountInfo(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/query.ts b/util/inj-types/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..4efd1dc2 --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,2070 @@ +//@ts-nocheck +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountAmino, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** + * 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; +} +export interface QueryAccountsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest"; + value: Uint8Array; +} +/** + * QueryAccountsRequest is the request type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAccountsRequestAminoMsg { + type: "cosmos-sdk/QueryAccountsRequest"; + value: QueryAccountsRequestAmino; +} +/** + * QueryAccountsRequest is the request type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * 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: (BaseAccount | Any)[] | Any[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryAccountsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse"; + value: Uint8Array; +} +export type QueryAccountsResponseEncoded = Omit & { + /** accounts are the existing accounts */accounts: (BaseAccountProtoMsg | AnyProtoMsg)[]; +}; +/** + * QueryAccountsResponse is the response type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsResponseAmino { + /** accounts are the existing accounts */ + accounts?: AnyAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryAccountsResponseAminoMsg { + type: "cosmos-sdk/QueryAccountsResponse"; + value: QueryAccountsResponseAmino; +} +/** + * QueryAccountsResponse is the response type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsResponseSDKType { + accounts: (BaseAccountSDKType | AnySDKType)[]; + pagination?: PageResponseSDKType; +} +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} +export interface QueryAccountRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest"; + value: Uint8Array; +} +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequestAmino { + /** address defines the address to query for. */ + address?: string; +} +export interface QueryAccountRequestAminoMsg { + type: "cosmos-sdk/QueryAccountRequest"; + value: QueryAccountRequestAmino; +} +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequestSDKType { + address: string; +} +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account?: BaseAccount | Any | undefined; +} +export interface QueryAccountResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse"; + value: Uint8Array; +} +export type QueryAccountResponseEncoded = Omit & { + /** account defines the account of the corresponding address. */account?: BaseAccountProtoMsg | AnyProtoMsg | undefined; +}; +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponseAmino { + /** account defines the account of the corresponding address. */ + account?: AnyAmino; +} +export interface QueryAccountResponseAminoMsg { + type: "cosmos-sdk/QueryAccountResponse"; + value: QueryAccountResponseAmino; +} +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponseSDKType { + account?: BaseAccountSDKType | AnySDKType | undefined; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequest {} +export interface QueryModuleAccountsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest"; + value: Uint8Array; +} +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequestAmino {} +export interface QueryModuleAccountsRequestAminoMsg { + type: "cosmos-sdk/QueryModuleAccountsRequest"; + value: QueryModuleAccountsRequestAmino; +} +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequestSDKType {} +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponse { + accounts: (ModuleAccount | Any)[] | Any[]; +} +export interface QueryModuleAccountsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse"; + value: Uint8Array; +} +export type QueryModuleAccountsResponseEncoded = Omit & { + accounts: (ModuleAccountProtoMsg | AnyProtoMsg)[]; +}; +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponseAmino { + accounts?: AnyAmino[]; +} +export interface QueryModuleAccountsResponseAminoMsg { + type: "cosmos-sdk/QueryModuleAccountsResponse"; + value: QueryModuleAccountsResponseAmino; +} +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponseSDKType { + accounts: (ModuleAccountSDKType | AnySDKType)[]; +} +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequest { + name: string; +} +export interface QueryModuleAccountByNameRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest"; + value: Uint8Array; +} +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequestAmino { + name?: string; +} +export interface QueryModuleAccountByNameRequestAminoMsg { + type: "cosmos-sdk/QueryModuleAccountByNameRequest"; + value: QueryModuleAccountByNameRequestAmino; +} +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequestSDKType { + name: string; +} +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponse { + account?: ModuleAccount | Any | undefined; +} +export interface QueryModuleAccountByNameResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse"; + value: Uint8Array; +} +export type QueryModuleAccountByNameResponseEncoded = Omit & { + account?: ModuleAccountProtoMsg | AnyProtoMsg | undefined; +}; +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponseAmino { + account?: AnyAmino; +} +export interface QueryModuleAccountByNameResponseAminoMsg { + type: "cosmos-sdk/QueryModuleAccountByNameResponse"; + value: QueryModuleAccountByNameResponseAmino; +} +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponseSDKType { + account?: ModuleAccountSDKType | AnySDKType | undefined; +} +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequest {} +export interface Bech32PrefixRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest"; + value: Uint8Array; +} +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequestAmino {} +export interface Bech32PrefixRequestAminoMsg { + type: "cosmos-sdk/Bech32PrefixRequest"; + value: Bech32PrefixRequestAmino; +} +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequestSDKType {} +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponse { + bech32Prefix: string; +} +export interface Bech32PrefixResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse"; + value: Uint8Array; +} +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponseAmino { + bech32_prefix?: string; +} +export interface Bech32PrefixResponseAminoMsg { + type: "cosmos-sdk/Bech32PrefixResponse"; + value: Bech32PrefixResponseAmino; +} +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponseSDKType { + bech32_prefix: string; +} +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequest { + addressBytes: Uint8Array; +} +export interface AddressBytesToStringRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest"; + value: Uint8Array; +} +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequestAmino { + address_bytes?: string; +} +export interface AddressBytesToStringRequestAminoMsg { + type: "cosmos-sdk/AddressBytesToStringRequest"; + value: AddressBytesToStringRequestAmino; +} +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequestSDKType { + address_bytes: Uint8Array; +} +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponse { + addressString: string; +} +export interface AddressBytesToStringResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse"; + value: Uint8Array; +} +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponseAmino { + address_string?: string; +} +export interface AddressBytesToStringResponseAminoMsg { + type: "cosmos-sdk/AddressBytesToStringResponse"; + value: AddressBytesToStringResponseAmino; +} +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponseSDKType { + address_string: string; +} +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequest { + addressString: string; +} +export interface AddressStringToBytesRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest"; + value: Uint8Array; +} +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequestAmino { + address_string?: string; +} +export interface AddressStringToBytesRequestAminoMsg { + type: "cosmos-sdk/AddressStringToBytesRequest"; + value: AddressStringToBytesRequestAmino; +} +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequestSDKType { + address_string: string; +} +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponse { + addressBytes: Uint8Array; +} +export interface AddressStringToBytesResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse"; + value: Uint8Array; +} +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponseAmino { + address_bytes?: string; +} +export interface AddressStringToBytesResponseAminoMsg { + type: "cosmos-sdk/AddressStringToBytesResponse"; + value: AddressStringToBytesResponseAmino; +} +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponseSDKType { + address_bytes: Uint8Array; +} +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequest { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + */ + /** @deprecated */ + id: bigint; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + accountId?: bigint; +} +export interface QueryAccountAddressByIDRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest"; + value: Uint8Array; +} +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequestAmino { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + */ + /** @deprecated */ + id?: string; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + account_id?: string; +} +export interface QueryAccountAddressByIDRequestAminoMsg { + type: "cosmos-sdk/QueryAccountAddressByIDRequest"; + value: QueryAccountAddressByIDRequestAmino; +} +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequestSDKType { + /** @deprecated */ + id: bigint; + account_id?: bigint; +} +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponse { + accountAddress: string; +} +export interface QueryAccountAddressByIDResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse"; + value: Uint8Array; +} +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponseAmino { + account_address?: string; +} +export interface QueryAccountAddressByIDResponseAminoMsg { + type: "cosmos-sdk/QueryAccountAddressByIDResponse"; + value: QueryAccountAddressByIDResponseAmino; +} +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponseSDKType { + account_address: string; +} +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequest { + /** address is the account address string. */ + address: string; +} +export interface QueryAccountInfoRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest"; + value: Uint8Array; +} +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequestAmino { + /** address is the account address string. */ + address?: string; +} +export interface QueryAccountInfoRequestAminoMsg { + type: "cosmos-sdk/QueryAccountInfoRequest"; + value: QueryAccountInfoRequestAmino; +} +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequestSDKType { + address: string; +} +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponse { + /** info is the account info which is represented by BaseAccount. */ + info?: BaseAccount; +} +export interface QueryAccountInfoResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse"; + value: Uint8Array; +} +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponseAmino { + /** info is the account info which is represented by BaseAccount. */ + info?: BaseAccountAmino; +} +export interface QueryAccountInfoResponseAminoMsg { + type: "cosmos-sdk/QueryAccountInfoResponse"; + value: QueryAccountInfoResponseAmino; +} +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponseSDKType { + info?: BaseAccountSDKType; +} +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { + pagination: undefined + }; +} +export const QueryAccountsRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", + aminoType: "cosmos-sdk/QueryAccountsRequest", + encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAccountsRequestAmino): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountsRequestAminoMsg): QueryAccountsRequest { + return QueryAccountsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountsRequest): QueryAccountsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountsRequest", + value: QueryAccountsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountsRequestProtoMsg): QueryAccountsRequest { + return QueryAccountsRequest.decode(message.value); + }, + toProto(message: QueryAccountsRequest): Uint8Array { + return QueryAccountsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountsRequest): QueryAccountsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", + value: QueryAccountsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAccountsResponse(): QueryAccountsResponse { + return { + accounts: [], + pagination: undefined + }; +} +export const QueryAccountsResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", + aminoType: "cosmos-sdk/QueryAccountsResponse", + encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.accounts) { + Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()) as Any)); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): 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; + }, + fromAmino(object: QueryAccountsResponseAmino): QueryAccountsResponse { + const message = createBaseQueryAccountsResponse(); + message.accounts = object.accounts?.map(e => Cosmos_authv1beta1AccountI_FromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAccountsResponse): QueryAccountsResponseAmino { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? Cosmos_authv1beta1AccountI_ToAmino((e as Any)) : undefined); + } else { + obj.accounts = message.accounts; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountsResponseAminoMsg): QueryAccountsResponse { + return QueryAccountsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountsResponse): QueryAccountsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountsResponse", + value: QueryAccountsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountsResponseProtoMsg): QueryAccountsResponse { + return QueryAccountsResponse.decode(message.value); + }, + toProto(message: QueryAccountsResponse): Uint8Array { + return QueryAccountsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountsResponse): QueryAccountsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", + value: QueryAccountsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { + address: "" + }; +} +export const QueryAccountRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", + aminoType: "cosmos-sdk/QueryAccountRequest", + encode(message: QueryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryAccountRequestAmino): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { + return QueryAccountRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountRequest): QueryAccountRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountRequest", + value: QueryAccountRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountRequestProtoMsg): QueryAccountRequest { + return QueryAccountRequest.decode(message.value); + }, + toProto(message: QueryAccountRequest): Uint8Array { + return QueryAccountRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountRequest): QueryAccountRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", + value: QueryAccountRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { + account: undefined + }; +} +export const QueryAccountResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", + aminoType: "cosmos-sdk/QueryAccountResponse", + encode(message: QueryAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== undefined) { + Any.encode((message.account as Any), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 = (Cosmos_authv1beta1AccountI_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountResponse { + const message = createBaseQueryAccountResponse(); + message.account = object.account !== undefined && object.account !== null ? Any.fromPartial(object.account) : undefined; + return message; + }, + fromAmino(object: QueryAccountResponseAmino): QueryAccountResponse { + const message = createBaseQueryAccountResponse(); + if (object.account !== undefined && object.account !== null) { + message.account = Cosmos_authv1beta1AccountI_FromAmino(object.account); + } + return message; + }, + toAmino(message: QueryAccountResponse): QueryAccountResponseAmino { + const obj: any = {}; + obj.account = message.account ? Cosmos_authv1beta1AccountI_ToAmino((message.account as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountResponseAminoMsg): QueryAccountResponse { + return QueryAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountResponse): QueryAccountResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountResponse", + value: QueryAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountResponseProtoMsg): QueryAccountResponse { + return QueryAccountResponse.decode(message.value); + }, + toProto(message: QueryAccountResponse): Uint8Array { + return QueryAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountResponse): QueryAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", + value: QueryAccountResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} +export const QueryModuleAccountsRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", + aminoType: "cosmos-sdk/QueryModuleAccountsRequest", + encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, + fromAmino(_: QueryModuleAccountsRequestAmino): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, + toAmino(_: QueryModuleAccountsRequest): QueryModuleAccountsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryModuleAccountsRequestAminoMsg): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountsRequest): QueryModuleAccountsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountsRequest", + value: QueryModuleAccountsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountsRequestProtoMsg): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.decode(message.value); + }, + toProto(message: QueryModuleAccountsRequest): Uint8Array { + return QueryModuleAccountsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountsRequest): QueryModuleAccountsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", + value: QueryModuleAccountsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { + accounts: [] + }; +} +export const QueryModuleAccountsResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", + aminoType: "cosmos-sdk/QueryModuleAccountsResponse", + encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.accounts) { + Any.encode((v! as Any), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()) as Any)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryModuleAccountsResponseAmino): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map(e => Cosmos_authv1beta1ModuleAccountI_FromAmino(e)) || []; + return message; + }, + toAmino(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseAmino { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? Cosmos_authv1beta1ModuleAccountI_ToAmino((e as Any)) : undefined); + } else { + obj.accounts = message.accounts; + } + return obj; + }, + fromAminoMsg(object: QueryModuleAccountsResponseAminoMsg): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountsResponse", + value: QueryModuleAccountsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountsResponseProtoMsg): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.decode(message.value); + }, + toProto(message: QueryModuleAccountsResponse): Uint8Array { + return QueryModuleAccountsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", + value: QueryModuleAccountsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryModuleAccountByNameRequest(): QueryModuleAccountByNameRequest { + return { + name: "" + }; +} +export const QueryModuleAccountByNameRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest", + aminoType: "cosmos-sdk/QueryModuleAccountByNameRequest", + encode(message: QueryModuleAccountByNameRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + message.name = object.name ?? ""; + return message; + }, + fromAmino(object: QueryModuleAccountByNameRequestAmino): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + return message; + }, + toAmino(message: QueryModuleAccountByNameRequest): QueryModuleAccountByNameRequestAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + return obj; + }, + fromAminoMsg(object: QueryModuleAccountByNameRequestAminoMsg): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountByNameRequest): QueryModuleAccountByNameRequestAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountByNameRequest", + value: QueryModuleAccountByNameRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountByNameRequestProtoMsg): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.decode(message.value); + }, + toProto(message: QueryModuleAccountByNameRequest): Uint8Array { + return QueryModuleAccountByNameRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountByNameRequest): QueryModuleAccountByNameRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest", + value: QueryModuleAccountByNameRequest.encode(message).finish() + }; + } +}; +function createBaseQueryModuleAccountByNameResponse(): QueryModuleAccountByNameResponse { + return { + account: undefined + }; +} +export const QueryModuleAccountByNameResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", + aminoType: "cosmos-sdk/QueryModuleAccountByNameResponse", + encode(message: QueryModuleAccountByNameResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== undefined) { + Any.encode((message.account as Any), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = (Cosmos_authv1beta1ModuleAccountI_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + message.account = object.account !== undefined && object.account !== null ? Any.fromPartial(object.account) : undefined; + return message; + }, + fromAmino(object: QueryModuleAccountByNameResponseAmino): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + if (object.account !== undefined && object.account !== null) { + message.account = Cosmos_authv1beta1ModuleAccountI_FromAmino(object.account); + } + return message; + }, + toAmino(message: QueryModuleAccountByNameResponse): QueryModuleAccountByNameResponseAmino { + const obj: any = {}; + obj.account = message.account ? Cosmos_authv1beta1ModuleAccountI_ToAmino((message.account as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: QueryModuleAccountByNameResponseAminoMsg): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountByNameResponse): QueryModuleAccountByNameResponseAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountByNameResponse", + value: QueryModuleAccountByNameResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountByNameResponseProtoMsg): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.decode(message.value); + }, + toProto(message: QueryModuleAccountByNameResponse): Uint8Array { + return QueryModuleAccountByNameResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountByNameResponse): QueryModuleAccountByNameResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", + value: QueryModuleAccountByNameResponse.encode(message).finish() + }; + } +}; +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} +export const Bech32PrefixRequest = { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", + aminoType: "cosmos-sdk/Bech32PrefixRequest", + encode(_: Bech32PrefixRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, + fromAmino(_: Bech32PrefixRequestAmino): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, + toAmino(_: Bech32PrefixRequest): Bech32PrefixRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: Bech32PrefixRequestAminoMsg): Bech32PrefixRequest { + return Bech32PrefixRequest.fromAmino(object.value); + }, + toAminoMsg(message: Bech32PrefixRequest): Bech32PrefixRequestAminoMsg { + return { + type: "cosmos-sdk/Bech32PrefixRequest", + value: Bech32PrefixRequest.toAmino(message) + }; + }, + fromProtoMsg(message: Bech32PrefixRequestProtoMsg): Bech32PrefixRequest { + return Bech32PrefixRequest.decode(message.value); + }, + toProto(message: Bech32PrefixRequest): Uint8Array { + return Bech32PrefixRequest.encode(message).finish(); + }, + toProtoMsg(message: Bech32PrefixRequest): Bech32PrefixRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", + value: Bech32PrefixRequest.encode(message).finish() + }; + } +}; +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { + bech32Prefix: "" + }; +} +export const Bech32PrefixResponse = { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", + aminoType: "cosmos-sdk/Bech32PrefixResponse", + encode(message: Bech32PrefixResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32Prefix = object.bech32Prefix ?? ""; + return message; + }, + fromAmino(object: Bech32PrefixResponseAmino): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + if (object.bech32_prefix !== undefined && object.bech32_prefix !== null) { + message.bech32Prefix = object.bech32_prefix; + } + return message; + }, + toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { + const obj: any = {}; + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; + return obj; + }, + fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { + return Bech32PrefixResponse.fromAmino(object.value); + }, + toAminoMsg(message: Bech32PrefixResponse): Bech32PrefixResponseAminoMsg { + return { + type: "cosmos-sdk/Bech32PrefixResponse", + value: Bech32PrefixResponse.toAmino(message) + }; + }, + fromProtoMsg(message: Bech32PrefixResponseProtoMsg): Bech32PrefixResponse { + return Bech32PrefixResponse.decode(message.value); + }, + toProto(message: Bech32PrefixResponse): Uint8Array { + return Bech32PrefixResponse.encode(message).finish(); + }, + toProtoMsg(message: Bech32PrefixResponse): Bech32PrefixResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", + value: Bech32PrefixResponse.encode(message).finish() + }; + } +}; +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { + addressBytes: new Uint8Array() + }; +} +export const AddressBytesToStringRequest = { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", + aminoType: "cosmos-sdk/AddressBytesToStringRequest", + encode(message: AddressBytesToStringRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.addressBytes = object.addressBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: AddressBytesToStringRequestAmino): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + if (object.address_bytes !== undefined && object.address_bytes !== null) { + message.addressBytes = bytesFromBase64(object.address_bytes); + } + return message; + }, + toAmino(message: AddressBytesToStringRequest): AddressBytesToStringRequestAmino { + const obj: any = {}; + obj.address_bytes = message.addressBytes ? base64FromBytes(message.addressBytes) : undefined; + return obj; + }, + fromAminoMsg(object: AddressBytesToStringRequestAminoMsg): AddressBytesToStringRequest { + return AddressBytesToStringRequest.fromAmino(object.value); + }, + toAminoMsg(message: AddressBytesToStringRequest): AddressBytesToStringRequestAminoMsg { + return { + type: "cosmos-sdk/AddressBytesToStringRequest", + value: AddressBytesToStringRequest.toAmino(message) + }; + }, + fromProtoMsg(message: AddressBytesToStringRequestProtoMsg): AddressBytesToStringRequest { + return AddressBytesToStringRequest.decode(message.value); + }, + toProto(message: AddressBytesToStringRequest): Uint8Array { + return AddressBytesToStringRequest.encode(message).finish(); + }, + toProtoMsg(message: AddressBytesToStringRequest): AddressBytesToStringRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", + value: AddressBytesToStringRequest.encode(message).finish() + }; + } +}; +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { + addressString: "" + }; +} +export const AddressBytesToStringResponse = { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", + aminoType: "cosmos-sdk/AddressBytesToStringResponse", + encode(message: AddressBytesToStringResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.addressString = object.addressString ?? ""; + return message; + }, + fromAmino(object: AddressBytesToStringResponseAmino): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + if (object.address_string !== undefined && object.address_string !== null) { + message.addressString = object.address_string; + } + return message; + }, + toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { + const obj: any = {}; + obj.address_string = message.addressString === "" ? undefined : message.addressString; + return obj; + }, + fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { + return AddressBytesToStringResponse.fromAmino(object.value); + }, + toAminoMsg(message: AddressBytesToStringResponse): AddressBytesToStringResponseAminoMsg { + return { + type: "cosmos-sdk/AddressBytesToStringResponse", + value: AddressBytesToStringResponse.toAmino(message) + }; + }, + fromProtoMsg(message: AddressBytesToStringResponseProtoMsg): AddressBytesToStringResponse { + return AddressBytesToStringResponse.decode(message.value); + }, + toProto(message: AddressBytesToStringResponse): Uint8Array { + return AddressBytesToStringResponse.encode(message).finish(); + }, + toProtoMsg(message: AddressBytesToStringResponse): AddressBytesToStringResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", + value: AddressBytesToStringResponse.encode(message).finish() + }; + } +}; +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { + addressString: "" + }; +} +export const AddressStringToBytesRequest = { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", + aminoType: "cosmos-sdk/AddressStringToBytesRequest", + encode(message: AddressStringToBytesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.addressString = object.addressString ?? ""; + return message; + }, + fromAmino(object: AddressStringToBytesRequestAmino): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + if (object.address_string !== undefined && object.address_string !== null) { + message.addressString = object.address_string; + } + return message; + }, + toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { + const obj: any = {}; + obj.address_string = message.addressString === "" ? undefined : message.addressString; + return obj; + }, + fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { + return AddressStringToBytesRequest.fromAmino(object.value); + }, + toAminoMsg(message: AddressStringToBytesRequest): AddressStringToBytesRequestAminoMsg { + return { + type: "cosmos-sdk/AddressStringToBytesRequest", + value: AddressStringToBytesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: AddressStringToBytesRequestProtoMsg): AddressStringToBytesRequest { + return AddressStringToBytesRequest.decode(message.value); + }, + toProto(message: AddressStringToBytesRequest): Uint8Array { + return AddressStringToBytesRequest.encode(message).finish(); + }, + toProtoMsg(message: AddressStringToBytesRequest): AddressStringToBytesRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", + value: AddressStringToBytesRequest.encode(message).finish() + }; + } +}; +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { + addressBytes: new Uint8Array() + }; +} +export const AddressStringToBytesResponse = { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", + aminoType: "cosmos-sdk/AddressStringToBytesResponse", + encode(message: AddressStringToBytesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.addressBytes = object.addressBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: AddressStringToBytesResponseAmino): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + if (object.address_bytes !== undefined && object.address_bytes !== null) { + message.addressBytes = bytesFromBase64(object.address_bytes); + } + return message; + }, + toAmino(message: AddressStringToBytesResponse): AddressStringToBytesResponseAmino { + const obj: any = {}; + obj.address_bytes = message.addressBytes ? base64FromBytes(message.addressBytes) : undefined; + return obj; + }, + fromAminoMsg(object: AddressStringToBytesResponseAminoMsg): AddressStringToBytesResponse { + return AddressStringToBytesResponse.fromAmino(object.value); + }, + toAminoMsg(message: AddressStringToBytesResponse): AddressStringToBytesResponseAminoMsg { + return { + type: "cosmos-sdk/AddressStringToBytesResponse", + value: AddressStringToBytesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: AddressStringToBytesResponseProtoMsg): AddressStringToBytesResponse { + return AddressStringToBytesResponse.decode(message.value); + }, + toProto(message: AddressStringToBytesResponse): Uint8Array { + return AddressStringToBytesResponse.encode(message).finish(); + }, + toProtoMsg(message: AddressStringToBytesResponse): AddressStringToBytesResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", + value: AddressStringToBytesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAccountAddressByIDRequest(): QueryAccountAddressByIDRequest { + return { + id: BigInt(0), + accountId: BigInt(0) + }; +} +export const QueryAccountAddressByIDRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", + aminoType: "cosmos-sdk/QueryAccountAddressByIDRequest", + encode(message: QueryAccountAddressByIDRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { + writer.uint32(8).int64(message.id); + } + if (message.accountId !== BigInt(0)) { + writer.uint32(16).uint64(message.accountId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.int64(); + break; + case 2: + message.accountId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.accountId = object.accountId !== undefined && object.accountId !== null ? BigInt(object.accountId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryAccountAddressByIDRequestAmino): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + if (object.account_id !== undefined && object.account_id !== null) { + message.accountId = BigInt(object.account_id); + } + return message; + }, + toAmino(message: QueryAccountAddressByIDRequest): QueryAccountAddressByIDRequestAmino { + const obj: any = {}; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; + obj.account_id = message.accountId !== BigInt(0) ? message.accountId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountAddressByIDRequestAminoMsg): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountAddressByIDRequest): QueryAccountAddressByIDRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountAddressByIDRequest", + value: QueryAccountAddressByIDRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountAddressByIDRequestProtoMsg): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.decode(message.value); + }, + toProto(message: QueryAccountAddressByIDRequest): Uint8Array { + return QueryAccountAddressByIDRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountAddressByIDRequest): QueryAccountAddressByIDRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", + value: QueryAccountAddressByIDRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAccountAddressByIDResponse(): QueryAccountAddressByIDResponse { + return { + accountAddress: "" + }; +} +export const QueryAccountAddressByIDResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", + aminoType: "cosmos-sdk/QueryAccountAddressByIDResponse", + encode(message: QueryAccountAddressByIDResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.accountAddress !== "") { + writer.uint32(10).string(message.accountAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.accountAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + message.accountAddress = object.accountAddress ?? ""; + return message; + }, + fromAmino(object: QueryAccountAddressByIDResponseAmino): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + if (object.account_address !== undefined && object.account_address !== null) { + message.accountAddress = object.account_address; + } + return message; + }, + toAmino(message: QueryAccountAddressByIDResponse): QueryAccountAddressByIDResponseAmino { + const obj: any = {}; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + return obj; + }, + fromAminoMsg(object: QueryAccountAddressByIDResponseAminoMsg): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountAddressByIDResponse): QueryAccountAddressByIDResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountAddressByIDResponse", + value: QueryAccountAddressByIDResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountAddressByIDResponseProtoMsg): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.decode(message.value); + }, + toProto(message: QueryAccountAddressByIDResponse): Uint8Array { + return QueryAccountAddressByIDResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountAddressByIDResponse): QueryAccountAddressByIDResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", + value: QueryAccountAddressByIDResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAccountInfoRequest(): QueryAccountInfoRequest { + return { + address: "" + }; +} +export const QueryAccountInfoRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest", + aminoType: "cosmos-sdk/QueryAccountInfoRequest", + encode(message: QueryAccountInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoRequest(); + 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: DeepPartial): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryAccountInfoRequestAmino): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountInfoRequest): QueryAccountInfoRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountInfoRequestAminoMsg): QueryAccountInfoRequest { + return QueryAccountInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountInfoRequest): QueryAccountInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountInfoRequest", + value: QueryAccountInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountInfoRequestProtoMsg): QueryAccountInfoRequest { + return QueryAccountInfoRequest.decode(message.value); + }, + toProto(message: QueryAccountInfoRequest): Uint8Array { + return QueryAccountInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountInfoRequest): QueryAccountInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest", + value: QueryAccountInfoRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAccountInfoResponse(): QueryAccountInfoResponse { + return { + info: undefined + }; +} +export const QueryAccountInfoResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse", + aminoType: "cosmos-sdk/QueryAccountInfoResponse", + encode(message: QueryAccountInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.info !== undefined) { + BaseAccount.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = BaseAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + message.info = object.info !== undefined && object.info !== null ? BaseAccount.fromPartial(object.info) : undefined; + return message; + }, + fromAmino(object: QueryAccountInfoResponseAmino): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + if (object.info !== undefined && object.info !== null) { + message.info = BaseAccount.fromAmino(object.info); + } + return message; + }, + toAmino(message: QueryAccountInfoResponse): QueryAccountInfoResponseAmino { + const obj: any = {}; + obj.info = message.info ? BaseAccount.toAmino(message.info) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountInfoResponseAminoMsg): QueryAccountInfoResponse { + return QueryAccountInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountInfoResponse): QueryAccountInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountInfoResponse", + value: QueryAccountInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountInfoResponseProtoMsg): QueryAccountInfoResponse { + return QueryAccountInfoResponse.decode(message.value); + }, + toProto(message: QueryAccountInfoResponse): Uint8Array { + return QueryAccountInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountInfoResponse): QueryAccountInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse", + value: QueryAccountInfoResponse.encode(message).finish() + }; + } +}; +export const Cosmos_authv1beta1AccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BaseAccount | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.auth.v1beta1.BaseAccount": + return BaseAccount.decode(data.value); + default: + return data; + } +}; +export const Cosmos_authv1beta1AccountI_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/BaseAccount": + return Any.fromPartial({ + typeUrl: "/cosmos.auth.v1beta1.BaseAccount", + value: BaseAccount.encode(BaseAccount.fromPartial(BaseAccount.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_authv1beta1AccountI_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.auth.v1beta1.BaseAccount": + return { + type: "cosmos-sdk/BaseAccount", + value: BaseAccount.toAmino(BaseAccount.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; +export const Cosmos_authv1beta1ModuleAccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): ModuleAccount | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.auth.v1beta1.ModuleAccount": + return ModuleAccount.decode(data.value); + default: + return data; + } +}; +export const Cosmos_authv1beta1ModuleAccountI_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/ModuleAccount": + return Any.fromPartial({ + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", + value: ModuleAccount.encode(ModuleAccount.fromPartial(ModuleAccount.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_authv1beta1ModuleAccountI_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.auth.v1beta1.ModuleAccount": + return { + type: "cosmos-sdk/ModuleAccount", + value: ModuleAccount.toAmino(ModuleAccount.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/tx.amino.ts b/util/inj-types/cosmos/auth/v1beta1/tx.amino.ts new file mode 100644 index 00000000..7232eddd --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/tx.amino.ts @@ -0,0 +1,8 @@ +import { MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.auth.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/auth/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/tx.registry.ts b/util/inj-types/cosmos/auth/v1beta1/tx.registry.ts new file mode 100644 index 00000000..2070e3ea --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.auth.v1beta1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/auth/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..a1057581 --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,28 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the x/auth Msg service. */ +export interface Msg { + /** + * UpdateParams defines a (governance) operation for updating the x/auth module + * parameters. The authority defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* UpdateParams defines a (governance) operation for updating the x/auth module + parameters. The authority defaults to the x/gov module account. + + Since: cosmos-sdk 0.47 */ + updateParams = async (request: MsgUpdateParams): Promise => { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.auth.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/auth/v1beta1/tx.ts b/util/inj-types/cosmos/auth/v1beta1/tx.ts new file mode 100644 index 00000000..388d1c6f --- /dev/null +++ b/util/inj-types/cosmos/auth/v1beta1/tx.ts @@ -0,0 +1,218 @@ +import { Params, ParamsAmino, ParamsSDKType } from "./auth"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/auth parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/auth/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + aminoType: "cosmos-sdk/x/auth/MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/auth/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/authz/module/v1/module.ts b/util/inj-types/cosmos/authz/module/v1/module.ts new file mode 100644 index 00000000..2aa1be4a --- /dev/null +++ b/util/inj-types/cosmos/authz/module/v1/module.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the authz module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.authz.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the authz module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the authz module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.authz.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.authz.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/authz/v1beta1/authz.ts b/util/inj-types/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..fbd84396 --- /dev/null +++ b/util/inj-types/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,585 @@ +//@ts-nocheck +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { SendAuthorization, SendAuthorizationProtoMsg, SendAuthorizationSDKType } from "../../bank/v1beta1/authz"; +import { StakeAuthorization, StakeAuthorizationProtoMsg, StakeAuthorizationSDKType } from "../../staking/v1beta1/authz"; +import { StoreCodeAuthorization, StoreCodeAuthorizationProtoMsg, StoreCodeAuthorizationSDKType, ContractExecutionAuthorization, ContractExecutionAuthorizationProtoMsg, ContractExecutionAuthorizationSDKType, ContractMigrationAuthorization, ContractMigrationAuthorizationProtoMsg, ContractMigrationAuthorizationSDKType } from "../../../cosmwasm/wasm/v1/authz"; +import { TransferAuthorization, TransferAuthorizationProtoMsg, TransferAuthorizationSDKType } from "../../../ibc/applications/transfer/v1/authz"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, 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 { + $typeUrl?: "/cosmos.authz.v1beta1.GenericAuthorization"; + /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ + msg: string; +} +export interface GenericAuthorizationProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization"; + value: Uint8Array; +} +/** + * GenericAuthorization gives the grantee unrestricted permissions to execute + * the provided method on behalf of the granter's account. + */ +export interface GenericAuthorizationAmino { + /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ + msg?: string; +} +export interface GenericAuthorizationAminoMsg { + type: "cosmos-sdk/GenericAuthorization"; + value: GenericAuthorizationAmino; +} +/** + * GenericAuthorization gives the grantee unrestricted permissions to execute + * the provided method on behalf of the granter's account. + */ +export interface GenericAuthorizationSDKType { + $typeUrl?: "/cosmos.authz.v1beta1.GenericAuthorization"; + msg: string; +} +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface Grant { + authorization?: GenericAuthorization | SendAuthorization | StakeAuthorization | StoreCodeAuthorization | ContractExecutionAuthorization | ContractMigrationAuthorization | TransferAuthorization | 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; +} +export interface GrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.Grant"; + value: Uint8Array; +} +export type GrantEncoded = Omit & { + authorization?: GenericAuthorizationProtoMsg | SendAuthorizationProtoMsg | StakeAuthorizationProtoMsg | StoreCodeAuthorizationProtoMsg | ContractExecutionAuthorizationProtoMsg | ContractMigrationAuthorizationProtoMsg | TransferAuthorizationProtoMsg | AnyProtoMsg | undefined; +}; +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface GrantAmino { + authorization?: AnyAmino; + /** + * time when the grant will expire and will be pruned. If null, then the grant + * doesn't have a time expiration (other conditions in `authorization` + * may apply to invalidate the grant) + */ + expiration?: string; +} +export interface GrantAminoMsg { + type: "cosmos-sdk/Grant"; + value: GrantAmino; +} +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface GrantSDKType { + authorization?: GenericAuthorizationSDKType | SendAuthorizationSDKType | StakeAuthorizationSDKType | StoreCodeAuthorizationSDKType | ContractExecutionAuthorizationSDKType | ContractMigrationAuthorizationSDKType | TransferAuthorizationSDKType | AnySDKType | undefined; + expiration?: Date; +} +/** + * 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?: GenericAuthorization | SendAuthorization | StakeAuthorization | StoreCodeAuthorization | ContractExecutionAuthorization | ContractMigrationAuthorization | TransferAuthorization | Any | undefined; + expiration?: Date; +} +export interface GrantAuthorizationProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization"; + value: Uint8Array; +} +export type GrantAuthorizationEncoded = Omit & { + authorization?: GenericAuthorizationProtoMsg | SendAuthorizationProtoMsg | StakeAuthorizationProtoMsg | StoreCodeAuthorizationProtoMsg | ContractExecutionAuthorizationProtoMsg | ContractMigrationAuthorizationProtoMsg | TransferAuthorizationProtoMsg | AnyProtoMsg | 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 GrantAuthorizationAmino { + granter?: string; + grantee?: string; + authorization?: AnyAmino; + expiration?: string; +} +export interface GrantAuthorizationAminoMsg { + type: "cosmos-sdk/GrantAuthorization"; + value: GrantAuthorizationAmino; +} +/** + * 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?: GenericAuthorizationSDKType | SendAuthorizationSDKType | StakeAuthorizationSDKType | StoreCodeAuthorizationSDKType | ContractExecutionAuthorizationSDKType | ContractMigrationAuthorizationSDKType | TransferAuthorizationSDKType | AnySDKType | undefined; + expiration?: Date; +} +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItem { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msgTypeUrls: string[]; +} +export interface GrantQueueItemProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem"; + value: Uint8Array; +} +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItemAmino { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msg_type_urls?: string[]; +} +export interface GrantQueueItemAminoMsg { + type: "cosmos-sdk/GrantQueueItem"; + value: GrantQueueItemAmino; +} +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItemSDKType { + msg_type_urls: string[]; +} +function createBaseGenericAuthorization(): GenericAuthorization { + return { + $typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + msg: "" + }; +} +export const GenericAuthorization = { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + aminoType: "cosmos-sdk/GenericAuthorization", + encode(message: GenericAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): GenericAuthorization { + const message = createBaseGenericAuthorization(); + message.msg = object.msg ?? ""; + return message; + }, + fromAmino(object: GenericAuthorizationAmino): GenericAuthorization { + const message = createBaseGenericAuthorization(); + if (object.msg !== undefined && object.msg !== null) { + message.msg = object.msg; + } + return message; + }, + toAmino(message: GenericAuthorization): GenericAuthorizationAmino { + const obj: any = {}; + obj.msg = message.msg === "" ? undefined : message.msg; + return obj; + }, + fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { + return GenericAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: GenericAuthorization): GenericAuthorizationAminoMsg { + return { + type: "cosmos-sdk/GenericAuthorization", + value: GenericAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: GenericAuthorizationProtoMsg): GenericAuthorization { + return GenericAuthorization.decode(message.value); + }, + toProto(message: GenericAuthorization): Uint8Array { + return GenericAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GenericAuthorization): GenericAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + value: GenericAuthorization.encode(message).finish() + }; + } +}; +function createBaseGrant(): Grant { + return { + authorization: undefined, + expiration: undefined + }; +} +export const Grant = { + typeUrl: "/cosmos.authz.v1beta1.Grant", + aminoType: "cosmos-sdk/Grant", + encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authorization !== undefined) { + Any.encode((message.authorization as Any), writer.uint32(10).fork()).ldelim(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 = (Cosmos_authzv1beta1Authorization_InterfaceDecoder(reader) as Any); + break; + case 2: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Grant { + const message = createBaseGrant(); + message.authorization = object.authorization !== undefined && object.authorization !== null ? Any.fromPartial(object.authorization) : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, + fromAmino(object: GrantAmino): Grant { + const message = createBaseGrant(); + if (object.authorization !== undefined && object.authorization !== null) { + message.authorization = Cosmos_authzv1beta1Authorization_FromAmino(object.authorization); + } + if (object.expiration !== undefined && object.expiration !== null) { + message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); + } + return message; + }, + toAmino(message: Grant): GrantAmino { + const obj: any = {}; + obj.authorization = message.authorization ? Cosmos_authzv1beta1Authorization_ToAmino((message.authorization as Any)) : undefined; + obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; + return obj; + }, + fromAminoMsg(object: GrantAminoMsg): Grant { + return Grant.fromAmino(object.value); + }, + toAminoMsg(message: Grant): GrantAminoMsg { + return { + type: "cosmos-sdk/Grant", + value: Grant.toAmino(message) + }; + }, + fromProtoMsg(message: GrantProtoMsg): Grant { + return Grant.decode(message.value); + }, + toProto(message: Grant): Uint8Array { + return Grant.encode(message).finish(); + }, + toProtoMsg(message: Grant): GrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.Grant", + value: Grant.encode(message).finish() + }; + } +}; +function createBaseGrantAuthorization(): GrantAuthorization { + return { + granter: "", + grantee: "", + authorization: undefined, + expiration: undefined + }; +} +export const GrantAuthorization = { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", + aminoType: "cosmos-sdk/GrantAuthorization", + encode(message: GrantAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode((message.authorization as Any), writer.uint32(26).fork()).ldelim(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 = (Cosmos_authzv1beta1Authorization_InterfaceDecoder(reader) as Any); + break; + case 4: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): 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; + }, + fromAmino(object: GrantAuthorizationAmino): GrantAuthorization { + const message = createBaseGrantAuthorization(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.authorization !== undefined && object.authorization !== null) { + message.authorization = Cosmos_authzv1beta1Authorization_FromAmino(object.authorization); + } + if (object.expiration !== undefined && object.expiration !== null) { + message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); + } + return message; + }, + toAmino(message: GrantAuthorization): GrantAuthorizationAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.authorization = message.authorization ? Cosmos_authzv1beta1Authorization_ToAmino((message.authorization as Any)) : undefined; + obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; + return obj; + }, + fromAminoMsg(object: GrantAuthorizationAminoMsg): GrantAuthorization { + return GrantAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: GrantAuthorization): GrantAuthorizationAminoMsg { + return { + type: "cosmos-sdk/GrantAuthorization", + value: GrantAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: GrantAuthorizationProtoMsg): GrantAuthorization { + return GrantAuthorization.decode(message.value); + }, + toProto(message: GrantAuthorization): Uint8Array { + return GrantAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GrantAuthorization): GrantAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", + value: GrantAuthorization.encode(message).finish() + }; + } +}; +function createBaseGrantQueueItem(): GrantQueueItem { + return { + msgTypeUrls: [] + }; +} +export const GrantQueueItem = { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", + aminoType: "cosmos-sdk/GrantQueueItem", + encode(message: GrantQueueItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.msgTypeUrls) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msgTypeUrls?.map(e => e) || []; + return message; + }, + fromAmino(object: GrantQueueItemAmino): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msg_type_urls?.map(e => e) || []; + return message; + }, + toAmino(message: GrantQueueItem): GrantQueueItemAmino { + const obj: any = {}; + if (message.msgTypeUrls) { + obj.msg_type_urls = message.msgTypeUrls.map(e => e); + } else { + obj.msg_type_urls = message.msgTypeUrls; + } + return obj; + }, + fromAminoMsg(object: GrantQueueItemAminoMsg): GrantQueueItem { + return GrantQueueItem.fromAmino(object.value); + }, + toAminoMsg(message: GrantQueueItem): GrantQueueItemAminoMsg { + return { + type: "cosmos-sdk/GrantQueueItem", + value: GrantQueueItem.toAmino(message) + }; + }, + fromProtoMsg(message: GrantQueueItemProtoMsg): GrantQueueItem { + return GrantQueueItem.decode(message.value); + }, + toProto(message: GrantQueueItem): Uint8Array { + return GrantQueueItem.encode(message).finish(); + }, + toProtoMsg(message: GrantQueueItem): GrantQueueItemProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", + value: GrantQueueItem.encode(message).finish() + }; + } +}; +export const Cosmos_authzv1beta1Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array): GenericAuthorization | SendAuthorization | StakeAuthorization | StoreCodeAuthorization | ContractExecutionAuthorization | ContractMigrationAuthorization | TransferAuthorization | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.authz.v1beta1.GenericAuthorization": + return GenericAuthorization.decode(data.value); + case "/cosmos.bank.v1beta1.SendAuthorization": + return SendAuthorization.decode(data.value); + case "/cosmos.staking.v1beta1.StakeAuthorization": + return StakeAuthorization.decode(data.value); + case "/cosmwasm.wasm.v1.StoreCodeAuthorization": + return StoreCodeAuthorization.decode(data.value); + case "/cosmwasm.wasm.v1.ContractExecutionAuthorization": + return ContractExecutionAuthorization.decode(data.value); + case "/cosmwasm.wasm.v1.ContractMigrationAuthorization": + return ContractMigrationAuthorization.decode(data.value); + case "/ibc.applications.transfer.v1.TransferAuthorization": + return TransferAuthorization.decode(data.value); + default: + return data; + } +}; +export const Cosmos_authzv1beta1Authorization_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/GenericAuthorization": + return Any.fromPartial({ + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + value: GenericAuthorization.encode(GenericAuthorization.fromPartial(GenericAuthorization.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/SendAuthorization": + return Any.fromPartial({ + typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", + value: SendAuthorization.encode(SendAuthorization.fromPartial(SendAuthorization.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/StakeAuthorization": + return Any.fromPartial({ + typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", + value: StakeAuthorization.encode(StakeAuthorization.fromPartial(StakeAuthorization.fromAmino(content.value))).finish() + }); + case "wasm/StoreCodeAuthorization": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.StoreCodeAuthorization", + value: StoreCodeAuthorization.encode(StoreCodeAuthorization.fromPartial(StoreCodeAuthorization.fromAmino(content.value))).finish() + }); + case "wasm/ContractExecutionAuthorization": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", + value: ContractExecutionAuthorization.encode(ContractExecutionAuthorization.fromPartial(ContractExecutionAuthorization.fromAmino(content.value))).finish() + }); + case "wasm/ContractMigrationAuthorization": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization", + value: ContractMigrationAuthorization.encode(ContractMigrationAuthorization.fromPartial(ContractMigrationAuthorization.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/TransferAuthorization": + return Any.fromPartial({ + typeUrl: "/ibc.applications.transfer.v1.TransferAuthorization", + value: TransferAuthorization.encode(TransferAuthorization.fromPartial(TransferAuthorization.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_authzv1beta1Authorization_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.authz.v1beta1.GenericAuthorization": + return { + type: "cosmos-sdk/GenericAuthorization", + value: GenericAuthorization.toAmino(GenericAuthorization.decode(content.value, undefined)) + }; + case "/cosmos.bank.v1beta1.SendAuthorization": + return { + type: "cosmos-sdk/SendAuthorization", + value: SendAuthorization.toAmino(SendAuthorization.decode(content.value, undefined)) + }; + case "/cosmos.staking.v1beta1.StakeAuthorization": + return { + type: "cosmos-sdk/StakeAuthorization", + value: StakeAuthorization.toAmino(StakeAuthorization.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.StoreCodeAuthorization": + return { + type: "wasm/StoreCodeAuthorization", + value: StoreCodeAuthorization.toAmino(StoreCodeAuthorization.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.ContractExecutionAuthorization": + return { + type: "wasm/ContractExecutionAuthorization", + value: ContractExecutionAuthorization.toAmino(ContractExecutionAuthorization.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.ContractMigrationAuthorization": + return { + type: "wasm/ContractMigrationAuthorization", + value: ContractMigrationAuthorization.toAmino(ContractMigrationAuthorization.decode(content.value, undefined)) + }; + case "/ibc.applications.transfer.v1.TransferAuthorization": + return { + type: "cosmos-sdk/TransferAuthorization", + value: TransferAuthorization.toAmino(TransferAuthorization.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/authz/v1beta1/event.ts b/util/inj-types/cosmos/authz/v1beta1/event.ts new file mode 100644 index 00000000..36f940f4 --- /dev/null +++ b/util/inj-types/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,254 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** 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; +} +export interface EventGrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.EventGrant"; + value: Uint8Array; +} +/** EventGrant is emitted on Msg/Grant */ +export interface EventGrantAmino { + /** Msg type URL for which an autorization is granted */ + msg_type_url?: string; + /** Granter account address */ + granter?: string; + /** Grantee account address */ + grantee?: string; +} +export interface EventGrantAminoMsg { + type: "cosmos-sdk/EventGrant"; + value: EventGrantAmino; +} +/** EventGrant is emitted on Msg/Grant */ +export interface EventGrantSDKType { + msg_type_url: string; + granter: string; + 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; +} +export interface EventRevokeProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.EventRevoke"; + value: Uint8Array; +} +/** EventRevoke is emitted on Msg/Revoke */ +export interface EventRevokeAmino { + /** Msg type URL for which an autorization is revoked */ + msg_type_url?: string; + /** Granter account address */ + granter?: string; + /** Grantee account address */ + grantee?: string; +} +export interface EventRevokeAminoMsg { + type: "cosmos-sdk/EventRevoke"; + value: EventRevokeAmino; +} +/** EventRevoke is emitted on Msg/Revoke */ +export interface EventRevokeSDKType { + msg_type_url: string; + granter: string; + grantee: string; +} +function createBaseEventGrant(): EventGrant { + return { + msgTypeUrl: "", + granter: "", + grantee: "" + }; +} +export const EventGrant = { + typeUrl: "/cosmos.authz.v1beta1.EventGrant", + aminoType: "cosmos-sdk/EventGrant", + encode(message: EventGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): EventGrant { + const message = createBaseEventGrant(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, + fromAmino(object: EventGrantAmino): EventGrant { + const message = createBaseEventGrant(); + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: EventGrant): EventGrantAmino { + const obj: any = {}; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + return obj; + }, + fromAminoMsg(object: EventGrantAminoMsg): EventGrant { + return EventGrant.fromAmino(object.value); + }, + toAminoMsg(message: EventGrant): EventGrantAminoMsg { + return { + type: "cosmos-sdk/EventGrant", + value: EventGrant.toAmino(message) + }; + }, + fromProtoMsg(message: EventGrantProtoMsg): EventGrant { + return EventGrant.decode(message.value); + }, + toProto(message: EventGrant): Uint8Array { + return EventGrant.encode(message).finish(); + }, + toProtoMsg(message: EventGrant): EventGrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.EventGrant", + value: EventGrant.encode(message).finish() + }; + } +}; +function createBaseEventRevoke(): EventRevoke { + return { + msgTypeUrl: "", + granter: "", + grantee: "" + }; +} +export const EventRevoke = { + typeUrl: "/cosmos.authz.v1beta1.EventRevoke", + aminoType: "cosmos-sdk/EventRevoke", + encode(message: EventRevoke, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): EventRevoke { + const message = createBaseEventRevoke(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, + fromAmino(object: EventRevokeAmino): EventRevoke { + const message = createBaseEventRevoke(); + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: EventRevoke): EventRevokeAmino { + const obj: any = {}; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + return obj; + }, + fromAminoMsg(object: EventRevokeAminoMsg): EventRevoke { + return EventRevoke.fromAmino(object.value); + }, + toAminoMsg(message: EventRevoke): EventRevokeAminoMsg { + return { + type: "cosmos-sdk/EventRevoke", + value: EventRevoke.toAmino(message) + }; + }, + fromProtoMsg(message: EventRevokeProtoMsg): EventRevoke { + return EventRevoke.decode(message.value); + }, + toProto(message: EventRevoke): Uint8Array { + return EventRevoke.encode(message).finish(); + }, + toProtoMsg(message: EventRevoke): EventRevokeProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.EventRevoke", + value: EventRevoke.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/authz/v1beta1/genesis.ts b/util/inj-types/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 00000000..7dc0fd50 --- /dev/null +++ b/util/inj-types/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,95 @@ +import { GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** GenesisState defines the authz module's genesis state. */ +export interface GenesisState { + authorization: GrantAuthorization[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the authz module's genesis state. */ +export interface GenesisStateAmino { + authorization: GrantAuthorizationAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the authz module's genesis state. */ +export interface GenesisStateSDKType { + authorization: GrantAuthorizationSDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + authorization: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmos.authz.v1beta1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.authorization = object.authorization?.map(e => GrantAuthorization.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.authorization = object.authorization?.map(e => GrantAuthorization.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.authorization) { + obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e) : undefined); + } else { + obj.authorization = message.authorization; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/authz/v1beta1/query.lcd.ts b/util/inj-types/cosmos/authz/v1beta1/query.lcd.ts new file mode 100644 index 00000000..e30a1aab --- /dev/null +++ b/util/inj-types/cosmos/authz/v1beta1/query.lcd.ts @@ -0,0 +1,59 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryGrantsRequest, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Returns list of `Authorization`, granted to the grantee by the granter. */ + grants = async (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 */ + granterGrants = async (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 */ + granteeGrants = async (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/util/inj-types/cosmos/authz/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/authz/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..0802d455 --- /dev/null +++ b/util/inj-types/cosmos/authz/v1beta1/query.rpc.Query.ts @@ -0,0 +1,64 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +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; + } + /* Returns list of `Authorization`, granted to the grantee by the granter. */ + grants = async (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 BinaryReader(data))); + }; + /* GranterGrants returns list of `GrantAuthorization`, granted by granter. + + Since: cosmos-sdk 0.46 */ + granterGrants = async (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 BinaryReader(data))); + }; + /* GranteeGrants returns a list of `GrantAuthorization` by grantee. + + Since: cosmos-sdk 0.46 */ + granteeGrants = async (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 BinaryReader(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/util/inj-types/cosmos/authz/v1beta1/query.ts b/util/inj-types/cosmos/authz/v1beta1/query.ts new file mode 100644 index 00000000..a374c61b --- /dev/null +++ b/util/inj-types/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,690 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantAmino, GrantSDKType, GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** 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; +} +export interface QueryGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest"; + value: Uint8Array; +} +/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ +export interface QueryGrantsRequestAmino { + granter?: string; + grantee?: string; + /** Optional, msg_type_url, when set, will query only grants matching given msg type. */ + msg_type_url?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGrantsRequest"; + value: QueryGrantsRequestAmino; +} +/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ +export interface QueryGrantsRequestSDKType { + granter?: string; + grantee?: string; + msg_type_url?: string; + pagination?: PageRequestSDKType; +} +/** 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; +} +export interface QueryGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse"; + value: Uint8Array; +} +/** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */ +export interface QueryGrantsResponseAmino { + /** authorizations is a list of grants granted for grantee by granter. */ + grants?: GrantAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGrantsResponse"; + value: QueryGrantsResponseAmino; +} +/** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */ +export interface QueryGrantsResponseSDKType { + grants: GrantSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGranterGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest"; + value: Uint8Array; +} +/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsRequestAmino { + granter?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGranterGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGranterGrantsRequest"; + value: QueryGranterGrantsRequestAmino; +} +/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsRequestSDKType { + granter: string; + pagination?: PageRequestSDKType; +} +/** 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; +} +export interface QueryGranterGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse"; + value: Uint8Array; +} +/** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsResponseAmino { + /** grants is a list of grants granted by the granter. */ + grants?: GrantAuthorizationAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGranterGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGranterGrantsResponse"; + value: QueryGranterGrantsResponseAmino; +} +/** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsResponseSDKType { + grants: GrantAuthorizationSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGranteeGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest"; + value: Uint8Array; +} +/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +export interface QueryGranteeGrantsRequestAmino { + grantee?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGranteeGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGranteeGrantsRequest"; + value: QueryGranteeGrantsRequestAmino; +} +/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +export interface QueryGranteeGrantsRequestSDKType { + grantee: string; + pagination?: PageRequestSDKType; +} +/** 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; +} +export interface QueryGranteeGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse"; + value: Uint8Array; +} +/** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsResponseAmino { + /** grants is a list of grants granted to the grantee. */ + grants?: GrantAuthorizationAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGranteeGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGranteeGrantsResponse"; + value: QueryGranteeGrantsResponseAmino; +} +/** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsResponseSDKType { + grants: GrantAuthorizationSDKType[]; + pagination?: PageResponseSDKType; +} +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { + granter: "", + grantee: "", + msgTypeUrl: "", + pagination: undefined + }; +} +export const QueryGrantsRequest = { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", + aminoType: "cosmos-sdk/QueryGrantsRequest", + encode(message: QueryGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QueryGrantsRequestAmino): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGrantsRequestAminoMsg): QueryGrantsRequest { + return QueryGrantsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGrantsRequest): QueryGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGrantsRequest", + value: QueryGrantsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGrantsRequestProtoMsg): QueryGrantsRequest { + return QueryGrantsRequest.decode(message.value); + }, + toProto(message: QueryGrantsRequest): Uint8Array { + return QueryGrantsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGrantsRequest): QueryGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", + value: QueryGrantsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGrantsResponse(): QueryGrantsResponse { + return { + grants: [], + pagination: undefined + }; +} +export const QueryGrantsResponse = { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", + aminoType: "cosmos-sdk/QueryGrantsResponse", + encode(message: QueryGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QueryGrantsResponseAmino): QueryGrantsResponse { + const message = createBaseQueryGrantsResponse(); + message.grants = object.grants?.map(e => Grant.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGrantsResponse): QueryGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? Grant.toAmino(e) : undefined); + } else { + obj.grants = message.grants; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGrantsResponseAminoMsg): QueryGrantsResponse { + return QueryGrantsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGrantsResponse): QueryGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGrantsResponse", + value: QueryGrantsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGrantsResponseProtoMsg): QueryGrantsResponse { + return QueryGrantsResponse.decode(message.value); + }, + toProto(message: QueryGrantsResponse): Uint8Array { + return QueryGrantsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGrantsResponse): QueryGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", + value: QueryGrantsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { + return { + granter: "", + pagination: undefined + }; +} +export const QueryGranterGrantsRequest = { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", + aminoType: "cosmos-sdk/QueryGranterGrantsRequest", + encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryGranterGrantsRequest { + const message = createBaseQueryGranterGrantsRequest(); + message.granter = object.granter ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGranterGrantsRequestAmino): QueryGranterGrantsRequest { + const message = createBaseQueryGranterGrantsRequest(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGranterGrantsRequestAminoMsg): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGranterGrantsRequest", + value: QueryGranterGrantsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGranterGrantsRequestProtoMsg): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.decode(message.value); + }, + toProto(message: QueryGranterGrantsRequest): Uint8Array { + return QueryGranterGrantsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", + value: QueryGranterGrantsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { + return { + grants: [], + pagination: undefined + }; +} +export const QueryGranterGrantsResponse = { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", + aminoType: "cosmos-sdk/QueryGranterGrantsResponse", + encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QueryGranterGrantsResponseAmino): QueryGranterGrantsResponse { + const message = createBaseQueryGranterGrantsResponse(); + message.grants = object.grants?.map(e => GrantAuthorization.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGranterGrantsResponse): QueryGranterGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); + } else { + obj.grants = message.grants; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGranterGrantsResponseAminoMsg): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGranterGrantsResponse): QueryGranterGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGranterGrantsResponse", + value: QueryGranterGrantsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGranterGrantsResponseProtoMsg): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.decode(message.value); + }, + toProto(message: QueryGranterGrantsResponse): Uint8Array { + return QueryGranterGrantsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGranterGrantsResponse): QueryGranterGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", + value: QueryGranterGrantsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { + return { + grantee: "", + pagination: undefined + }; +} +export const QueryGranteeGrantsRequest = { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", + aminoType: "cosmos-sdk/QueryGranteeGrantsRequest", + encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryGranteeGrantsRequest { + const message = createBaseQueryGranteeGrantsRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGranteeGrantsRequestAmino): QueryGranteeGrantsRequest { + const message = createBaseQueryGranteeGrantsRequest(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { + const obj: any = {}; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGranteeGrantsRequestAminoMsg): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGranteeGrantsRequest", + value: QueryGranteeGrantsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGranteeGrantsRequestProtoMsg): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.decode(message.value); + }, + toProto(message: QueryGranteeGrantsRequest): Uint8Array { + return QueryGranteeGrantsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", + value: QueryGranteeGrantsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { + return { + grants: [], + pagination: undefined + }; +} +export const QueryGranteeGrantsResponse = { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", + aminoType: "cosmos-sdk/QueryGranteeGrantsResponse", + encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QueryGranteeGrantsResponseAmino): QueryGranteeGrantsResponse { + const message = createBaseQueryGranteeGrantsResponse(); + message.grants = object.grants?.map(e => GrantAuthorization.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGranteeGrantsResponse): QueryGranteeGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); + } else { + obj.grants = message.grants; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGranteeGrantsResponseAminoMsg): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGranteeGrantsResponse): QueryGranteeGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGranteeGrantsResponse", + value: QueryGranteeGrantsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGranteeGrantsResponseProtoMsg): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.decode(message.value); + }, + toProto(message: QueryGranteeGrantsResponse): Uint8Array { + return QueryGranteeGrantsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGranteeGrantsResponse): QueryGranteeGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", + value: QueryGranteeGrantsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/authz/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/authz/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..dcdcc524 --- /dev/null +++ b/util/inj-types/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,62 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgGrant, MsgGrantResponse, MsgExec, MsgExecResponse, MsgRevoke, MsgRevokeResponse, MsgExecCompat, MsgExecCompatResponse } 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; + /** ExecCompat has same functionality as Exec but accepts array of json-encoded message string instead of []*Any */ + execCompat(request: MsgExecCompat): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* 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 = async (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 BinaryReader(data))); + }; + /* 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 = async (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 BinaryReader(data))); + }; + /* Revoke revokes any authorization corresponding to the provided method name on the + granter's account that has been granted to the grantee. */ + revoke = async (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 BinaryReader(data))); + }; + /* ExecCompat has same functionality as Exec but accepts array of json-encoded message string instead of []*Any */ + execCompat = async (request: MsgExecCompat): Promise => { + const data = MsgExecCompat.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "ExecCompat", data); + return promise.then(data => MsgExecCompatResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/authz/v1beta1/tx.ts b/util/inj-types/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..df39b6d2 --- /dev/null +++ b/util/inj-types/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,855 @@ +import { Grant, GrantAmino, GrantSDKType } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** + * 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; +} +export interface MsgGrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface MsgGrantAmino { + granter?: string; + grantee?: string; + grant: GrantAmino; +} +export interface MsgGrantAminoMsg { + type: "cosmos-sdk/MsgGrant"; + value: MsgGrantAmino; +} +/** + * 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; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse"; + value: Uint8Array; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponseAmino { + results?: string[]; +} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} +/** 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; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: (Any)[] | Any[]; +} +export interface MsgExecProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExec"; + value: Uint8Array; +} +export type MsgExecEncoded = Omit & { + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: (AnyProtoMsg)[]; +}; +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExecAmino { + grantee?: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs?: AnyAmino[]; +} +export interface MsgExecAminoMsg { + type: "cosmos-sdk/MsgExec"; + value: MsgExecAmino; +} +/** + * 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; + msgs: (AnySDKType)[]; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse {} +export interface MsgGrantResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponseAmino {} +export interface MsgGrantResponseAminoMsg { + type: "cosmos-sdk/MsgGrantResponse"; + value: MsgGrantResponseAmino; +} +/** 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; +} +export interface MsgRevokeProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke"; + value: Uint8Array; +} +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevokeAmino { + granter?: string; + grantee?: string; + msg_type_url?: string; +} +export interface MsgRevokeAminoMsg { + type: "cosmos-sdk/MsgRevoke"; + value: MsgRevokeAmino; +} +/** + * 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 {} +export interface MsgRevokeResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse"; + value: Uint8Array; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponseAmino {} +export interface MsgRevokeResponseAminoMsg { + type: "cosmos-sdk/MsgRevokeResponse"; + value: MsgRevokeResponseAmino; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponseSDKType {} +/** MsgExecCompatResponse defines the Msg/MsgExecCompatResponse response type. */ +export interface MsgExecCompatResponse { + results: Uint8Array[]; +} +export interface MsgExecCompatResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExecCompatResponse"; + value: Uint8Array; +} +/** MsgExecCompatResponse defines the Msg/MsgExecCompatResponse response type. */ +export interface MsgExecCompatResponseAmino { + results?: string[]; +} +export interface MsgExecCompatResponseAminoMsg { + type: "cosmos-sdk/MsgExecCompatResponse"; + value: MsgExecCompatResponseAmino; +} +/** MsgExecCompatResponse defines the Msg/MsgExecCompatResponse response type. */ +export interface MsgExecCompatResponseSDKType { + results: Uint8Array[]; +} +/** + * MsgExecCompat supports legacy amino codec for frontend metamask signing + * Functions are same as MsgExec, but input for msgs is array of strings + */ +export interface MsgExecCompat { + grantee: string; + msgs: string[]; +} +export interface MsgExecCompatProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExecCompat"; + value: Uint8Array; +} +/** + * MsgExecCompat supports legacy amino codec for frontend metamask signing + * Functions are same as MsgExec, but input for msgs is array of strings + */ +export interface MsgExecCompatAmino { + grantee?: string; + msgs?: string[]; +} +export interface MsgExecCompatAminoMsg { + type: "cosmos-sdk/MsgExec"; + value: MsgExecCompatAmino; +} +/** + * MsgExecCompat supports legacy amino codec for frontend metamask signing + * Functions are same as MsgExec, but input for msgs is array of strings + */ +export interface MsgExecCompatSDKType { + grantee: string; + msgs: string[]; +} +function createBaseMsgGrant(): MsgGrant { + return { + granter: "", + grantee: "", + grant: Grant.fromPartial({}) + }; +} +export const MsgGrant = { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + aminoType: "cosmos-sdk/MsgGrant", + encode(message: MsgGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: MsgGrantAmino): MsgGrant { + const message = createBaseMsgGrant(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = Grant.fromAmino(object.grant); + } + return message; + }, + toAmino(message: MsgGrant): MsgGrantAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.grant = message.grant ? Grant.toAmino(message.grant) : Grant.toAmino(Grant.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgGrantAminoMsg): MsgGrant { + return MsgGrant.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrant): MsgGrantAminoMsg { + return { + type: "cosmos-sdk/MsgGrant", + value: MsgGrant.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantProtoMsg): MsgGrant { + return MsgGrant.decode(message.value); + }, + toProto(message: MsgGrant): Uint8Array { + return MsgGrant.encode(message).finish(); + }, + toProtoMsg(message: MsgGrant): MsgGrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.encode(message).finish() + }; + } +}; +function createBaseMsgExecResponse(): MsgExecResponse { + return { + results: [] + }; +} +export const MsgExecResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + aminoType: "cosmos-sdk/MsgExecResponse", + encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgExecResponseAmino): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MsgExecResponse): MsgExecResponseAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => base64FromBytes(e)); + } else { + obj.results = message.results; + } + return obj; + }, + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); + }, + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish() + }; + } +}; +function createBaseMsgExec(): MsgExec { + return { + grantee: "", + msgs: [] + }; +} +export const MsgExec = { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + aminoType: "cosmos-sdk/MsgExec", + encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode((v! as Any), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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()) as Any)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgExecAmino): MsgExec { + const message = createBaseMsgExec(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + message.msgs = object.msgs?.map(e => Cosmos_basev1beta1Msg_FromAmino(e)) || []; + return message; + }, + toAmino(message: MsgExec): MsgExecAmino { + const obj: any = {}; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + if (message.msgs) { + obj.msgs = message.msgs.map(e => e ? Cosmos_basev1beta1Msg_ToAmino((e as Any)) : undefined); + } else { + obj.msgs = message.msgs; + } + return obj; + }, + fromAminoMsg(object: MsgExecAminoMsg): MsgExec { + return MsgExec.fromAmino(object.value); + }, + toAminoMsg(message: MsgExec): MsgExecAminoMsg { + return { + type: "cosmos-sdk/MsgExec", + value: MsgExec.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecProtoMsg): MsgExec { + return MsgExec.decode(message.value); + }, + toProto(message: MsgExec): Uint8Array { + return MsgExec.encode(message).finish(); + }, + toProtoMsg(message: MsgExec): MsgExecProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.encode(message).finish() + }; + } +}; +function createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} +export const MsgGrantResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + aminoType: "cosmos-sdk/MsgGrantResponse", + encode(_: MsgGrantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, + fromAmino(_: MsgGrantResponseAmino): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, + toAmino(_: MsgGrantResponse): MsgGrantResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGrantResponseAminoMsg): MsgGrantResponse { + return MsgGrantResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantResponse): MsgGrantResponseAminoMsg { + return { + type: "cosmos-sdk/MsgGrantResponse", + value: MsgGrantResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantResponseProtoMsg): MsgGrantResponse { + return MsgGrantResponse.decode(message.value); + }, + toProto(message: MsgGrantResponse): Uint8Array { + return MsgGrantResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantResponse): MsgGrantResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + value: MsgGrantResponse.encode(message).finish() + }; + } +}; +function createBaseMsgRevoke(): MsgRevoke { + return { + granter: "", + grantee: "", + msgTypeUrl: "" + }; +} +export const MsgRevoke = { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + aminoType: "cosmos-sdk/MsgRevoke", + encode(message: MsgRevoke, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, + fromAmino(object: MsgRevokeAmino): MsgRevoke { + const message = createBaseMsgRevoke(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + return message; + }, + toAmino(message: MsgRevoke): MsgRevokeAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; + return obj; + }, + fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { + return MsgRevoke.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevoke): MsgRevokeAminoMsg { + return { + type: "cosmos-sdk/MsgRevoke", + value: MsgRevoke.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeProtoMsg): MsgRevoke { + return MsgRevoke.decode(message.value); + }, + toProto(message: MsgRevoke): Uint8Array { + return MsgRevoke.encode(message).finish(); + }, + toProtoMsg(message: MsgRevoke): MsgRevokeProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.encode(message).finish() + }; + } +}; +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} +export const MsgRevokeResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + aminoType: "cosmos-sdk/MsgRevokeResponse", + encode(_: MsgRevokeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, + fromAmino(_: MsgRevokeResponseAmino): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, + toAmino(_: MsgRevokeResponse): MsgRevokeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRevokeResponseAminoMsg): MsgRevokeResponse { + return MsgRevokeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeResponse): MsgRevokeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeResponse", + value: MsgRevokeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeResponseProtoMsg): MsgRevokeResponse { + return MsgRevokeResponse.decode(message.value); + }, + toProto(message: MsgRevokeResponse): Uint8Array { + return MsgRevokeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeResponse): MsgRevokeResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + value: MsgRevokeResponse.encode(message).finish() + }; + } +}; +function createBaseMsgExecCompatResponse(): MsgExecCompatResponse { + return { + results: [] + }; +} +export const MsgExecCompatResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgExecCompatResponse", + aminoType: "cosmos-sdk/MsgExecCompatResponse", + encode(message: MsgExecCompatResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecCompatResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecCompatResponse(); + 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: DeepPartial): MsgExecCompatResponse { + const message = createBaseMsgExecCompatResponse(); + message.results = object.results?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgExecCompatResponseAmino): MsgExecCompatResponse { + const message = createBaseMsgExecCompatResponse(); + message.results = object.results?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MsgExecCompatResponse): MsgExecCompatResponseAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => base64FromBytes(e)); + } else { + obj.results = message.results; + } + return obj; + }, + fromAminoMsg(object: MsgExecCompatResponseAminoMsg): MsgExecCompatResponse { + return MsgExecCompatResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecCompatResponse): MsgExecCompatResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecCompatResponse", + value: MsgExecCompatResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecCompatResponseProtoMsg): MsgExecCompatResponse { + return MsgExecCompatResponse.decode(message.value); + }, + toProto(message: MsgExecCompatResponse): Uint8Array { + return MsgExecCompatResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecCompatResponse): MsgExecCompatResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExecCompatResponse", + value: MsgExecCompatResponse.encode(message).finish() + }; + } +}; +function createBaseMsgExecCompat(): MsgExecCompat { + return { + grantee: "", + msgs: [] + }; +} +export const MsgExecCompat = { + typeUrl: "/cosmos.authz.v1beta1.MsgExecCompat", + aminoType: "cosmos-sdk/MsgExec", + encode(message: MsgExecCompat, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecCompat { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecCompat(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.msgs.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecCompat { + const message = createBaseMsgExecCompat(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgExecCompatAmino): MsgExecCompat { + const message = createBaseMsgExecCompat(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + message.msgs = object.msgs?.map(e => e) || []; + return message; + }, + toAmino(message: MsgExecCompat): MsgExecCompatAmino { + const obj: any = {}; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + if (message.msgs) { + obj.msgs = message.msgs.map(e => e); + } else { + obj.msgs = message.msgs; + } + return obj; + }, + fromAminoMsg(object: MsgExecCompatAminoMsg): MsgExecCompat { + return MsgExecCompat.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecCompat): MsgExecCompatAminoMsg { + return { + type: "cosmos-sdk/MsgExec", + value: MsgExecCompat.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecCompatProtoMsg): MsgExecCompat { + return MsgExecCompat.decode(message.value); + }, + toProto(message: MsgExecCompat): Uint8Array { + return MsgExecCompat.encode(message).finish(); + }, + toProtoMsg(message: MsgExecCompat): MsgExecCompatProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExecCompat", + value: MsgExecCompat.encode(message).finish() + }; + } +}; +export const Cosmos_basev1beta1Msg_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + default: + return data; + } +}; +export const Cosmos_basev1beta1Msg_FromAmino = (content: AnyAmino): Any => { + return Any.fromAmino(content); +}; +export const Cosmos_basev1beta1Msg_ToAmino = (content: Any) => { + return Any.toAmino(content); +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/module/v1/module.ts b/util/inj-types/cosmos/bank/module/v1/module.ts new file mode 100644 index 00000000..c0771a6e --- /dev/null +++ b/util/inj-types/cosmos/bank/module/v1/module.ts @@ -0,0 +1,121 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the bank module. */ +export interface Module { + /** + * blocked_module_accounts configures exceptional module accounts which should be blocked from receiving funds. + * If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blockedModuleAccountsOverride: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.bank.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the bank module. */ +export interface ModuleAmino { + /** + * blocked_module_accounts configures exceptional module accounts which should be blocked from receiving funds. + * If left empty it defaults to the list of account names supplied in the auth module configuration as + * module_account_permissions + */ + blocked_module_accounts_override?: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the bank module. */ +export interface ModuleSDKType { + blocked_module_accounts_override: string[]; + authority: string; +} +function createBaseModule(): Module { + return { + blockedModuleAccountsOverride: [], + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.bank.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.blockedModuleAccountsOverride) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockedModuleAccountsOverride.push(reader.string()); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blockedModuleAccountsOverride?.map(e => e) || []; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + message.blockedModuleAccountsOverride = object.blocked_module_accounts_override?.map(e => e) || []; + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + if (message.blockedModuleAccountsOverride) { + obj.blocked_module_accounts_override = message.blockedModuleAccountsOverride.map(e => e); + } else { + obj.blocked_module_accounts_override = message.blockedModuleAccountsOverride; + } + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.bank.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/authz.ts b/util/inj-types/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 00000000..56195b77 --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,142 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * SendAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account. + * + * Since: cosmos-sdk 0.43 + */ +export interface SendAuthorization { + $typeUrl?: "/cosmos.bank.v1beta1.SendAuthorization"; + spendLimit: Coin[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + * + * Since: cosmos-sdk 0.47 + */ + allowList: string[]; +} +export interface SendAuthorizationProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.SendAuthorization"; + value: Uint8Array; +} +/** + * SendAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account. + * + * Since: cosmos-sdk 0.43 + */ +export interface SendAuthorizationAmino { + spend_limit: CoinAmino[]; + /** + * allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the + * granter. If omitted, any recipient is allowed. + * + * Since: cosmos-sdk 0.47 + */ + allow_list?: string[]; +} +export interface SendAuthorizationAminoMsg { + type: "cosmos-sdk/SendAuthorization"; + value: SendAuthorizationAmino; +} +/** + * SendAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account. + * + * Since: cosmos-sdk 0.43 + */ +export interface SendAuthorizationSDKType { + $typeUrl?: "/cosmos.bank.v1beta1.SendAuthorization"; + spend_limit: CoinSDKType[]; + allow_list: string[]; +} +function createBaseSendAuthorization(): SendAuthorization { + return { + $typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", + spendLimit: [], + allowList: [] + }; +} +export const SendAuthorization = { + typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", + aminoType: "cosmos-sdk/SendAuthorization", + encode(message: SendAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.allowList) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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; + case 2: + message.allowList.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map(e => e) || []; + return message; + }, + fromAmino(object: SendAuthorizationAmino): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spendLimit = object.spend_limit?.map(e => Coin.fromAmino(e)) || []; + message.allowList = object.allow_list?.map(e => e) || []; + return message; + }, + toAmino(message: SendAuthorization): SendAuthorizationAmino { + const obj: any = {}; + if (message.spendLimit) { + obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.spend_limit = message.spendLimit; + } + if (message.allowList) { + obj.allow_list = message.allowList.map(e => e); + } else { + obj.allow_list = message.allowList; + } + return obj; + }, + fromAminoMsg(object: SendAuthorizationAminoMsg): SendAuthorization { + return SendAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: SendAuthorization): SendAuthorizationAminoMsg { + return { + type: "cosmos-sdk/SendAuthorization", + value: SendAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: SendAuthorizationProtoMsg): SendAuthorization { + return SendAuthorization.decode(message.value); + }, + toProto(message: SendAuthorization): Uint8Array { + return SendAuthorization.encode(message).finish(); + }, + toProtoMsg(message: SendAuthorization): SendAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.SendAuthorization", + value: SendAuthorization.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/bank.ts b/util/inj-types/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..fe50fa8e --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,976 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** Params defines the parameters for the bank module. */ +export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + */ + /** @deprecated */ + sendEnabled: SendEnabled[]; + defaultSendEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the bank module. */ +export interface ParamsAmino { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + */ + /** @deprecated */ + send_enabled?: SendEnabledAmino[]; + default_send_enabled?: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/bank/Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the bank module. */ +export interface ParamsSDKType { + /** @deprecated */ + 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; +} +export interface SendEnabledProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled"; + value: Uint8Array; +} +/** + * SendEnabled maps coin denom to a send_enabled status (whether a denom is + * sendable). + */ +export interface SendEnabledAmino { + denom?: string; + enabled?: boolean; +} +export interface SendEnabledAminoMsg { + type: "cosmos-sdk/SendEnabled"; + value: SendEnabledAmino; +} +/** + * 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[]; +} +export interface InputProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Input"; + value: Uint8Array; +} +/** Input models transaction input. */ +export interface InputAmino { + address?: string; + coins: CoinAmino[]; +} +export interface InputAminoMsg { + type: "cosmos-sdk/Input"; + value: InputAmino; +} +/** Input models transaction input. */ +export interface InputSDKType { + address: string; + coins: CoinSDKType[]; +} +/** Output models transaction outputs. */ +export interface Output { + address: string; + coins: Coin[]; +} +export interface OutputProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Output"; + value: Uint8Array; +} +/** Output models transaction outputs. */ +export interface OutputAmino { + address?: string; + coins: CoinAmino[]; +} +export interface OutputAminoMsg { + type: "cosmos-sdk/Output"; + value: OutputAmino; +} +/** 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 { + $typeUrl?: "/cosmos.bank.v1beta1.Supply"; + total: Coin[]; +} +export interface SupplyProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Supply"; + value: Uint8Array; +} +/** + * 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 SupplyAmino { + total: CoinAmino[]; +} +export interface SupplyAminoMsg { + type: "cosmos-sdk/Supply"; + value: SupplyAmino; +} +/** + * 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 { + $typeUrl?: "/cosmos.bank.v1beta1.Supply"; + 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[]; +} +export interface DenomUnitProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit"; + value: Uint8Array; +} +/** + * DenomUnit represents a struct that describes a given + * denomination unit of the basic token. + */ +export interface DenomUnitAmino { + /** 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[]; +} +export interface DenomUnitAminoMsg { + type: "cosmos-sdk/DenomUnit"; + value: DenomUnitAmino; +} +/** + * DenomUnit represents a struct that describes a given + * denomination unit of the basic token. + */ +export interface DenomUnitSDKType { + denom: string; + exponent: number; + 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; +} +export interface MetadataProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Metadata"; + value: Uint8Array; +} +/** + * Metadata represents a struct that describes + * a basic token. + */ +export interface MetadataAmino { + description?: string; + /** denom_units represents the list of DenomUnit's for a given coin */ + denom_units?: DenomUnitAmino[]; + /** 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; +} +export interface MetadataAminoMsg { + type: "cosmos-sdk/Metadata"; + value: MetadataAmino; +} +/** + * Metadata represents a struct that describes + * a basic token. + */ +export interface MetadataSDKType { + description: string; + denom_units: DenomUnitSDKType[]; + base: string; + display: string; + name: string; + symbol: string; + uri: string; + uri_hash: string; +} +function createBaseParams(): Params { + return { + sendEnabled: [], + defaultSendEnabled: false + }; +} +export const Params = { + typeUrl: "/cosmos.bank.v1beta1.Params", + aminoType: "cosmos-sdk/x/bank/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + if (object.default_send_enabled !== undefined && object.default_send_enabled !== null) { + message.defaultSendEnabled = object.default_send_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + obj.default_send_enabled = message.defaultSendEnabled === false ? undefined : message.defaultSendEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/bank/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; +function createBaseSendEnabled(): SendEnabled { + return { + denom: "", + enabled: false + }; +} +export const SendEnabled = { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled", + aminoType: "cosmos-sdk/SendEnabled", + encode(message: SendEnabled, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled === true) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): SendEnabled { + const message = createBaseSendEnabled(); + message.denom = object.denom ?? ""; + message.enabled = object.enabled ?? false; + return message; + }, + fromAmino(object: SendEnabledAmino): SendEnabled { + const message = createBaseSendEnabled(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.enabled !== undefined && object.enabled !== null) { + message.enabled = object.enabled; + } + return message; + }, + toAmino(message: SendEnabled): SendEnabledAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; + return obj; + }, + fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { + return SendEnabled.fromAmino(object.value); + }, + toAminoMsg(message: SendEnabled): SendEnabledAminoMsg { + return { + type: "cosmos-sdk/SendEnabled", + value: SendEnabled.toAmino(message) + }; + }, + fromProtoMsg(message: SendEnabledProtoMsg): SendEnabled { + return SendEnabled.decode(message.value); + }, + toProto(message: SendEnabled): Uint8Array { + return SendEnabled.encode(message).finish(); + }, + toProtoMsg(message: SendEnabled): SendEnabledProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled", + value: SendEnabled.encode(message).finish() + }; + } +}; +function createBaseInput(): Input { + return { + address: "", + coins: [] + }; +} +export const Input = { + typeUrl: "/cosmos.bank.v1beta1.Input", + aminoType: "cosmos-sdk/Input", + encode(message: Input, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): Input { + const message = createBaseInput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: InputAmino): Input { + const message = createBaseInput(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.coins = object.coins?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Input): InputAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + if (message.coins) { + obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.coins = message.coins; + } + return obj; + }, + fromAminoMsg(object: InputAminoMsg): Input { + return Input.fromAmino(object.value); + }, + toAminoMsg(message: Input): InputAminoMsg { + return { + type: "cosmos-sdk/Input", + value: Input.toAmino(message) + }; + }, + fromProtoMsg(message: InputProtoMsg): Input { + return Input.decode(message.value); + }, + toProto(message: Input): Uint8Array { + return Input.encode(message).finish(); + }, + toProtoMsg(message: Input): InputProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Input", + value: Input.encode(message).finish() + }; + } +}; +function createBaseOutput(): Output { + return { + address: "", + coins: [] + }; +} +export const Output = { + typeUrl: "/cosmos.bank.v1beta1.Output", + aminoType: "cosmos-sdk/Output", + encode(message: Output, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): Output { + const message = createBaseOutput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: OutputAmino): Output { + const message = createBaseOutput(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.coins = object.coins?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Output): OutputAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + if (message.coins) { + obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.coins = message.coins; + } + return obj; + }, + fromAminoMsg(object: OutputAminoMsg): Output { + return Output.fromAmino(object.value); + }, + toAminoMsg(message: Output): OutputAminoMsg { + return { + type: "cosmos-sdk/Output", + value: Output.toAmino(message) + }; + }, + fromProtoMsg(message: OutputProtoMsg): Output { + return Output.decode(message.value); + }, + toProto(message: Output): Uint8Array { + return Output.encode(message).finish(); + }, + toProtoMsg(message: Output): OutputProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Output", + value: Output.encode(message).finish() + }; + } +}; +function createBaseSupply(): Supply { + return { + $typeUrl: "/cosmos.bank.v1beta1.Supply", + total: [] + }; +} +export const Supply = { + typeUrl: "/cosmos.bank.v1beta1.Supply", + aminoType: "cosmos-sdk/Supply", + encode(message: Supply, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): Supply { + const message = createBaseSupply(); + message.total = object.total?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SupplyAmino): Supply { + const message = createBaseSupply(); + message.total = object.total?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Supply): SupplyAmino { + const obj: any = {}; + if (message.total) { + obj.total = message.total.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total = message.total; + } + return obj; + }, + fromAminoMsg(object: SupplyAminoMsg): Supply { + return Supply.fromAmino(object.value); + }, + toAminoMsg(message: Supply): SupplyAminoMsg { + return { + type: "cosmos-sdk/Supply", + value: Supply.toAmino(message) + }; + }, + fromProtoMsg(message: SupplyProtoMsg): Supply { + return Supply.decode(message.value); + }, + toProto(message: Supply): Uint8Array { + return Supply.encode(message).finish(); + }, + toProtoMsg(message: Supply): SupplyProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Supply", + value: Supply.encode(message).finish() + }; + } +}; +function createBaseDenomUnit(): DenomUnit { + return { + denom: "", + exponent: 0, + aliases: [] + }; +} +export const DenomUnit = { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit", + aminoType: "cosmos-sdk/DenomUnit", + encode(message: DenomUnit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): DenomUnit { + const message = createBaseDenomUnit(); + message.denom = object.denom ?? ""; + message.exponent = object.exponent ?? 0; + message.aliases = object.aliases?.map(e => e) || []; + return message; + }, + fromAmino(object: DenomUnitAmino): DenomUnit { + const message = createBaseDenomUnit(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + message.aliases = object.aliases?.map(e => e) || []; + return message; + }, + toAmino(message: DenomUnit): DenomUnitAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.exponent = message.exponent === 0 ? undefined : message.exponent; + if (message.aliases) { + obj.aliases = message.aliases.map(e => e); + } else { + obj.aliases = message.aliases; + } + return obj; + }, + fromAminoMsg(object: DenomUnitAminoMsg): DenomUnit { + return DenomUnit.fromAmino(object.value); + }, + toAminoMsg(message: DenomUnit): DenomUnitAminoMsg { + return { + type: "cosmos-sdk/DenomUnit", + value: DenomUnit.toAmino(message) + }; + }, + fromProtoMsg(message: DenomUnitProtoMsg): DenomUnit { + return DenomUnit.decode(message.value); + }, + toProto(message: DenomUnit): Uint8Array { + return DenomUnit.encode(message).finish(); + }, + toProtoMsg(message: DenomUnit): DenomUnitProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit", + value: DenomUnit.encode(message).finish() + }; + } +}; +function createBaseMetadata(): Metadata { + return { + description: "", + denomUnits: [], + base: "", + display: "", + name: "", + symbol: "", + uri: "", + uriHash: "" + }; +} +export const Metadata = { + typeUrl: "/cosmos.bank.v1beta1.Metadata", + aminoType: "cosmos-sdk/Metadata", + encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: MetadataAmino): Metadata { + const message = createBaseMetadata(); + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.denomUnits = object.denom_units?.map(e => DenomUnit.fromAmino(e)) || []; + if (object.base !== undefined && object.base !== null) { + message.base = object.base; + } + if (object.display !== undefined && object.display !== null) { + message.display = object.display; + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.symbol !== undefined && object.symbol !== null) { + message.symbol = object.symbol; + } + if (object.uri !== undefined && object.uri !== null) { + message.uri = object.uri; + } + if (object.uri_hash !== undefined && object.uri_hash !== null) { + message.uriHash = object.uri_hash; + } + return message; + }, + toAmino(message: Metadata): MetadataAmino { + const obj: any = {}; + obj.description = message.description === "" ? undefined : message.description; + if (message.denomUnits) { + obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); + } else { + obj.denom_units = message.denomUnits; + } + obj.base = message.base === "" ? undefined : message.base; + obj.display = message.display === "" ? undefined : message.display; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; + return obj; + }, + fromAminoMsg(object: MetadataAminoMsg): Metadata { + return Metadata.fromAmino(object.value); + }, + toAminoMsg(message: Metadata): MetadataAminoMsg { + return { + type: "cosmos-sdk/Metadata", + value: Metadata.toAmino(message) + }; + }, + fromProtoMsg(message: MetadataProtoMsg): Metadata { + return Metadata.decode(message.value); + }, + toProto(message: Metadata): Uint8Array { + return Metadata.encode(message).finish(); + }, + toProtoMsg(message: Metadata): MetadataProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Metadata", + value: Metadata.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/events.ts b/util/inj-types/cosmos/bank/v1beta1/events.ts new file mode 100644 index 00000000..55e29831 --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/events.ts @@ -0,0 +1,216 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** EventSetBalance is an event that tracks the latest bank balance. */ +export interface EventSetBalances { + balanceUpdates: BalanceUpdate[]; +} +export interface EventSetBalancesProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.EventSetBalances"; + value: Uint8Array; +} +/** EventSetBalance is an event that tracks the latest bank balance. */ +export interface EventSetBalancesAmino { + balance_updates?: BalanceUpdateAmino[]; +} +export interface EventSetBalancesAminoMsg { + type: "cosmos-sdk/EventSetBalances"; + value: EventSetBalancesAmino; +} +/** EventSetBalance is an event that tracks the latest bank balance. */ +export interface EventSetBalancesSDKType { + balance_updates: BalanceUpdateSDKType[]; +} +/** BalanceUpdate contains a given address's latest balance */ +export interface BalanceUpdate { + addr: Uint8Array; + denom: Uint8Array; + /** the latest amount */ + amt: string; +} +export interface BalanceUpdateProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.BalanceUpdate"; + value: Uint8Array; +} +/** BalanceUpdate contains a given address's latest balance */ +export interface BalanceUpdateAmino { + addr?: string; + denom?: string; + /** the latest amount */ + amt: string; +} +export interface BalanceUpdateAminoMsg { + type: "cosmos-sdk/BalanceUpdate"; + value: BalanceUpdateAmino; +} +/** BalanceUpdate contains a given address's latest balance */ +export interface BalanceUpdateSDKType { + addr: Uint8Array; + denom: Uint8Array; + amt: string; +} +function createBaseEventSetBalances(): EventSetBalances { + return { + balanceUpdates: [] + }; +} +export const EventSetBalances = { + typeUrl: "/cosmos.bank.v1beta1.EventSetBalances", + aminoType: "cosmos-sdk/EventSetBalances", + encode(message: EventSetBalances, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.balanceUpdates) { + BalanceUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventSetBalances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSetBalances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balanceUpdates.push(BalanceUpdate.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventSetBalances { + const message = createBaseEventSetBalances(); + message.balanceUpdates = object.balanceUpdates?.map(e => BalanceUpdate.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EventSetBalancesAmino): EventSetBalances { + const message = createBaseEventSetBalances(); + message.balanceUpdates = object.balance_updates?.map(e => BalanceUpdate.fromAmino(e)) || []; + return message; + }, + toAmino(message: EventSetBalances): EventSetBalancesAmino { + const obj: any = {}; + if (message.balanceUpdates) { + obj.balance_updates = message.balanceUpdates.map(e => e ? BalanceUpdate.toAmino(e) : undefined); + } else { + obj.balance_updates = message.balanceUpdates; + } + return obj; + }, + fromAminoMsg(object: EventSetBalancesAminoMsg): EventSetBalances { + return EventSetBalances.fromAmino(object.value); + }, + toAminoMsg(message: EventSetBalances): EventSetBalancesAminoMsg { + return { + type: "cosmos-sdk/EventSetBalances", + value: EventSetBalances.toAmino(message) + }; + }, + fromProtoMsg(message: EventSetBalancesProtoMsg): EventSetBalances { + return EventSetBalances.decode(message.value); + }, + toProto(message: EventSetBalances): Uint8Array { + return EventSetBalances.encode(message).finish(); + }, + toProtoMsg(message: EventSetBalances): EventSetBalancesProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.EventSetBalances", + value: EventSetBalances.encode(message).finish() + }; + } +}; +function createBaseBalanceUpdate(): BalanceUpdate { + return { + addr: new Uint8Array(), + denom: new Uint8Array(), + amt: "" + }; +} +export const BalanceUpdate = { + typeUrl: "/cosmos.bank.v1beta1.BalanceUpdate", + aminoType: "cosmos-sdk/BalanceUpdate", + encode(message: BalanceUpdate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addr.length !== 0) { + writer.uint32(10).bytes(message.addr); + } + if (message.denom.length !== 0) { + writer.uint32(18).bytes(message.denom); + } + if (message.amt !== "") { + writer.uint32(26).string(message.amt); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BalanceUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBalanceUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addr = reader.bytes(); + break; + case 2: + message.denom = reader.bytes(); + break; + case 3: + message.amt = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BalanceUpdate { + const message = createBaseBalanceUpdate(); + message.addr = object.addr ?? new Uint8Array(); + message.denom = object.denom ?? new Uint8Array(); + message.amt = object.amt ?? ""; + return message; + }, + fromAmino(object: BalanceUpdateAmino): BalanceUpdate { + const message = createBaseBalanceUpdate(); + if (object.addr !== undefined && object.addr !== null) { + message.addr = bytesFromBase64(object.addr); + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = bytesFromBase64(object.denom); + } + if (object.amt !== undefined && object.amt !== null) { + message.amt = object.amt; + } + return message; + }, + toAmino(message: BalanceUpdate): BalanceUpdateAmino { + const obj: any = {}; + obj.addr = message.addr ? base64FromBytes(message.addr) : undefined; + obj.denom = message.denom ? base64FromBytes(message.denom) : undefined; + obj.amt = message.amt ?? ""; + return obj; + }, + fromAminoMsg(object: BalanceUpdateAminoMsg): BalanceUpdate { + return BalanceUpdate.fromAmino(object.value); + }, + toAminoMsg(message: BalanceUpdate): BalanceUpdateAminoMsg { + return { + type: "cosmos-sdk/BalanceUpdate", + value: BalanceUpdate.toAmino(message) + }; + }, + fromProtoMsg(message: BalanceUpdateProtoMsg): BalanceUpdate { + return BalanceUpdate.decode(message.value); + }, + toProto(message: BalanceUpdate): Uint8Array { + return BalanceUpdate.encode(message).finish(); + }, + toProtoMsg(message: BalanceUpdate): BalanceUpdateProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.BalanceUpdate", + value: BalanceUpdate.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/genesis.ts b/util/inj-types/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 00000000..187855a9 --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,306 @@ +import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType, SendEnabled, SendEnabledAmino, SendEnabledSDKType } from "./bank"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params; + /** balances is an array containing the balances of all the accounts. */ + balances: Balance[]; + /** + * supply represents the total supply. If it is left empty, then supply will be calculated based on the provided + * balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. + */ + supply: Coin[]; + /** denom_metadata defines the metadata of the different coins. */ + denomMetadata: Metadata[]; + /** + * send_enabled defines the denoms where send is enabled or disabled. + * + * Since: cosmos-sdk 0.47 + */ + sendEnabled: SendEnabled[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisStateAmino { + /** params defines all the parameters of the module. */ + params: ParamsAmino; + /** balances is an array containing the balances of all the accounts. */ + balances: BalanceAmino[]; + /** + * 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: CoinAmino[]; + /** denom_metadata defines the metadata of the different coins. */ + denom_metadata: MetadataAmino[]; + /** + * send_enabled defines the denoms where send is enabled or disabled. + * + * Since: cosmos-sdk 0.47 + */ + send_enabled: SendEnabledAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the bank module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + balances: BalanceSDKType[]; + supply: CoinSDKType[]; + denom_metadata: MetadataSDKType[]; + send_enabled: SendEnabledSDKType[]; +} +/** + * 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[]; +} +export interface BalanceProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Balance"; + value: Uint8Array; +} +/** + * Balance defines an account address and balance pair used in the bank module's + * genesis state. + */ +export interface BalanceAmino { + /** address is the address of the balance holder. */ + address?: string; + /** coins defines the different coins this balance holds. */ + coins: CoinAmino[]; +} +export interface BalanceAminoMsg { + type: "cosmos-sdk/Balance"; + value: BalanceAmino; +} +/** + * Balance defines an account address and balance pair used in the bank module's + * genesis state. + */ +export interface BalanceSDKType { + address: string; + coins: CoinSDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + params: Params.fromPartial({}), + balances: [], + supply: [], + denomMetadata: [], + sendEnabled: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmos.bank.v1beta1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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; + case 5: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): 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)) || []; + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.balances = object.balances?.map(e => Balance.fromAmino(e)) || []; + message.supply = object.supply?.map(e => Coin.fromAmino(e)) || []; + message.denomMetadata = object.denom_metadata?.map(e => Metadata.fromAmino(e)) || []; + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + if (message.balances) { + obj.balances = message.balances.map(e => e ? Balance.toAmino(e) : undefined); + } else { + obj.balances = message.balances; + } + if (message.supply) { + obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.supply = message.supply; + } + if (message.denomMetadata) { + obj.denom_metadata = message.denomMetadata.map(e => e ? Metadata.toAmino(e) : undefined); + } else { + obj.denom_metadata = message.denomMetadata; + } + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; +function createBaseBalance(): Balance { + return { + address: "", + coins: [] + }; +} +export const Balance = { + typeUrl: "/cosmos.bank.v1beta1.Balance", + aminoType: "cosmos-sdk/Balance", + encode(message: Balance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): Balance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): Balance { + const message = createBaseBalance(); + message.address = object.address ?? ""; + message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: BalanceAmino): Balance { + const message = createBaseBalance(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.coins = object.coins?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Balance): BalanceAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + if (message.coins) { + obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.coins = message.coins; + } + return obj; + }, + fromAminoMsg(object: BalanceAminoMsg): Balance { + return Balance.fromAmino(object.value); + }, + toAminoMsg(message: Balance): BalanceAminoMsg { + return { + type: "cosmos-sdk/Balance", + value: Balance.toAmino(message) + }; + }, + fromProtoMsg(message: BalanceProtoMsg): Balance { + return Balance.decode(message.value); + }, + toProto(message: Balance): Uint8Array { + return Balance.encode(message).finish(); + }, + toProtoMsg(message: Balance): BalanceProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Balance", + value: Balance.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/query.lcd.ts b/util/inj-types/cosmos/bank/v1beta1/query.lcd.ts new file mode 100644 index 00000000..5d3b3fbf --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/query.lcd.ts @@ -0,0 +1,163 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryBalanceRequest, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesResponseSDKType, QuerySpendableBalanceByDenomRequest, QuerySpendableBalanceByDenomResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersResponseSDKType, QuerySendEnabledRequest, QuerySendEnabledResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Balance queries the balance of a single coin for a single account. */ + balance = async (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. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + allBalances = async (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 spendable balance of all coins for a single + account. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. + + Since: cosmos-sdk 0.46 */ + spendableBalances = async (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); + }; + /* SpendableBalanceByDenom queries the spendable balance of a single denom for + a single account. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. + + Since: cosmos-sdk 0.47 */ + spendableBalanceByDenom = async (params: QuerySpendableBalanceByDenomRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `cosmos/bank/v1beta1/spendable_balances/${params.address}/by_denom`; + return await this.req.get(endpoint, options); + }; + /* TotalSupply queries the total supply of all coins. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + totalSupply = async (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. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + supplyOf = async (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. */ + params = async (_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. */ + denomMetadata = async (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. */ + denomsMetadata = async (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. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. + + Since: cosmos-sdk 0.46 */ + denomOwners = async (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); + }; + /* SendEnabled queries for SendEnabled entries. + + This query only returns denominations that have specific SendEnabled settings. + Any denomination that does not have a specific setting will use the default + params.default_send_enabled, and will not be returned by this query. + + Since: cosmos-sdk 0.47 */ + sendEnabled = async (params: QuerySendEnabledRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.denoms !== "undefined") { + options.params.denoms = params.denoms; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/bank/v1beta1/send_enabled`; + return await this.req.get(endpoint, options); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/bank/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..c21712b1 --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/query.rpc.Query.ts @@ -0,0 +1,228 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QuerySpendableBalanceByDenomRequest, QuerySpendableBalanceByDenomResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse, QuerySendEnabledRequest, QuerySendEnabledResponse } 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + allBalances(request: QueryAllBalancesRequest): Promise; + /** + * SpendableBalances queries the spendable balance of all coins for a single + * account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + spendableBalances(request: QuerySpendableBalancesRequest): Promise; + /** + * SpendableBalanceByDenom queries the spendable balance of a single denom for + * a single account. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.47 + */ + spendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise; + /** + * TotalSupply queries the total supply of all coins. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + totalSupply(request?: QueryTotalSupplyRequest): Promise; + /** + * SupplyOf queries the supply of a single coin. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + 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. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + * + * Since: cosmos-sdk 0.46 + */ + denomOwners(request: QueryDenomOwnersRequest): Promise; + /** + * SendEnabled queries for SendEnabled entries. + * + * This query only returns denominations that have specific SendEnabled settings. + * Any denomination that does not have a specific setting will use the default + * params.default_send_enabled, and will not be returned by this query. + * + * Since: cosmos-sdk 0.47 + */ + sendEnabled(request: QuerySendEnabledRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Balance queries the balance of a single coin for a single account. */ + balance = async (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 BinaryReader(data))); + }; + /* AllBalances queries the balance of all coins for a single account. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + allBalances = async (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 BinaryReader(data))); + }; + /* SpendableBalances queries the spendable balance of all coins for a single + account. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. + + Since: cosmos-sdk 0.46 */ + spendableBalances = async (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 BinaryReader(data))); + }; + /* SpendableBalanceByDenom queries the spendable balance of a single denom for + a single account. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. + + Since: cosmos-sdk 0.47 */ + spendableBalanceByDenom = async (request: QuerySpendableBalanceByDenomRequest): Promise => { + const data = QuerySpendableBalanceByDenomRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SpendableBalanceByDenom", data); + return promise.then(data => QuerySpendableBalanceByDenomResponse.decode(new BinaryReader(data))); + }; + /* TotalSupply queries the total supply of all coins. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + totalSupply = async (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 BinaryReader(data))); + }; + /* SupplyOf queries the supply of a single coin. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + supplyOf = async (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 BinaryReader(data))); + }; + /* Params queries the parameters of x/bank module. */ + params = async (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 BinaryReader(data))); + }; + /* DenomsMetadata queries the client metadata of a given coin denomination. */ + denomMetadata = async (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 BinaryReader(data))); + }; + /* DenomsMetadata queries the client metadata for all registered coin + denominations. */ + denomsMetadata = async (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 BinaryReader(data))); + }; + /* DenomOwners queries for all account addresses that own a particular token + denomination. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. + + Since: cosmos-sdk 0.46 */ + denomOwners = async (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 BinaryReader(data))); + }; + /* SendEnabled queries for SendEnabled entries. + + This query only returns denominations that have specific SendEnabled settings. + Any denomination that does not have a specific setting will use the default + params.default_send_enabled, and will not be returned by this query. + + Since: cosmos-sdk 0.47 */ + sendEnabled = async (request: QuerySendEnabledRequest): Promise => { + const data = QuerySendEnabledRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SendEnabled", data); + return promise.then(data => QuerySendEnabledResponse.decode(new BinaryReader(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); + }, + spendableBalanceByDenom(request: QuerySpendableBalanceByDenomRequest): Promise { + return queryService.spendableBalanceByDenom(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); + }, + sendEnabled(request: QuerySendEnabledRequest): Promise { + return queryService.sendEnabled(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/query.ts b/util/inj-types/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..0d7ed1e1 --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,2528 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType, SendEnabled, SendEnabledAmino, SendEnabledSDKType } from "./bank"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** 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; +} +export interface QueryBalanceRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest"; + value: Uint8Array; +} +/** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ +export interface QueryBalanceRequestAmino { + /** address is the address to query balances for. */ + address?: string; + /** denom is the coin denom to query balances for. */ + denom?: string; +} +export interface QueryBalanceRequestAminoMsg { + type: "cosmos-sdk/QueryBalanceRequest"; + value: QueryBalanceRequestAmino; +} +/** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ +export interface QueryBalanceRequestSDKType { + address: string; + 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; +} +export interface QueryBalanceResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse"; + value: Uint8Array; +} +/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ +export interface QueryBalanceResponseAmino { + /** balance is the balance of the coin. */ + balance?: CoinAmino; +} +export interface QueryBalanceResponseAminoMsg { + type: "cosmos-sdk/QueryBalanceResponse"; + value: QueryBalanceResponseAmino; +} +/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ +export interface QueryBalanceResponseSDKType { + balance?: CoinSDKType; +} +/** 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; +} +export interface QueryAllBalancesRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest"; + value: Uint8Array; +} +/** QueryBalanceRequest is the request type for the Query/AllBalances RPC method. */ +export interface QueryAllBalancesRequestAmino { + /** address is the address to query balances for. */ + address?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAllBalancesRequestAminoMsg { + type: "cosmos-sdk/QueryAllBalancesRequest"; + value: QueryAllBalancesRequestAmino; +} +/** QueryBalanceRequest is the request type for the Query/AllBalances RPC method. */ +export interface QueryAllBalancesRequestSDKType { + address: string; + pagination?: PageRequestSDKType; +} +/** + * 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; +} +export interface QueryAllBalancesResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse"; + value: Uint8Array; +} +/** + * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC + * method. + */ +export interface QueryAllBalancesResponseAmino { + /** balances is the balances of all the coins. */ + balances: CoinAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryAllBalancesResponseAminoMsg { + type: "cosmos-sdk/QueryAllBalancesResponse"; + value: QueryAllBalancesResponseAmino; +} +/** + * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC + * method. + */ +export interface QueryAllBalancesResponseSDKType { + balances: CoinSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QuerySpendableBalancesRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest"; + value: Uint8Array; +} +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequestAmino { + /** address is the address to query spendable balances for. */ + address?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QuerySpendableBalancesRequestAminoMsg { + type: "cosmos-sdk/QuerySpendableBalancesRequest"; + value: QuerySpendableBalancesRequestAmino; +} +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequestSDKType { + address: string; + pagination?: PageRequestSDKType; +} +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QuerySpendableBalancesResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse"; + value: Uint8Array; +} +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponseAmino { + /** balances is the spendable balances of all the coins. */ + balances: CoinAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QuerySpendableBalancesResponseAminoMsg { + type: "cosmos-sdk/QuerySpendableBalancesResponse"; + value: QuerySpendableBalancesResponseAmino; +} +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponseSDKType { + balances: CoinSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom?: string; +} +export interface QuerySpendableBalanceByDenomRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest"; + value: Uint8Array; +} +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequestAmino { + /** address is the address to query balances for. */ + address?: string; + /** denom is the coin denom to query balances for. */ + denom?: string; +} +export interface QuerySpendableBalanceByDenomRequestAminoMsg { + type: "cosmos-sdk/QuerySpendableBalanceByDenomRequest"; + value: QuerySpendableBalanceByDenomRequestAmino; +} +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequestSDKType { + address: string; + denom?: string; +} +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponse { + /** balance is the balance of the coin. */ + balance?: Coin; +} +export interface QuerySpendableBalanceByDenomResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse"; + value: Uint8Array; +} +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponseAmino { + /** balance is the balance of the coin. */ + balance?: CoinAmino; +} +export interface QuerySpendableBalanceByDenomResponseAminoMsg { + type: "cosmos-sdk/QuerySpendableBalanceByDenomResponse"; + value: QuerySpendableBalanceByDenomResponseAmino; +} +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponseSDKType { + balance?: CoinSDKType; +} +/** + * 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; +} +export interface QueryTotalSupplyRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest"; + value: Uint8Array; +} +/** + * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC + * method. + */ +export interface QueryTotalSupplyRequestAmino { + /** + * pagination defines an optional pagination for the request. + * + * Since: cosmos-sdk 0.43 + */ + pagination?: PageRequestAmino; +} +export interface QueryTotalSupplyRequestAminoMsg { + type: "cosmos-sdk/QueryTotalSupplyRequest"; + value: QueryTotalSupplyRequestAmino; +} +/** + * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC + * method. + */ +export interface QueryTotalSupplyRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * 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; +} +export interface QueryTotalSupplyResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse"; + value: Uint8Array; +} +/** + * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC + * method + */ +export interface QueryTotalSupplyResponseAmino { + /** supply is the supply of the coins */ + supply: CoinAmino[]; + /** + * pagination defines the pagination in the response. + * + * Since: cosmos-sdk 0.43 + */ + pagination?: PageResponseAmino; +} +export interface QueryTotalSupplyResponseAminoMsg { + type: "cosmos-sdk/QueryTotalSupplyResponse"; + value: QueryTotalSupplyResponseAmino; +} +/** + * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC + * method + */ +export interface QueryTotalSupplyResponseSDKType { + supply: CoinSDKType[]; + pagination?: PageResponseSDKType; +} +/** 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; +} +export interface QuerySupplyOfRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest"; + value: Uint8Array; +} +/** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfRequestAmino { + /** denom is the coin denom to query balances for. */ + denom?: string; +} +export interface QuerySupplyOfRequestAminoMsg { + type: "cosmos-sdk/QuerySupplyOfRequest"; + value: QuerySupplyOfRequestAmino; +} +/** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfRequestSDKType { + 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; +} +export interface QuerySupplyOfResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse"; + value: Uint8Array; +} +/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfResponseAmino { + /** amount is the supply of the coin. */ + amount: CoinAmino; +} +export interface QuerySupplyOfResponseAminoMsg { + type: "cosmos-sdk/QuerySupplyOfResponse"; + value: QuerySupplyOfResponseAmino; +} +/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfResponseSDKType { + amount: CoinSDKType; +} +/** QueryParamsRequest defines the request type for querying x/bank parameters. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest defines the request type for querying x/bank parameters. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** 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; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse defines the response type for querying x/bank parameters. */ +export interface QueryParamsResponseAmino { + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse defines the response type for querying x/bank parameters. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDenomsMetadataRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest"; + value: Uint8Array; +} +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomsMetadataRequestAminoMsg { + type: "cosmos-sdk/QueryDenomsMetadataRequest"; + value: QueryDenomsMetadataRequestAmino; +} +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * 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; +} +export interface QueryDenomsMetadataResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse"; + value: Uint8Array; +} +/** + * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC + * method. + */ +export interface QueryDenomsMetadataResponseAmino { + /** metadata provides the client information for all the registered tokens. */ + metadatas: MetadataAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDenomsMetadataResponseAminoMsg { + type: "cosmos-sdk/QueryDenomsMetadataResponse"; + value: QueryDenomsMetadataResponseAmino; +} +/** + * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC + * method. + */ +export interface QueryDenomsMetadataResponseSDKType { + metadatas: MetadataSDKType[]; + pagination?: PageResponseSDKType; +} +/** 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; +} +export interface QueryDenomMetadataRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest"; + value: Uint8Array; +} +/** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */ +export interface QueryDenomMetadataRequestAmino { + /** denom is the coin denom to query the metadata for. */ + denom?: string; +} +export interface QueryDenomMetadataRequestAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataRequest"; + value: QueryDenomMetadataRequestAmino; +} +/** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */ +export interface QueryDenomMetadataRequestSDKType { + 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; +} +export interface QueryDenomMetadataResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse"; + value: Uint8Array; +} +/** + * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC + * method. + */ +export interface QueryDenomMetadataResponseAmino { + /** metadata describes and provides all the client information for the requested token. */ + metadata: MetadataAmino; +} +export interface QueryDenomMetadataResponseAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataResponse"; + value: QueryDenomMetadataResponseAmino; +} +/** + * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC + * method. + */ +export interface QueryDenomMetadataResponseSDKType { + metadata: MetadataSDKType; +} +/** + * 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; +} +export interface QueryDenomOwnersRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest"; + value: Uint8Array; +} +/** + * 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 QueryDenomOwnersRequestAmino { + /** denom defines the coin denomination to query all account holders for. */ + denom?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomOwnersRequestAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersRequest"; + value: QueryDenomOwnersRequestAmino; +} +/** + * 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: string; + pagination?: PageRequestSDKType; +} +/** + * 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. + * + * Since: cosmos-sdk 0.46 + */ +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; +} +export interface DenomOwnerProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner"; + value: Uint8Array; +} +/** + * 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. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwnerAmino { + /** address defines the address that owns a particular denomination. */ + address?: string; + /** balance is the balance of the denominated coin for an account. */ + balance: CoinAmino; +} +export interface DenomOwnerAminoMsg { + type: "cosmos-sdk/DenomOwner"; + value: DenomOwnerAmino; +} +/** + * 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. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwnerSDKType { + address: string; + balance: CoinSDKType; +} +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDenomOwnersResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse"; + value: Uint8Array; +} +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponseAmino { + denom_owners?: DenomOwnerAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDenomOwnersResponseAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersResponse"; + value: QueryDenomOwnersResponseAmino; +} +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponseSDKType { + denom_owners: DenomOwnerSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequest { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms?: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination?: PageRequest; +} +export interface QuerySendEnabledRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest"; + value: Uint8Array; +} +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequestAmino { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms?: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination?: PageRequestAmino; +} +export interface QuerySendEnabledRequestAminoMsg { + type: "cosmos-sdk/QuerySendEnabledRequest"; + value: QuerySendEnabledRequestAmino; +} +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequestSDKType { + denoms?: string[]; + pagination?: PageRequestSDKType; +} +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponse { + sendEnabled: SendEnabled[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination?: PageResponse; +} +export interface QuerySendEnabledResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse"; + value: Uint8Array; +} +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponseAmino { + send_enabled?: SendEnabledAmino[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination?: PageResponseAmino; +} +export interface QuerySendEnabledResponseAminoMsg { + type: "cosmos-sdk/QuerySendEnabledResponse"; + value: QuerySendEnabledResponseAmino; +} +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponseSDKType { + send_enabled: SendEnabledSDKType[]; + pagination?: PageResponseSDKType; +} +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { + address: "", + denom: "" + }; +} +export const QueryBalanceRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", + aminoType: "cosmos-sdk/QueryBalanceRequest", + encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryBalanceRequestAmino): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { + return QueryBalanceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryBalanceRequest): QueryBalanceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryBalanceRequest", + value: QueryBalanceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBalanceRequestProtoMsg): QueryBalanceRequest { + return QueryBalanceRequest.decode(message.value); + }, + toProto(message: QueryBalanceRequest): Uint8Array { + return QueryBalanceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryBalanceRequest): QueryBalanceRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", + value: QueryBalanceRequest.encode(message).finish() + }; + } +}; +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { + balance: undefined + }; +} +export const QueryBalanceResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", + aminoType: "cosmos-sdk/QueryBalanceResponse", + encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, + fromAmino(object: QueryBalanceResponseAmino): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { + const obj: any = {}; + obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + return obj; + }, + fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { + return QueryBalanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryBalanceResponse): QueryBalanceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryBalanceResponse", + value: QueryBalanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBalanceResponseProtoMsg): QueryBalanceResponse { + return QueryBalanceResponse.decode(message.value); + }, + toProto(message: QueryBalanceResponse): Uint8Array { + return QueryBalanceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryBalanceResponse): QueryBalanceResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", + value: QueryBalanceResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { + return { + address: "", + pagination: undefined + }; +} +export const QueryAllBalancesRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", + aminoType: "cosmos-sdk/QueryAllBalancesRequest", + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryAllBalancesRequest { + const message = createBaseQueryAllBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllBalancesRequestAmino): QueryAllBalancesRequest { + const message = createBaseQueryAllBalancesRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllBalancesRequestAminoMsg): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllBalancesRequest): QueryAllBalancesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllBalancesRequest", + value: QueryAllBalancesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllBalancesRequestProtoMsg): QueryAllBalancesRequest { + return QueryAllBalancesRequest.decode(message.value); + }, + toProto(message: QueryAllBalancesRequest): Uint8Array { + return QueryAllBalancesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllBalancesRequest): QueryAllBalancesRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", + value: QueryAllBalancesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { + balances: [], + pagination: undefined + }; +} +export const QueryAllBalancesResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", + aminoType: "cosmos-sdk/QueryAllBalancesResponse", + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QueryAllBalancesResponseAmino): QueryAllBalancesResponse { + const message = createBaseQueryAllBalancesResponse(); + message.balances = object.balances?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllBalancesResponse): QueryAllBalancesResponseAmino { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.balances = message.balances; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllBalancesResponseAminoMsg): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllBalancesResponse): QueryAllBalancesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllBalancesResponse", + value: QueryAllBalancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllBalancesResponseProtoMsg): QueryAllBalancesResponse { + return QueryAllBalancesResponse.decode(message.value); + }, + toProto(message: QueryAllBalancesResponse): Uint8Array { + return QueryAllBalancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllBalancesResponse): QueryAllBalancesResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", + value: QueryAllBalancesResponse.encode(message).finish() + }; + } +}; +function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest { + return { + address: "", + pagination: undefined + }; +} +export const QuerySpendableBalancesRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", + aminoType: "cosmos-sdk/QuerySpendableBalancesRequest", + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QuerySpendableBalancesRequest { + const message = createBaseQuerySpendableBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySpendableBalancesRequestAmino): QuerySpendableBalancesRequest { + const message = createBaseQuerySpendableBalancesRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalancesRequestAminoMsg): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalancesRequest", + value: QuerySpendableBalancesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalancesRequestProtoMsg): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.decode(message.value); + }, + toProto(message: QuerySpendableBalancesRequest): Uint8Array { + return QuerySpendableBalancesRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", + value: QuerySpendableBalancesRequest.encode(message).finish() + }; + } +}; +function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse { + return { + balances: [], + pagination: undefined + }; +} +export const QuerySpendableBalancesResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", + aminoType: "cosmos-sdk/QuerySpendableBalancesResponse", + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QuerySpendableBalancesResponseAmino): QuerySpendableBalancesResponse { + const message = createBaseQuerySpendableBalancesResponse(); + message.balances = object.balances?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseAmino { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.balances = message.balances; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalancesResponseAminoMsg): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalancesResponse", + value: QuerySpendableBalancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalancesResponseProtoMsg): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.decode(message.value); + }, + toProto(message: QuerySpendableBalancesResponse): Uint8Array { + return QuerySpendableBalancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", + value: QuerySpendableBalancesResponse.encode(message).finish() + }; + } +}; +function createBaseQuerySpendableBalanceByDenomRequest(): QuerySpendableBalanceByDenomRequest { + return { + address: "", + denom: "" + }; +} +export const QuerySpendableBalanceByDenomRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", + aminoType: "cosmos-sdk/QuerySpendableBalanceByDenomRequest", + encode(message: QuerySpendableBalanceByDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomRequest(); + 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: DeepPartial): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QuerySpendableBalanceByDenomRequestAmino): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalanceByDenomRequestAminoMsg): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalanceByDenomRequest", + value: QuerySpendableBalanceByDenomRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalanceByDenomRequestProtoMsg): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.decode(message.value); + }, + toProto(message: QuerySpendableBalanceByDenomRequest): Uint8Array { + return QuerySpendableBalanceByDenomRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", + value: QuerySpendableBalanceByDenomRequest.encode(message).finish() + }; + } +}; +function createBaseQuerySpendableBalanceByDenomResponse(): QuerySpendableBalanceByDenomResponse { + return { + balance: undefined + }; +} +export const QuerySpendableBalanceByDenomResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", + aminoType: "cosmos-sdk/QuerySpendableBalanceByDenomResponse", + encode(message: QuerySpendableBalanceByDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomResponse(); + 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: DeepPartial): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, + fromAmino(object: QuerySpendableBalanceByDenomResponseAmino): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseAmino { + const obj: any = {}; + obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalanceByDenomResponseAminoMsg): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalanceByDenomResponse", + value: QuerySpendableBalanceByDenomResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalanceByDenomResponseProtoMsg): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.decode(message.value); + }, + toProto(message: QuerySpendableBalanceByDenomResponse): Uint8Array { + return QuerySpendableBalanceByDenomResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", + value: QuerySpendableBalanceByDenomResponse.encode(message).finish() + }; + } +}; +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { + pagination: undefined + }; +} +export const QueryTotalSupplyRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", + aminoType: "cosmos-sdk/QueryTotalSupplyRequest", + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryTotalSupplyRequestAmino): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalSupplyRequestAminoMsg): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTotalSupplyRequest", + value: QueryTotalSupplyRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalSupplyRequestProtoMsg): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.decode(message.value); + }, + toProto(message: QueryTotalSupplyRequest): Uint8Array { + return QueryTotalSupplyRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", + value: QueryTotalSupplyRequest.encode(message).finish() + }; + } +}; +function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { + return { + supply: [], + pagination: undefined + }; +} +export const QueryTotalSupplyResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", + aminoType: "cosmos-sdk/QueryTotalSupplyResponse", + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QueryTotalSupplyResponseAmino): QueryTotalSupplyResponse { + const message = createBaseQueryTotalSupplyResponse(); + message.supply = object.supply?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAmino { + const obj: any = {}; + if (message.supply) { + obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.supply = message.supply; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalSupplyResponseAminoMsg): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTotalSupplyResponse", + value: QueryTotalSupplyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalSupplyResponseProtoMsg): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.decode(message.value); + }, + toProto(message: QueryTotalSupplyResponse): Uint8Array { + return QueryTotalSupplyResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", + value: QueryTotalSupplyResponse.encode(message).finish() + }; + } +}; +function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { + return { + denom: "" + }; +} +export const QuerySupplyOfRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", + aminoType: "cosmos-sdk/QuerySupplyOfRequest", + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QuerySupplyOfRequestAmino): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySupplyOfRequest): QuerySupplyOfRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySupplyOfRequest", + value: QuerySupplyOfRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySupplyOfRequestProtoMsg): QuerySupplyOfRequest { + return QuerySupplyOfRequest.decode(message.value); + }, + toProto(message: QuerySupplyOfRequest): Uint8Array { + return QuerySupplyOfRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySupplyOfRequest): QuerySupplyOfRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", + value: QuerySupplyOfRequest.encode(message).finish() + }; + } +}; +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { + amount: Coin.fromPartial({}) + }; +} +export const QuerySupplyOfResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", + aminoType: "cosmos-sdk/QuerySupplyOfResponse", + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QuerySupplyOfResponse { + const message = createBaseQuerySupplyOfResponse(); + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: QuerySupplyOfResponseAmino): QuerySupplyOfResponse { + const message = createBaseQuerySupplyOfResponse(); + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: QuerySupplyOfResponse): QuerySupplyOfResponseAmino { + const obj: any = {}; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QuerySupplyOfResponseAminoMsg): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySupplyOfResponse): QuerySupplyOfResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySupplyOfResponse", + value: QuerySupplyOfResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySupplyOfResponseProtoMsg): QuerySupplyOfResponse { + return QuerySupplyOfResponse.decode(message.value); + }, + toProto(message: QuerySupplyOfResponse): Uint8Array { + return QuerySupplyOfResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySupplyOfResponse): QuerySupplyOfResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", + value: QuerySupplyOfResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { + pagination: undefined + }; +} +export const QueryDenomsMetadataRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", + aminoType: "cosmos-sdk/QueryDenomsMetadataRequest", + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryDenomsMetadataRequest { + const message = createBaseQueryDenomsMetadataRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomsMetadataRequestAmino): QueryDenomsMetadataRequest { + const message = createBaseQueryDenomsMetadataRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomsMetadataRequestAminoMsg): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomsMetadataRequest", + value: QueryDenomsMetadataRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomsMetadataRequestProtoMsg): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.decode(message.value); + }, + toProto(message: QueryDenomsMetadataRequest): Uint8Array { + return QueryDenomsMetadataRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", + value: QueryDenomsMetadataRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { + return { + metadatas: [], + pagination: undefined + }; +} +export const QueryDenomsMetadataResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", + aminoType: "cosmos-sdk/QueryDenomsMetadataResponse", + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QueryDenomsMetadataResponseAmino): QueryDenomsMetadataResponse { + const message = createBaseQueryDenomsMetadataResponse(); + message.metadatas = object.metadatas?.map(e => Metadata.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseAmino { + const obj: any = {}; + if (message.metadatas) { + obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e) : undefined); + } else { + obj.metadatas = message.metadatas; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomsMetadataResponseAminoMsg): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomsMetadataResponse", + value: QueryDenomsMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomsMetadataResponseProtoMsg): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.decode(message.value); + }, + toProto(message: QueryDenomsMetadataResponse): Uint8Array { + return QueryDenomsMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", + value: QueryDenomsMetadataResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { + return { + denom: "" + }; +} +export const QueryDenomMetadataRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", + aminoType: "cosmos-sdk/QueryDenomMetadataRequest", + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryDenomMetadataRequestAmino): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataRequest", + value: QueryDenomMetadataRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataRequestProtoMsg): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.decode(message.value); + }, + toProto(message: QueryDenomMetadataRequest): Uint8Array { + return QueryDenomMetadataRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", + value: QueryDenomMetadataRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { + metadata: Metadata.fromPartial({}) + }; +} +export const QueryDenomMetadataResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", + aminoType: "cosmos-sdk/QueryDenomMetadataResponse", + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, + fromAmino(object: QueryDenomMetadataResponseAmino): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Metadata.fromAmino(object.metadata); + } + return message; + }, + toAmino(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseAmino { + const obj: any = {}; + obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : Metadata.toAmino(Metadata.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataResponseAminoMsg): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataResponse", + value: QueryDenomMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataResponseProtoMsg): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.decode(message.value); + }, + toProto(message: QueryDenomMetadataResponse): Uint8Array { + return QueryDenomMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", + value: QueryDenomMetadataResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { + return { + denom: "", + pagination: undefined + }; +} +export const QueryDenomOwnersRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", + aminoType: "cosmos-sdk/QueryDenomOwnersRequest", + encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryDenomOwnersRequest { + const message = createBaseQueryDenomOwnersRequest(); + message.denom = object.denom ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomOwnersRequestAmino): QueryDenomOwnersRequest { + const message = createBaseQueryDenomOwnersRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersRequestAminoMsg): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersRequest", + value: QueryDenomOwnersRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersRequestProtoMsg): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.decode(message.value); + }, + toProto(message: QueryDenomOwnersRequest): Uint8Array { + return QueryDenomOwnersRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", + value: QueryDenomOwnersRequest.encode(message).finish() + }; + } +}; +function createBaseDenomOwner(): DenomOwner { + return { + address: "", + balance: Coin.fromPartial({}) + }; +} +export const DenomOwner = { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner", + aminoType: "cosmos-sdk/DenomOwner", + encode(message: DenomOwner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): DenomOwner { + const message = createBaseDenomOwner(); + message.address = object.address ?? ""; + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, + fromAmino(object: DenomOwnerAmino): DenomOwner { + const message = createBaseDenomOwner(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: DenomOwner): DenomOwnerAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: DenomOwnerAminoMsg): DenomOwner { + return DenomOwner.fromAmino(object.value); + }, + toAminoMsg(message: DenomOwner): DenomOwnerAminoMsg { + return { + type: "cosmos-sdk/DenomOwner", + value: DenomOwner.toAmino(message) + }; + }, + fromProtoMsg(message: DenomOwnerProtoMsg): DenomOwner { + return DenomOwner.decode(message.value); + }, + toProto(message: DenomOwner): Uint8Array { + return DenomOwner.encode(message).finish(); + }, + toProtoMsg(message: DenomOwner): DenomOwnerProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner", + value: DenomOwner.encode(message).finish() + }; + } +}; +function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { + return { + denomOwners: [], + pagination: undefined + }; +} +export const QueryDenomOwnersResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", + aminoType: "cosmos-sdk/QueryDenomOwnersResponse", + encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: QueryDenomOwnersResponseAmino): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denom_owners?.map(e => DenomOwner.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseAmino { + const obj: any = {}; + if (message.denomOwners) { + obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); + } else { + obj.denom_owners = message.denomOwners; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersResponseAminoMsg): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersResponse", + value: QueryDenomOwnersResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersResponseProtoMsg): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.decode(message.value); + }, + toProto(message: QueryDenomOwnersResponse): Uint8Array { + return QueryDenomOwnersResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", + value: QueryDenomOwnersResponse.encode(message).finish() + }; + } +}; +function createBaseQuerySendEnabledRequest(): QuerySendEnabledRequest { + return { + denoms: [], + pagination: undefined + }; +} +export const QuerySendEnabledRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest", + aminoType: "cosmos-sdk/QuerySendEnabledRequest", + encode(message: QuerySendEnabledRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(794).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denoms.push(reader.string()); + break; + case 99: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySendEnabledRequestAmino): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySendEnabledRequest): QuerySendEnabledRequestAmino { + const obj: any = {}; + if (message.denoms) { + obj.denoms = message.denoms.map(e => e); + } else { + obj.denoms = message.denoms; + } + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySendEnabledRequestAminoMsg): QuerySendEnabledRequest { + return QuerySendEnabledRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySendEnabledRequest): QuerySendEnabledRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySendEnabledRequest", + value: QuerySendEnabledRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySendEnabledRequestProtoMsg): QuerySendEnabledRequest { + return QuerySendEnabledRequest.decode(message.value); + }, + toProto(message: QuerySendEnabledRequest): Uint8Array { + return QuerySendEnabledRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySendEnabledRequest): QuerySendEnabledRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest", + value: QuerySendEnabledRequest.encode(message).finish() + }; + } +}; +function createBaseQuerySendEnabledResponse(): QuerySendEnabledResponse { + return { + sendEnabled: [], + pagination: undefined + }; +} +export const QuerySendEnabledResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse", + aminoType: "cosmos-sdk/QuerySendEnabledResponse", + encode(message: QuerySendEnabledResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(794).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 99: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySendEnabledResponseAmino): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySendEnabledResponse): QuerySendEnabledResponseAmino { + const obj: any = {}; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySendEnabledResponseAminoMsg): QuerySendEnabledResponse { + return QuerySendEnabledResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySendEnabledResponse): QuerySendEnabledResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySendEnabledResponse", + value: QuerySendEnabledResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySendEnabledResponseProtoMsg): QuerySendEnabledResponse { + return QuerySendEnabledResponse.decode(message.value); + }, + toProto(message: QuerySendEnabledResponse): Uint8Array { + return QuerySendEnabledResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySendEnabledResponse): QuerySendEnabledResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse", + value: QuerySendEnabledResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/tx.amino.ts b/util/inj-types/cosmos/bank/v1beta1/tx.amino.ts new file mode 100644 index 00000000..f146051f --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/tx.amino.ts @@ -0,0 +1,23 @@ +import { MsgSend, MsgMultiSend, MsgUpdateParams, MsgSetSendEnabled } from "./tx"; +export const AminoConverter = { + "/cosmos.bank.v1beta1.MsgSend": { + aminoType: "cosmos-sdk/MsgSend", + toAmino: MsgSend.toAmino, + fromAmino: MsgSend.fromAmino + }, + "/cosmos.bank.v1beta1.MsgMultiSend": { + aminoType: "cosmos-sdk/MsgMultiSend", + toAmino: MsgMultiSend.toAmino, + fromAmino: MsgMultiSend.fromAmino + }, + "/cosmos.bank.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/bank/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + }, + "/cosmos.bank.v1beta1.MsgSetSendEnabled": { + aminoType: "cosmos-sdk/MsgSetSendEnabled", + toAmino: MsgSetSendEnabled.toAmino, + fromAmino: MsgSetSendEnabled.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/tx.registry.ts b/util/inj-types/cosmos/bank/v1beta1/tx.registry.ts new file mode 100644 index 00000000..33b6bb81 --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/tx.registry.ts @@ -0,0 +1,89 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgSend, MsgMultiSend, MsgUpdateParams, MsgSetSendEnabled } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend], ["/cosmos.bank.v1beta1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.bank.v1beta1.MsgSetSendEnabled", MsgSetSendEnabled]]; +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() + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + }, + setSendEnabled(value: MsgSetSendEnabled) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + value: MsgSetSendEnabled.encode(value).finish() + }; + } + }, + withTypeUrl: { + send(value: MsgSend) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value + }; + }, + multiSend(value: MsgMultiSend) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", + value + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value + }; + }, + setSendEnabled(value: MsgSetSendEnabled) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + 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) + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + }, + setSendEnabled(value: MsgSetSendEnabled) { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + value: MsgSetSendEnabled.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/bank/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..31634142 --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,64 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSend, MsgSendResponse, MsgMultiSend, MsgMultiSendResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgSetSendEnabled, MsgSetSendEnabledResponse } 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; + /** + * UpdateParams defines a governance operation for updating the x/bank module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + updateParams(request: MsgUpdateParams): Promise; + /** + * SetSendEnabled is a governance operation for setting the SendEnabled flag + * on any number of Denoms. Only the entries to add or update should be + * included. Entries that already exist in the store, but that aren't + * included in this message, will be left unchanged. + * + * Since: cosmos-sdk 0.47 + */ + setSendEnabled(request: MsgSetSendEnabled): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Send defines a method for sending coins from one account to another account. */ + send = async (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 BinaryReader(data))); + }; + /* MultiSend defines a method for sending coins from some accounts to other accounts. */ + multiSend = async (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 BinaryReader(data))); + }; + /* UpdateParams defines a governance operation for updating the x/bank module parameters. + The authority is defined in the keeper. + + Since: cosmos-sdk 0.47 */ + updateParams = async (request: MsgUpdateParams): Promise => { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + }; + /* SetSendEnabled is a governance operation for setting the SendEnabled flag + on any number of Denoms. Only the entries to add or update should be + included. Entries that already exist in the store, but that aren't + included in this message, will be left unchanged. + + Since: cosmos-sdk 0.47 */ + setSendEnabled = async (request: MsgSetSendEnabled): Promise => { + const data = MsgSetSendEnabled.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "SetSendEnabled", data); + return promise.then(data => MsgSetSendEnabledResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/bank/v1beta1/tx.ts b/util/inj-types/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..e4b3feca --- /dev/null +++ b/util/inj-types/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,845 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType, Params, ParamsAmino, ParamsSDKType, SendEnabled, SendEnabledAmino, SendEnabledSDKType } from "./bank"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} +export interface MsgSendProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSend"; + value: Uint8Array; +} +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSendAmino { + from_address?: string; + to_address?: string; + amount: CoinAmino[]; +} +export interface MsgSendAminoMsg { + type: "cosmos-sdk/MsgSend"; + value: MsgSendAmino; +} +/** 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 {} +export interface MsgSendResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse"; + value: Uint8Array; +} +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponseAmino {} +export interface MsgSendResponseAminoMsg { + type: "cosmos-sdk/MsgSendResponse"; + value: MsgSendResponseAmino; +} +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponseSDKType {} +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ +export interface MsgMultiSend { + /** + * Inputs, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; +} +export interface MsgMultiSendProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend"; + value: Uint8Array; +} +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ +export interface MsgMultiSendAmino { + /** + * Inputs, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: InputAmino[]; + outputs: OutputAmino[]; +} +export interface MsgMultiSendAminoMsg { + type: "cosmos-sdk/MsgMultiSend"; + value: MsgMultiSendAmino; +} +/** 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 {} +export interface MsgMultiSendResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse"; + value: Uint8Array; +} +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponseAmino {} +export interface MsgMultiSendResponseAminoMsg { + type: "cosmos-sdk/MsgMultiSendResponse"; + value: MsgMultiSendResponseAmino; +} +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponseSDKType {} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/bank/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseSDKType {} +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabled { + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; +} +export interface MsgSetSendEnabledProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled"; + value: Uint8Array; +} +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledAmino { + authority?: string; + /** send_enabled is the list of entries to add or update. */ + send_enabled?: SendEnabledAmino[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + use_default_for?: string[]; +} +export interface MsgSetSendEnabledAminoMsg { + type: "cosmos-sdk/MsgSetSendEnabled"; + value: MsgSetSendEnabledAmino; +} +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledSDKType { + authority: string; + send_enabled: SendEnabledSDKType[]; + use_default_for: string[]; +} +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponse {} +export interface MsgSetSendEnabledResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse"; + value: Uint8Array; +} +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponseAmino {} +export interface MsgSetSendEnabledResponseAminoMsg { + type: "cosmos-sdk/MsgSetSendEnabledResponse"; + value: MsgSetSendEnabledResponseAmino; +} +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponseSDKType {} +function createBaseMsgSend(): MsgSend { + return { + fromAddress: "", + toAddress: "", + amount: [] + }; +} +export const MsgSend = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + aminoType: "cosmos-sdk/MsgSend", + encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): MsgSend { + const message = createBaseMsgSend(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgSendAmino): MsgSend { + const message = createBaseMsgSend(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgSend): MsgSendAmino { + const obj: any = {}; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgSendAminoMsg): MsgSend { + return MsgSend.fromAmino(object.value); + }, + toAminoMsg(message: MsgSend): MsgSendAminoMsg { + return { + type: "cosmos-sdk/MsgSend", + value: MsgSend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendProtoMsg): MsgSend { + return MsgSend.decode(message.value); + }, + toProto(message: MsgSend): Uint8Array { + return MsgSend.encode(message).finish(); + }, + toProtoMsg(message: MsgSend): MsgSendProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: MsgSend.encode(message).finish() + }; + } +}; +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} +export const MsgSendResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", + aminoType: "cosmos-sdk/MsgSendResponse", + encode(_: MsgSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, + fromAmino(_: MsgSendResponseAmino): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, + toAmino(_: MsgSendResponse): MsgSendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSendResponseAminoMsg): MsgSendResponse { + return MsgSendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSendResponse): MsgSendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSendResponse", + value: MsgSendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendResponseProtoMsg): MsgSendResponse { + return MsgSendResponse.decode(message.value); + }, + toProto(message: MsgSendResponse): Uint8Array { + return MsgSendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSendResponse): MsgSendResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", + value: MsgSendResponse.encode(message).finish() + }; + } +}; +function createBaseMsgMultiSend(): MsgMultiSend { + return { + inputs: [], + outputs: [] + }; +} +export const MsgMultiSend = { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", + aminoType: "cosmos-sdk/MsgMultiSend", + encode(message: MsgMultiSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): MsgMultiSend { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map(e => Input.fromPartial(e)) || []; + message.outputs = object.outputs?.map(e => Output.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgMultiSendAmino): MsgMultiSend { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map(e => Input.fromAmino(e)) || []; + message.outputs = object.outputs?.map(e => Output.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgMultiSend): MsgMultiSendAmino { + const obj: any = {}; + if (message.inputs) { + obj.inputs = message.inputs.map(e => e ? Input.toAmino(e) : undefined); + } else { + obj.inputs = message.inputs; + } + if (message.outputs) { + obj.outputs = message.outputs.map(e => e ? Output.toAmino(e) : undefined); + } else { + obj.outputs = message.outputs; + } + return obj; + }, + fromAminoMsg(object: MsgMultiSendAminoMsg): MsgMultiSend { + return MsgMultiSend.fromAmino(object.value); + }, + toAminoMsg(message: MsgMultiSend): MsgMultiSendAminoMsg { + return { + type: "cosmos-sdk/MsgMultiSend", + value: MsgMultiSend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMultiSendProtoMsg): MsgMultiSend { + return MsgMultiSend.decode(message.value); + }, + toProto(message: MsgMultiSend): Uint8Array { + return MsgMultiSend.encode(message).finish(); + }, + toProtoMsg(message: MsgMultiSend): MsgMultiSendProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", + value: MsgMultiSend.encode(message).finish() + }; + } +}; +function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { + return {}; +} +export const MsgMultiSendResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", + aminoType: "cosmos-sdk/MsgMultiSendResponse", + encode(_: MsgMultiSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, + fromAmino(_: MsgMultiSendResponseAmino): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, + toAmino(_: MsgMultiSendResponse): MsgMultiSendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgMultiSendResponseAminoMsg): MsgMultiSendResponse { + return MsgMultiSendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgMultiSendResponse): MsgMultiSendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgMultiSendResponse", + value: MsgMultiSendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMultiSendResponseProtoMsg): MsgMultiSendResponse { + return MsgMultiSendResponse.decode(message.value); + }, + toProto(message: MsgMultiSendResponse): Uint8Array { + return MsgMultiSendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgMultiSendResponse): MsgMultiSendResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", + value: MsgMultiSendResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + aminoType: "cosmos-sdk/x/bank/MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/bank/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgSetSendEnabled(): MsgSetSendEnabled { + return { + authority: "", + sendEnabled: [], + useDefaultFor: [] + }; +} +export const MsgSetSendEnabled = { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + aminoType: "cosmos-sdk/MsgSetSendEnabled", + encode(message: MsgSetSendEnabled, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.useDefaultFor) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 3: + message.useDefaultFor.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + message.authority = object.authority ?? ""; + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + message.useDefaultFor = object.useDefaultFor?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgSetSendEnabledAmino): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + message.useDefaultFor = object.use_default_for?.map(e => e) || []; + return message; + }, + toAmino(message: MsgSetSendEnabled): MsgSetSendEnabledAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + if (message.useDefaultFor) { + obj.use_default_for = message.useDefaultFor.map(e => e); + } else { + obj.use_default_for = message.useDefaultFor; + } + return obj; + }, + fromAminoMsg(object: MsgSetSendEnabledAminoMsg): MsgSetSendEnabled { + return MsgSetSendEnabled.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetSendEnabled): MsgSetSendEnabledAminoMsg { + return { + type: "cosmos-sdk/MsgSetSendEnabled", + value: MsgSetSendEnabled.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetSendEnabledProtoMsg): MsgSetSendEnabled { + return MsgSetSendEnabled.decode(message.value); + }, + toProto(message: MsgSetSendEnabled): Uint8Array { + return MsgSetSendEnabled.encode(message).finish(); + }, + toProtoMsg(message: MsgSetSendEnabled): MsgSetSendEnabledProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + value: MsgSetSendEnabled.encode(message).finish() + }; + } +}; +function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse { + return {}; +} +export const MsgSetSendEnabledResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", + aminoType: "cosmos-sdk/MsgSetSendEnabledResponse", + encode(_: MsgSetSendEnabledResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + return message; + }, + fromAmino(_: MsgSetSendEnabledResponseAmino): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + return message; + }, + toAmino(_: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSetSendEnabledResponseAminoMsg): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSetSendEnabledResponse", + value: MsgSetSendEnabledResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetSendEnabledResponseProtoMsg): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.decode(message.value); + }, + toProto(message: MsgSetSendEnabledResponse): Uint8Array { + return MsgSetSendEnabledResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", + value: MsgSetSendEnabledResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/base/abci/v1beta1/abci.ts b/util/inj-types/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..cc303fe5 --- /dev/null +++ b/util/inj-types/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1527 @@ +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Event, EventAmino, EventSDKType } from "../../../../tendermint/abci/types"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } 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: bigint; + /** 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: bigint; + /** Amount of gas consumed by transaction. */ + gasUsed: bigint; + /** The request transaction bytes. */ + tx?: Any; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: Event[]; +} +export interface TxResponseProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse"; + value: Uint8Array; +} +/** + * TxResponse defines a structure containing relevant tx data and metadata. The + * tags are stringified and the log is JSON decoded. + */ +export interface TxResponseAmino { + /** The block height */ + height?: string; + /** 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?: ABCIMessageLogAmino[]; + /** Additional information. May be non-deterministic. */ + info?: string; + /** Amount of gas requested for transaction. */ + gas_wanted?: string; + /** Amount of gas consumed by transaction. */ + gas_used?: string; + /** The request transaction bytes. */ + tx?: AnyAmino; + /** + * 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. 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?: EventAmino[]; +} +export interface TxResponseAminoMsg { + type: "cosmos-sdk/TxResponse"; + value: TxResponseAmino; +} +/** + * TxResponse defines a structure containing relevant tx data and metadata. The + * tags are stringified and the log is JSON decoded. + */ +export interface TxResponseSDKType { + height: bigint; + txhash: string; + codespace: string; + code: number; + data: string; + raw_log: string; + logs: ABCIMessageLogSDKType[]; + info: string; + gas_wanted: bigint; + gas_used: bigint; + tx?: AnySDKType; + timestamp: string; + 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[]; +} +export interface ABCIMessageLogProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog"; + value: Uint8Array; +} +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLogAmino { + msg_index: number; + log?: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events?: StringEventAmino[]; +} +export interface ABCIMessageLogAminoMsg { + type: "cosmos-sdk/ABCIMessageLog"; + value: ABCIMessageLogAmino; +} +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLogSDKType { + msg_index: number; + log: string; + 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[]; +} +export interface StringEventProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent"; + value: Uint8Array; +} +/** + * StringEvent defines en Event object wrapper where all the attributes + * contain key/value pairs that are strings instead of raw bytes. + */ +export interface StringEventAmino { + type?: string; + attributes?: AttributeAmino[]; +} +export interface StringEventAminoMsg { + type: "cosmos-sdk/StringEvent"; + value: StringEventAmino; +} +/** + * 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; +} +export interface AttributeProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute"; + value: Uint8Array; +} +/** + * Attribute defines an attribute wrapper where the key and value are + * strings instead of raw bytes. + */ +export interface AttributeAmino { + key?: string; + value?: string; +} +export interface AttributeAminoMsg { + type: "cosmos-sdk/Attribute"; + value: AttributeAmino; +} +/** + * 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: bigint; + /** GasUsed is the amount of gas actually consumed. */ + gasUsed: bigint; +} +export interface GasInfoProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo"; + value: Uint8Array; +} +/** GasInfo defines tx execution gas context. */ +export interface GasInfoAmino { + /** GasWanted is the maximum units of work we allow this tx to perform. */ + gas_wanted?: string; + /** GasUsed is the amount of gas actually consumed. */ + gas_used?: string; +} +export interface GasInfoAminoMsg { + type: "cosmos-sdk/GasInfo"; + value: GasInfoAmino; +} +/** GasInfo defines tx execution gas context. */ +export interface GasInfoSDKType { + gas_wanted: bigint; + gas_used: bigint; +} +/** 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[]; +} +export interface ResultProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.Result"; + value: Uint8Array; +} +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface ResultAmino { + /** + * 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?: string; + /** 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?: EventAmino[]; + /** + * msg_responses contains the Msg handler responses type packed in Anys. + * + * Since: cosmos-sdk 0.46 + */ + msg_responses?: AnyAmino[]; +} +export interface ResultAminoMsg { + type: "cosmos-sdk/Result"; + value: ResultAmino; +} +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface ResultSDKType { + /** @deprecated */ + data: Uint8Array; + log: string; + events: EventSDKType[]; + msg_responses: AnySDKType[]; +} +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gasInfo: GasInfo; + result?: Result; +} +export interface SimulationResponseProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse"; + value: Uint8Array; +} +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponseAmino { + gas_info?: GasInfoAmino; + result?: ResultAmino; +} +export interface SimulationResponseAminoMsg { + type: "cosmos-sdk/SimulationResponse"; + value: SimulationResponseAmino; +} +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponseSDKType { + gas_info: GasInfoSDKType; + result?: ResultSDKType; +} +/** + * MsgData defines the data returned in a Result object during message + * execution. + */ +/** @deprecated */ +export interface MsgData { + msgType: string; + data: Uint8Array; +} +export interface MsgDataProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData"; + value: Uint8Array; +} +/** + * MsgData defines the data returned in a Result object during message + * execution. + */ +/** @deprecated */ +export interface MsgDataAmino { + msg_type?: string; + data?: string; +} +export interface MsgDataAminoMsg { + type: "cosmos-sdk/MsgData"; + value: MsgDataAmino; +} +/** + * 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[]; +} +export interface TxMsgDataProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData"; + value: Uint8Array; +} +/** + * TxMsgData defines a list of MsgData. A transaction will have a MsgData object + * for each message. + */ +export interface TxMsgDataAmino { + /** data field is deprecated and not populated. */ + /** @deprecated */ + data?: MsgDataAmino[]; + /** + * msg_responses contains the Msg handler responses packed into Anys. + * + * Since: cosmos-sdk 0.46 + */ + msg_responses?: AnyAmino[]; +} +export interface TxMsgDataAminoMsg { + type: "cosmos-sdk/TxMsgData"; + value: TxMsgDataAmino; +} +/** + * TxMsgData defines a list of MsgData. A transaction will have a MsgData object + * for each message. + */ +export interface TxMsgDataSDKType { + /** @deprecated */ + data: MsgDataSDKType[]; + msg_responses: AnySDKType[]; +} +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** Count of all txs */ + totalCount: bigint; + /** Count of txs in current page */ + count: bigint; + /** Index of current page, start from 1 */ + pageNumber: bigint; + /** Count of total pages */ + pageTotal: bigint; + /** Max count txs per page */ + limit: bigint; + /** List of txs in current page */ + txs: TxResponse[]; +} +export interface SearchTxsResultProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult"; + value: Uint8Array; +} +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResultAmino { + /** Count of all txs */ + total_count?: string; + /** Count of txs in current page */ + count?: string; + /** Index of current page, start from 1 */ + page_number?: string; + /** Count of total pages */ + page_total?: string; + /** Max count txs per page */ + limit?: string; + /** List of txs in current page */ + txs?: TxResponseAmino[]; +} +export interface SearchTxsResultAminoMsg { + type: "cosmos-sdk/SearchTxsResult"; + value: SearchTxsResultAmino; +} +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResultSDKType { + total_count: bigint; + count: bigint; + page_number: bigint; + page_total: bigint; + limit: bigint; + txs: TxResponseSDKType[]; +} +function createBaseTxResponse(): TxResponse { + return { + height: BigInt(0), + txhash: "", + codespace: "", + code: 0, + data: "", + rawLog: "", + logs: [], + info: "", + gasWanted: BigInt(0), + gasUsed: BigInt(0), + tx: undefined, + timestamp: "", + events: [] + }; +} +export const TxResponse = { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", + aminoType: "cosmos-sdk/TxResponse", + encode(message: TxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.txhash !== "") { + writer.uint32(18).string(message.txhash); + } + if (message.codespace !== "") { + writer.uint32(26).string(message.codespace); + } + if (message.code !== 0) { + writer.uint32(32).uint32(message.code); + } + if (message.data !== "") { + writer.uint32(42).string(message.data); + } + if (message.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 !== BigInt(0)) { + writer.uint32(72).int64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + 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: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(); + 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(); + break; + case 10: + message.gasUsed = reader.int64(); + 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: DeepPartial): TxResponse { + const message = createBaseTxResponse(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + 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 ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + message.tx = object.tx !== undefined && object.tx !== null ? Any.fromPartial(object.tx) : undefined; + message.timestamp = object.timestamp ?? ""; + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TxResponseAmino): TxResponse { + const message = createBaseTxResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.txhash !== undefined && object.txhash !== null) { + message.txhash = object.txhash; + } + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = object.data; + } + if (object.raw_log !== undefined && object.raw_log !== null) { + message.rawLog = object.raw_log; + } + message.logs = object.logs?.map(e => ABCIMessageLog.fromAmino(e)) || []; + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + if (object.tx !== undefined && object.tx !== null) { + message.tx = Any.fromAmino(object.tx); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = object.timestamp; + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxResponse): TxResponseAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.txhash = message.txhash === "" ? undefined : message.txhash; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data === "" ? undefined : message.data; + obj.raw_log = message.rawLog === "" ? undefined : message.rawLog; + if (message.logs) { + obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); + } else { + obj.logs = message.logs; + } + obj.info = message.info === "" ? undefined : message.info; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; + obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; + obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + return obj; + }, + fromAminoMsg(object: TxResponseAminoMsg): TxResponse { + return TxResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxResponse): TxResponseAminoMsg { + return { + type: "cosmos-sdk/TxResponse", + value: TxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxResponseProtoMsg): TxResponse { + return TxResponse.decode(message.value); + }, + toProto(message: TxResponse): Uint8Array { + return TxResponse.encode(message).finish(); + }, + toProtoMsg(message: TxResponse): TxResponseProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", + value: TxResponse.encode(message).finish() + }; + } +}; +function createBaseABCIMessageLog(): ABCIMessageLog { + return { + msgIndex: 0, + log: "", + events: [] + }; +} +export const ABCIMessageLog = { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", + aminoType: "cosmos-sdk/ABCIMessageLog", + encode(message: ABCIMessageLog, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msgIndex = object.msgIndex ?? 0; + message.log = object.log ?? ""; + message.events = object.events?.map(e => StringEvent.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ABCIMessageLogAmino): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + if (object.msg_index !== undefined && object.msg_index !== null) { + message.msgIndex = object.msg_index; + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + message.events = object.events?.map(e => StringEvent.fromAmino(e)) || []; + return message; + }, + toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { + const obj: any = {}; + obj.msg_index = message.msgIndex ?? 0; + obj.log = message.log === "" ? undefined : message.log; + if (message.events) { + obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + return obj; + }, + fromAminoMsg(object: ABCIMessageLogAminoMsg): ABCIMessageLog { + return ABCIMessageLog.fromAmino(object.value); + }, + toAminoMsg(message: ABCIMessageLog): ABCIMessageLogAminoMsg { + return { + type: "cosmos-sdk/ABCIMessageLog", + value: ABCIMessageLog.toAmino(message) + }; + }, + fromProtoMsg(message: ABCIMessageLogProtoMsg): ABCIMessageLog { + return ABCIMessageLog.decode(message.value); + }, + toProto(message: ABCIMessageLog): Uint8Array { + return ABCIMessageLog.encode(message).finish(); + }, + toProtoMsg(message: ABCIMessageLog): ABCIMessageLogProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", + value: ABCIMessageLog.encode(message).finish() + }; + } +}; +function createBaseStringEvent(): StringEvent { + return { + type: "", + attributes: [] + }; +} +export const StringEvent = { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", + aminoType: "cosmos-sdk/StringEvent", + encode(message: StringEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): StringEvent { + const message = createBaseStringEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map(e => Attribute.fromPartial(e)) || []; + return message; + }, + fromAmino(object: StringEventAmino): StringEvent { + const message = createBaseStringEvent(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + message.attributes = object.attributes?.map(e => Attribute.fromAmino(e)) || []; + return message; + }, + toAmino(message: StringEvent): StringEventAmino { + const obj: any = {}; + obj.type = message.type === "" ? undefined : message.type; + if (message.attributes) { + obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); + } else { + obj.attributes = message.attributes; + } + return obj; + }, + fromAminoMsg(object: StringEventAminoMsg): StringEvent { + return StringEvent.fromAmino(object.value); + }, + toAminoMsg(message: StringEvent): StringEventAminoMsg { + return { + type: "cosmos-sdk/StringEvent", + value: StringEvent.toAmino(message) + }; + }, + fromProtoMsg(message: StringEventProtoMsg): StringEvent { + return StringEvent.decode(message.value); + }, + toProto(message: StringEvent): Uint8Array { + return StringEvent.encode(message).finish(); + }, + toProtoMsg(message: StringEvent): StringEventProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", + value: StringEvent.encode(message).finish() + }; + } +}; +function createBaseAttribute(): Attribute { + return { + key: "", + value: "" + }; +} +export const Attribute = { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute", + aminoType: "cosmos-sdk/Attribute", + encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, + fromAmino(object: AttributeAmino): Attribute { + const message = createBaseAttribute(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: Attribute): AttributeAmino { + const obj: any = {}; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; + return obj; + }, + fromAminoMsg(object: AttributeAminoMsg): Attribute { + return Attribute.fromAmino(object.value); + }, + toAminoMsg(message: Attribute): AttributeAminoMsg { + return { + type: "cosmos-sdk/Attribute", + value: Attribute.toAmino(message) + }; + }, + fromProtoMsg(message: AttributeProtoMsg): Attribute { + return Attribute.decode(message.value); + }, + toProto(message: Attribute): Uint8Array { + return Attribute.encode(message).finish(); + }, + toProtoMsg(message: Attribute): AttributeProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute", + value: Attribute.encode(message).finish() + }; + } +}; +function createBaseGasInfo(): GasInfo { + return { + gasWanted: BigInt(0), + gasUsed: BigInt(0) + }; +} +export const GasInfo = { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", + aminoType: "cosmos-sdk/GasInfo", + encode(message: GasInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.gasWanted !== BigInt(0)) { + writer.uint32(8).uint64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + writer.uint32(16).uint64(message.gasUsed); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(); + break; + case 2: + message.gasUsed = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GasInfo { + const message = createBaseGasInfo(); + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GasInfoAmino): GasInfo { + const message = createBaseGasInfo(); + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + return message; + }, + toAmino(message: GasInfo): GasInfoAmino { + const obj: any = {}; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GasInfoAminoMsg): GasInfo { + return GasInfo.fromAmino(object.value); + }, + toAminoMsg(message: GasInfo): GasInfoAminoMsg { + return { + type: "cosmos-sdk/GasInfo", + value: GasInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GasInfoProtoMsg): GasInfo { + return GasInfo.decode(message.value); + }, + toProto(message: GasInfo): Uint8Array { + return GasInfo.encode(message).finish(); + }, + toProtoMsg(message: GasInfo): GasInfoProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", + value: GasInfo.encode(message).finish() + }; + } +}; +function createBaseResult(): Result { + return { + data: new Uint8Array(), + log: "", + events: [], + msgResponses: [] + }; +} +export const Result = { + typeUrl: "/cosmos.base.abci.v1beta1.Result", + aminoType: "cosmos-sdk/Result", + encode(message: Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: ResultAmino): Result { + const message = createBaseResult(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + message.msgResponses = object.msg_responses?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: Result): ResultAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log === "" ? undefined : message.log; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + if (message.msgResponses) { + obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.msg_responses = message.msgResponses; + } + return obj; + }, + fromAminoMsg(object: ResultAminoMsg): Result { + return Result.fromAmino(object.value); + }, + toAminoMsg(message: Result): ResultAminoMsg { + return { + type: "cosmos-sdk/Result", + value: Result.toAmino(message) + }; + }, + fromProtoMsg(message: ResultProtoMsg): Result { + return Result.decode(message.value); + }, + toProto(message: Result): Uint8Array { + return Result.encode(message).finish(); + }, + toProtoMsg(message: Result): ResultProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.Result", + value: Result.encode(message).finish() + }; + } +}; +function createBaseSimulationResponse(): SimulationResponse { + return { + gasInfo: GasInfo.fromPartial({}), + result: undefined + }; +} +export const SimulationResponse = { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", + aminoType: "cosmos-sdk/SimulationResponse", + encode(message: SimulationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: SimulationResponseAmino): SimulationResponse { + const message = createBaseSimulationResponse(); + if (object.gas_info !== undefined && object.gas_info !== null) { + message.gasInfo = GasInfo.fromAmino(object.gas_info); + } + if (object.result !== undefined && object.result !== null) { + message.result = Result.fromAmino(object.result); + } + return message; + }, + toAmino(message: SimulationResponse): SimulationResponseAmino { + const obj: any = {}; + obj.gas_info = message.gasInfo ? GasInfo.toAmino(message.gasInfo) : undefined; + obj.result = message.result ? Result.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: SimulationResponseAminoMsg): SimulationResponse { + return SimulationResponse.fromAmino(object.value); + }, + toAminoMsg(message: SimulationResponse): SimulationResponseAminoMsg { + return { + type: "cosmos-sdk/SimulationResponse", + value: SimulationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: SimulationResponseProtoMsg): SimulationResponse { + return SimulationResponse.decode(message.value); + }, + toProto(message: SimulationResponse): Uint8Array { + return SimulationResponse.encode(message).finish(); + }, + toProtoMsg(message: SimulationResponse): SimulationResponseProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", + value: SimulationResponse.encode(message).finish() + }; + } +}; +function createBaseMsgData(): MsgData { + return { + msgType: "", + data: new Uint8Array() + }; +} +export const MsgData = { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData", + aminoType: "cosmos-sdk/MsgData", + encode(message: MsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): MsgData { + const message = createBaseMsgData(); + message.msgType = object.msgType ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgDataAmino): MsgData { + const message = createBaseMsgData(); + if (object.msg_type !== undefined && object.msg_type !== null) { + message.msgType = object.msg_type; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgData): MsgDataAmino { + const obj: any = {}; + obj.msg_type = message.msgType === "" ? undefined : message.msgType; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgDataAminoMsg): MsgData { + return MsgData.fromAmino(object.value); + }, + toAminoMsg(message: MsgData): MsgDataAminoMsg { + return { + type: "cosmos-sdk/MsgData", + value: MsgData.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDataProtoMsg): MsgData { + return MsgData.decode(message.value); + }, + toProto(message: MsgData): Uint8Array { + return MsgData.encode(message).finish(); + }, + toProtoMsg(message: MsgData): MsgDataProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData", + value: MsgData.encode(message).finish() + }; + } +}; +function createBaseTxMsgData(): TxMsgData { + return { + data: [], + msgResponses: [] + }; +} +export const TxMsgData = { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", + aminoType: "cosmos-sdk/TxMsgData", + encode(message: TxMsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map(e => MsgData.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TxMsgDataAmino): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map(e => MsgData.fromAmino(e)) || []; + message.msgResponses = object.msg_responses?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxMsgData): TxMsgDataAmino { + const obj: any = {}; + if (message.data) { + obj.data = message.data.map(e => e ? MsgData.toAmino(e) : undefined); + } else { + obj.data = message.data; + } + if (message.msgResponses) { + obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.msg_responses = message.msgResponses; + } + return obj; + }, + fromAminoMsg(object: TxMsgDataAminoMsg): TxMsgData { + return TxMsgData.fromAmino(object.value); + }, + toAminoMsg(message: TxMsgData): TxMsgDataAminoMsg { + return { + type: "cosmos-sdk/TxMsgData", + value: TxMsgData.toAmino(message) + }; + }, + fromProtoMsg(message: TxMsgDataProtoMsg): TxMsgData { + return TxMsgData.decode(message.value); + }, + toProto(message: TxMsgData): Uint8Array { + return TxMsgData.encode(message).finish(); + }, + toProtoMsg(message: TxMsgData): TxMsgDataProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", + value: TxMsgData.encode(message).finish() + }; + } +}; +function createBaseSearchTxsResult(): SearchTxsResult { + return { + totalCount: BigInt(0), + count: BigInt(0), + pageNumber: BigInt(0), + pageTotal: BigInt(0), + limit: BigInt(0), + txs: [] + }; +} +export const SearchTxsResult = { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", + aminoType: "cosmos-sdk/SearchTxsResult", + encode(message: SearchTxsResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.totalCount !== BigInt(0)) { + writer.uint32(8).uint64(message.totalCount); + } + if (message.count !== BigInt(0)) { + writer.uint32(16).uint64(message.count); + } + if (message.pageNumber !== BigInt(0)) { + writer.uint32(24).uint64(message.pageNumber); + } + if (message.pageTotal !== BigInt(0)) { + writer.uint32(32).uint64(message.pageTotal); + } + if (message.limit !== BigInt(0)) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + TxResponse.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(); + break; + case 2: + message.count = reader.uint64(); + break; + case 3: + message.pageNumber = reader.uint64(); + break; + case 4: + message.pageTotal = reader.uint64(); + break; + case 5: + message.limit = reader.uint64(); + break; + case 6: + message.txs.push(TxResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.totalCount = object.totalCount !== undefined && object.totalCount !== null ? BigInt(object.totalCount.toString()) : BigInt(0); + message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); + message.pageNumber = object.pageNumber !== undefined && object.pageNumber !== null ? BigInt(object.pageNumber.toString()) : BigInt(0); + message.pageTotal = object.pageTotal !== undefined && object.pageTotal !== null ? BigInt(object.pageTotal.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.txs = object.txs?.map(e => TxResponse.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SearchTxsResultAmino): SearchTxsResult { + const message = createBaseSearchTxsResult(); + if (object.total_count !== undefined && object.total_count !== null) { + message.totalCount = BigInt(object.total_count); + } + if (object.count !== undefined && object.count !== null) { + message.count = BigInt(object.count); + } + if (object.page_number !== undefined && object.page_number !== null) { + message.pageNumber = BigInt(object.page_number); + } + if (object.page_total !== undefined && object.page_total !== null) { + message.pageTotal = BigInt(object.page_total); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + message.txs = object.txs?.map(e => TxResponse.fromAmino(e)) || []; + return message; + }, + toAmino(message: SearchTxsResult): SearchTxsResultAmino { + const obj: any = {}; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; + if (message.txs) { + obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); + } else { + obj.txs = message.txs; + } + return obj; + }, + fromAminoMsg(object: SearchTxsResultAminoMsg): SearchTxsResult { + return SearchTxsResult.fromAmino(object.value); + }, + toAminoMsg(message: SearchTxsResult): SearchTxsResultAminoMsg { + return { + type: "cosmos-sdk/SearchTxsResult", + value: SearchTxsResult.toAmino(message) + }; + }, + fromProtoMsg(message: SearchTxsResultProtoMsg): SearchTxsResult { + return SearchTxsResult.decode(message.value); + }, + toProto(message: SearchTxsResult): Uint8Array { + return SearchTxsResult.encode(message).finish(); + }, + toProtoMsg(message: SearchTxsResult): SearchTxsResultProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", + value: SearchTxsResult.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/base/node/v1beta1/query.lcd.ts b/util/inj-types/cosmos/base/node/v1beta1/query.lcd.ts new file mode 100644 index 00000000..951e156d --- /dev/null +++ b/util/inj-types/cosmos/base/node/v1beta1/query.lcd.ts @@ -0,0 +1,17 @@ +import { LCDClient } from "@cosmology/lcd"; +import { ConfigRequest, ConfigResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Config queries for the operator configuration. */ + config = async (_params: ConfigRequest = {}): Promise => { + const endpoint = `cosmos/base/node/v1beta1/config`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/base/node/v1beta1/query.rpc.Service.ts b/util/inj-types/cosmos/base/node/v1beta1/query.rpc.Service.ts new file mode 100644 index 00000000..3769bd16 --- /dev/null +++ b/util/inj-types/cosmos/base/node/v1beta1/query.rpc.Service.ts @@ -0,0 +1,30 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { ConfigRequest, ConfigResponse } from "./query"; +/** Service defines the gRPC querier service for node related queries. */ +export interface Service { + /** Config queries for the operator configuration. */ + config(request?: ConfigRequest): Promise; +} +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Config queries for the operator configuration. */ + config = async (request: ConfigRequest = {}): Promise => { + const data = ConfigRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.base.node.v1beta1.Service", "Config", data); + return promise.then(data => ConfigResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new ServiceClientImpl(rpc); + return { + config(request?: ConfigRequest): Promise { + return queryService.config(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/base/node/v1beta1/query.ts b/util/inj-types/cosmos/base/node/v1beta1/query.ts new file mode 100644 index 00000000..00c7b849 --- /dev/null +++ b/util/inj-types/cosmos/base/node/v1beta1/query.ts @@ -0,0 +1,163 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** ConfigRequest defines the request structure for the Config gRPC query. */ +export interface ConfigRequest {} +export interface ConfigRequestProtoMsg { + typeUrl: "/cosmos.base.node.v1beta1.ConfigRequest"; + value: Uint8Array; +} +/** ConfigRequest defines the request structure for the Config gRPC query. */ +export interface ConfigRequestAmino {} +export interface ConfigRequestAminoMsg { + type: "cosmos-sdk/ConfigRequest"; + value: ConfigRequestAmino; +} +/** ConfigRequest defines the request structure for the Config gRPC query. */ +export interface ConfigRequestSDKType {} +/** ConfigResponse defines the response structure for the Config gRPC query. */ +export interface ConfigResponse { + minimumGasPrice: string; +} +export interface ConfigResponseProtoMsg { + typeUrl: "/cosmos.base.node.v1beta1.ConfigResponse"; + value: Uint8Array; +} +/** ConfigResponse defines the response structure for the Config gRPC query. */ +export interface ConfigResponseAmino { + minimum_gas_price?: string; +} +export interface ConfigResponseAminoMsg { + type: "cosmos-sdk/ConfigResponse"; + value: ConfigResponseAmino; +} +/** ConfigResponse defines the response structure for the Config gRPC query. */ +export interface ConfigResponseSDKType { + minimum_gas_price: string; +} +function createBaseConfigRequest(): ConfigRequest { + return {}; +} +export const ConfigRequest = { + typeUrl: "/cosmos.base.node.v1beta1.ConfigRequest", + aminoType: "cosmos-sdk/ConfigRequest", + encode(_: ConfigRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConfigRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): ConfigRequest { + const message = createBaseConfigRequest(); + return message; + }, + fromAmino(_: ConfigRequestAmino): ConfigRequest { + const message = createBaseConfigRequest(); + return message; + }, + toAmino(_: ConfigRequest): ConfigRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ConfigRequestAminoMsg): ConfigRequest { + return ConfigRequest.fromAmino(object.value); + }, + toAminoMsg(message: ConfigRequest): ConfigRequestAminoMsg { + return { + type: "cosmos-sdk/ConfigRequest", + value: ConfigRequest.toAmino(message) + }; + }, + fromProtoMsg(message: ConfigRequestProtoMsg): ConfigRequest { + return ConfigRequest.decode(message.value); + }, + toProto(message: ConfigRequest): Uint8Array { + return ConfigRequest.encode(message).finish(); + }, + toProtoMsg(message: ConfigRequest): ConfigRequestProtoMsg { + return { + typeUrl: "/cosmos.base.node.v1beta1.ConfigRequest", + value: ConfigRequest.encode(message).finish() + }; + } +}; +function createBaseConfigResponse(): ConfigResponse { + return { + minimumGasPrice: "" + }; +} +export const ConfigResponse = { + typeUrl: "/cosmos.base.node.v1beta1.ConfigResponse", + aminoType: "cosmos-sdk/ConfigResponse", + encode(message: ConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.minimumGasPrice !== "") { + writer.uint32(10).string(message.minimumGasPrice); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minimumGasPrice = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConfigResponse { + const message = createBaseConfigResponse(); + message.minimumGasPrice = object.minimumGasPrice ?? ""; + return message; + }, + fromAmino(object: ConfigResponseAmino): ConfigResponse { + const message = createBaseConfigResponse(); + if (object.minimum_gas_price !== undefined && object.minimum_gas_price !== null) { + message.minimumGasPrice = object.minimum_gas_price; + } + return message; + }, + toAmino(message: ConfigResponse): ConfigResponseAmino { + const obj: any = {}; + obj.minimum_gas_price = message.minimumGasPrice === "" ? undefined : message.minimumGasPrice; + return obj; + }, + fromAminoMsg(object: ConfigResponseAminoMsg): ConfigResponse { + return ConfigResponse.fromAmino(object.value); + }, + toAminoMsg(message: ConfigResponse): ConfigResponseAminoMsg { + return { + type: "cosmos-sdk/ConfigResponse", + value: ConfigResponse.toAmino(message) + }; + }, + fromProtoMsg(message: ConfigResponseProtoMsg): ConfigResponse { + return ConfigResponse.decode(message.value); + }, + toProto(message: ConfigResponse): Uint8Array { + return ConfigResponse.encode(message).finish(); + }, + toProtoMsg(message: ConfigResponse): ConfigResponseProtoMsg { + return { + typeUrl: "/cosmos.base.node.v1beta1.ConfigResponse", + value: ConfigResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/base/query/v1beta1/pagination.ts b/util/inj-types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..284ee7cd --- /dev/null +++ b/util/inj-types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,373 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } 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: bigint; + /** + * 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: bigint; + /** + * 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; +} +export interface PageRequestProtoMsg { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest"; + value: Uint8Array; +} +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequestAmino { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key?: string; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset?: string; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit?: string; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + count_total?: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse?: boolean; +} +export interface PageRequestAminoMsg { + type: "cosmos-sdk/PageRequest"; + value: PageRequestAmino; +} +/** + * 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: Uint8Array; + offset: bigint; + limit: bigint; + count_total: boolean; + 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: bigint; +} +export interface PageResponseProtoMsg { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse"; + value: Uint8Array; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponseAmino { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + next_key?: string; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total?: string; +} +export interface PageResponseAminoMsg { + type: "cosmos-sdk/PageResponse"; + value: PageResponseAmino; +} +/** + * 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: Uint8Array; + total: bigint; +} +function createBasePageRequest(): PageRequest { + return { + key: new Uint8Array(), + offset: BigInt(0), + limit: BigInt(0), + countTotal: false, + reverse: false + }; +} +export const PageRequest = { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest", + aminoType: "cosmos-sdk/PageRequest", + encode(message: PageRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== BigInt(0)) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== BigInt(0)) { + 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: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(); + break; + case 3: + message.limit = reader.uint64(); + 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: DeepPartial): PageRequest { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = object.offset !== undefined && object.offset !== null ? BigInt(object.offset.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, + fromAmino(object: PageRequestAmino): PageRequest { + const message = createBasePageRequest(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.offset !== undefined && object.offset !== null) { + message.offset = BigInt(object.offset); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + if (object.count_total !== undefined && object.count_total !== null) { + message.countTotal = object.count_total; + } + if (object.reverse !== undefined && object.reverse !== null) { + message.reverse = object.reverse; + } + return message; + }, + toAmino(message: PageRequest): PageRequestAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.offset = message.offset !== BigInt(0) ? message.offset.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; + obj.count_total = message.countTotal === false ? undefined : message.countTotal; + obj.reverse = message.reverse === false ? undefined : message.reverse; + return obj; + }, + fromAminoMsg(object: PageRequestAminoMsg): PageRequest { + return PageRequest.fromAmino(object.value); + }, + toAminoMsg(message: PageRequest): PageRequestAminoMsg { + return { + type: "cosmos-sdk/PageRequest", + value: PageRequest.toAmino(message) + }; + }, + fromProtoMsg(message: PageRequestProtoMsg): PageRequest { + return PageRequest.decode(message.value); + }, + toProto(message: PageRequest): Uint8Array { + return PageRequest.encode(message).finish(); + }, + toProtoMsg(message: PageRequest): PageRequestProtoMsg { + return { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest", + value: PageRequest.encode(message).finish() + }; + } +}; +function createBasePageResponse(): PageResponse { + return { + nextKey: new Uint8Array(), + total: BigInt(0) + }; +} +export const PageResponse = { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse", + aminoType: "cosmos-sdk/PageResponse", + encode(message: PageResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== BigInt(0)) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(); + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PageResponseAmino): PageResponse { + const message = createBasePageResponse(); + if (object.next_key !== undefined && object.next_key !== null) { + message.nextKey = bytesFromBase64(object.next_key); + } + if (object.total !== undefined && object.total !== null) { + message.total = BigInt(object.total); + } + return message; + }, + toAmino(message: PageResponse): PageResponseAmino { + const obj: any = {}; + obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PageResponseAminoMsg): PageResponse { + return PageResponse.fromAmino(object.value); + }, + toAminoMsg(message: PageResponse): PageResponseAminoMsg { + return { + type: "cosmos-sdk/PageResponse", + value: PageResponse.toAmino(message) + }; + }, + fromProtoMsg(message: PageResponseProtoMsg): PageResponse { + return PageResponse.decode(message.value); + }, + toProto(message: PageResponse): Uint8Array { + return PageResponse.encode(message).finish(); + }, + toProtoMsg(message: PageResponse): PageResponseProtoMsg { + return { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse", + value: PageResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/base/reflection/v2alpha1/reflection.ts b/util/inj-types/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 00000000..7afe0a8e --- /dev/null +++ b/util/inj-types/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,2640 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** 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; + /** chain provides the chain descriptor */ + chain?: ChainDescriptor; + /** codec provides metadata information regarding codec related types */ + codec?: CodecDescriptor; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration?: ConfigurationDescriptor; + /** query_services provides metadata information regarding the available queriable endpoints */ + queryServices?: QueryServicesDescriptor; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx?: TxDescriptor; +} +export interface AppDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor"; + value: Uint8Array; +} +/** AppDescriptor describes a cosmos-sdk based application */ +export interface AppDescriptorAmino { + /** + * AuthnDescriptor provides information on how to authenticate transactions on the application + * NOTE: experimental and subject to change in future releases. + */ + authn?: AuthnDescriptorAmino; + /** chain provides the chain descriptor */ + chain?: ChainDescriptorAmino; + /** codec provides metadata information regarding codec related types */ + codec?: CodecDescriptorAmino; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration?: ConfigurationDescriptorAmino; + /** query_services provides metadata information regarding the available queriable endpoints */ + query_services?: QueryServicesDescriptorAmino; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx?: TxDescriptorAmino; +} +export interface AppDescriptorAminoMsg { + type: "cosmos-sdk/AppDescriptor"; + value: AppDescriptorAmino; +} +/** AppDescriptor describes a cosmos-sdk based application */ +export interface AppDescriptorSDKType { + authn?: AuthnDescriptorSDKType; + chain?: ChainDescriptorSDKType; + codec?: CodecDescriptorSDKType; + configuration?: ConfigurationDescriptorSDKType; + query_services?: QueryServicesDescriptorSDKType; + tx?: TxDescriptorSDKType; +} +/** 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[]; +} +export interface TxDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor"; + value: Uint8Array; +} +/** TxDescriptor describes the accepted transaction type */ +export interface TxDescriptorAmino { + /** + * 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?: MsgDescriptorAmino[]; +} +export interface TxDescriptorAminoMsg { + type: "cosmos-sdk/TxDescriptor"; + value: TxDescriptorAmino; +} +/** TxDescriptor describes the accepted transaction type */ +export interface TxDescriptorSDKType { + fullname: string; + 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[]; +} +export interface AuthnDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor"; + value: Uint8Array; +} +/** + * AuthnDescriptor provides information on how to sign transactions without relying + * on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures + */ +export interface AuthnDescriptorAmino { + /** sign_modes defines the supported signature algorithm */ + sign_modes?: SigningModeDescriptorAmino[]; +} +export interface AuthnDescriptorAminoMsg { + type: "cosmos-sdk/AuthnDescriptor"; + value: AuthnDescriptorAmino; +} +/** + * AuthnDescriptor provides information on how to sign transactions without relying + * on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures + */ +export interface AuthnDescriptorSDKType { + 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; +} +export interface SigningModeDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor"; + value: Uint8Array; +} +/** + * 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 SigningModeDescriptorAmino { + /** name defines the unique name of the signing mode */ + name?: string; + /** number is the unique int32 identifier for the sign_mode enum */ + number?: number; + /** + * authn_info_provider_method_fullname defines the fullname of the method to call to get + * the metadata required to authenticate using the provided sign_modes + */ + authn_info_provider_method_fullname?: string; +} +export interface SigningModeDescriptorAminoMsg { + type: "cosmos-sdk/SigningModeDescriptor"; + value: SigningModeDescriptorAmino; +} +/** + * 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: string; + number: number; + authn_info_provider_method_fullname: string; +} +/** ChainDescriptor describes chain information of the application */ +export interface ChainDescriptor { + /** id is the chain id */ + id: string; +} +export interface ChainDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor"; + value: Uint8Array; +} +/** ChainDescriptor describes chain information of the application */ +export interface ChainDescriptorAmino { + /** id is the chain id */ + id?: string; +} +export interface ChainDescriptorAminoMsg { + type: "cosmos-sdk/ChainDescriptor"; + value: ChainDescriptorAmino; +} +/** ChainDescriptor describes chain information of the application */ +export interface ChainDescriptorSDKType { + 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[]; +} +export interface CodecDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor"; + value: Uint8Array; +} +/** CodecDescriptor describes the registered interfaces and provides metadata information on the types */ +export interface CodecDescriptorAmino { + /** interfaces is a list of the registerted interfaces descriptors */ + interfaces?: InterfaceDescriptorAmino[]; +} +export interface CodecDescriptorAminoMsg { + type: "cosmos-sdk/CodecDescriptor"; + value: CodecDescriptorAmino; +} +/** CodecDescriptor describes the registered interfaces and provides metadata information on the types */ +export interface CodecDescriptorSDKType { + 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[]; +} +export interface InterfaceDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor"; + value: Uint8Array; +} +/** InterfaceDescriptor describes the implementation of an interface */ +export interface InterfaceDescriptorAmino { + /** 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?: InterfaceAcceptingMessageDescriptorAmino[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interface_implementers?: InterfaceImplementerDescriptorAmino[]; +} +export interface InterfaceDescriptorAminoMsg { + type: "cosmos-sdk/InterfaceDescriptor"; + value: InterfaceDescriptorAmino; +} +/** InterfaceDescriptor describes the implementation of an interface */ +export interface InterfaceDescriptorSDKType { + fullname: string; + interface_accepting_messages: InterfaceAcceptingMessageDescriptorSDKType[]; + 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; +} +export interface InterfaceImplementerDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor"; + value: Uint8Array; +} +/** InterfaceImplementerDescriptor describes an interface implementer */ +export interface InterfaceImplementerDescriptorAmino { + /** fullname is the protobuf queryable name of the interface implementer */ + fullname?: string; + /** + * type_url defines the type URL used when marshalling the type as any + * this is required so we can provide type safe google.protobuf.Any marshalling and + * unmarshalling, making sure that we don't accept just 'any' type + * in our interface fields + */ + type_url?: string; +} +export interface InterfaceImplementerDescriptorAminoMsg { + type: "cosmos-sdk/InterfaceImplementerDescriptor"; + value: InterfaceImplementerDescriptorAmino; +} +/** InterfaceImplementerDescriptor describes an interface implementer */ +export interface InterfaceImplementerDescriptorSDKType { + fullname: string; + 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[]; +} +export interface InterfaceAcceptingMessageDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor"; + value: Uint8Array; +} +/** + * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains + * an interface represented as a google.protobuf.Any + */ +export interface InterfaceAcceptingMessageDescriptorAmino { + /** fullname is the protobuf fullname of the type containing the interface */ + fullname?: string; + /** + * field_descriptor_names is a list of the protobuf name (not fullname) of the field + * which contains the interface as google.protobuf.Any (the interface is the same, but + * it can be in multiple fields of the same proto message) + */ + field_descriptor_names?: string[]; +} +export interface InterfaceAcceptingMessageDescriptorAminoMsg { + type: "cosmos-sdk/InterfaceAcceptingMessageDescriptor"; + value: InterfaceAcceptingMessageDescriptorAmino; +} +/** + * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains + * an interface represented as a google.protobuf.Any + */ +export interface InterfaceAcceptingMessageDescriptorSDKType { + fullname: string; + 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; +} +export interface ConfigurationDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor"; + value: Uint8Array; +} +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptorAmino { + /** bech32_account_address_prefix is the account address prefix */ + bech32_account_address_prefix?: string; +} +export interface ConfigurationDescriptorAminoMsg { + type: "cosmos-sdk/ConfigurationDescriptor"; + value: ConfigurationDescriptorAmino; +} +/** ConfigurationDescriptor contains metadata information on the sdk.Config */ +export interface ConfigurationDescriptorSDKType { + 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; +} +export interface MsgDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor"; + value: Uint8Array; +} +/** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */ +export interface MsgDescriptorAmino { + /** msg_type_url contains the TypeURL of a sdk.Msg. */ + msg_type_url?: string; +} +export interface MsgDescriptorAminoMsg { + type: "cosmos-sdk/MsgDescriptor"; + value: MsgDescriptorAmino; +} +/** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */ +export interface MsgDescriptorSDKType { + msg_type_url: string; +} +/** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorRequest {} +export interface GetAuthnDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest"; + value: Uint8Array; +} +/** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorRequestAmino {} +export interface GetAuthnDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetAuthnDescriptorRequest"; + value: GetAuthnDescriptorRequestAmino; +} +/** 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; +} +export interface GetAuthnDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse"; + value: Uint8Array; +} +/** GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorResponseAmino { + /** authn describes how to authenticate to the application when sending transactions */ + authn?: AuthnDescriptorAmino; +} +export interface GetAuthnDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetAuthnDescriptorResponse"; + value: GetAuthnDescriptorResponseAmino; +} +/** GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC */ +export interface GetAuthnDescriptorResponseSDKType { + authn?: AuthnDescriptorSDKType; +} +/** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */ +export interface GetChainDescriptorRequest {} +export interface GetChainDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest"; + value: Uint8Array; +} +/** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */ +export interface GetChainDescriptorRequestAmino {} +export interface GetChainDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetChainDescriptorRequest"; + value: GetChainDescriptorRequestAmino; +} +/** 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; +} +export interface GetChainDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse"; + value: Uint8Array; +} +/** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */ +export interface GetChainDescriptorResponseAmino { + /** chain describes application chain information */ + chain?: ChainDescriptorAmino; +} +export interface GetChainDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetChainDescriptorResponse"; + value: GetChainDescriptorResponseAmino; +} +/** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */ +export interface GetChainDescriptorResponseSDKType { + chain?: ChainDescriptorSDKType; +} +/** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorRequest {} +export interface GetCodecDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest"; + value: Uint8Array; +} +/** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorRequestAmino {} +export interface GetCodecDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetCodecDescriptorRequest"; + value: GetCodecDescriptorRequestAmino; +} +/** 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; +} +export interface GetCodecDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse"; + value: Uint8Array; +} +/** GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorResponseAmino { + /** codec describes the application codec such as registered interfaces and implementations */ + codec?: CodecDescriptorAmino; +} +export interface GetCodecDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetCodecDescriptorResponse"; + value: GetCodecDescriptorResponseAmino; +} +/** GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC */ +export interface GetCodecDescriptorResponseSDKType { + codec?: CodecDescriptorSDKType; +} +/** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorRequest {} +export interface GetConfigurationDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest"; + value: Uint8Array; +} +/** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorRequestAmino {} +export interface GetConfigurationDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetConfigurationDescriptorRequest"; + value: GetConfigurationDescriptorRequestAmino; +} +/** 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; +} +export interface GetConfigurationDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse"; + value: Uint8Array; +} +/** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorResponseAmino { + /** config describes the application's sdk.Config */ + config?: ConfigurationDescriptorAmino; +} +export interface GetConfigurationDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetConfigurationDescriptorResponse"; + value: GetConfigurationDescriptorResponseAmino; +} +/** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */ +export interface GetConfigurationDescriptorResponseSDKType { + config?: ConfigurationDescriptorSDKType; +} +/** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorRequest {} +export interface GetQueryServicesDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest"; + value: Uint8Array; +} +/** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorRequestAmino {} +export interface GetQueryServicesDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetQueryServicesDescriptorRequest"; + value: GetQueryServicesDescriptorRequestAmino; +} +/** 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; +} +export interface GetQueryServicesDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse"; + value: Uint8Array; +} +/** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorResponseAmino { + /** queries provides information on the available queryable services */ + queries?: QueryServicesDescriptorAmino; +} +export interface GetQueryServicesDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetQueryServicesDescriptorResponse"; + value: GetQueryServicesDescriptorResponseAmino; +} +/** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */ +export interface GetQueryServicesDescriptorResponseSDKType { + queries?: QueryServicesDescriptorSDKType; +} +/** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */ +export interface GetTxDescriptorRequest {} +export interface GetTxDescriptorRequestProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest"; + value: Uint8Array; +} +/** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */ +export interface GetTxDescriptorRequestAmino {} +export interface GetTxDescriptorRequestAminoMsg { + type: "cosmos-sdk/GetTxDescriptorRequest"; + value: GetTxDescriptorRequestAmino; +} +/** 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; +} +export interface GetTxDescriptorResponseProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse"; + value: Uint8Array; +} +/** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */ +export interface GetTxDescriptorResponseAmino { + /** + * tx provides information on msgs that can be forwarded to the application + * alongside the accepted transaction protobuf type + */ + tx?: TxDescriptorAmino; +} +export interface GetTxDescriptorResponseAminoMsg { + type: "cosmos-sdk/GetTxDescriptorResponse"; + value: GetTxDescriptorResponseAmino; +} +/** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */ +export interface GetTxDescriptorResponseSDKType { + tx?: TxDescriptorSDKType; +} +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + queryServices: QueryServiceDescriptor[]; +} +export interface QueryServicesDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor"; + value: Uint8Array; +} +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptorAmino { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + query_services?: QueryServiceDescriptorAmino[]; +} +export interface QueryServicesDescriptorAminoMsg { + type: "cosmos-sdk/QueryServicesDescriptor"; + value: QueryServicesDescriptorAmino; +} +/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */ +export interface QueryServicesDescriptorSDKType { + 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[]; +} +export interface QueryServiceDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor"; + value: Uint8Array; +} +/** QueryServiceDescriptor describes a cosmos-sdk queryable service */ +export interface QueryServiceDescriptorAmino { + /** 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?: QueryMethodDescriptorAmino[]; +} +export interface QueryServiceDescriptorAminoMsg { + type: "cosmos-sdk/QueryServiceDescriptor"; + value: QueryServiceDescriptorAmino; +} +/** QueryServiceDescriptor describes a cosmos-sdk queryable service */ +export interface QueryServiceDescriptorSDKType { + fullname: string; + is_module: boolean; + 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; +} +export interface QueryMethodDescriptorProtoMsg { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor"; + value: Uint8Array; +} +/** + * 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 QueryMethodDescriptorAmino { + /** 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; +} +export interface QueryMethodDescriptorAminoMsg { + type: "cosmos-sdk/QueryMethodDescriptor"; + value: QueryMethodDescriptorAmino; +} +/** + * 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: string; + full_query_path: string; +} +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + queryServices: undefined, + tx: undefined + }; +} +export const AppDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor", + aminoType: "cosmos-sdk/AppDescriptor", + encode(message: AppDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: AppDescriptorAmino): AppDescriptor { + const message = createBaseAppDescriptor(); + if (object.authn !== undefined && object.authn !== null) { + message.authn = AuthnDescriptor.fromAmino(object.authn); + } + if (object.chain !== undefined && object.chain !== null) { + message.chain = ChainDescriptor.fromAmino(object.chain); + } + if (object.codec !== undefined && object.codec !== null) { + message.codec = CodecDescriptor.fromAmino(object.codec); + } + if (object.configuration !== undefined && object.configuration !== null) { + message.configuration = ConfigurationDescriptor.fromAmino(object.configuration); + } + if (object.query_services !== undefined && object.query_services !== null) { + message.queryServices = QueryServicesDescriptor.fromAmino(object.query_services); + } + if (object.tx !== undefined && object.tx !== null) { + message.tx = TxDescriptor.fromAmino(object.tx); + } + return message; + }, + toAmino(message: AppDescriptor): AppDescriptorAmino { + const obj: any = {}; + obj.authn = message.authn ? AuthnDescriptor.toAmino(message.authn) : undefined; + obj.chain = message.chain ? ChainDescriptor.toAmino(message.chain) : undefined; + obj.codec = message.codec ? CodecDescriptor.toAmino(message.codec) : undefined; + obj.configuration = message.configuration ? ConfigurationDescriptor.toAmino(message.configuration) : undefined; + obj.query_services = message.queryServices ? QueryServicesDescriptor.toAmino(message.queryServices) : undefined; + obj.tx = message.tx ? TxDescriptor.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: AppDescriptorAminoMsg): AppDescriptor { + return AppDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: AppDescriptor): AppDescriptorAminoMsg { + return { + type: "cosmos-sdk/AppDescriptor", + value: AppDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: AppDescriptorProtoMsg): AppDescriptor { + return AppDescriptor.decode(message.value); + }, + toProto(message: AppDescriptor): Uint8Array { + return AppDescriptor.encode(message).finish(); + }, + toProtoMsg(message: AppDescriptor): AppDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.AppDescriptor", + value: AppDescriptor.encode(message).finish() + }; + } +}; +function createBaseTxDescriptor(): TxDescriptor { + return { + fullname: "", + msgs: [] + }; +} +export const TxDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor", + aminoType: "cosmos-sdk/TxDescriptor", + encode(message: TxDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): TxDescriptor { + const message = createBaseTxDescriptor(); + message.fullname = object.fullname ?? ""; + message.msgs = object.msgs?.map(e => MsgDescriptor.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TxDescriptorAmino): TxDescriptor { + const message = createBaseTxDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + message.msgs = object.msgs?.map(e => MsgDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxDescriptor): TxDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + if (message.msgs) { + obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); + } else { + obj.msgs = message.msgs; + } + return obj; + }, + fromAminoMsg(object: TxDescriptorAminoMsg): TxDescriptor { + return TxDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: TxDescriptor): TxDescriptorAminoMsg { + return { + type: "cosmos-sdk/TxDescriptor", + value: TxDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: TxDescriptorProtoMsg): TxDescriptor { + return TxDescriptor.decode(message.value); + }, + toProto(message: TxDescriptor): Uint8Array { + return TxDescriptor.encode(message).finish(); + }, + toProtoMsg(message: TxDescriptor): TxDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.TxDescriptor", + value: TxDescriptor.encode(message).finish() + }; + } +}; +function createBaseAuthnDescriptor(): AuthnDescriptor { + return { + signModes: [] + }; +} +export const AuthnDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor", + aminoType: "cosmos-sdk/AuthnDescriptor", + encode(message: AuthnDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.signModes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.signModes = object.signModes?.map(e => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, + fromAmino(object: AuthnDescriptorAmino): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.signModes = object.sign_modes?.map(e => SigningModeDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: AuthnDescriptor): AuthnDescriptorAmino { + const obj: any = {}; + if (message.signModes) { + obj.sign_modes = message.signModes.map(e => e ? SigningModeDescriptor.toAmino(e) : undefined); + } else { + obj.sign_modes = message.signModes; + } + return obj; + }, + fromAminoMsg(object: AuthnDescriptorAminoMsg): AuthnDescriptor { + return AuthnDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: AuthnDescriptor): AuthnDescriptorAminoMsg { + return { + type: "cosmos-sdk/AuthnDescriptor", + value: AuthnDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: AuthnDescriptorProtoMsg): AuthnDescriptor { + return AuthnDescriptor.decode(message.value); + }, + toProto(message: AuthnDescriptor): Uint8Array { + return AuthnDescriptor.encode(message).finish(); + }, + toProtoMsg(message: AuthnDescriptor): AuthnDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.AuthnDescriptor", + value: AuthnDescriptor.encode(message).finish() + }; + } +}; +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { + name: "", + number: 0, + authnInfoProviderMethodFullname: "" + }; +} +export const SigningModeDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor", + aminoType: "cosmos-sdk/SigningModeDescriptor", + encode(message: SigningModeDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authnInfoProviderMethodFullname = object.authnInfoProviderMethodFullname ?? ""; + return message; + }, + fromAmino(object: SigningModeDescriptorAmino): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.authn_info_provider_method_fullname !== undefined && object.authn_info_provider_method_fullname !== null) { + message.authnInfoProviderMethodFullname = object.authn_info_provider_method_fullname; + } + return message; + }, + toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname === "" ? undefined : message.authnInfoProviderMethodFullname; + return obj; + }, + fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { + return SigningModeDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: SigningModeDescriptor): SigningModeDescriptorAminoMsg { + return { + type: "cosmos-sdk/SigningModeDescriptor", + value: SigningModeDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: SigningModeDescriptorProtoMsg): SigningModeDescriptor { + return SigningModeDescriptor.decode(message.value); + }, + toProto(message: SigningModeDescriptor): Uint8Array { + return SigningModeDescriptor.encode(message).finish(); + }, + toProtoMsg(message: SigningModeDescriptor): SigningModeDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor", + value: SigningModeDescriptor.encode(message).finish() + }; + } +}; +function createBaseChainDescriptor(): ChainDescriptor { + return { + id: "" + }; +} +export const ChainDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor", + aminoType: "cosmos-sdk/ChainDescriptor", + encode(message: ChainDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, + fromAmino(object: ChainDescriptorAmino): ChainDescriptor { + const message = createBaseChainDescriptor(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + return message; + }, + toAmino(message: ChainDescriptor): ChainDescriptorAmino { + const obj: any = {}; + obj.id = message.id === "" ? undefined : message.id; + return obj; + }, + fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { + return ChainDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: ChainDescriptor): ChainDescriptorAminoMsg { + return { + type: "cosmos-sdk/ChainDescriptor", + value: ChainDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: ChainDescriptorProtoMsg): ChainDescriptor { + return ChainDescriptor.decode(message.value); + }, + toProto(message: ChainDescriptor): Uint8Array { + return ChainDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ChainDescriptor): ChainDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.ChainDescriptor", + value: ChainDescriptor.encode(message).finish() + }; + } +}; +function createBaseCodecDescriptor(): CodecDescriptor { + return { + interfaces: [] + }; +} +export const CodecDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor", + aminoType: "cosmos-sdk/CodecDescriptor", + encode(message: CodecDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map(e => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CodecDescriptorAmino): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map(e => InterfaceDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: CodecDescriptor): CodecDescriptorAmino { + const obj: any = {}; + if (message.interfaces) { + obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toAmino(e) : undefined); + } else { + obj.interfaces = message.interfaces; + } + return obj; + }, + fromAminoMsg(object: CodecDescriptorAminoMsg): CodecDescriptor { + return CodecDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: CodecDescriptor): CodecDescriptorAminoMsg { + return { + type: "cosmos-sdk/CodecDescriptor", + value: CodecDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: CodecDescriptorProtoMsg): CodecDescriptor { + return CodecDescriptor.decode(message.value); + }, + toProto(message: CodecDescriptor): Uint8Array { + return CodecDescriptor.encode(message).finish(); + }, + toProtoMsg(message: CodecDescriptor): CodecDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.CodecDescriptor", + value: CodecDescriptor.encode(message).finish() + }; + } +}; +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { + fullname: "", + interfaceAcceptingMessages: [], + interfaceImplementers: [] + }; +} +export const InterfaceDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor", + aminoType: "cosmos-sdk/InterfaceDescriptor", + encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: InterfaceDescriptorAmino): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + message.interfaceAcceptingMessages = object.interface_accepting_messages?.map(e => InterfaceAcceptingMessageDescriptor.fromAmino(e)) || []; + message.interfaceImplementers = object.interface_implementers?.map(e => InterfaceImplementerDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + if (message.interfaceAcceptingMessages) { + obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); + } else { + obj.interface_accepting_messages = message.interfaceAcceptingMessages; + } + if (message.interfaceImplementers) { + obj.interface_implementers = message.interfaceImplementers.map(e => e ? InterfaceImplementerDescriptor.toAmino(e) : undefined); + } else { + obj.interface_implementers = message.interfaceImplementers; + } + return obj; + }, + fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { + return InterfaceDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: InterfaceDescriptor): InterfaceDescriptorAminoMsg { + return { + type: "cosmos-sdk/InterfaceDescriptor", + value: InterfaceDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: InterfaceDescriptorProtoMsg): InterfaceDescriptor { + return InterfaceDescriptor.decode(message.value); + }, + toProto(message: InterfaceDescriptor): Uint8Array { + return InterfaceDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceDescriptor): InterfaceDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor", + value: InterfaceDescriptor.encode(message).finish() + }; + } +}; +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { + fullname: "", + typeUrl: "" + }; +} +export const InterfaceImplementerDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", + aminoType: "cosmos-sdk/InterfaceImplementerDescriptor", + encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.typeUrl !== "") { + writer.uint32(18).string(message.typeUrl); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.typeUrl = object.typeUrl ?? ""; + return message; + }, + fromAmino(object: InterfaceImplementerDescriptorAmino): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + if (object.type_url !== undefined && object.type_url !== null) { + message.typeUrl = object.type_url; + } + return message; + }, + toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; + return obj; + }, + fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAminoMsg { + return { + type: "cosmos-sdk/InterfaceImplementerDescriptor", + value: InterfaceImplementerDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: InterfaceImplementerDescriptorProtoMsg): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.decode(message.value); + }, + toProto(message: InterfaceImplementerDescriptor): Uint8Array { + return InterfaceImplementerDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor", + value: InterfaceImplementerDescriptor.encode(message).finish() + }; + } +}; +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { + fullname: "", + fieldDescriptorNames: [] + }; +} +export const InterfaceAcceptingMessageDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", + aminoType: "cosmos-sdk/InterfaceAcceptingMessageDescriptor", + encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.fieldDescriptorNames) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.fieldDescriptorNames = object.fieldDescriptorNames?.map(e => e) || []; + return message; + }, + fromAmino(object: InterfaceAcceptingMessageDescriptorAmino): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + message.fieldDescriptorNames = object.field_descriptor_names?.map(e => e) || []; + return message; + }, + toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + if (message.fieldDescriptorNames) { + obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); + } else { + obj.field_descriptor_names = message.fieldDescriptorNames; + } + return obj; + }, + fromAminoMsg(object: InterfaceAcceptingMessageDescriptorAminoMsg): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAminoMsg { + return { + type: "cosmos-sdk/InterfaceAcceptingMessageDescriptor", + value: InterfaceAcceptingMessageDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: InterfaceAcceptingMessageDescriptorProtoMsg): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.decode(message.value); + }, + toProto(message: InterfaceAcceptingMessageDescriptor): Uint8Array { + return InterfaceAcceptingMessageDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor", + value: InterfaceAcceptingMessageDescriptor.encode(message).finish() + }; + } +}; +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { + bech32AccountAddressPrefix: "" + }; +} +export const ConfigurationDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", + aminoType: "cosmos-sdk/ConfigurationDescriptor", + encode(message: ConfigurationDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bech32AccountAddressPrefix !== "") { + writer.uint32(10).string(message.bech32AccountAddressPrefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32AccountAddressPrefix = object.bech32AccountAddressPrefix ?? ""; + return message; + }, + fromAmino(object: ConfigurationDescriptorAmino): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + if (object.bech32_account_address_prefix !== undefined && object.bech32_account_address_prefix !== null) { + message.bech32AccountAddressPrefix = object.bech32_account_address_prefix; + } + return message; + }, + toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { + const obj: any = {}; + obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix === "" ? undefined : message.bech32AccountAddressPrefix; + return obj; + }, + fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { + return ConfigurationDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: ConfigurationDescriptor): ConfigurationDescriptorAminoMsg { + return { + type: "cosmos-sdk/ConfigurationDescriptor", + value: ConfigurationDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: ConfigurationDescriptorProtoMsg): ConfigurationDescriptor { + return ConfigurationDescriptor.decode(message.value); + }, + toProto(message: ConfigurationDescriptor): Uint8Array { + return ConfigurationDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ConfigurationDescriptor): ConfigurationDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor", + value: ConfigurationDescriptor.encode(message).finish() + }; + } +}; +function createBaseMsgDescriptor(): MsgDescriptor { + return { + msgTypeUrl: "" + }; +} +export const MsgDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor", + aminoType: "cosmos-sdk/MsgDescriptor", + encode(message: MsgDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.msgTypeUrl !== "") { + writer.uint32(10).string(message.msgTypeUrl); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, + fromAmino(object: MsgDescriptorAmino): MsgDescriptor { + const message = createBaseMsgDescriptor(); + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + return message; + }, + toAmino(message: MsgDescriptor): MsgDescriptorAmino { + const obj: any = {}; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; + return obj; + }, + fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { + return MsgDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: MsgDescriptor): MsgDescriptorAminoMsg { + return { + type: "cosmos-sdk/MsgDescriptor", + value: MsgDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDescriptorProtoMsg): MsgDescriptor { + return MsgDescriptor.decode(message.value); + }, + toProto(message: MsgDescriptor): Uint8Array { + return MsgDescriptor.encode(message).finish(); + }, + toProtoMsg(message: MsgDescriptor): MsgDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.MsgDescriptor", + value: MsgDescriptor.encode(message).finish() + }; + } +}; +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} +export const GetAuthnDescriptorRequest = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", + aminoType: "cosmos-sdk/GetAuthnDescriptorRequest", + encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, + fromAmino(_: GetAuthnDescriptorRequestAmino): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, + toAmino(_: GetAuthnDescriptorRequest): GetAuthnDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetAuthnDescriptorRequestAminoMsg): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetAuthnDescriptorRequest): GetAuthnDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetAuthnDescriptorRequest", + value: GetAuthnDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetAuthnDescriptorRequestProtoMsg): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.decode(message.value); + }, + toProto(message: GetAuthnDescriptorRequest): Uint8Array { + return GetAuthnDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetAuthnDescriptorRequest): GetAuthnDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest", + value: GetAuthnDescriptorRequest.encode(message).finish() + }; + } +}; +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { + authn: undefined + }; +} +export const GetAuthnDescriptorResponse = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", + aminoType: "cosmos-sdk/GetAuthnDescriptorResponse", + encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): GetAuthnDescriptorResponse { + const message = createBaseGetAuthnDescriptorResponse(); + message.authn = object.authn !== undefined && object.authn !== null ? AuthnDescriptor.fromPartial(object.authn) : undefined; + return message; + }, + fromAmino(object: GetAuthnDescriptorResponseAmino): GetAuthnDescriptorResponse { + const message = createBaseGetAuthnDescriptorResponse(); + if (object.authn !== undefined && object.authn !== null) { + message.authn = AuthnDescriptor.fromAmino(object.authn); + } + return message; + }, + toAmino(message: GetAuthnDescriptorResponse): GetAuthnDescriptorResponseAmino { + const obj: any = {}; + obj.authn = message.authn ? AuthnDescriptor.toAmino(message.authn) : undefined; + return obj; + }, + fromAminoMsg(object: GetAuthnDescriptorResponseAminoMsg): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetAuthnDescriptorResponse): GetAuthnDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetAuthnDescriptorResponse", + value: GetAuthnDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetAuthnDescriptorResponseProtoMsg): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.decode(message.value); + }, + toProto(message: GetAuthnDescriptorResponse): Uint8Array { + return GetAuthnDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetAuthnDescriptorResponse): GetAuthnDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse", + value: GetAuthnDescriptorResponse.encode(message).finish() + }; + } +}; +function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { + return {}; +} +export const GetChainDescriptorRequest = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", + aminoType: "cosmos-sdk/GetChainDescriptorRequest", + encode(_: GetChainDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, + fromAmino(_: GetChainDescriptorRequestAmino): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, + toAmino(_: GetChainDescriptorRequest): GetChainDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetChainDescriptorRequestAminoMsg): GetChainDescriptorRequest { + return GetChainDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetChainDescriptorRequest): GetChainDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetChainDescriptorRequest", + value: GetChainDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetChainDescriptorRequestProtoMsg): GetChainDescriptorRequest { + return GetChainDescriptorRequest.decode(message.value); + }, + toProto(message: GetChainDescriptorRequest): Uint8Array { + return GetChainDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetChainDescriptorRequest): GetChainDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest", + value: GetChainDescriptorRequest.encode(message).finish() + }; + } +}; +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { + chain: undefined + }; +} +export const GetChainDescriptorResponse = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", + aminoType: "cosmos-sdk/GetChainDescriptorResponse", + encode(message: GetChainDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): GetChainDescriptorResponse { + const message = createBaseGetChainDescriptorResponse(); + message.chain = object.chain !== undefined && object.chain !== null ? ChainDescriptor.fromPartial(object.chain) : undefined; + return message; + }, + fromAmino(object: GetChainDescriptorResponseAmino): GetChainDescriptorResponse { + const message = createBaseGetChainDescriptorResponse(); + if (object.chain !== undefined && object.chain !== null) { + message.chain = ChainDescriptor.fromAmino(object.chain); + } + return message; + }, + toAmino(message: GetChainDescriptorResponse): GetChainDescriptorResponseAmino { + const obj: any = {}; + obj.chain = message.chain ? ChainDescriptor.toAmino(message.chain) : undefined; + return obj; + }, + fromAminoMsg(object: GetChainDescriptorResponseAminoMsg): GetChainDescriptorResponse { + return GetChainDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetChainDescriptorResponse): GetChainDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetChainDescriptorResponse", + value: GetChainDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetChainDescriptorResponseProtoMsg): GetChainDescriptorResponse { + return GetChainDescriptorResponse.decode(message.value); + }, + toProto(message: GetChainDescriptorResponse): Uint8Array { + return GetChainDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetChainDescriptorResponse): GetChainDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse", + value: GetChainDescriptorResponse.encode(message).finish() + }; + } +}; +function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { + return {}; +} +export const GetCodecDescriptorRequest = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", + aminoType: "cosmos-sdk/GetCodecDescriptorRequest", + encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, + fromAmino(_: GetCodecDescriptorRequestAmino): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, + toAmino(_: GetCodecDescriptorRequest): GetCodecDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetCodecDescriptorRequestAminoMsg): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetCodecDescriptorRequest): GetCodecDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetCodecDescriptorRequest", + value: GetCodecDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetCodecDescriptorRequestProtoMsg): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.decode(message.value); + }, + toProto(message: GetCodecDescriptorRequest): Uint8Array { + return GetCodecDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetCodecDescriptorRequest): GetCodecDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest", + value: GetCodecDescriptorRequest.encode(message).finish() + }; + } +}; +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { + codec: undefined + }; +} +export const GetCodecDescriptorResponse = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", + aminoType: "cosmos-sdk/GetCodecDescriptorResponse", + encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): GetCodecDescriptorResponse { + const message = createBaseGetCodecDescriptorResponse(); + message.codec = object.codec !== undefined && object.codec !== null ? CodecDescriptor.fromPartial(object.codec) : undefined; + return message; + }, + fromAmino(object: GetCodecDescriptorResponseAmino): GetCodecDescriptorResponse { + const message = createBaseGetCodecDescriptorResponse(); + if (object.codec !== undefined && object.codec !== null) { + message.codec = CodecDescriptor.fromAmino(object.codec); + } + return message; + }, + toAmino(message: GetCodecDescriptorResponse): GetCodecDescriptorResponseAmino { + const obj: any = {}; + obj.codec = message.codec ? CodecDescriptor.toAmino(message.codec) : undefined; + return obj; + }, + fromAminoMsg(object: GetCodecDescriptorResponseAminoMsg): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetCodecDescriptorResponse): GetCodecDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetCodecDescriptorResponse", + value: GetCodecDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetCodecDescriptorResponseProtoMsg): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.decode(message.value); + }, + toProto(message: GetCodecDescriptorResponse): Uint8Array { + return GetCodecDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetCodecDescriptorResponse): GetCodecDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse", + value: GetCodecDescriptorResponse.encode(message).finish() + }; + } +}; +function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescriptorRequest { + return {}; +} +export const GetConfigurationDescriptorRequest = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", + aminoType: "cosmos-sdk/GetConfigurationDescriptorRequest", + encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, + fromAmino(_: GetConfigurationDescriptorRequestAmino): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, + toAmino(_: GetConfigurationDescriptorRequest): GetConfigurationDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetConfigurationDescriptorRequestAminoMsg): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetConfigurationDescriptorRequest): GetConfigurationDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetConfigurationDescriptorRequest", + value: GetConfigurationDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetConfigurationDescriptorRequestProtoMsg): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.decode(message.value); + }, + toProto(message: GetConfigurationDescriptorRequest): Uint8Array { + return GetConfigurationDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetConfigurationDescriptorRequest): GetConfigurationDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest", + value: GetConfigurationDescriptorRequest.encode(message).finish() + }; + } +}; +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { + config: undefined + }; +} +export const GetConfigurationDescriptorResponse = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", + aminoType: "cosmos-sdk/GetConfigurationDescriptorResponse", + encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): GetConfigurationDescriptorResponse { + const message = createBaseGetConfigurationDescriptorResponse(); + message.config = object.config !== undefined && object.config !== null ? ConfigurationDescriptor.fromPartial(object.config) : undefined; + return message; + }, + fromAmino(object: GetConfigurationDescriptorResponseAmino): GetConfigurationDescriptorResponse { + const message = createBaseGetConfigurationDescriptorResponse(); + if (object.config !== undefined && object.config !== null) { + message.config = ConfigurationDescriptor.fromAmino(object.config); + } + return message; + }, + toAmino(message: GetConfigurationDescriptorResponse): GetConfigurationDescriptorResponseAmino { + const obj: any = {}; + obj.config = message.config ? ConfigurationDescriptor.toAmino(message.config) : undefined; + return obj; + }, + fromAminoMsg(object: GetConfigurationDescriptorResponseAminoMsg): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetConfigurationDescriptorResponse): GetConfigurationDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetConfigurationDescriptorResponse", + value: GetConfigurationDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetConfigurationDescriptorResponseProtoMsg): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.decode(message.value); + }, + toProto(message: GetConfigurationDescriptorResponse): Uint8Array { + return GetConfigurationDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetConfigurationDescriptorResponse): GetConfigurationDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse", + value: GetConfigurationDescriptorResponse.encode(message).finish() + }; + } +}; +function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescriptorRequest { + return {}; +} +export const GetQueryServicesDescriptorRequest = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", + aminoType: "cosmos-sdk/GetQueryServicesDescriptorRequest", + encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, + fromAmino(_: GetQueryServicesDescriptorRequestAmino): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, + toAmino(_: GetQueryServicesDescriptorRequest): GetQueryServicesDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetQueryServicesDescriptorRequestAminoMsg): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetQueryServicesDescriptorRequest): GetQueryServicesDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetQueryServicesDescriptorRequest", + value: GetQueryServicesDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetQueryServicesDescriptorRequestProtoMsg): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.decode(message.value); + }, + toProto(message: GetQueryServicesDescriptorRequest): Uint8Array { + return GetQueryServicesDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetQueryServicesDescriptorRequest): GetQueryServicesDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest", + value: GetQueryServicesDescriptorRequest.encode(message).finish() + }; + } +}; +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { + queries: undefined + }; +} +export const GetQueryServicesDescriptorResponse = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", + aminoType: "cosmos-sdk/GetQueryServicesDescriptorResponse", + encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetQueryServicesDescriptorResponse { + const message = createBaseGetQueryServicesDescriptorResponse(); + message.queries = object.queries !== undefined && object.queries !== null ? QueryServicesDescriptor.fromPartial(object.queries) : undefined; + return message; + }, + fromAmino(object: GetQueryServicesDescriptorResponseAmino): GetQueryServicesDescriptorResponse { + const message = createBaseGetQueryServicesDescriptorResponse(); + if (object.queries !== undefined && object.queries !== null) { + message.queries = QueryServicesDescriptor.fromAmino(object.queries); + } + return message; + }, + toAmino(message: GetQueryServicesDescriptorResponse): GetQueryServicesDescriptorResponseAmino { + const obj: any = {}; + obj.queries = message.queries ? QueryServicesDescriptor.toAmino(message.queries) : undefined; + return obj; + }, + fromAminoMsg(object: GetQueryServicesDescriptorResponseAminoMsg): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetQueryServicesDescriptorResponse): GetQueryServicesDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetQueryServicesDescriptorResponse", + value: GetQueryServicesDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetQueryServicesDescriptorResponseProtoMsg): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.decode(message.value); + }, + toProto(message: GetQueryServicesDescriptorResponse): Uint8Array { + return GetQueryServicesDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetQueryServicesDescriptorResponse): GetQueryServicesDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse", + value: GetQueryServicesDescriptorResponse.encode(message).finish() + }; + } +}; +function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { + return {}; +} +export const GetTxDescriptorRequest = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", + aminoType: "cosmos-sdk/GetTxDescriptorRequest", + encode(_: GetTxDescriptorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, + fromAmino(_: GetTxDescriptorRequestAmino): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, + toAmino(_: GetTxDescriptorRequest): GetTxDescriptorRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: GetTxDescriptorRequestAminoMsg): GetTxDescriptorRequest { + return GetTxDescriptorRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetTxDescriptorRequest): GetTxDescriptorRequestAminoMsg { + return { + type: "cosmos-sdk/GetTxDescriptorRequest", + value: GetTxDescriptorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxDescriptorRequestProtoMsg): GetTxDescriptorRequest { + return GetTxDescriptorRequest.decode(message.value); + }, + toProto(message: GetTxDescriptorRequest): Uint8Array { + return GetTxDescriptorRequest.encode(message).finish(); + }, + toProtoMsg(message: GetTxDescriptorRequest): GetTxDescriptorRequestProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest", + value: GetTxDescriptorRequest.encode(message).finish() + }; + } +}; +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { + tx: undefined + }; +} +export const GetTxDescriptorResponse = { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", + aminoType: "cosmos-sdk/GetTxDescriptorResponse", + encode(message: GetTxDescriptorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = TxDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxDescriptorResponse { + const message = createBaseGetTxDescriptorResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? TxDescriptor.fromPartial(object.tx) : undefined; + return message; + }, + fromAmino(object: GetTxDescriptorResponseAmino): GetTxDescriptorResponse { + const message = createBaseGetTxDescriptorResponse(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = TxDescriptor.fromAmino(object.tx); + } + return message; + }, + toAmino(message: GetTxDescriptorResponse): GetTxDescriptorResponseAmino { + const obj: any = {}; + obj.tx = message.tx ? TxDescriptor.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: GetTxDescriptorResponseAminoMsg): GetTxDescriptorResponse { + return GetTxDescriptorResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetTxDescriptorResponse): GetTxDescriptorResponseAminoMsg { + return { + type: "cosmos-sdk/GetTxDescriptorResponse", + value: GetTxDescriptorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxDescriptorResponseProtoMsg): GetTxDescriptorResponse { + return GetTxDescriptorResponse.decode(message.value); + }, + toProto(message: GetTxDescriptorResponse): Uint8Array { + return GetTxDescriptorResponse.encode(message).finish(); + }, + toProtoMsg(message: GetTxDescriptorResponse): GetTxDescriptorResponseProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse", + value: GetTxDescriptorResponse.encode(message).finish() + }; + } +}; +function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { + return { + queryServices: [] + }; +} +export const QueryServicesDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", + aminoType: "cosmos-sdk/QueryServicesDescriptor", + encode(message: QueryServicesDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.queryServices) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryServicesDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.queryServices.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.queryServices = object.queryServices?.map(e => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryServicesDescriptorAmino): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.queryServices = object.query_services?.map(e => QueryServiceDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryServicesDescriptor): QueryServicesDescriptorAmino { + const obj: any = {}; + if (message.queryServices) { + obj.query_services = message.queryServices.map(e => e ? QueryServiceDescriptor.toAmino(e) : undefined); + } else { + obj.query_services = message.queryServices; + } + return obj; + }, + fromAminoMsg(object: QueryServicesDescriptorAminoMsg): QueryServicesDescriptor { + return QueryServicesDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: QueryServicesDescriptor): QueryServicesDescriptorAminoMsg { + return { + type: "cosmos-sdk/QueryServicesDescriptor", + value: QueryServicesDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: QueryServicesDescriptorProtoMsg): QueryServicesDescriptor { + return QueryServicesDescriptor.decode(message.value); + }, + toProto(message: QueryServicesDescriptor): Uint8Array { + return QueryServicesDescriptor.encode(message).finish(); + }, + toProtoMsg(message: QueryServicesDescriptor): QueryServicesDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor", + value: QueryServicesDescriptor.encode(message).finish() + }; + } +}; +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { + fullname: "", + isModule: false, + methods: [] + }; +} +export const QueryServiceDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", + aminoType: "cosmos-sdk/QueryServiceDescriptor", + encode(message: QueryServiceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.isModule === true) { + writer.uint32(16).bool(message.isModule); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryServiceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullname = reader.string(); + break; + case 2: + message.isModule = reader.bool(); + break; + case 3: + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.isModule = object.isModule ?? false; + message.methods = object.methods?.map(e => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryServiceDescriptorAmino): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + if (object.fullname !== undefined && object.fullname !== null) { + message.fullname = object.fullname; + } + if (object.is_module !== undefined && object.is_module !== null) { + message.isModule = object.is_module; + } + message.methods = object.methods?.map(e => QueryMethodDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { + const obj: any = {}; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.is_module = message.isModule === false ? undefined : message.isModule; + if (message.methods) { + obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); + } else { + obj.methods = message.methods; + } + return obj; + }, + fromAminoMsg(object: QueryServiceDescriptorAminoMsg): QueryServiceDescriptor { + return QueryServiceDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: QueryServiceDescriptor): QueryServiceDescriptorAminoMsg { + return { + type: "cosmos-sdk/QueryServiceDescriptor", + value: QueryServiceDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: QueryServiceDescriptorProtoMsg): QueryServiceDescriptor { + return QueryServiceDescriptor.decode(message.value); + }, + toProto(message: QueryServiceDescriptor): Uint8Array { + return QueryServiceDescriptor.encode(message).finish(); + }, + toProtoMsg(message: QueryServiceDescriptor): QueryServiceDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor", + value: QueryServiceDescriptor.encode(message).finish() + }; + } +}; +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { + name: "", + fullQueryPath: "" + }; +} +export const QueryMethodDescriptor = { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", + aminoType: "cosmos-sdk/QueryMethodDescriptor", + encode(message: QueryMethodDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.fullQueryPath !== "") { + writer.uint32(18).string(message.fullQueryPath); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMethodDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.fullQueryPath = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.fullQueryPath = object.fullQueryPath ?? ""; + return message; + }, + fromAmino(object: QueryMethodDescriptorAmino): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.full_query_path !== undefined && object.full_query_path !== null) { + message.fullQueryPath = object.full_query_path; + } + return message; + }, + toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.full_query_path = message.fullQueryPath === "" ? undefined : message.fullQueryPath; + return obj; + }, + fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { + return QueryMethodDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: QueryMethodDescriptor): QueryMethodDescriptorAminoMsg { + return { + type: "cosmos-sdk/QueryMethodDescriptor", + value: QueryMethodDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: QueryMethodDescriptorProtoMsg): QueryMethodDescriptor { + return QueryMethodDescriptor.decode(message.value); + }, + toProto(message: QueryMethodDescriptor): Uint8Array { + return QueryMethodDescriptor.encode(message).finish(); + }, + toProtoMsg(message: QueryMethodDescriptor): QueryMethodDescriptorProtoMsg { + return { + typeUrl: "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor", + value: QueryMethodDescriptor.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/base/v1beta1/coin.ts b/util/inj-types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..5225ed75 --- /dev/null +++ b/util/inj-types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,422 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} +export interface CoinProtoMsg { + typeUrl: "/cosmos.base.v1beta1.Coin"; + value: Uint8Array; +} +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface CoinAmino { + denom?: string; + amount: string; +} +export interface CoinAminoMsg { + type: "cosmos-sdk/Coin"; + value: CoinAmino; +} +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface CoinSDKType { + denom: string; + amount: string; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} +export interface DecCoinProtoMsg { + typeUrl: "/cosmos.base.v1beta1.DecCoin"; + value: Uint8Array; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoinAmino { + denom?: string; + amount?: string; +} +export interface DecCoinAminoMsg { + type: "cosmos-sdk/DecCoin"; + value: DecCoinAmino; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoinSDKType { + denom: string; + amount: string; +} +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProto { + int: string; +} +export interface IntProtoProtoMsg { + typeUrl: "/cosmos.base.v1beta1.IntProto"; + value: Uint8Array; +} +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProtoAmino { + int?: string; +} +export interface IntProtoAminoMsg { + type: "cosmos-sdk/IntProto"; + value: IntProtoAmino; +} +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProtoSDKType { + int: string; +} +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProto { + dec: string; +} +export interface DecProtoProtoMsg { + typeUrl: "/cosmos.base.v1beta1.DecProto"; + value: Uint8Array; +} +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProtoAmino { + dec?: string; +} +export interface DecProtoAminoMsg { + type: "cosmos-sdk/DecProto"; + value: DecProtoAmino; +} +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProtoSDKType { + dec: string; +} +function createBaseCoin(): Coin { + return { + denom: "", + amount: "" + }; +} +export const Coin = { + typeUrl: "/cosmos.base.v1beta1.Coin", + aminoType: "cosmos-sdk/Coin", + encode(message: Coin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Coin { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, + fromAmino(object: CoinAmino): Coin { + const message = createBaseCoin(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + return message; + }, + toAmino(message: Coin): CoinAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount ?? ""; + return obj; + }, + fromAminoMsg(object: CoinAminoMsg): Coin { + return Coin.fromAmino(object.value); + }, + toAminoMsg(message: Coin): CoinAminoMsg { + return { + type: "cosmos-sdk/Coin", + value: Coin.toAmino(message) + }; + }, + fromProtoMsg(message: CoinProtoMsg): Coin { + return Coin.decode(message.value); + }, + toProto(message: Coin): Uint8Array { + return Coin.encode(message).finish(); + }, + toProtoMsg(message: Coin): CoinProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.Coin", + value: Coin.encode(message).finish() + }; + } +}; +function createBaseDecCoin(): DecCoin { + return { + denom: "", + amount: "" + }; +} +export const DecCoin = { + typeUrl: "/cosmos.base.v1beta1.DecCoin", + aminoType: "cosmos-sdk/DecCoin", + encode(message: DecCoin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DecCoin { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, + fromAmino(object: DecCoinAmino): DecCoin { + const message = createBaseDecCoin(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + return message; + }, + toAmino(message: DecCoin): DecCoinAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + return obj; + }, + fromAminoMsg(object: DecCoinAminoMsg): DecCoin { + return DecCoin.fromAmino(object.value); + }, + toAminoMsg(message: DecCoin): DecCoinAminoMsg { + return { + type: "cosmos-sdk/DecCoin", + value: DecCoin.toAmino(message) + }; + }, + fromProtoMsg(message: DecCoinProtoMsg): DecCoin { + return DecCoin.decode(message.value); + }, + toProto(message: DecCoin): Uint8Array { + return DecCoin.encode(message).finish(); + }, + toProtoMsg(message: DecCoin): DecCoinProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.DecCoin", + value: DecCoin.encode(message).finish() + }; + } +}; +function createBaseIntProto(): IntProto { + return { + int: "" + }; +} +export const IntProto = { + typeUrl: "/cosmos.base.v1beta1.IntProto", + aminoType: "cosmos-sdk/IntProto", + encode(message: IntProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.int = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IntProto { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, + fromAmino(object: IntProtoAmino): IntProto { + const message = createBaseIntProto(); + if (object.int !== undefined && object.int !== null) { + message.int = object.int; + } + return message; + }, + toAmino(message: IntProto): IntProtoAmino { + const obj: any = {}; + obj.int = message.int === "" ? undefined : message.int; + return obj; + }, + fromAminoMsg(object: IntProtoAminoMsg): IntProto { + return IntProto.fromAmino(object.value); + }, + toAminoMsg(message: IntProto): IntProtoAminoMsg { + return { + type: "cosmos-sdk/IntProto", + value: IntProto.toAmino(message) + }; + }, + fromProtoMsg(message: IntProtoProtoMsg): IntProto { + return IntProto.decode(message.value); + }, + toProto(message: IntProto): Uint8Array { + return IntProto.encode(message).finish(); + }, + toProtoMsg(message: IntProto): IntProtoProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.IntProto", + value: IntProto.encode(message).finish() + }; + } +}; +function createBaseDecProto(): DecProto { + return { + dec: "" + }; +} +export const DecProto = { + typeUrl: "/cosmos.base.v1beta1.DecProto", + aminoType: "cosmos-sdk/DecProto", + encode(message: DecProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dec = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DecProto { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, + fromAmino(object: DecProtoAmino): DecProto { + const message = createBaseDecProto(); + if (object.dec !== undefined && object.dec !== null) { + message.dec = object.dec; + } + return message; + }, + toAmino(message: DecProto): DecProtoAmino { + const obj: any = {}; + obj.dec = message.dec === "" ? undefined : message.dec; + return obj; + }, + fromAminoMsg(object: DecProtoAminoMsg): DecProto { + return DecProto.fromAmino(object.value); + }, + toAminoMsg(message: DecProto): DecProtoAminoMsg { + return { + type: "cosmos-sdk/DecProto", + value: DecProto.toAmino(message) + }; + }, + fromProtoMsg(message: DecProtoProtoMsg): DecProto { + return DecProto.decode(message.value); + }, + toProto(message: DecProto): Uint8Array { + return DecProto.encode(message).finish(); + }, + toProtoMsg(message: DecProto): DecProtoProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.DecProto", + value: DecProto.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/bundle.ts b/util/inj-types/cosmos/bundle.ts new file mode 100644 index 00000000..5a457525 --- /dev/null +++ b/util/inj-types/cosmos/bundle.ts @@ -0,0 +1,552 @@ +import * as _2 from "./app/runtime/v1alpha1/module"; +import * as _3 from "./auth/module/v1/module"; +import * as _4 from "./auth/v1beta1/auth"; +import * as _5 from "./auth/v1beta1/genesis"; +import * as _6 from "./auth/v1beta1/query"; +import * as _7 from "./auth/v1beta1/tx"; +import * as _8 from "./authz/module/v1/module"; +import * as _9 from "./authz/v1beta1/authz"; +import * as _10 from "./authz/v1beta1/event"; +import * as _11 from "./authz/v1beta1/genesis"; +import * as _12 from "./authz/v1beta1/query"; +import * as _13 from "./authz/v1beta1/tx"; +import * as _14 from "./bank/module/v1/module"; +import * as _15 from "./bank/v1beta1/authz"; +import * as _16 from "./bank/v1beta1/bank"; +import * as _17 from "./bank/v1beta1/events"; +import * as _18 from "./bank/v1beta1/genesis"; +import * as _19 from "./bank/v1beta1/query"; +import * as _20 from "./bank/v1beta1/tx"; +import * as _21 from "./base/abci/v1beta1/abci"; +import * as _22 from "./base/node/v1beta1/query"; +import * as _23 from "./base/query/v1beta1/pagination"; +import * as _24 from "./base/reflection/v2alpha1/reflection"; +import * as _25 from "./base/v1beta1/coin"; +import * as _26 from "./capability/module/v1/module"; +import * as _27 from "./consensus/module/v1/module"; +import * as _28 from "./consensus/v1/query"; +import * as _29 from "./consensus/v1/tx"; +import * as _30 from "./crisis/module/v1/module"; +import * as _31 from "./crypto/ed25519/keys"; +import * as _32 from "./crypto/hd/v1/hd"; +import * as _33 from "./crypto/keyring/v1/record"; +import * as _34 from "./crypto/multisig/keys"; +import * as _35 from "./crypto/secp256k1/keys"; +import * as _36 from "./crypto/secp256r1/keys"; +import * as _37 from "./distribution/module/v1/module"; +import * as _38 from "./distribution/v1beta1/distribution"; +import * as _39 from "./distribution/v1beta1/genesis"; +import * as _40 from "./distribution/v1beta1/query"; +import * as _41 from "./distribution/v1beta1/tx"; +import * as _42 from "./evidence/module/v1/module"; +import * as _43 from "./feegrant/module/v1/module"; +import * as _44 from "./feegrant/v1beta1/feegrant"; +import * as _45 from "./feegrant/v1beta1/genesis"; +import * as _46 from "./feegrant/v1beta1/query"; +import * as _47 from "./feegrant/v1beta1/tx"; +import * as _48 from "./genutil/module/v1/module"; +import * as _49 from "./gov/module/v1/module"; +import * as _50 from "./gov/v1/genesis"; +import * as _51 from "./gov/v1/gov"; +import * as _52 from "./gov/v1/query"; +import * as _53 from "./gov/v1/tx"; +import * as _54 from "./gov/v1beta1/genesis"; +import * as _55 from "./gov/v1beta1/gov"; +import * as _56 from "./gov/v1beta1/query"; +import * as _57 from "./gov/v1beta1/tx"; +import * as _58 from "./group/module/v1/module"; +import * as _59 from "./group/v1/events"; +import * as _60 from "./group/v1/genesis"; +import * as _61 from "./group/v1/query"; +import * as _62 from "./group/v1/tx"; +import * as _63 from "./group/v1/types"; +import * as _64 from "./ics23/v1/proofs"; +import * as _65 from "./mint/module/v1/module"; +import * as _66 from "./mint/v1beta1/genesis"; +import * as _67 from "./mint/v1beta1/mint"; +import * as _68 from "./mint/v1beta1/query"; +import * as _69 from "./mint/v1beta1/tx"; +import * as _70 from "./nft/module/v1/module"; +import * as _71 from "./orm/module/v1alpha1/module"; +import * as _72 from "./orm/query/v1alpha1/query"; +import * as _73 from "./params/module/v1/module"; +import * as _74 from "./params/v1beta1/params"; +import * as _75 from "./params/v1beta1/query"; +import * as _76 from "./query/v1/query"; +import * as _77 from "./reflection/v1/reflection"; +import * as _78 from "./slashing/module/v1/module"; +import * as _79 from "./staking/module/v1/module"; +import * as _80 from "./staking/v1beta1/authz"; +import * as _81 from "./staking/v1beta1/genesis"; +import * as _82 from "./staking/v1beta1/query"; +import * as _83 from "./staking/v1beta1/staking"; +import * as _84 from "./staking/v1beta1/tx"; +import * as _85 from "./tx/config/v1/config"; +import * as _86 from "./tx/signing/v1beta1/signing"; +import * as _87 from "./tx/v1beta1/service"; +import * as _88 from "./tx/v1beta1/tx"; +import * as _89 from "./upgrade/module/v1/module"; +import * as _90 from "./upgrade/v1beta1/query"; +import * as _91 from "./upgrade/v1beta1/tx"; +import * as _92 from "./upgrade/v1beta1/upgrade"; +import * as _93 from "./vesting/module/v1/module"; +import * as _94 from "./vesting/v1beta1/tx"; +import * as _95 from "./vesting/v1beta1/vesting"; +import * as _164 from "./auth/v1beta1/tx.amino"; +import * as _165 from "./bank/v1beta1/tx.amino"; +import * as _166 from "./consensus/v1/tx.amino"; +import * as _167 from "./distribution/v1beta1/tx.amino"; +import * as _168 from "./feegrant/v1beta1/tx.amino"; +import * as _169 from "./gov/v1/tx.amino"; +import * as _170 from "./gov/v1beta1/tx.amino"; +import * as _171 from "./group/v1/tx.amino"; +import * as _172 from "./mint/v1beta1/tx.amino"; +import * as _173 from "./staking/v1beta1/tx.amino"; +import * as _174 from "./upgrade/v1beta1/tx.amino"; +import * as _175 from "./vesting/v1beta1/tx.amino"; +import * as _176 from "./auth/v1beta1/tx.registry"; +import * as _177 from "./bank/v1beta1/tx.registry"; +import * as _178 from "./consensus/v1/tx.registry"; +import * as _179 from "./distribution/v1beta1/tx.registry"; +import * as _180 from "./feegrant/v1beta1/tx.registry"; +import * as _181 from "./gov/v1/tx.registry"; +import * as _182 from "./gov/v1beta1/tx.registry"; +import * as _183 from "./group/v1/tx.registry"; +import * as _184 from "./mint/v1beta1/tx.registry"; +import * as _185 from "./staking/v1beta1/tx.registry"; +import * as _186 from "./upgrade/v1beta1/tx.registry"; +import * as _187 from "./vesting/v1beta1/tx.registry"; +import * as _188 from "./auth/v1beta1/query.lcd"; +import * as _189 from "./authz/v1beta1/query.lcd"; +import * as _190 from "./bank/v1beta1/query.lcd"; +import * as _191 from "./base/node/v1beta1/query.lcd"; +import * as _192 from "./consensus/v1/query.lcd"; +import * as _193 from "./distribution/v1beta1/query.lcd"; +import * as _194 from "./feegrant/v1beta1/query.lcd"; +import * as _195 from "./gov/v1/query.lcd"; +import * as _196 from "./gov/v1beta1/query.lcd"; +import * as _197 from "./group/v1/query.lcd"; +import * as _198 from "./mint/v1beta1/query.lcd"; +import * as _199 from "./params/v1beta1/query.lcd"; +import * as _200 from "./staking/v1beta1/query.lcd"; +import * as _201 from "./tx/v1beta1/service.lcd"; +import * as _202 from "./upgrade/v1beta1/query.lcd"; +import * as _203 from "./auth/v1beta1/query.rpc.Query"; +import * as _204 from "./authz/v1beta1/query.rpc.Query"; +import * as _205 from "./bank/v1beta1/query.rpc.Query"; +import * as _206 from "./base/node/v1beta1/query.rpc.Service"; +import * as _207 from "./consensus/v1/query.rpc.Query"; +import * as _208 from "./distribution/v1beta1/query.rpc.Query"; +import * as _209 from "./feegrant/v1beta1/query.rpc.Query"; +import * as _210 from "./gov/v1/query.rpc.Query"; +import * as _211 from "./gov/v1beta1/query.rpc.Query"; +import * as _212 from "./group/v1/query.rpc.Query"; +import * as _213 from "./mint/v1beta1/query.rpc.Query"; +import * as _214 from "./orm/query/v1alpha1/query.rpc.Query"; +import * as _215 from "./params/v1beta1/query.rpc.Query"; +import * as _216 from "./staking/v1beta1/query.rpc.Query"; +import * as _217 from "./tx/v1beta1/service.rpc.Service"; +import * as _218 from "./upgrade/v1beta1/query.rpc.Query"; +import * as _219 from "./auth/v1beta1/tx.rpc.msg"; +import * as _220 from "./authz/v1beta1/tx.rpc.msg"; +import * as _221 from "./bank/v1beta1/tx.rpc.msg"; +import * as _222 from "./consensus/v1/tx.rpc.msg"; +import * as _223 from "./distribution/v1beta1/tx.rpc.msg"; +import * as _224 from "./feegrant/v1beta1/tx.rpc.msg"; +import * as _225 from "./gov/v1/tx.rpc.msg"; +import * as _226 from "./gov/v1beta1/tx.rpc.msg"; +import * as _227 from "./group/v1/tx.rpc.msg"; +import * as _228 from "./mint/v1beta1/tx.rpc.msg"; +import * as _229 from "./staking/v1beta1/tx.rpc.msg"; +import * as _230 from "./upgrade/v1beta1/tx.rpc.msg"; +import * as _231 from "./vesting/v1beta1/tx.rpc.msg"; +import * as _265 from "./rpc.query"; +import * as _266 from "./rpc.tx"; +export namespace cosmos { + export namespace app { + export namespace runtime { + export const v1alpha1 = { + ..._2 + }; + } + } + export namespace auth { + export namespace module { + export const v1 = { + ..._3 + }; + } + export const v1beta1 = { + ..._4, + ..._5, + ..._6, + ..._7, + ..._164, + ..._176, + ..._188, + ..._203, + ..._219 + }; + } + export namespace authz { + export namespace module { + export const v1 = { + ..._8 + }; + } + export const v1beta1 = { + ..._9, + ..._10, + ..._11, + ..._12, + ..._13, + ..._189, + ..._204, + ..._220 + }; + } + export namespace bank { + export namespace module { + export const v1 = { + ..._14 + }; + } + export const v1beta1 = { + ..._15, + ..._16, + ..._17, + ..._18, + ..._19, + ..._20, + ..._165, + ..._177, + ..._190, + ..._205, + ..._221 + }; + } + export namespace base { + export namespace abci { + export const v1beta1 = { + ..._21 + }; + } + export namespace node { + export const v1beta1 = { + ..._22, + ..._191, + ..._206 + }; + } + export namespace query { + export const v1beta1 = { + ..._23 + }; + } + export namespace reflection { + export const v2alpha1 = { + ..._24 + }; + } + export const v1beta1 = { + ..._25 + }; + } + export namespace capability { + export namespace module { + export const v1 = { + ..._26 + }; + } + } + export namespace consensus { + export namespace module { + export const v1 = { + ..._27 + }; + } + export const v1 = { + ..._28, + ..._29, + ..._166, + ..._178, + ..._192, + ..._207, + ..._222 + }; + } + export namespace crisis { + export namespace module { + export const v1 = { + ..._30 + }; + } + } + export namespace crypto { + export const ed25519 = { + ..._31 + }; + export namespace hd { + export const v1 = { + ..._32 + }; + } + export namespace keyring { + export const v1 = { + ..._33 + }; + } + export const multisig = { + ..._34 + }; + export const secp256k1 = { + ..._35 + }; + export const secp256r1 = { + ..._36 + }; + } + export namespace distribution { + export namespace module { + export const v1 = { + ..._37 + }; + } + export const v1beta1 = { + ..._38, + ..._39, + ..._40, + ..._41, + ..._167, + ..._179, + ..._193, + ..._208, + ..._223 + }; + } + export namespace evidence { + export namespace module { + export const v1 = { + ..._42 + }; + } + } + export namespace feegrant { + export namespace module { + export const v1 = { + ..._43 + }; + } + export const v1beta1 = { + ..._44, + ..._45, + ..._46, + ..._47, + ..._168, + ..._180, + ..._194, + ..._209, + ..._224 + }; + } + export namespace genutil { + export namespace module { + export const v1 = { + ..._48 + }; + } + } + export namespace gov { + export namespace module { + export const v1 = { + ..._49 + }; + } + export const v1 = { + ..._50, + ..._51, + ..._52, + ..._53, + ..._169, + ..._181, + ..._195, + ..._210, + ..._225 + }; + export const v1beta1 = { + ..._54, + ..._55, + ..._56, + ..._57, + ..._170, + ..._182, + ..._196, + ..._211, + ..._226 + }; + } + export namespace group { + export namespace module { + export const v1 = { + ..._58 + }; + } + export const v1 = { + ..._59, + ..._60, + ..._61, + ..._62, + ..._63, + ..._171, + ..._183, + ..._197, + ..._212, + ..._227 + }; + } + export namespace ics23 { + export const v1 = { + ..._64 + }; + } + export namespace mint { + export namespace module { + export const v1 = { + ..._65 + }; + } + export const v1beta1 = { + ..._66, + ..._67, + ..._68, + ..._69, + ..._172, + ..._184, + ..._198, + ..._213, + ..._228 + }; + } + export namespace nft { + export namespace module { + export const v1 = { + ..._70 + }; + } + } + export namespace orm { + export namespace module { + export const v1alpha1 = { + ..._71 + }; + } + export namespace query { + export const v1alpha1 = { + ..._72, + ..._214 + }; + } + } + export namespace params { + export namespace module { + export const v1 = { + ..._73 + }; + } + export const v1beta1 = { + ..._74, + ..._75, + ..._199, + ..._215 + }; + } + export namespace query { + export const v1 = { + ..._76 + }; + } + export namespace reflection { + export const v1 = { + ..._77 + }; + } + export namespace slashing { + export namespace module { + export const v1 = { + ..._78 + }; + } + } + export namespace staking { + export namespace module { + export const v1 = { + ..._79 + }; + } + export const v1beta1 = { + ..._80, + ..._81, + ..._82, + ..._83, + ..._84, + ..._173, + ..._185, + ..._200, + ..._216, + ..._229 + }; + } + export namespace tx { + export namespace config { + export const v1 = { + ..._85 + }; + } + export namespace signing { + export const v1beta1 = { + ..._86 + }; + } + export const v1beta1 = { + ..._87, + ..._88, + ..._201, + ..._217 + }; + } + export namespace upgrade { + export namespace module { + export const v1 = { + ..._89 + }; + } + export const v1beta1 = { + ..._90, + ..._91, + ..._92, + ..._174, + ..._186, + ..._202, + ..._218, + ..._230 + }; + } + export namespace vesting { + export namespace module { + export const v1 = { + ..._93 + }; + } + export const v1beta1 = { + ..._94, + ..._95, + ..._175, + ..._187, + ..._231 + }; + } + export const ClientFactory = { + ..._265, + ..._266 + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/capability/module/v1/module.ts b/util/inj-types/cosmos/capability/module/v1/module.ts new file mode 100644 index 00000000..0058dc28 --- /dev/null +++ b/util/inj-types/cosmos/capability/module/v1/module.ts @@ -0,0 +1,100 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the capability module. */ +export interface Module { + /** + * seal_keeper defines if keeper.Seal() will run on BeginBlock() to prevent further modules from creating a scoped + * keeper. For more details check x/capability/keeper.go. + */ + sealKeeper: boolean; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.capability.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the capability module. */ +export interface ModuleAmino { + /** + * seal_keeper defines if keeper.Seal() will run on BeginBlock() to prevent further modules from creating a scoped + * keeper. For more details check x/capability/keeper.go. + */ + seal_keeper?: boolean; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the capability module. */ +export interface ModuleSDKType { + seal_keeper: boolean; +} +function createBaseModule(): Module { + return { + sealKeeper: false + }; +} +export const Module = { + typeUrl: "/cosmos.capability.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sealKeeper === true) { + writer.uint32(8).bool(message.sealKeeper); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sealKeeper = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.sealKeeper = object.sealKeeper ?? false; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.seal_keeper !== undefined && object.seal_keeper !== null) { + message.sealKeeper = object.seal_keeper; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.seal_keeper = message.sealKeeper === false ? undefined : message.sealKeeper; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.capability.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/client.ts b/util/inj-types/cosmos/client.ts new file mode 100644 index 00000000..80a9b7fe --- /dev/null +++ b/util/inj-types/cosmos/client.ts @@ -0,0 +1,72 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as cosmosAuthV1beta1TxRegistry from "./auth/v1beta1/tx.registry"; +import * as cosmosBankV1beta1TxRegistry from "./bank/v1beta1/tx.registry"; +import * as cosmosConsensusV1TxRegistry from "./consensus/v1/tx.registry"; +import * as cosmosDistributionV1beta1TxRegistry from "./distribution/v1beta1/tx.registry"; +import * as cosmosFeegrantV1beta1TxRegistry from "./feegrant/v1beta1/tx.registry"; +import * as cosmosGovV1TxRegistry from "./gov/v1/tx.registry"; +import * as cosmosGovV1beta1TxRegistry from "./gov/v1beta1/tx.registry"; +import * as cosmosGroupV1TxRegistry from "./group/v1/tx.registry"; +import * as cosmosMintV1beta1TxRegistry from "./mint/v1beta1/tx.registry"; +import * as cosmosStakingV1beta1TxRegistry from "./staking/v1beta1/tx.registry"; +import * as cosmosUpgradeV1beta1TxRegistry from "./upgrade/v1beta1/tx.registry"; +import * as cosmosVestingV1beta1TxRegistry from "./vesting/v1beta1/tx.registry"; +import * as cosmosAuthV1beta1TxAmino from "./auth/v1beta1/tx.amino"; +import * as cosmosBankV1beta1TxAmino from "./bank/v1beta1/tx.amino"; +import * as cosmosConsensusV1TxAmino from "./consensus/v1/tx.amino"; +import * as cosmosDistributionV1beta1TxAmino from "./distribution/v1beta1/tx.amino"; +import * as cosmosFeegrantV1beta1TxAmino from "./feegrant/v1beta1/tx.amino"; +import * as cosmosGovV1TxAmino from "./gov/v1/tx.amino"; +import * as cosmosGovV1beta1TxAmino from "./gov/v1beta1/tx.amino"; +import * as cosmosGroupV1TxAmino from "./group/v1/tx.amino"; +import * as cosmosMintV1beta1TxAmino from "./mint/v1beta1/tx.amino"; +import * as cosmosStakingV1beta1TxAmino from "./staking/v1beta1/tx.amino"; +import * as cosmosUpgradeV1beta1TxAmino from "./upgrade/v1beta1/tx.amino"; +import * as cosmosVestingV1beta1TxAmino from "./vesting/v1beta1/tx.amino"; +export const cosmosAminoConverters = { + ...cosmosAuthV1beta1TxAmino.AminoConverter, + ...cosmosBankV1beta1TxAmino.AminoConverter, + ...cosmosConsensusV1TxAmino.AminoConverter, + ...cosmosDistributionV1beta1TxAmino.AminoConverter, + ...cosmosFeegrantV1beta1TxAmino.AminoConverter, + ...cosmosGovV1TxAmino.AminoConverter, + ...cosmosGovV1beta1TxAmino.AminoConverter, + ...cosmosGroupV1TxAmino.AminoConverter, + ...cosmosMintV1beta1TxAmino.AminoConverter, + ...cosmosStakingV1beta1TxAmino.AminoConverter, + ...cosmosUpgradeV1beta1TxAmino.AminoConverter, + ...cosmosVestingV1beta1TxAmino.AminoConverter +}; +export const cosmosProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...cosmosAuthV1beta1TxRegistry.registry, ...cosmosBankV1beta1TxRegistry.registry, ...cosmosConsensusV1TxRegistry.registry, ...cosmosDistributionV1beta1TxRegistry.registry, ...cosmosFeegrantV1beta1TxRegistry.registry, ...cosmosGovV1TxRegistry.registry, ...cosmosGovV1beta1TxRegistry.registry, ...cosmosGroupV1TxRegistry.registry, ...cosmosMintV1beta1TxRegistry.registry, ...cosmosStakingV1beta1TxRegistry.registry, ...cosmosUpgradeV1beta1TxRegistry.registry, ...cosmosVestingV1beta1TxRegistry.registry]; +export const getSigningCosmosClientOptions = (): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...cosmosProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...cosmosAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningCosmosClient = async ({ + rpcEndpoint, + signer +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; +}) => { + const { + registry, + aminoTypes + } = getSigningCosmosClientOptions(); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/consensus/module/v1/module.ts b/util/inj-types/cosmos/consensus/module/v1/module.ts new file mode 100644 index 00000000..256077c7 --- /dev/null +++ b/util/inj-types/cosmos/consensus/module/v1/module.ts @@ -0,0 +1,94 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the consensus module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.consensus.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the consensus module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the consensus module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.consensus.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.consensus.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/consensus/v1/query.lcd.ts b/util/inj-types/cosmos/consensus/v1/query.lcd.ts new file mode 100644 index 00000000..143e9287 --- /dev/null +++ b/util/inj-types/cosmos/consensus/v1/query.lcd.ts @@ -0,0 +1,17 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Params queries the parameters of x/consensus_param module. */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `cosmos/consensus/v1/params`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/consensus/v1/query.rpc.Query.ts b/util/inj-types/cosmos/consensus/v1/query.rpc.Query.ts new file mode 100644 index 00000000..2ce74693 --- /dev/null +++ b/util/inj-types/cosmos/consensus/v1/query.rpc.Query.ts @@ -0,0 +1,30 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParamsRequest, QueryParamsResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/consensus_param module. */ + params(request?: QueryParamsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Params queries the parameters of x/consensus_param module. */ + params = async (request: QueryParamsRequest = {}): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.consensus.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/consensus/v1/query.ts b/util/inj-types/cosmos/consensus/v1/query.ts new file mode 100644 index 00000000..f5ee03ca --- /dev/null +++ b/util/inj-types/cosmos/consensus/v1/query.ts @@ -0,0 +1,174 @@ +import { ConsensusParams, ConsensusParamsAmino, ConsensusParamsSDKType } from "../../../tendermint/types/params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.consensus.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest defines the request type for querying x/consensus parameters. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponse { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params?: ConsensusParams; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.consensus.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponseAmino { + /** + * params are the tendermint consensus params stored in the consensus module. + * Please note that `params.version` is not populated in this response, it is + * tracked separately in the x/upgrade module. + */ + params?: ConsensusParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse defines the response type for querying x/consensus parameters. */ +export interface QueryParamsResponseSDKType { + params?: ConsensusParamsSDKType; +} +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.consensus.v1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.consensus.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.consensus.v1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + ConsensusParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 = ConsensusParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? ConsensusParams.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = ConsensusParams.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? ConsensusParams.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.consensus.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/consensus/v1/tx.amino.ts b/util/inj-types/cosmos/consensus/v1/tx.amino.ts new file mode 100644 index 00000000..e261b250 --- /dev/null +++ b/util/inj-types/cosmos/consensus/v1/tx.amino.ts @@ -0,0 +1,8 @@ +import { MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.consensus.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/consensus/v1/tx.registry.ts b/util/inj-types/cosmos/consensus/v1/tx.registry.ts new file mode 100644 index 00000000..5dd24e11 --- /dev/null +++ b/util/inj-types/cosmos/consensus/v1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.consensus.v1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/consensus/v1/tx.rpc.msg.ts b/util/inj-types/cosmos/consensus/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..bf702cbe --- /dev/null +++ b/util/inj-types/cosmos/consensus/v1/tx.rpc.msg.ts @@ -0,0 +1,28 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the bank Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/consensus_param module parameters. + * The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* UpdateParams defines a governance operation for updating the x/consensus_param module parameters. + The authority is defined in the keeper. + + Since: cosmos-sdk 0.47 */ + updateParams = async (request: MsgUpdateParams): Promise => { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.consensus.v1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/consensus/v1/tx.ts b/util/inj-types/cosmos/consensus/v1/tx.ts new file mode 100644 index 00000000..2431e877 --- /dev/null +++ b/util/inj-types/cosmos/consensus/v1/tx.ts @@ -0,0 +1,234 @@ +import { BlockParams, BlockParamsAmino, BlockParamsSDKType, EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType } from "../../../tendermint/types/params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/consensus parameters to update. + * VersionsParams is not included in this Msg because it is tracked + * separarately in x/upgrade. + * + * NOTE: All parameters must be supplied. + */ + block?: BlockParamsAmino; + evidence?: EvidenceParamsAmino; + validator?: ValidatorParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsSDKType { + authority: string; + block?: BlockParamsSDKType; + evidence?: EvidenceParamsSDKType; + validator?: ValidatorParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + block: undefined, + evidence: undefined, + validator: undefined + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + aminoType: "cosmos-sdk/MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(18).fork()).ldelim(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(26).fork()).ldelim(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.block = BlockParams.decode(reader, reader.uint32()); + break; + case 3: + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + break; + case 4: + message.validator = ValidatorParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.block = object.block !== undefined && object.block !== null ? BlockParams.fromPartial(object.block) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; + message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.block !== undefined && object.block !== null) { + message.block = BlockParams.fromAmino(object.block); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceParams.fromAmino(object.evidence); + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = ValidatorParams.fromAmino(object.validator); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.block = message.block ? BlockParams.toAmino(message.block) : undefined; + obj.evidence = message.evidence ? EvidenceParams.toAmino(message.evidence) : undefined; + obj.validator = message.validator ? ValidatorParams.toAmino(message.validator) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.consensus.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/crisis/module/v1/module.ts b/util/inj-types/cosmos/crisis/module/v1/module.ts new file mode 100644 index 00000000..80859c52 --- /dev/null +++ b/util/inj-types/cosmos/crisis/module/v1/module.ts @@ -0,0 +1,111 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the crisis module. */ +export interface Module { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.crisis.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the crisis module. */ +export interface ModuleAmino { + /** fee_collector_name is the name of the FeeCollector ModuleAccount. */ + fee_collector_name?: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the crisis module. */ +export interface ModuleSDKType { + fee_collector_name: string; + authority: string; +} +function createBaseModule(): Module { + return { + feeCollectorName: "", + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.crisis.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.feeCollectorName = reader.string(); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.fee_collector_name !== undefined && object.fee_collector_name !== null) { + message.feeCollectorName = object.fee_collector_name; + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.fee_collector_name = message.feeCollectorName === "" ? undefined : message.feeCollectorName; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.crisis.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/crypto/ed25519/keys.ts b/util/inj-types/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..c1f7ebf0 --- /dev/null +++ b/util/inj-types/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,209 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** + * PubKey is an ed25519 public key for handling Tendermint keys in SDK. + * It's needed for Any serialization and SDK compatibility. + * It must not be used in a non Tendermint key context because it doesn't implement + * ADR-28. Nevertheless, you will like to use ed25519 in app user level + * then you must create a new proto message and follow ADR-28 for Address construction. + */ +export interface PubKey { + key: Uint8Array; +} +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.ed25519.PubKey"; + value: Uint8Array; +} +/** + * PubKey is an ed25519 public key for handling Tendermint keys in SDK. + * It's needed for Any serialization and SDK compatibility. + * It must not be used in a non Tendermint key context because it doesn't implement + * ADR-28. Nevertheless, you will like to use ed25519 in app user level + * then you must create a new proto message and follow ADR-28 for Address construction. + */ +export interface PubKeyAmino { + key?: string; +} +export interface PubKeyAminoMsg { + type: "tendermint/PubKeyEd25519"; + value: PubKeyAmino; +} +/** + * PubKey is an ed25519 public key for handling Tendermint keys in SDK. + * It's needed for Any serialization and SDK compatibility. + * It must not be used in a non Tendermint key context because it doesn't implement + * ADR-28. Nevertheless, you will like to use ed25519 in app user level + * then you must create a new proto message and follow ADR-28 for Address construction. + */ +export interface PubKeySDKType { + key: Uint8Array; +} +/** + * Deprecated: PrivKey defines a ed25519 private key. + * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. + */ +export interface PrivKey { + key: Uint8Array; +} +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.ed25519.PrivKey"; + value: Uint8Array; +} +/** + * Deprecated: PrivKey defines a ed25519 private key. + * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. + */ +export interface PrivKeyAmino { + key?: string; +} +export interface PrivKeyAminoMsg { + type: "tendermint/PrivKeyEd25519"; + value: PrivKeyAmino; +} +/** + * Deprecated: PrivKey defines a ed25519 private key. + * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. + */ +export interface PrivKeySDKType { + key: Uint8Array; +} +function createBasePubKey(): PubKey { + return { + key: new Uint8Array() + }; +} +export const PubKey = { + typeUrl: "/cosmos.crypto.ed25519.PubKey", + aminoType: "tendermint/PubKeyEd25519", + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "tendermint/PubKeyEd25519", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.ed25519.PubKey", + value: PubKey.encode(message).finish() + }; + } +}; +function createBasePrivKey(): PrivKey { + return { + key: new Uint8Array() + }; +} +export const PrivKey = { + typeUrl: "/cosmos.crypto.ed25519.PrivKey", + aminoType: "tendermint/PrivKeyEd25519", + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "tendermint/PrivKeyEd25519", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.ed25519.PrivKey", + value: PrivKey.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/crypto/hd/v1/hd.ts b/util/inj-types/cosmos/crypto/hd/v1/hd.ts new file mode 100644 index 00000000..075bfe49 --- /dev/null +++ b/util/inj-types/cosmos/crypto/hd/v1/hd.ts @@ -0,0 +1,168 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** BIP44Params is used as path field in ledger item in Record. */ +export interface BIP44Params { + /** purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation */ + purpose: number; + /** coin_type is a constant that improves privacy */ + coinType: number; + /** account splits the key space into independent user identities */ + account: number; + /** + * change is a constant used for public derivation. Constant 0 is used for external chain and constant 1 for internal + * chain. + */ + change: boolean; + /** address_index is used as child index in BIP32 derivation */ + addressIndex: number; +} +export interface BIP44ParamsProtoMsg { + typeUrl: "/cosmos.crypto.hd.v1.BIP44Params"; + value: Uint8Array; +} +/** BIP44Params is used as path field in ledger item in Record. */ +export interface BIP44ParamsAmino { + /** purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation */ + purpose?: number; + /** coin_type is a constant that improves privacy */ + coin_type?: number; + /** account splits the key space into independent user identities */ + account?: number; + /** + * change is a constant used for public derivation. Constant 0 is used for external chain and constant 1 for internal + * chain. + */ + change?: boolean; + /** address_index is used as child index in BIP32 derivation */ + address_index?: number; +} +export interface BIP44ParamsAminoMsg { + type: "crypto/keys/hd/BIP44Params"; + value: BIP44ParamsAmino; +} +/** BIP44Params is used as path field in ledger item in Record. */ +export interface BIP44ParamsSDKType { + purpose: number; + coin_type: number; + account: number; + change: boolean; + address_index: number; +} +function createBaseBIP44Params(): BIP44Params { + return { + purpose: 0, + coinType: 0, + account: 0, + change: false, + addressIndex: 0 + }; +} +export const BIP44Params = { + typeUrl: "/cosmos.crypto.hd.v1.BIP44Params", + aminoType: "crypto/keys/hd/BIP44Params", + encode(message: BIP44Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.purpose !== 0) { + writer.uint32(8).uint32(message.purpose); + } + if (message.coinType !== 0) { + writer.uint32(16).uint32(message.coinType); + } + if (message.account !== 0) { + writer.uint32(24).uint32(message.account); + } + if (message.change === true) { + writer.uint32(32).bool(message.change); + } + if (message.addressIndex !== 0) { + writer.uint32(40).uint32(message.addressIndex); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BIP44Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBIP44Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.purpose = reader.uint32(); + break; + case 2: + message.coinType = reader.uint32(); + break; + case 3: + message.account = reader.uint32(); + break; + case 4: + message.change = reader.bool(); + break; + case 5: + message.addressIndex = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BIP44Params { + const message = createBaseBIP44Params(); + message.purpose = object.purpose ?? 0; + message.coinType = object.coinType ?? 0; + message.account = object.account ?? 0; + message.change = object.change ?? false; + message.addressIndex = object.addressIndex ?? 0; + return message; + }, + fromAmino(object: BIP44ParamsAmino): BIP44Params { + const message = createBaseBIP44Params(); + if (object.purpose !== undefined && object.purpose !== null) { + message.purpose = object.purpose; + } + if (object.coin_type !== undefined && object.coin_type !== null) { + message.coinType = object.coin_type; + } + if (object.account !== undefined && object.account !== null) { + message.account = object.account; + } + if (object.change !== undefined && object.change !== null) { + message.change = object.change; + } + if (object.address_index !== undefined && object.address_index !== null) { + message.addressIndex = object.address_index; + } + return message; + }, + toAmino(message: BIP44Params): BIP44ParamsAmino { + const obj: any = {}; + obj.purpose = message.purpose === 0 ? undefined : message.purpose; + obj.coin_type = message.coinType === 0 ? undefined : message.coinType; + obj.account = message.account === 0 ? undefined : message.account; + obj.change = message.change === false ? undefined : message.change; + obj.address_index = message.addressIndex === 0 ? undefined : message.addressIndex; + return obj; + }, + fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { + return BIP44Params.fromAmino(object.value); + }, + toAminoMsg(message: BIP44Params): BIP44ParamsAminoMsg { + return { + type: "crypto/keys/hd/BIP44Params", + value: BIP44Params.toAmino(message) + }; + }, + fromProtoMsg(message: BIP44ParamsProtoMsg): BIP44Params { + return BIP44Params.decode(message.value); + }, + toProto(message: BIP44Params): Uint8Array { + return BIP44Params.encode(message).finish(); + }, + toProtoMsg(message: BIP44Params): BIP44ParamsProtoMsg { + return { + typeUrl: "/cosmos.crypto.hd.v1.BIP44Params", + value: BIP44Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/crypto/keyring/v1/record.ts b/util/inj-types/cosmos/crypto/keyring/v1/record.ts new file mode 100644 index 00000000..658d86d6 --- /dev/null +++ b/util/inj-types/cosmos/crypto/keyring/v1/record.ts @@ -0,0 +1,512 @@ +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BIP44Params, BIP44ParamsAmino, BIP44ParamsSDKType } from "../../hd/v1/hd"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Record is used for representing a key in the keyring. */ +export interface Record { + /** name represents a name of Record */ + name: string; + /** pub_key represents a public key in any format */ + pubKey?: Any; + /** local stores the private key locally. */ + local?: Record_Local; + /** ledger stores the information about a Ledger key. */ + ledger?: Record_Ledger; + /** Multi does not store any other information. */ + multi?: Record_Multi; + /** Offline does not store any other information. */ + offline?: Record_Offline; +} +export interface RecordProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Record"; + value: Uint8Array; +} +/** Record is used for representing a key in the keyring. */ +export interface RecordAmino { + /** name represents a name of Record */ + name?: string; + /** pub_key represents a public key in any format */ + pub_key?: AnyAmino; + /** local stores the private key locally. */ + local?: Record_LocalAmino; + /** ledger stores the information about a Ledger key. */ + ledger?: Record_LedgerAmino; + /** Multi does not store any other information. */ + multi?: Record_MultiAmino; + /** Offline does not store any other information. */ + offline?: Record_OfflineAmino; +} +export interface RecordAminoMsg { + type: "cosmos-sdk/Record"; + value: RecordAmino; +} +/** Record is used for representing a key in the keyring. */ +export interface RecordSDKType { + name: string; + pub_key?: AnySDKType; + local?: Record_LocalSDKType; + ledger?: Record_LedgerSDKType; + multi?: Record_MultiSDKType; + offline?: Record_OfflineSDKType; +} +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_Local { + privKey?: Any; +} +export interface Record_LocalProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Local"; + value: Uint8Array; +} +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_LocalAmino { + priv_key?: AnyAmino; +} +export interface Record_LocalAminoMsg { + type: "cosmos-sdk/Local"; + value: Record_LocalAmino; +} +/** + * Item is a keyring item stored in a keyring backend. + * Local item + */ +export interface Record_LocalSDKType { + priv_key?: AnySDKType; +} +/** Ledger item */ +export interface Record_Ledger { + path?: BIP44Params; +} +export interface Record_LedgerProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Ledger"; + value: Uint8Array; +} +/** Ledger item */ +export interface Record_LedgerAmino { + path?: BIP44ParamsAmino; +} +export interface Record_LedgerAminoMsg { + type: "cosmos-sdk/Ledger"; + value: Record_LedgerAmino; +} +/** Ledger item */ +export interface Record_LedgerSDKType { + path?: BIP44ParamsSDKType; +} +/** Multi item */ +export interface Record_Multi {} +export interface Record_MultiProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Multi"; + value: Uint8Array; +} +/** Multi item */ +export interface Record_MultiAmino {} +export interface Record_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: Record_MultiAmino; +} +/** Multi item */ +export interface Record_MultiSDKType {} +/** Offline item */ +export interface Record_Offline {} +export interface Record_OfflineProtoMsg { + typeUrl: "/cosmos.crypto.keyring.v1.Offline"; + value: Uint8Array; +} +/** Offline item */ +export interface Record_OfflineAmino {} +export interface Record_OfflineAminoMsg { + type: "cosmos-sdk/Offline"; + value: Record_OfflineAmino; +} +/** Offline item */ +export interface Record_OfflineSDKType {} +function createBaseRecord(): Record { + return { + name: "", + pubKey: undefined, + local: undefined, + ledger: undefined, + multi: undefined, + offline: undefined + }; +} +export const Record = { + typeUrl: "/cosmos.crypto.keyring.v1.Record", + aminoType: "cosmos-sdk/Record", + encode(message: Record, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (message.local !== undefined) { + Record_Local.encode(message.local, writer.uint32(26).fork()).ldelim(); + } + if (message.ledger !== undefined) { + Record_Ledger.encode(message.ledger, writer.uint32(34).fork()).ldelim(); + } + if (message.multi !== undefined) { + Record_Multi.encode(message.multi, writer.uint32(42).fork()).ldelim(); + } + if (message.offline !== undefined) { + Record_Offline.encode(message.offline, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Record { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.pubKey = Any.decode(reader, reader.uint32()); + break; + case 3: + message.local = Record_Local.decode(reader, reader.uint32()); + break; + case 4: + message.ledger = Record_Ledger.decode(reader, reader.uint32()); + break; + case 5: + message.multi = Record_Multi.decode(reader, reader.uint32()); + break; + case 6: + message.offline = Record_Offline.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Record { + const message = createBaseRecord(); + message.name = object.name ?? ""; + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? Any.fromPartial(object.pubKey) : undefined; + message.local = object.local !== undefined && object.local !== null ? Record_Local.fromPartial(object.local) : undefined; + message.ledger = object.ledger !== undefined && object.ledger !== null ? Record_Ledger.fromPartial(object.ledger) : undefined; + message.multi = object.multi !== undefined && object.multi !== null ? Record_Multi.fromPartial(object.multi) : undefined; + message.offline = object.offline !== undefined && object.offline !== null ? Record_Offline.fromPartial(object.offline) : undefined; + return message; + }, + fromAmino(object: RecordAmino): Record { + const message = createBaseRecord(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = Any.fromAmino(object.pub_key); + } + if (object.local !== undefined && object.local !== null) { + message.local = Record_Local.fromAmino(object.local); + } + if (object.ledger !== undefined && object.ledger !== null) { + message.ledger = Record_Ledger.fromAmino(object.ledger); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = Record_Multi.fromAmino(object.multi); + } + if (object.offline !== undefined && object.offline !== null) { + message.offline = Record_Offline.fromAmino(object.offline); + } + return message; + }, + toAmino(message: Record): RecordAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; + obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; + obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; + obj.multi = message.multi ? Record_Multi.toAmino(message.multi) : undefined; + obj.offline = message.offline ? Record_Offline.toAmino(message.offline) : undefined; + return obj; + }, + fromAminoMsg(object: RecordAminoMsg): Record { + return Record.fromAmino(object.value); + }, + toAminoMsg(message: Record): RecordAminoMsg { + return { + type: "cosmos-sdk/Record", + value: Record.toAmino(message) + }; + }, + fromProtoMsg(message: RecordProtoMsg): Record { + return Record.decode(message.value); + }, + toProto(message: Record): Uint8Array { + return Record.encode(message).finish(); + }, + toProtoMsg(message: Record): RecordProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Record", + value: Record.encode(message).finish() + }; + } +}; +function createBaseRecord_Local(): Record_Local { + return { + privKey: undefined + }; +} +export const Record_Local = { + typeUrl: "/cosmos.crypto.keyring.v1.Local", + aminoType: "cosmos-sdk/Local", + encode(message: Record_Local, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.privKey !== undefined) { + Any.encode(message.privKey, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Record_Local { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Local(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.privKey = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Record_Local { + const message = createBaseRecord_Local(); + message.privKey = object.privKey !== undefined && object.privKey !== null ? Any.fromPartial(object.privKey) : undefined; + return message; + }, + fromAmino(object: Record_LocalAmino): Record_Local { + const message = createBaseRecord_Local(); + if (object.priv_key !== undefined && object.priv_key !== null) { + message.privKey = Any.fromAmino(object.priv_key); + } + return message; + }, + toAmino(message: Record_Local): Record_LocalAmino { + const obj: any = {}; + obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; + return obj; + }, + fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { + return Record_Local.fromAmino(object.value); + }, + toAminoMsg(message: Record_Local): Record_LocalAminoMsg { + return { + type: "cosmos-sdk/Local", + value: Record_Local.toAmino(message) + }; + }, + fromProtoMsg(message: Record_LocalProtoMsg): Record_Local { + return Record_Local.decode(message.value); + }, + toProto(message: Record_Local): Uint8Array { + return Record_Local.encode(message).finish(); + }, + toProtoMsg(message: Record_Local): Record_LocalProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Local", + value: Record_Local.encode(message).finish() + }; + } +}; +function createBaseRecord_Ledger(): Record_Ledger { + return { + path: undefined + }; +} +export const Record_Ledger = { + typeUrl: "/cosmos.crypto.keyring.v1.Ledger", + aminoType: "cosmos-sdk/Ledger", + encode(message: Record_Ledger, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path !== undefined) { + BIP44Params.encode(message.path, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Record_Ledger { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Ledger(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = BIP44Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Record_Ledger { + const message = createBaseRecord_Ledger(); + message.path = object.path !== undefined && object.path !== null ? BIP44Params.fromPartial(object.path) : undefined; + return message; + }, + fromAmino(object: Record_LedgerAmino): Record_Ledger { + const message = createBaseRecord_Ledger(); + if (object.path !== undefined && object.path !== null) { + message.path = BIP44Params.fromAmino(object.path); + } + return message; + }, + toAmino(message: Record_Ledger): Record_LedgerAmino { + const obj: any = {}; + obj.path = message.path ? BIP44Params.toAmino(message.path) : undefined; + return obj; + }, + fromAminoMsg(object: Record_LedgerAminoMsg): Record_Ledger { + return Record_Ledger.fromAmino(object.value); + }, + toAminoMsg(message: Record_Ledger): Record_LedgerAminoMsg { + return { + type: "cosmos-sdk/Ledger", + value: Record_Ledger.toAmino(message) + }; + }, + fromProtoMsg(message: Record_LedgerProtoMsg): Record_Ledger { + return Record_Ledger.decode(message.value); + }, + toProto(message: Record_Ledger): Uint8Array { + return Record_Ledger.encode(message).finish(); + }, + toProtoMsg(message: Record_Ledger): Record_LedgerProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Ledger", + value: Record_Ledger.encode(message).finish() + }; + } +}; +function createBaseRecord_Multi(): Record_Multi { + return {}; +} +export const Record_Multi = { + typeUrl: "/cosmos.crypto.keyring.v1.Multi", + aminoType: "cosmos-sdk/Multi", + encode(_: Record_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Record_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, + fromAmino(_: Record_MultiAmino): Record_Multi { + const message = createBaseRecord_Multi(); + return message; + }, + toAmino(_: Record_Multi): Record_MultiAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: Record_MultiAminoMsg): Record_Multi { + return Record_Multi.fromAmino(object.value); + }, + toAminoMsg(message: Record_Multi): Record_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: Record_Multi.toAmino(message) + }; + }, + fromProtoMsg(message: Record_MultiProtoMsg): Record_Multi { + return Record_Multi.decode(message.value); + }, + toProto(message: Record_Multi): Uint8Array { + return Record_Multi.encode(message).finish(); + }, + toProtoMsg(message: Record_Multi): Record_MultiProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Multi", + value: Record_Multi.encode(message).finish() + }; + } +}; +function createBaseRecord_Offline(): Record_Offline { + return {}; +} +export const Record_Offline = { + typeUrl: "/cosmos.crypto.keyring.v1.Offline", + aminoType: "cosmos-sdk/Offline", + encode(_: Record_Offline, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Record_Offline { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecord_Offline(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Record_Offline { + const message = createBaseRecord_Offline(); + return message; + }, + fromAmino(_: Record_OfflineAmino): Record_Offline { + const message = createBaseRecord_Offline(); + return message; + }, + toAmino(_: Record_Offline): Record_OfflineAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: Record_OfflineAminoMsg): Record_Offline { + return Record_Offline.fromAmino(object.value); + }, + toAminoMsg(message: Record_Offline): Record_OfflineAminoMsg { + return { + type: "cosmos-sdk/Offline", + value: Record_Offline.toAmino(message) + }; + }, + fromProtoMsg(message: Record_OfflineProtoMsg): Record_Offline { + return Record_Offline.decode(message.value); + }, + toProto(message: Record_Offline): Uint8Array { + return Record_Offline.encode(message).finish(); + }, + toProtoMsg(message: Record_Offline): Record_OfflineProtoMsg { + return { + typeUrl: "/cosmos.crypto.keyring.v1.Offline", + value: Record_Offline.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/crypto/multisig/keys.ts b/util/inj-types/cosmos/crypto/multisig/keys.ts new file mode 100644 index 00000000..535a473a --- /dev/null +++ b/util/inj-types/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,122 @@ +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * LegacyAminoPubKey specifies a public key type + * which nests multiple public keys and a threshold, + * it uses legacy amino address rules. + */ +export interface LegacyAminoPubKey { + threshold: number; + publicKeys: Any[]; +} +export interface LegacyAminoPubKeyProtoMsg { + typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey"; + value: Uint8Array; +} +/** + * LegacyAminoPubKey specifies a public key type + * which nests multiple public keys and a threshold, + * it uses legacy amino address rules. + */ +export interface LegacyAminoPubKeyAmino { + threshold?: number; + public_keys?: AnyAmino[]; +} +export interface LegacyAminoPubKeyAminoMsg { + type: "tendermint/PubKeyMultisigThreshold"; + value: LegacyAminoPubKeyAmino; +} +/** + * LegacyAminoPubKey specifies a public key type + * which nests multiple public keys and a threshold, + * it uses legacy amino address rules. + */ +export interface LegacyAminoPubKeySDKType { + threshold: number; + public_keys: AnySDKType[]; +} +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { + threshold: 0, + publicKeys: [] + }; +} +export const LegacyAminoPubKey = { + typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", + aminoType: "tendermint/PubKeyMultisigThreshold", + encode(message: LegacyAminoPubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.publicKeys) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyAminoPubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.threshold = reader.uint32(); + break; + case 2: + message.publicKeys.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.publicKeys = object.publicKeys?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: LegacyAminoPubKeyAmino): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + message.publicKeys = object.public_keys?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { + const obj: any = {}; + obj.threshold = message.threshold === 0 ? undefined : message.threshold; + if (message.publicKeys) { + obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.public_keys = message.publicKeys; + } + return obj; + }, + fromAminoMsg(object: LegacyAminoPubKeyAminoMsg): LegacyAminoPubKey { + return LegacyAminoPubKey.fromAmino(object.value); + }, + toAminoMsg(message: LegacyAminoPubKey): LegacyAminoPubKeyAminoMsg { + return { + type: "tendermint/PubKeyMultisigThreshold", + value: LegacyAminoPubKey.toAmino(message) + }; + }, + fromProtoMsg(message: LegacyAminoPubKeyProtoMsg): LegacyAminoPubKey { + return LegacyAminoPubKey.decode(message.value); + }, + toProto(message: LegacyAminoPubKey): Uint8Array { + return LegacyAminoPubKey.encode(message).finish(); + }, + toProtoMsg(message: LegacyAminoPubKey): LegacyAminoPubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.LegacyAminoPubKey", + value: LegacyAminoPubKey.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/crypto/multisig/v1beta1/multisig.ts b/util/inj-types/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..427f6d54 --- /dev/null +++ b/util/inj-types/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,226 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. + */ +export interface MultiSignature { + signatures: Uint8Array[]; +} +export interface MultiSignatureProtoMsg { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature"; + value: Uint8Array; +} +/** + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. + */ +export interface MultiSignatureAmino { + signatures?: string[]; +} +export interface MultiSignatureAminoMsg { + type: "cosmos-sdk/MultiSignature"; + value: MultiSignatureAmino; +} +/** + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. + */ +export interface MultiSignatureSDKType { + signatures: Uint8Array[]; +} +/** + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. + */ +export interface CompactBitArray { + extraBitsStored: number; + elems: Uint8Array; +} +export interface CompactBitArrayProtoMsg { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray"; + value: Uint8Array; +} +/** + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. + */ +export interface CompactBitArrayAmino { + extra_bits_stored?: number; + elems?: string; +} +export interface CompactBitArrayAminoMsg { + type: "cosmos-sdk/CompactBitArray"; + value: CompactBitArrayAmino; +} +/** + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. + */ +export interface CompactBitArraySDKType { + extra_bits_stored: number; + elems: Uint8Array; +} +function createBaseMultiSignature(): MultiSignature { + return { + signatures: [] + }; +} +export const MultiSignature = { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", + aminoType: "cosmos-sdk/MultiSignature", + encode(message: MultiSignature, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map(e => e) || []; + return message; + }, + fromAmino(object: MultiSignatureAmino): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MultiSignature): MultiSignatureAmino { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: MultiSignatureAminoMsg): MultiSignature { + return MultiSignature.fromAmino(object.value); + }, + toAminoMsg(message: MultiSignature): MultiSignatureAminoMsg { + return { + type: "cosmos-sdk/MultiSignature", + value: MultiSignature.toAmino(message) + }; + }, + fromProtoMsg(message: MultiSignatureProtoMsg): MultiSignature { + return MultiSignature.decode(message.value); + }, + toProto(message: MultiSignature): Uint8Array { + return MultiSignature.encode(message).finish(); + }, + toProtoMsg(message: MultiSignature): MultiSignatureProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", + value: MultiSignature.encode(message).finish() + }; + } +}; +function createBaseCompactBitArray(): CompactBitArray { + return { + extraBitsStored: 0, + elems: new Uint8Array() + }; +} +export const CompactBitArray = { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", + aminoType: "cosmos-sdk/CompactBitArray", + encode(message: CompactBitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.extraBitsStored = reader.uint32(); + break; + case 2: + message.elems = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extraBitsStored = object.extraBitsStored ?? 0; + message.elems = object.elems ?? new Uint8Array(); + return message; + }, + fromAmino(object: CompactBitArrayAmino): CompactBitArray { + const message = createBaseCompactBitArray(); + if (object.extra_bits_stored !== undefined && object.extra_bits_stored !== null) { + message.extraBitsStored = object.extra_bits_stored; + } + if (object.elems !== undefined && object.elems !== null) { + message.elems = bytesFromBase64(object.elems); + } + return message; + }, + toAmino(message: CompactBitArray): CompactBitArrayAmino { + const obj: any = {}; + obj.extra_bits_stored = message.extraBitsStored === 0 ? undefined : message.extraBitsStored; + obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; + return obj; + }, + fromAminoMsg(object: CompactBitArrayAminoMsg): CompactBitArray { + return CompactBitArray.fromAmino(object.value); + }, + toAminoMsg(message: CompactBitArray): CompactBitArrayAminoMsg { + return { + type: "cosmos-sdk/CompactBitArray", + value: CompactBitArray.toAmino(message) + }; + }, + fromProtoMsg(message: CompactBitArrayProtoMsg): CompactBitArray { + return CompactBitArray.decode(message.value); + }, + toProto(message: CompactBitArray): Uint8Array { + return CompactBitArray.encode(message).finish(); + }, + toProtoMsg(message: CompactBitArray): CompactBitArrayProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", + value: CompactBitArray.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/crypto/secp256k1/keys.ts b/util/inj-types/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..71a88579 --- /dev/null +++ b/util/inj-types/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,200 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** + * PubKey defines a secp256k1 public key + * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte + * if the y-coordinate is the lexicographically largest of the two associated with + * the x-coordinate. Otherwise the first byte is a 0x03. + * This prefix is followed with the x-coordinate. + */ +export interface PubKey { + key: Uint8Array; +} +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256k1.PubKey"; + value: Uint8Array; +} +/** + * PubKey defines a secp256k1 public key + * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte + * if the y-coordinate is the lexicographically largest of the two associated with + * the x-coordinate. Otherwise the first byte is a 0x03. + * This prefix is followed with the x-coordinate. + */ +export interface PubKeyAmino { + key?: string; +} +export interface PubKeyAminoMsg { + type: "tendermint/PubKeySecp256k1"; + value: PubKeyAmino; +} +/** + * PubKey defines a secp256k1 public key + * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte + * if the y-coordinate is the lexicographically largest of the two associated with + * the x-coordinate. Otherwise the first byte is a 0x03. + * This prefix is followed with the x-coordinate. + */ +export interface PubKeySDKType { + key: Uint8Array; +} +/** PrivKey defines a secp256k1 private key. */ +export interface PrivKey { + key: Uint8Array; +} +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey"; + value: Uint8Array; +} +/** PrivKey defines a secp256k1 private key. */ +export interface PrivKeyAmino { + key?: string; +} +export interface PrivKeyAminoMsg { + type: "tendermint/PrivKeySecp256k1"; + value: PrivKeyAmino; +} +/** PrivKey defines a secp256k1 private key. */ +export interface PrivKeySDKType { + key: Uint8Array; +} +function createBasePubKey(): PubKey { + return { + key: new Uint8Array() + }; +} +export const PubKey = { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + aminoType: "tendermint/PubKeySecp256k1", + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "tendermint/PubKeySecp256k1", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: PubKey.encode(message).finish() + }; + } +}; +function createBasePrivKey(): PrivKey { + return { + key: new Uint8Array() + }; +} +export const PrivKey = { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey", + aminoType: "tendermint/PrivKeySecp256k1", + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "tendermint/PrivKeySecp256k1", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey", + value: PrivKey.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/crypto/secp256r1/keys.ts b/util/inj-types/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..c7346a47 --- /dev/null +++ b/util/inj-types/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,192 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** PubKey defines a secp256r1 ECDSA public key. */ +export interface PubKey { + /** + * Point on secp256r1 curve in a compressed representation as specified in section + * 4.3.6 of ANSI X9.62: https://webstore.ansi.org/standards/ascx9/ansix9621998 + */ + key: Uint8Array; +} +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256r1.PubKey"; + value: Uint8Array; +} +/** PubKey defines a secp256r1 ECDSA public key. */ +export interface PubKeyAmino { + /** + * Point on secp256r1 curve in a compressed representation as specified in section + * 4.3.6 of ANSI X9.62: https://webstore.ansi.org/standards/ascx9/ansix9621998 + */ + key?: string; +} +export interface PubKeyAminoMsg { + type: "cosmos-sdk/PubKey"; + value: PubKeyAmino; +} +/** PubKey defines a secp256r1 ECDSA public key. */ +export interface PubKeySDKType { + key: Uint8Array; +} +/** PrivKey defines a secp256r1 ECDSA private key. */ +export interface PrivKey { + /** secret number serialized using big-endian encoding */ + secret: Uint8Array; +} +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey"; + value: Uint8Array; +} +/** PrivKey defines a secp256r1 ECDSA private key. */ +export interface PrivKeyAmino { + /** secret number serialized using big-endian encoding */ + secret?: string; +} +export interface PrivKeyAminoMsg { + type: "cosmos-sdk/PrivKey"; + value: PrivKeyAmino; +} +/** PrivKey defines a secp256r1 ECDSA private key. */ +export interface PrivKeySDKType { + secret: Uint8Array; +} +function createBasePubKey(): PubKey { + return { + key: new Uint8Array() + }; +} +export const PubKey = { + typeUrl: "/cosmos.crypto.secp256r1.PubKey", + aminoType: "cosmos-sdk/PubKey", + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "cosmos-sdk/PubKey", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256r1.PubKey", + value: PubKey.encode(message).finish() + }; + } +}; +function createBasePrivKey(): PrivKey { + return { + secret: new Uint8Array() + }; +} +export const PrivKey = { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey", + aminoType: "cosmos-sdk/PrivKey", + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.secret = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(); + return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.secret !== undefined && object.secret !== null) { + message.secret = bytesFromBase64(object.secret); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.secret = message.secret ? base64FromBytes(message.secret) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "cosmos-sdk/PrivKey", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey", + value: PrivKey.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/module/v1/module.ts b/util/inj-types/cosmos/distribution/module/v1/module.ts new file mode 100644 index 00000000..830c08eb --- /dev/null +++ b/util/inj-types/cosmos/distribution/module/v1/module.ts @@ -0,0 +1,109 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the distribution module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.distribution.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the distribution module. */ +export interface ModuleAmino { + fee_collector_name?: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the distribution module. */ +export interface ModuleSDKType { + fee_collector_name: string; + authority: string; +} +function createBaseModule(): Module { + return { + feeCollectorName: "", + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.distribution.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.feeCollectorName = reader.string(); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.fee_collector_name !== undefined && object.fee_collector_name !== null) { + message.feeCollectorName = object.fee_collector_name; + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.fee_collector_name = message.feeCollectorName === "" ? undefined : message.feeCollectorName; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.distribution.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/distribution.ts b/util/inj-types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..86051f83 --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1521 @@ +import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { DeepPartial } from "../../../helpers"; +/** Params defines the set of params for the distribution module. */ +export interface Params { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the set of params for the distribution module. */ +export interface ParamsAmino { + community_tax?: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + base_proposer_reward?: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + bonus_proposer_reward?: string; + withdraw_addr_enabled?: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/distribution/Params"; + value: ParamsAmino; +} +/** Params defines the set of params for the distribution module. */ +export interface ParamsSDKType { + community_tax: string; + /** @deprecated */ + base_proposer_reward: string; + /** @deprecated */ + bonus_proposer_reward: string; + withdraw_addr_enabled: boolean; +} +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} +export interface ValidatorHistoricalRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards"; + value: Uint8Array; +} +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewardsAmino { + cumulative_reward_ratio: DecCoinAmino[]; + reference_count?: number; +} +export interface ValidatorHistoricalRewardsAminoMsg { + type: "cosmos-sdk/ValidatorHistoricalRewards"; + value: ValidatorHistoricalRewardsAmino; +} +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewardsSDKType { + cumulative_reward_ratio: DecCoinSDKType[]; + reference_count: number; +} +/** + * ValidatorCurrentRewards represents current rewards and current + * period for a validator kept as a running counter and incremented + * each block as long as the validator's tokens remain constant. + */ +export interface ValidatorCurrentRewards { + rewards: DecCoin[]; + period: bigint; +} +export interface ValidatorCurrentRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards"; + value: Uint8Array; +} +/** + * ValidatorCurrentRewards represents current rewards and current + * period for a validator kept as a running counter and incremented + * each block as long as the validator's tokens remain constant. + */ +export interface ValidatorCurrentRewardsAmino { + rewards: DecCoinAmino[]; + period?: string; +} +export interface ValidatorCurrentRewardsAminoMsg { + type: "cosmos-sdk/ValidatorCurrentRewards"; + value: ValidatorCurrentRewardsAmino; +} +/** + * ValidatorCurrentRewards represents current rewards and current + * period for a validator kept as a running counter and incremented + * each block as long as the validator's tokens remain constant. + */ +export interface ValidatorCurrentRewardsSDKType { + rewards: DecCoinSDKType[]; + period: bigint; +} +/** + * ValidatorAccumulatedCommission represents accumulated commission + * for a validator kept as a running counter, can be withdrawn at any time. + */ +export interface ValidatorAccumulatedCommission { + commission: DecCoin[]; +} +export interface ValidatorAccumulatedCommissionProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission"; + value: Uint8Array; +} +/** + * ValidatorAccumulatedCommission represents accumulated commission + * for a validator kept as a running counter, can be withdrawn at any time. + */ +export interface ValidatorAccumulatedCommissionAmino { + commission: DecCoinAmino[]; +} +export interface ValidatorAccumulatedCommissionAminoMsg { + type: "cosmos-sdk/ValidatorAccumulatedCommission"; + value: ValidatorAccumulatedCommissionAmino; +} +/** + * ValidatorAccumulatedCommission represents accumulated commission + * for a validator kept as a running counter, can be withdrawn at any time. + */ +export interface ValidatorAccumulatedCommissionSDKType { + commission: DecCoinSDKType[]; +} +/** + * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards + * for a validator inexpensive to track, allows simple sanity checks. + */ +export interface ValidatorOutstandingRewards { + rewards: DecCoin[]; +} +export interface ValidatorOutstandingRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards"; + value: Uint8Array; +} +/** + * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards + * for a validator inexpensive to track, allows simple sanity checks. + */ +export interface ValidatorOutstandingRewardsAmino { + rewards: DecCoinAmino[]; +} +export interface ValidatorOutstandingRewardsAminoMsg { + type: "cosmos-sdk/ValidatorOutstandingRewards"; + value: ValidatorOutstandingRewardsAmino; +} +/** + * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards + * for a validator inexpensive to track, allows simple sanity checks. + */ +export interface ValidatorOutstandingRewardsSDKType { + rewards: DecCoinSDKType[]; +} +/** + * ValidatorSlashEvent represents a validator slash event. + * Height is implicit within the store key. + * This is needed to calculate appropriate amount of staking tokens + * for delegations which are withdrawn after a slash has occurred. + */ +export interface ValidatorSlashEvent { + validatorPeriod: bigint; + fraction: string; +} +export interface ValidatorSlashEventProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent"; + value: Uint8Array; +} +/** + * ValidatorSlashEvent represents a validator slash event. + * Height is implicit within the store key. + * This is needed to calculate appropriate amount of staking tokens + * for delegations which are withdrawn after a slash has occurred. + */ +export interface ValidatorSlashEventAmino { + validator_period?: string; + fraction?: string; +} +export interface ValidatorSlashEventAminoMsg { + type: "cosmos-sdk/ValidatorSlashEvent"; + value: ValidatorSlashEventAmino; +} +/** + * ValidatorSlashEvent represents a validator slash event. + * Height is implicit within the store key. + * This is needed to calculate appropriate amount of staking tokens + * for delegations which are withdrawn after a slash has occurred. + */ +export interface ValidatorSlashEventSDKType { + validator_period: bigint; + fraction: string; +} +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} +export interface ValidatorSlashEventsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents"; + value: Uint8Array; +} +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEventsAmino { + validator_slash_events: ValidatorSlashEventAmino[]; +} +export interface ValidatorSlashEventsAminoMsg { + type: "cosmos-sdk/ValidatorSlashEvents"; + value: ValidatorSlashEventsAmino; +} +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEventsSDKType { + validator_slash_events: ValidatorSlashEventSDKType[]; +} +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: DecCoin[]; +} +export interface FeePoolProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.FeePool"; + value: Uint8Array; +} +/** FeePool is the global fee pool for distribution. */ +export interface FeePoolAmino { + community_pool: DecCoinAmino[]; +} +export interface FeePoolAminoMsg { + type: "cosmos-sdk/FeePool"; + value: FeePoolAmino; +} +/** FeePool is the global fee pool for distribution. */ +export interface FeePoolSDKType { + community_pool: DecCoinSDKType[]; +} +/** + * CommunityPoolSpendProposal details a proposal for use of community funds, + * together with how many coins are proposed to be spent, and to which + * recipient account. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + */ +/** @deprecated */ +export interface CommunityPoolSpendProposal { + $typeUrl?: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal"; + title: string; + description: string; + recipient: string; + amount: Coin[]; +} +export interface CommunityPoolSpendProposalProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal"; + value: Uint8Array; +} +/** + * CommunityPoolSpendProposal details a proposal for use of community funds, + * together with how many coins are proposed to be spent, and to which + * recipient account. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + */ +/** @deprecated */ +export interface CommunityPoolSpendProposalAmino { + title?: string; + description?: string; + recipient?: string; + amount: CoinAmino[]; +} +export interface CommunityPoolSpendProposalAminoMsg { + type: "cosmos-sdk/CommunityPoolSpendProposal"; + value: CommunityPoolSpendProposalAmino; +} +/** + * CommunityPoolSpendProposal details a proposal for use of community funds, + * together with how many coins are proposed to be spent, and to which + * recipient account. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + */ +/** @deprecated */ +export interface CommunityPoolSpendProposalSDKType { + $typeUrl?: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal"; + title: string; + description: string; + recipient: string; + amount: CoinSDKType[]; +} +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: bigint; + stake: string; + height: bigint; +} +export interface DelegatorStartingInfoProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo"; + value: Uint8Array; +} +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfoAmino { + previous_period?: string; + stake?: string; + height: string; +} +export interface DelegatorStartingInfoAminoMsg { + type: "cosmos-sdk/DelegatorStartingInfo"; + value: DelegatorStartingInfoAmino; +} +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfoSDKType { + previous_period: bigint; + stake: string; + height: bigint; +} +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: string; + reward: DecCoin[]; +} +export interface DelegationDelegatorRewardProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward"; + value: Uint8Array; +} +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorRewardAmino { + validator_address?: string; + reward: DecCoinAmino[]; +} +export interface DelegationDelegatorRewardAminoMsg { + type: "cosmos-sdk/DelegationDelegatorReward"; + value: DelegationDelegatorRewardAmino; +} +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorRewardSDKType { + validator_address: string; + reward: DecCoinSDKType[]; +} +/** + * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal + * with a deposit + */ +export interface CommunityPoolSpendProposalWithDeposit { + $typeUrl?: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit"; + title: string; + description: string; + recipient: string; + amount: string; + deposit: string; +} +export interface CommunityPoolSpendProposalWithDepositProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit"; + value: Uint8Array; +} +/** + * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal + * with a deposit + */ +export interface CommunityPoolSpendProposalWithDepositAmino { + title?: string; + description?: string; + recipient?: string; + amount?: string; + deposit?: string; +} +export interface CommunityPoolSpendProposalWithDepositAminoMsg { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit"; + value: CommunityPoolSpendProposalWithDepositAmino; +} +/** + * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal + * with a deposit + */ +export interface CommunityPoolSpendProposalWithDepositSDKType { + $typeUrl?: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit"; + title: string; + description: string; + recipient: string; + amount: string; + deposit: string; +} +function createBaseParams(): Params { + return { + communityTax: "", + baseProposerReward: "", + bonusProposerReward: "", + withdrawAddrEnabled: false + }; +} +export const Params = { + typeUrl: "/cosmos.distribution.v1beta1.Params", + aminoType: "cosmos-sdk/x/distribution/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.communityTax !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.communityTax, 18).atomics); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.baseProposerReward, 18).atomics); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.bonusProposerReward, 18).atomics); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.communityTax = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 2: + message.baseProposerReward = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.bonusProposerReward = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 4: + message.withdrawAddrEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.community_tax !== undefined && object.community_tax !== null) { + message.communityTax = object.community_tax; + } + if (object.base_proposer_reward !== undefined && object.base_proposer_reward !== null) { + message.baseProposerReward = object.base_proposer_reward; + } + if (object.bonus_proposer_reward !== undefined && object.bonus_proposer_reward !== null) { + message.bonusProposerReward = object.bonus_proposer_reward; + } + if (object.withdraw_addr_enabled !== undefined && object.withdraw_addr_enabled !== null) { + message.withdrawAddrEnabled = object.withdraw_addr_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.community_tax = message.communityTax === "" ? undefined : message.communityTax; + obj.base_proposer_reward = message.baseProposerReward === "" ? undefined : message.baseProposerReward; + obj.bonus_proposer_reward = message.bonusProposerReward === "" ? undefined : message.bonusProposerReward; + obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/distribution/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: [], + referenceCount: 0 + }; +} +export const ValidatorHistoricalRewards = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", + aminoType: "cosmos-sdk/ValidatorHistoricalRewards", + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.referenceCount = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map(e => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 0; + return message; + }, + fromAmino(object: ValidatorHistoricalRewardsAmino): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulative_reward_ratio?.map(e => DecCoin.fromAmino(e)) || []; + if (object.reference_count !== undefined && object.reference_count !== null) { + message.referenceCount = object.reference_count; + } + return message; + }, + toAmino(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsAmino { + const obj: any = {}; + if (message.cumulativeRewardRatio) { + obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.cumulative_reward_ratio = message.cumulativeRewardRatio; + } + obj.reference_count = message.referenceCount === 0 ? undefined : message.referenceCount; + return obj; + }, + fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorHistoricalRewards", + value: ValidatorHistoricalRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorHistoricalRewardsProtoMsg): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.decode(message.value); + }, + toProto(message: ValidatorHistoricalRewards): Uint8Array { + return ValidatorHistoricalRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", + value: ValidatorHistoricalRewards.encode(message).finish() + }; + } +}; +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { + rewards: [], + period: BigInt(0) + }; +} +export const ValidatorCurrentRewards = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", + aminoType: "cosmos-sdk/ValidatorCurrentRewards", + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.period !== BigInt(0)) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.period = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorCurrentRewards { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; + message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorCurrentRewardsAmino): ValidatorCurrentRewards { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period); + } + return message; + }, + toAmino(message: ValidatorCurrentRewards): ValidatorCurrentRewardsAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = message.rewards; + } + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorCurrentRewards): ValidatorCurrentRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorCurrentRewards", + value: ValidatorCurrentRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorCurrentRewardsProtoMsg): ValidatorCurrentRewards { + return ValidatorCurrentRewards.decode(message.value); + }, + toProto(message: ValidatorCurrentRewards): Uint8Array { + return ValidatorCurrentRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorCurrentRewards): ValidatorCurrentRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", + value: ValidatorCurrentRewards.encode(message).finish() + }; + } +}; +function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommission { + return { + commission: [] + }; +} +export const ValidatorAccumulatedCommission = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", + aminoType: "cosmos-sdk/ValidatorAccumulatedCommission", + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorAccumulatedCommission { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorAccumulatedCommissionAmino): ValidatorAccumulatedCommission { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionAmino { + const obj: any = {}; + if (message.commission) { + obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.commission = message.commission; + } + return obj; + }, + fromAminoMsg(object: ValidatorAccumulatedCommissionAminoMsg): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionAminoMsg { + return { + type: "cosmos-sdk/ValidatorAccumulatedCommission", + value: ValidatorAccumulatedCommission.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorAccumulatedCommissionProtoMsg): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.decode(message.value); + }, + toProto(message: ValidatorAccumulatedCommission): Uint8Array { + return ValidatorAccumulatedCommission.encode(message).finish(); + }, + toProtoMsg(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", + value: ValidatorAccumulatedCommission.encode(message).finish() + }; + } +}; +function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { + return { + rewards: [] + }; +} +export const ValidatorOutstandingRewards = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", + aminoType: "cosmos-sdk/ValidatorOutstandingRewards", + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorOutstandingRewardsAmino): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = message.rewards; + } + return obj; + }, + fromAminoMsg(object: ValidatorOutstandingRewardsAminoMsg): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorOutstandingRewards", + value: ValidatorOutstandingRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorOutstandingRewardsProtoMsg): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.decode(message.value); + }, + toProto(message: ValidatorOutstandingRewards): Uint8Array { + return ValidatorOutstandingRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", + value: ValidatorOutstandingRewards.encode(message).finish() + }; + } +}; +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { + validatorPeriod: BigInt(0), + fraction: "" + }; +} +export const ValidatorSlashEvent = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", + aminoType: "cosmos-sdk/ValidatorSlashEvent", + encode(message: ValidatorSlashEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorPeriod !== BigInt(0)) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.fraction, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorPeriod = reader.uint64(); + break; + case 2: + message.fraction = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod !== undefined && object.validatorPeriod !== null ? BigInt(object.validatorPeriod.toString()) : BigInt(0); + message.fraction = object.fraction ?? ""; + return message; + }, + fromAmino(object: ValidatorSlashEventAmino): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + if (object.validator_period !== undefined && object.validator_period !== null) { + message.validatorPeriod = BigInt(object.validator_period); + } + if (object.fraction !== undefined && object.fraction !== null) { + message.fraction = object.fraction; + } + return message; + }, + toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { + const obj: any = {}; + obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod.toString() : undefined; + obj.fraction = message.fraction === "" ? undefined : message.fraction; + return obj; + }, + fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { + return ValidatorSlashEvent.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSlashEvent): ValidatorSlashEventAminoMsg { + return { + type: "cosmos-sdk/ValidatorSlashEvent", + value: ValidatorSlashEvent.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSlashEventProtoMsg): ValidatorSlashEvent { + return ValidatorSlashEvent.decode(message.value); + }, + toProto(message: ValidatorSlashEvent): Uint8Array { + return ValidatorSlashEvent.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSlashEvent): ValidatorSlashEventProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", + value: ValidatorSlashEvent.encode(message).finish() + }; + } +}; +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { + validatorSlashEvents: [] + }; +} +export const ValidatorSlashEvents = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", + aminoType: "cosmos-sdk/ValidatorSlashEvents", + encode(message: ValidatorSlashEvents, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validatorSlashEvents) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map(e => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorSlashEventsAmino): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validator_slash_events?.map(e => ValidatorSlashEvent.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorSlashEvents): ValidatorSlashEventsAmino { + const obj: any = {}; + if (message.validatorSlashEvents) { + obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); + } else { + obj.validator_slash_events = message.validatorSlashEvents; + } + return obj; + }, + fromAminoMsg(object: ValidatorSlashEventsAminoMsg): ValidatorSlashEvents { + return ValidatorSlashEvents.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSlashEvents): ValidatorSlashEventsAminoMsg { + return { + type: "cosmos-sdk/ValidatorSlashEvents", + value: ValidatorSlashEvents.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSlashEventsProtoMsg): ValidatorSlashEvents { + return ValidatorSlashEvents.decode(message.value); + }, + toProto(message: ValidatorSlashEvents): Uint8Array { + return ValidatorSlashEvents.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSlashEvents): ValidatorSlashEventsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", + value: ValidatorSlashEvents.encode(message).finish() + }; + } +}; +function createBaseFeePool(): FeePool { + return { + communityPool: [] + }; +} +export const FeePool = { + typeUrl: "/cosmos.distribution.v1beta1.FeePool", + aminoType: "cosmos-sdk/FeePool", + encode(message: FeePool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.communityPool) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FeePoolAmino): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.community_pool?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: FeePool): FeePoolAmino { + const obj: any = {}; + if (message.communityPool) { + obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.community_pool = message.communityPool; + } + return obj; + }, + fromAminoMsg(object: FeePoolAminoMsg): FeePool { + return FeePool.fromAmino(object.value); + }, + toAminoMsg(message: FeePool): FeePoolAminoMsg { + return { + type: "cosmos-sdk/FeePool", + value: FeePool.toAmino(message) + }; + }, + fromProtoMsg(message: FeePoolProtoMsg): FeePool { + return FeePool.decode(message.value); + }, + toProto(message: FeePool): Uint8Array { + return FeePool.encode(message).finish(); + }, + toProtoMsg(message: FeePool): FeePoolProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.FeePool", + value: FeePool.encode(message).finish() + }; + } +}; +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { + $typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + title: "", + description: "", + recipient: "", + amount: [] + }; +} +export const CommunityPoolSpendProposal = { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + aminoType: "cosmos-sdk/CommunityPoolSpendProposal", + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.recipient = reader.string(); + break; + case 4: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommunityPoolSpendProposal { + const message = createBaseCommunityPoolSpendProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CommunityPoolSpendProposalAmino): CommunityPoolSpendProposal { + const message = createBaseCommunityPoolSpendProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: CommunityPoolSpendProposalAminoMsg): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromAmino(object.value); + }, + toAminoMsg(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAminoMsg { + return { + type: "cosmos-sdk/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(message) + }; + }, + fromProtoMsg(message: CommunityPoolSpendProposalProtoMsg): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.decode(message.value); + }, + toProto(message: CommunityPoolSpendProposal): Uint8Array { + return CommunityPoolSpendProposal.encode(message).finish(); + }, + toProtoMsg(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(message).finish() + }; + } +}; +function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { + return { + previousPeriod: BigInt(0), + stake: "", + height: BigInt(0) + }; +} +export const DelegatorStartingInfo = { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", + aminoType: "cosmos-sdk/DelegatorStartingInfo", + encode(message: DelegatorStartingInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.previousPeriod !== BigInt(0)) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.stake, 18).atomics); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.previousPeriod = reader.uint64(); + break; + case 2: + message.stake = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.height = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod !== undefined && object.previousPeriod !== null ? BigInt(object.previousPeriod.toString()) : BigInt(0); + message.stake = object.stake ?? ""; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: DelegatorStartingInfoAmino): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + if (object.previous_period !== undefined && object.previous_period !== null) { + message.previousPeriod = BigInt(object.previous_period); + } + if (object.stake !== undefined && object.stake !== null) { + message.stake = object.stake; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { + const obj: any = {}; + obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod.toString() : undefined; + obj.stake = message.stake === "" ? undefined : message.stake; + obj.height = message.height ? message.height.toString() : "0"; + return obj; + }, + fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { + return DelegatorStartingInfo.fromAmino(object.value); + }, + toAminoMsg(message: DelegatorStartingInfo): DelegatorStartingInfoAminoMsg { + return { + type: "cosmos-sdk/DelegatorStartingInfo", + value: DelegatorStartingInfo.toAmino(message) + }; + }, + fromProtoMsg(message: DelegatorStartingInfoProtoMsg): DelegatorStartingInfo { + return DelegatorStartingInfo.decode(message.value); + }, + toProto(message: DelegatorStartingInfo): Uint8Array { + return DelegatorStartingInfo.encode(message).finish(); + }, + toProtoMsg(message: DelegatorStartingInfo): DelegatorStartingInfoProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", + value: DelegatorStartingInfo.encode(message).finish() + }; + } +}; +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { + validatorAddress: "", + reward: [] + }; +} +export const DelegationDelegatorReward = { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", + aminoType: "cosmos-sdk/DelegationDelegatorReward", + encode(message: DelegationDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.reward.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + message.reward = object.reward?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DelegationDelegatorRewardAmino): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.reward = object.reward?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + if (message.reward) { + obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.reward = message.reward; + } + return obj; + }, + fromAminoMsg(object: DelegationDelegatorRewardAminoMsg): DelegationDelegatorReward { + return DelegationDelegatorReward.fromAmino(object.value); + }, + toAminoMsg(message: DelegationDelegatorReward): DelegationDelegatorRewardAminoMsg { + return { + type: "cosmos-sdk/DelegationDelegatorReward", + value: DelegationDelegatorReward.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationDelegatorRewardProtoMsg): DelegationDelegatorReward { + return DelegationDelegatorReward.decode(message.value); + }, + toProto(message: DelegationDelegatorReward): Uint8Array { + return DelegationDelegatorReward.encode(message).finish(); + }, + toProtoMsg(message: DelegationDelegatorReward): DelegationDelegatorRewardProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", + value: DelegationDelegatorReward.encode(message).finish() + }; + } +}; +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { + $typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + title: "", + description: "", + recipient: "", + amount: "", + deposit: "" + }; +} +export const CommunityPoolSpendProposalWithDeposit = { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + aminoType: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.recipient = reader.string(); + break; + case 4: + message.amount = reader.string(); + break; + case 5: + message.deposit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommunityPoolSpendProposalWithDeposit { + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount ?? ""; + message.deposit = object.deposit ?? ""; + return message; + }, + fromAmino(object: CommunityPoolSpendProposalWithDepositAmino): CommunityPoolSpendProposalWithDeposit { + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + if (object.deposit !== undefined && object.deposit !== null) { + message.deposit = object.deposit; + } + return message; + }, + toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.deposit = message.deposit === "" ? undefined : message.deposit; + return obj; + }, + fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromAmino(object.value); + }, + toAminoMsg(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAminoMsg { + return { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: CommunityPoolSpendProposalWithDepositProtoMsg): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.decode(message.value); + }, + toProto(message: CommunityPoolSpendProposalWithDeposit): Uint8Array { + return CommunityPoolSpendProposalWithDeposit.encode(message).finish(); + }, + toProtoMsg(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/genesis.ts b/util/inj-types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 00000000..4481e08b --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,1126 @@ +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; +import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsAmino, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsAmino, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoAmino, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, Params, ParamsAmino, ParamsSDKType, FeePool, FeePoolAmino, FeePoolSDKType } from "./distribution"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * DelegatorWithdrawInfo is the address for where distributions rewards are + * withdrawn to by default this struct is only used at genesis to feed in + * default withdraw addresses. + */ +export interface DelegatorWithdrawInfo { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdrawAddress: string; +} +export interface DelegatorWithdrawInfoProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo"; + value: Uint8Array; +} +/** + * DelegatorWithdrawInfo is the address for where distributions rewards are + * withdrawn to by default this struct is only used at genesis to feed in + * default withdraw addresses. + */ +export interface DelegatorWithdrawInfoAmino { + /** delegator_address is the address of the delegator. */ + delegator_address?: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdraw_address?: string; +} +export interface DelegatorWithdrawInfoAminoMsg { + type: "cosmos-sdk/DelegatorWithdrawInfo"; + value: DelegatorWithdrawInfoAmino; +} +/** + * DelegatorWithdrawInfo is the address for where distributions rewards are + * withdrawn to by default this struct is only used at genesis to feed in + * default withdraw addresses. + */ +export interface DelegatorWithdrawInfoSDKType { + delegator_address: string; + withdraw_address: string; +} +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstandingRewards: DecCoin[]; +} +export interface ValidatorOutstandingRewardsRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord"; + value: Uint8Array; +} +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecordAmino { + /** validator_address is the address of the validator. */ + validator_address?: string; + /** outstanding_rewards represents the outstanding rewards of a validator. */ + outstanding_rewards: DecCoinAmino[]; +} +export interface ValidatorOutstandingRewardsRecordAminoMsg { + type: "cosmos-sdk/ValidatorOutstandingRewardsRecord"; + value: ValidatorOutstandingRewardsRecordAmino; +} +/** ValidatorOutstandingRewardsRecord is used for import/export via genesis json. */ +export interface ValidatorOutstandingRewardsRecordSDKType { + validator_address: string; + outstanding_rewards: DecCoinSDKType[]; +} +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommission; +} +export interface ValidatorAccumulatedCommissionRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord"; + value: Uint8Array; +} +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecordAmino { + /** validator_address is the address of the validator. */ + validator_address?: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated: ValidatorAccumulatedCommissionAmino; +} +export interface ValidatorAccumulatedCommissionRecordAminoMsg { + type: "cosmos-sdk/ValidatorAccumulatedCommissionRecord"; + value: ValidatorAccumulatedCommissionRecordAmino; +} +/** + * ValidatorAccumulatedCommissionRecord is used for import / export via genesis + * json. + */ +export interface ValidatorAccumulatedCommissionRecordSDKType { + validator_address: string; + accumulated: ValidatorAccumulatedCommissionSDKType; +} +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** period defines the period the historical rewards apply to. */ + period: bigint; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewards; +} +export interface ValidatorHistoricalRewardsRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord"; + value: Uint8Array; +} +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecordAmino { + /** validator_address is the address of the validator. */ + validator_address?: string; + /** period defines the period the historical rewards apply to. */ + period?: string; + /** rewards defines the historical rewards of a validator. */ + rewards: ValidatorHistoricalRewardsAmino; +} +export interface ValidatorHistoricalRewardsRecordAminoMsg { + type: "cosmos-sdk/ValidatorHistoricalRewardsRecord"; + value: ValidatorHistoricalRewardsRecordAmino; +} +/** + * ValidatorHistoricalRewardsRecord is used for import / export via genesis + * json. + */ +export interface ValidatorHistoricalRewardsRecordSDKType { + validator_address: string; + period: bigint; + rewards: ValidatorHistoricalRewardsSDKType; +} +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewards; +} +export interface ValidatorCurrentRewardsRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord"; + value: Uint8Array; +} +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecordAmino { + /** validator_address is the address of the validator. */ + validator_address?: string; + /** rewards defines the current rewards of a validator. */ + rewards: ValidatorCurrentRewardsAmino; +} +export interface ValidatorCurrentRewardsRecordAminoMsg { + type: "cosmos-sdk/ValidatorCurrentRewardsRecord"; + value: ValidatorCurrentRewardsRecordAmino; +} +/** ValidatorCurrentRewardsRecord is used for import / export via genesis json. */ +export interface ValidatorCurrentRewardsRecordSDKType { + validator_address: string; + rewards: ValidatorCurrentRewardsSDKType; +} +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegatorAddress: string; + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** starting_info defines the starting info of a delegator. */ + startingInfo: DelegatorStartingInfo; +} +export interface DelegatorStartingInfoRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord"; + value: Uint8Array; +} +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecordAmino { + /** delegator_address is the address of the delegator. */ + delegator_address?: string; + /** validator_address is the address of the validator. */ + validator_address?: string; + /** starting_info defines the starting info of a delegator. */ + starting_info: DelegatorStartingInfoAmino; +} +export interface DelegatorStartingInfoRecordAminoMsg { + type: "cosmos-sdk/DelegatorStartingInfoRecord"; + value: DelegatorStartingInfoRecordAmino; +} +/** DelegatorStartingInfoRecord used for import / export via genesis json. */ +export interface DelegatorStartingInfoRecordSDKType { + delegator_address: string; + validator_address: string; + starting_info: DelegatorStartingInfoSDKType; +} +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validatorAddress: string; + /** height defines the block height at which the slash event occurred. */ + height: bigint; + /** period is the period of the slash event. */ + period: bigint; + /** validator_slash_event describes the slash event. */ + validatorSlashEvent: ValidatorSlashEvent; +} +export interface ValidatorSlashEventRecordProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord"; + value: Uint8Array; +} +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecordAmino { + /** validator_address is the address of the validator. */ + validator_address?: string; + /** height defines the block height at which the slash event occurred. */ + height?: string; + /** period is the period of the slash event. */ + period?: string; + /** validator_slash_event describes the slash event. */ + validator_slash_event: ValidatorSlashEventAmino; +} +export interface ValidatorSlashEventRecordAminoMsg { + type: "cosmos-sdk/ValidatorSlashEventRecord"; + value: ValidatorSlashEventRecordAmino; +} +/** ValidatorSlashEventRecord is used for import / export via genesis json. */ +export interface ValidatorSlashEventRecordSDKType { + validator_address: string; + height: bigint; + period: bigint; + validator_slash_event: ValidatorSlashEventSDKType; +} +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params; + /** fee_pool defines the fee pool at genesis. */ + feePool: FeePool; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegatorWithdrawInfos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previousProposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstandingRewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validatorAccumulatedCommissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validatorHistoricalRewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validatorCurrentRewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegatorStartingInfos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validatorSlashEvents: ValidatorSlashEventRecord[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisStateAmino { + /** params defines all the parameters of the module. */ + params: ParamsAmino; + /** fee_pool defines the fee pool at genesis. */ + fee_pool: FeePoolAmino; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegator_withdraw_infos: DelegatorWithdrawInfoAmino[]; + /** fee_pool defines the previous proposer at genesis. */ + previous_proposer?: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstanding_rewards: ValidatorOutstandingRewardsRecordAmino[]; + /** fee_pool defines the accumulated commissions of all validators at genesis. */ + validator_accumulated_commissions: ValidatorAccumulatedCommissionRecordAmino[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validator_historical_rewards: ValidatorHistoricalRewardsRecordAmino[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validator_current_rewards: ValidatorCurrentRewardsRecordAmino[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegator_starting_infos: DelegatorStartingInfoRecordAmino[]; + /** fee_pool defines the validator slash events at genesis. */ + validator_slash_events: ValidatorSlashEventRecordAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the distribution module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + fee_pool: FeePoolSDKType; + delegator_withdraw_infos: DelegatorWithdrawInfoSDKType[]; + previous_proposer: string; + outstanding_rewards: ValidatorOutstandingRewardsRecordSDKType[]; + validator_accumulated_commissions: ValidatorAccumulatedCommissionRecordSDKType[]; + validator_historical_rewards: ValidatorHistoricalRewardsRecordSDKType[]; + validator_current_rewards: ValidatorCurrentRewardsRecordSDKType[]; + delegator_starting_infos: DelegatorStartingInfoRecordSDKType[]; + validator_slash_events: ValidatorSlashEventRecordSDKType[]; +} +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { + delegatorAddress: "", + withdrawAddress: "" + }; +} +export const DelegatorWithdrawInfo = { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", + aminoType: "cosmos-sdk/DelegatorWithdrawInfo", + encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorWithdrawInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.withdrawAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, + fromAmino(object: DelegatorWithdrawInfoAmino): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.withdraw_address !== undefined && object.withdraw_address !== null) { + message.withdrawAddress = object.withdraw_address; + } + return message; + }, + toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; + return obj; + }, + fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromAmino(object.value); + }, + toAminoMsg(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAminoMsg { + return { + type: "cosmos-sdk/DelegatorWithdrawInfo", + value: DelegatorWithdrawInfo.toAmino(message) + }; + }, + fromProtoMsg(message: DelegatorWithdrawInfoProtoMsg): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.decode(message.value); + }, + toProto(message: DelegatorWithdrawInfo): Uint8Array { + return DelegatorWithdrawInfo.encode(message).finish(); + }, + toProtoMsg(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo", + value: DelegatorWithdrawInfo.encode(message).finish() + }; + } +}; +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { + validatorAddress: "", + outstandingRewards: [] + }; +} +export const ValidatorOutstandingRewardsRecord = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", + aminoType: "cosmos-sdk/ValidatorOutstandingRewardsRecord", + encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.outstandingRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.outstandingRewards.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.outstandingRewards = object.outstandingRewards?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorOutstandingRewardsRecordAmino): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.outstandingRewards = object.outstanding_rewards?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + if (message.outstandingRewards) { + obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.outstanding_rewards = message.outstandingRewards; + } + return obj; + }, + fromAminoMsg(object: ValidatorOutstandingRewardsRecordAminoMsg): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorOutstandingRewardsRecord", + value: ValidatorOutstandingRewardsRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorOutstandingRewardsRecordProtoMsg): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.decode(message.value); + }, + toProto(message: ValidatorOutstandingRewardsRecord): Uint8Array { + return ValidatorOutstandingRewardsRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord", + value: ValidatorOutstandingRewardsRecord.encode(message).finish() + }; + } +}; +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { + validatorAddress: "", + accumulated: ValidatorAccumulatedCommission.fromPartial({}) + }; +} +export const ValidatorAccumulatedCommissionRecord = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", + aminoType: "cosmos-sdk/ValidatorAccumulatedCommissionRecord", + encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommissionRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.accumulated = object.accumulated !== undefined && object.accumulated !== null ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) : undefined; + return message; + }, + fromAmino(object: ValidatorAccumulatedCommissionRecordAmino): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.accumulated !== undefined && object.accumulated !== null) { + message.accumulated = ValidatorAccumulatedCommission.fromAmino(object.accumulated); + } + return message; + }, + toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : ValidatorAccumulatedCommission.toAmino(ValidatorAccumulatedCommission.fromPartial({})); + return obj; + }, + fromAminoMsg(object: ValidatorAccumulatedCommissionRecordAminoMsg): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorAccumulatedCommissionRecord", + value: ValidatorAccumulatedCommissionRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorAccumulatedCommissionRecordProtoMsg): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.decode(message.value); + }, + toProto(message: ValidatorAccumulatedCommissionRecord): Uint8Array { + return ValidatorAccumulatedCommissionRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord", + value: ValidatorAccumulatedCommissionRecord.encode(message).finish() + }; + } +}; +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { + validatorAddress: "", + period: BigInt(0), + rewards: ValidatorHistoricalRewards.fromPartial({}) + }; +} +export const ValidatorHistoricalRewardsRecord = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", + aminoType: "cosmos-sdk/ValidatorHistoricalRewardsRecord", + encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.period !== BigInt(0)) { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.period = reader.uint64(); + break; + case 3: + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); + message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorHistoricalRewards.fromPartial(object.rewards) : undefined; + return message; + }, + fromAmino(object: ValidatorHistoricalRewardsRecordAmino): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period); + } + if (object.rewards !== undefined && object.rewards !== null) { + message.rewards = ValidatorHistoricalRewards.fromAmino(object.rewards); + } + return message; + }, + toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; + obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : ValidatorHistoricalRewards.toAmino(ValidatorHistoricalRewards.fromPartial({})); + return obj; + }, + fromAminoMsg(object: ValidatorHistoricalRewardsRecordAminoMsg): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorHistoricalRewardsRecord", + value: ValidatorHistoricalRewardsRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorHistoricalRewardsRecordProtoMsg): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.decode(message.value); + }, + toProto(message: ValidatorHistoricalRewardsRecord): Uint8Array { + return ValidatorHistoricalRewardsRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord", + value: ValidatorHistoricalRewardsRecord.encode(message).finish() + }; + } +}; +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { + validatorAddress: "", + rewards: ValidatorCurrentRewards.fromPartial({}) + }; +} +export const ValidatorCurrentRewardsRecord = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", + aminoType: "cosmos-sdk/ValidatorCurrentRewardsRecord", + encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorCurrentRewards.fromPartial(object.rewards) : undefined; + return message; + }, + fromAmino(object: ValidatorCurrentRewardsRecordAmino): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.rewards !== undefined && object.rewards !== null) { + message.rewards = ValidatorCurrentRewards.fromAmino(object.rewards); + } + return message; + }, + toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : ValidatorCurrentRewards.toAmino(ValidatorCurrentRewards.fromPartial({})); + return obj; + }, + fromAminoMsg(object: ValidatorCurrentRewardsRecordAminoMsg): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorCurrentRewardsRecord", + value: ValidatorCurrentRewardsRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorCurrentRewardsRecordProtoMsg): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.decode(message.value); + }, + toProto(message: ValidatorCurrentRewardsRecord): Uint8Array { + return ValidatorCurrentRewardsRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord", + value: ValidatorCurrentRewardsRecord.encode(message).finish() + }; + } +}; +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { + delegatorAddress: "", + validatorAddress: "", + startingInfo: DelegatorStartingInfo.fromPartial({}) + }; +} +export const DelegatorStartingInfoRecord = { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", + aminoType: "cosmos-sdk/DelegatorStartingInfoRecord", + encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.startingInfo !== undefined) { + DelegatorStartingInfo.encode(message.startingInfo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfoRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.startingInfo = DelegatorStartingInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.startingInfo = object.startingInfo !== undefined && object.startingInfo !== null ? DelegatorStartingInfo.fromPartial(object.startingInfo) : undefined; + return message; + }, + fromAmino(object: DelegatorStartingInfoRecordAmino): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.starting_info !== undefined && object.starting_info !== null) { + message.startingInfo = DelegatorStartingInfo.fromAmino(object.starting_info); + } + return message; + }, + toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : DelegatorStartingInfo.toAmino(DelegatorStartingInfo.fromPartial({})); + return obj; + }, + fromAminoMsg(object: DelegatorStartingInfoRecordAminoMsg): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromAmino(object.value); + }, + toAminoMsg(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAminoMsg { + return { + type: "cosmos-sdk/DelegatorStartingInfoRecord", + value: DelegatorStartingInfoRecord.toAmino(message) + }; + }, + fromProtoMsg(message: DelegatorStartingInfoRecordProtoMsg): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.decode(message.value); + }, + toProto(message: DelegatorStartingInfoRecord): Uint8Array { + return DelegatorStartingInfoRecord.encode(message).finish(); + }, + toProtoMsg(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord", + value: DelegatorStartingInfoRecord.encode(message).finish() + }; + } +}; +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { + validatorAddress: "", + height: BigInt(0), + period: BigInt(0), + validatorSlashEvent: ValidatorSlashEvent.fromPartial({}) + }; +} +export const ValidatorSlashEventRecord = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", + aminoType: "cosmos-sdk/ValidatorSlashEventRecord", + encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== BigInt(0)) { + writer.uint32(24).uint64(message.period); + } + if (message.validatorSlashEvent !== undefined) { + ValidatorSlashEvent.encode(message.validatorSlashEvent, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEventRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.height = reader.uint64(); + break; + case 3: + message.period = reader.uint64(); + break; + case 4: + message.validatorSlashEvent = ValidatorSlashEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validatorAddress = object.validatorAddress ?? ""; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); + message.validatorSlashEvent = object.validatorSlashEvent !== undefined && object.validatorSlashEvent !== null ? ValidatorSlashEvent.fromPartial(object.validatorSlashEvent) : undefined; + return message; + }, + fromAmino(object: ValidatorSlashEventRecordAmino): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period); + } + if (object.validator_slash_event !== undefined && object.validator_slash_event !== null) { + message.validatorSlashEvent = ValidatorSlashEvent.fromAmino(object.validator_slash_event); + } + return message; + }, + toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; + obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : ValidatorSlashEvent.toAmino(ValidatorSlashEvent.fromPartial({})); + return obj; + }, + fromAminoMsg(object: ValidatorSlashEventRecordAminoMsg): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAminoMsg { + return { + type: "cosmos-sdk/ValidatorSlashEventRecord", + value: ValidatorSlashEventRecord.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSlashEventRecordProtoMsg): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.decode(message.value); + }, + toProto(message: ValidatorSlashEventRecord): Uint8Array { + return ValidatorSlashEventRecord.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord", + value: ValidatorSlashEventRecord.encode(message).finish() + }; + } +}; +function createBaseGenesisState(): GenesisState { + return { + params: Params.fromPartial({}), + feePool: FeePool.fromPartial({}), + delegatorWithdrawInfos: [], + previousProposer: "", + outstandingRewards: [], + validatorAccumulatedCommissions: [], + validatorHistoricalRewards: [], + validatorCurrentRewards: [], + delegatorStartingInfos: [], + validatorSlashEvents: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmos.distribution.v1beta1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.feePool !== undefined) { + FeePool.encode(message.feePool, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatorWithdrawInfos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.previousProposer !== "") { + writer.uint32(34).string(message.previousProposer); + } + for (const v of message.outstandingRewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.validatorAccumulatedCommissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.validatorHistoricalRewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.validatorCurrentRewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.delegatorStartingInfos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.validatorSlashEvents) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.feePool = FeePool.decode(reader, reader.uint32()); + break; + case 3: + message.delegatorWithdrawInfos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + break; + case 4: + message.previousProposer = reader.string(); + break; + case 5: + message.outstandingRewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + break; + case 6: + message.validatorAccumulatedCommissions.push(ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32())); + break; + case 7: + message.validatorHistoricalRewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + break; + case 8: + message.validatorCurrentRewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + break; + case 9: + message.delegatorStartingInfos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + break; + case 10: + message.validatorSlashEvents.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.feePool = object.feePool !== undefined && object.feePool !== null ? FeePool.fromPartial(object.feePool) : undefined; + message.delegatorWithdrawInfos = object.delegatorWithdrawInfos?.map(e => DelegatorWithdrawInfo.fromPartial(e)) || []; + message.previousProposer = object.previousProposer ?? ""; + message.outstandingRewards = object.outstandingRewards?.map(e => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validatorAccumulatedCommissions = object.validatorAccumulatedCommissions?.map(e => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validatorHistoricalRewards = object.validatorHistoricalRewards?.map(e => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validatorCurrentRewards = object.validatorCurrentRewards?.map(e => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegatorStartingInfos = object.delegatorStartingInfos?.map(e => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validatorSlashEvents = object.validatorSlashEvents?.map(e => ValidatorSlashEventRecord.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + if (object.fee_pool !== undefined && object.fee_pool !== null) { + message.feePool = FeePool.fromAmino(object.fee_pool); + } + message.delegatorWithdrawInfos = object.delegator_withdraw_infos?.map(e => DelegatorWithdrawInfo.fromAmino(e)) || []; + if (object.previous_proposer !== undefined && object.previous_proposer !== null) { + message.previousProposer = object.previous_proposer; + } + message.outstandingRewards = object.outstanding_rewards?.map(e => ValidatorOutstandingRewardsRecord.fromAmino(e)) || []; + message.validatorAccumulatedCommissions = object.validator_accumulated_commissions?.map(e => ValidatorAccumulatedCommissionRecord.fromAmino(e)) || []; + message.validatorHistoricalRewards = object.validator_historical_rewards?.map(e => ValidatorHistoricalRewardsRecord.fromAmino(e)) || []; + message.validatorCurrentRewards = object.validator_current_rewards?.map(e => ValidatorCurrentRewardsRecord.fromAmino(e)) || []; + message.delegatorStartingInfos = object.delegator_starting_infos?.map(e => DelegatorStartingInfoRecord.fromAmino(e)) || []; + message.validatorSlashEvents = object.validator_slash_events?.map(e => ValidatorSlashEventRecord.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + obj.fee_pool = message.feePool ? FeePool.toAmino(message.feePool) : FeePool.toAmino(FeePool.fromPartial({})); + if (message.delegatorWithdrawInfos) { + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e) : undefined); + } else { + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos; + } + obj.previous_proposer = message.previousProposer === "" ? undefined : message.previousProposer; + if (message.outstandingRewards) { + obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); + } else { + obj.outstanding_rewards = message.outstandingRewards; + } + if (message.validatorAccumulatedCommissions) { + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions.map(e => e ? ValidatorAccumulatedCommissionRecord.toAmino(e) : undefined); + } else { + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions; + } + if (message.validatorHistoricalRewards) { + obj.validator_historical_rewards = message.validatorHistoricalRewards.map(e => e ? ValidatorHistoricalRewardsRecord.toAmino(e) : undefined); + } else { + obj.validator_historical_rewards = message.validatorHistoricalRewards; + } + if (message.validatorCurrentRewards) { + obj.validator_current_rewards = message.validatorCurrentRewards.map(e => e ? ValidatorCurrentRewardsRecord.toAmino(e) : undefined); + } else { + obj.validator_current_rewards = message.validatorCurrentRewards; + } + if (message.delegatorStartingInfos) { + obj.delegator_starting_infos = message.delegatorStartingInfos.map(e => e ? DelegatorStartingInfoRecord.toAmino(e) : undefined); + } else { + obj.delegator_starting_infos = message.delegatorStartingInfos; + } + if (message.validatorSlashEvents) { + obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEventRecord.toAmino(e) : undefined); + } else { + obj.validator_slash_events = message.validatorSlashEvents; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/query.lcd.ts b/util/inj-types/cosmos/distribution/v1beta1/query.lcd.ts new file mode 100644 index 00000000..b262743e --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/query.lcd.ts @@ -0,0 +1,76 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryParamsRequest, QueryParamsResponseSDKType, QueryValidatorDistributionInfoRequest, QueryValidatorDistributionInfoResponseSDKType, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponseSDKType, QueryValidatorCommissionRequest, QueryValidatorCommissionResponseSDKType, QueryValidatorSlashesRequest, QueryValidatorSlashesResponseSDKType, QueryDelegationRewardsRequest, QueryDelegationRewardsResponseSDKType, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponseSDKType, QueryCommunityPoolRequest, QueryCommunityPoolResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Params queries params of the distribution module. */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `cosmos/distribution/v1beta1/params`; + return await this.req.get(endpoint); + }; + /* ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + validatorDistributionInfo = async (params: QueryValidatorDistributionInfoRequest): Promise => { + const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}`; + return await this.req.get(endpoint); + }; + /* ValidatorOutstandingRewards queries rewards of a validator address. */ + validatorOutstandingRewards = async (params: QueryValidatorOutstandingRewardsRequest): Promise => { + const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}/outstanding_rewards`; + return await this.req.get(endpoint); + }; + /* ValidatorCommission queries accumulated commission for a validator. */ + validatorCommission = async (params: QueryValidatorCommissionRequest): Promise => { + const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}/commission`; + return await this.req.get(endpoint); + }; + /* ValidatorSlashes queries slash events of a validator. */ + validatorSlashes = async (params: QueryValidatorSlashesRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.startingHeight !== "undefined") { + options.params.starting_height = params.startingHeight; + } + if (typeof params?.endingHeight !== "undefined") { + options.params.ending_height = params.endingHeight; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/distribution/v1beta1/validators/${params.validatorAddress}/slashes`; + return await this.req.get(endpoint, options); + }; + /* DelegationRewards queries the total rewards accrued by a delegation. */ + delegationRewards = async (params: QueryDelegationRewardsRequest): Promise => { + const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/rewards/${params.validatorAddress}`; + return await this.req.get(endpoint); + }; + /* DelegationTotalRewards queries the total rewards accrued by a each + validator. */ + delegationTotalRewards = async (params: QueryDelegationTotalRewardsRequest): Promise => { + const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/rewards`; + return await this.req.get(endpoint); + }; + /* DelegatorValidators queries the validators of a delegator. */ + delegatorValidators = async (params: QueryDelegatorValidatorsRequest): Promise => { + const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/validators`; + return await this.req.get(endpoint); + }; + /* DelegatorWithdrawAddress queries withdraw address of a delegator. */ + delegatorWithdrawAddress = async (params: QueryDelegatorWithdrawAddressRequest): Promise => { + const endpoint = `cosmos/distribution/v1beta1/delegators/${params.delegatorAddress}/withdraw_address`; + return await this.req.get(endpoint); + }; + /* CommunityPool queries the community pool coins. */ + communityPool = async (_params: QueryCommunityPoolRequest = {}): Promise => { + const endpoint = `cosmos/distribution/v1beta1/community_pool`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/distribution/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..e2836d0f --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/query.rpc.Query.ts @@ -0,0 +1,133 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParamsRequest, QueryParamsResponse, QueryValidatorDistributionInfoRequest, QueryValidatorDistributionInfoResponse, QueryValidatorOutstandingRewardsRequest, QueryValidatorOutstandingRewardsResponse, QueryValidatorCommissionRequest, QueryValidatorCommissionResponse, QueryValidatorSlashesRequest, QueryValidatorSlashesResponse, QueryDelegationRewardsRequest, QueryDelegationRewardsResponse, QueryDelegationTotalRewardsRequest, QueryDelegationTotalRewardsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorWithdrawAddressRequest, QueryDelegatorWithdrawAddressResponse, QueryCommunityPoolRequest, QueryCommunityPoolResponse } from "./query"; +/** Query defines the gRPC querier service for distribution module. */ +export interface Query { + /** Params queries params of the distribution module. */ + params(request?: QueryParamsRequest): Promise; + /** ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + validatorDistributionInfo(request: QueryValidatorDistributionInfoRequest): Promise; + /** ValidatorOutstandingRewards queries rewards of a validator address. */ + validatorOutstandingRewards(request: QueryValidatorOutstandingRewardsRequest): Promise; + /** ValidatorCommission queries accumulated commission for a validator. */ + validatorCommission(request: QueryValidatorCommissionRequest): Promise; + /** ValidatorSlashes queries slash events of a validator. */ + validatorSlashes(request: QueryValidatorSlashesRequest): Promise; + /** DelegationRewards queries the total rewards accrued by a delegation. */ + delegationRewards(request: QueryDelegationRewardsRequest): Promise; + /** + * DelegationTotalRewards queries the total rewards accrued by a each + * validator. + */ + delegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise; + /** DelegatorValidators queries the validators of a delegator. */ + delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; + /** DelegatorWithdrawAddress queries withdraw address of a delegator. */ + delegatorWithdrawAddress(request: QueryDelegatorWithdrawAddressRequest): Promise; + /** CommunityPool queries the community pool coins. */ + communityPool(request?: QueryCommunityPoolRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Params queries params of the distribution module. */ + params = async (request: QueryParamsRequest = {}): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; + /* ValidatorDistributionInfo queries validator commission and self-delegation rewards for validator */ + validatorDistributionInfo = async (request: QueryValidatorDistributionInfoRequest): Promise => { + const data = QueryValidatorDistributionInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorDistributionInfo", data); + return promise.then(data => QueryValidatorDistributionInfoResponse.decode(new BinaryReader(data))); + }; + /* ValidatorOutstandingRewards queries rewards of a validator address. */ + validatorOutstandingRewards = async (request: QueryValidatorOutstandingRewardsRequest): Promise => { + const data = QueryValidatorOutstandingRewardsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorOutstandingRewards", data); + return promise.then(data => QueryValidatorOutstandingRewardsResponse.decode(new BinaryReader(data))); + }; + /* ValidatorCommission queries accumulated commission for a validator. */ + validatorCommission = async (request: QueryValidatorCommissionRequest): Promise => { + const data = QueryValidatorCommissionRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorCommission", data); + return promise.then(data => QueryValidatorCommissionResponse.decode(new BinaryReader(data))); + }; + /* ValidatorSlashes queries slash events of a validator. */ + validatorSlashes = async (request: QueryValidatorSlashesRequest): Promise => { + const data = QueryValidatorSlashesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "ValidatorSlashes", data); + return promise.then(data => QueryValidatorSlashesResponse.decode(new BinaryReader(data))); + }; + /* DelegationRewards queries the total rewards accrued by a delegation. */ + delegationRewards = async (request: QueryDelegationRewardsRequest): Promise => { + const data = QueryDelegationRewardsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "DelegationRewards", data); + return promise.then(data => QueryDelegationRewardsResponse.decode(new BinaryReader(data))); + }; + /* DelegationTotalRewards queries the total rewards accrued by a each + validator. */ + delegationTotalRewards = async (request: QueryDelegationTotalRewardsRequest): Promise => { + const data = QueryDelegationTotalRewardsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "DelegationTotalRewards", data); + return promise.then(data => QueryDelegationTotalRewardsResponse.decode(new BinaryReader(data))); + }; + /* DelegatorValidators queries the validators of a delegator. */ + delegatorValidators = async (request: QueryDelegatorValidatorsRequest): Promise => { + const data = QueryDelegatorValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "DelegatorValidators", data); + return promise.then(data => QueryDelegatorValidatorsResponse.decode(new BinaryReader(data))); + }; + /* DelegatorWithdrawAddress queries withdraw address of a delegator. */ + delegatorWithdrawAddress = async (request: QueryDelegatorWithdrawAddressRequest): Promise => { + const data = QueryDelegatorWithdrawAddressRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "DelegatorWithdrawAddress", data); + return promise.then(data => QueryDelegatorWithdrawAddressResponse.decode(new BinaryReader(data))); + }; + /* CommunityPool queries the community pool coins. */ + communityPool = async (request: QueryCommunityPoolRequest = {}): Promise => { + const data = QueryCommunityPoolRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Query", "CommunityPool", data); + return promise.then(data => QueryCommunityPoolResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + }, + validatorDistributionInfo(request: QueryValidatorDistributionInfoRequest): Promise { + return queryService.validatorDistributionInfo(request); + }, + validatorOutstandingRewards(request: QueryValidatorOutstandingRewardsRequest): Promise { + return queryService.validatorOutstandingRewards(request); + }, + validatorCommission(request: QueryValidatorCommissionRequest): Promise { + return queryService.validatorCommission(request); + }, + validatorSlashes(request: QueryValidatorSlashesRequest): Promise { + return queryService.validatorSlashes(request); + }, + delegationRewards(request: QueryDelegationRewardsRequest): Promise { + return queryService.delegationRewards(request); + }, + delegationTotalRewards(request: QueryDelegationTotalRewardsRequest): Promise { + return queryService.delegationTotalRewards(request); + }, + delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise { + return queryService.delegatorValidators(request); + }, + delegatorWithdrawAddress(request: QueryDelegatorWithdrawAddressRequest): Promise { + return queryService.delegatorWithdrawAddress(request); + }, + communityPool(request?: QueryCommunityPoolRequest): Promise { + return queryService.communityPool(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/query.ts b/util/inj-types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 00000000..7f80bf1e --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,2097 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Params, ParamsAmino, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsAmino, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardAmino, DelegationDelegatorRewardSDKType } from "./distribution"; +import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} +export interface QueryValidatorDistributionInfoRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest"; + value: Uint8Array; +} +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequestAmino { + /** validator_address defines the validator address to query for. */ + validator_address?: string; +} +export interface QueryValidatorDistributionInfoRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorDistributionInfoRequest"; + value: QueryValidatorDistributionInfoRequestAmino; +} +/** QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoRequestSDKType { + validator_address: string; +} +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponse { + /** operator_address defines the validator operator address. */ + operatorAddress: string; + /** self_bond_rewards defines the self delegations rewards. */ + selfBondRewards: DecCoin[]; + /** commission defines the commission the validator received. */ + commission: DecCoin[]; +} +export interface QueryValidatorDistributionInfoResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse"; + value: Uint8Array; +} +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponseAmino { + /** operator_address defines the validator operator address. */ + operator_address?: string; + /** self_bond_rewards defines the self delegations rewards. */ + self_bond_rewards: DecCoinAmino[]; + /** commission defines the commission the validator received. */ + commission?: DecCoinAmino[]; +} +export interface QueryValidatorDistributionInfoResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorDistributionInfoResponse"; + value: QueryValidatorDistributionInfoResponseAmino; +} +/** QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. */ +export interface QueryValidatorDistributionInfoResponseSDKType { + operator_address: string; + self_bond_rewards: DecCoinSDKType[]; + commission: DecCoinSDKType[]; +} +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} +export interface QueryValidatorOutstandingRewardsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest"; + value: Uint8Array; +} +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequestAmino { + /** validator_address defines the validator address to query for. */ + validator_address?: string; +} +export interface QueryValidatorOutstandingRewardsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorOutstandingRewardsRequest"; + value: QueryValidatorOutstandingRewardsRequestAmino; +} +/** + * QueryValidatorOutstandingRewardsRequest is the request type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsRequestSDKType { + validator_address: string; +} +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponse { + rewards: ValidatorOutstandingRewards; +} +export interface QueryValidatorOutstandingRewardsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse"; + value: Uint8Array; +} +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponseAmino { + rewards: ValidatorOutstandingRewardsAmino; +} +export interface QueryValidatorOutstandingRewardsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorOutstandingRewardsResponse"; + value: QueryValidatorOutstandingRewardsResponseAmino; +} +/** + * QueryValidatorOutstandingRewardsResponse is the response type for the + * Query/ValidatorOutstandingRewards RPC method. + */ +export interface QueryValidatorOutstandingRewardsResponseSDKType { + rewards: ValidatorOutstandingRewardsSDKType; +} +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} +export interface QueryValidatorCommissionRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest"; + value: Uint8Array; +} +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequestAmino { + /** validator_address defines the validator address to query for. */ + validator_address?: string; +} +export interface QueryValidatorCommissionRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorCommissionRequest"; + value: QueryValidatorCommissionRequestAmino; +} +/** + * QueryValidatorCommissionRequest is the request type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionRequestSDKType { + validator_address: string; +} +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponse { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommission; +} +export interface QueryValidatorCommissionResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse"; + value: Uint8Array; +} +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponseAmino { + /** commission defines the commission the validator received. */ + commission: ValidatorAccumulatedCommissionAmino; +} +export interface QueryValidatorCommissionResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorCommissionResponse"; + value: QueryValidatorCommissionResponseAmino; +} +/** + * QueryValidatorCommissionResponse is the response type for the + * Query/ValidatorCommission RPC method + */ +export interface QueryValidatorCommissionResponseSDKType { + commission: ValidatorAccumulatedCommissionSDKType; +} +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validatorAddress: string; + /** starting_height defines the optional starting height to query the slashes. */ + startingHeight?: bigint; + /** starting_height defines the optional ending height to query the slashes. */ + endingHeight?: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryValidatorSlashesRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest"; + value: Uint8Array; +} +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequestAmino { + /** validator_address defines the validator address to query for. */ + validator_address?: string; + /** starting_height defines the optional starting height to query the slashes. */ + starting_height?: string; + /** starting_height defines the optional ending height to query the slashes. */ + ending_height?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryValidatorSlashesRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorSlashesRequest"; + value: QueryValidatorSlashesRequestAmino; +} +/** + * QueryValidatorSlashesRequest is the request type for the + * Query/ValidatorSlashes RPC method + */ +export interface QueryValidatorSlashesRequestSDKType { + validator_address: string; + starting_height?: bigint; + ending_height?: bigint; + pagination?: PageRequestSDKType; +} +/** + * QueryValidatorSlashesResponse is the response type for the + * Query/ValidatorSlashes RPC method. + */ +export interface QueryValidatorSlashesResponse { + /** slashes defines the slashes the validator received. */ + slashes: ValidatorSlashEvent[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryValidatorSlashesResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse"; + value: Uint8Array; +} +/** + * QueryValidatorSlashesResponse is the response type for the + * Query/ValidatorSlashes RPC method. + */ +export interface QueryValidatorSlashesResponseAmino { + /** slashes defines the slashes the validator received. */ + slashes: ValidatorSlashEventAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorSlashesResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorSlashesResponse"; + value: QueryValidatorSlashesResponseAmino; +} +/** + * QueryValidatorSlashesResponse is the response type for the + * Query/ValidatorSlashes RPC method. + */ +export interface QueryValidatorSlashesResponseSDKType { + slashes: ValidatorSlashEventSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; + /** validator_address defines the validator address to query for. */ + validatorAddress: string; +} +export interface QueryDelegationRewardsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest"; + value: Uint8Array; +} +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequestAmino { + /** delegator_address defines the delegator address to query for. */ + delegator_address?: string; + /** validator_address defines the validator address to query for. */ + validator_address?: string; +} +export interface QueryDelegationRewardsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegationRewardsRequest"; + value: QueryDelegationRewardsRequestAmino; +} +/** + * QueryDelegationRewardsRequest is the request type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsRequestSDKType { + delegator_address: string; + validator_address: string; +} +/** + * QueryDelegationRewardsResponse is the response type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsResponse { + /** rewards defines the rewards accrued by a delegation. */ + rewards: DecCoin[]; +} +export interface QueryDelegationRewardsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse"; + value: Uint8Array; +} +/** + * QueryDelegationRewardsResponse is the response type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsResponseAmino { + /** rewards defines the rewards accrued by a delegation. */ + rewards: DecCoinAmino[]; +} +export interface QueryDelegationRewardsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegationRewardsResponse"; + value: QueryDelegationRewardsResponseAmino; +} +/** + * QueryDelegationRewardsResponse is the response type for the + * Query/DelegationRewards RPC method. + */ +export interface QueryDelegationRewardsResponseSDKType { + rewards: DecCoinSDKType[]; +} +/** + * QueryDelegationTotalRewardsRequest is the request type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; +} +export interface QueryDelegationTotalRewardsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest"; + value: Uint8Array; +} +/** + * QueryDelegationTotalRewardsRequest is the request type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsRequestAmino { + /** delegator_address defines the delegator address to query for. */ + delegator_address?: string; +} +export interface QueryDelegationTotalRewardsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegationTotalRewardsRequest"; + value: QueryDelegationTotalRewardsRequestAmino; +} +/** + * QueryDelegationTotalRewardsRequest is the request type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsRequestSDKType { + delegator_address: string; +} +/** + * QueryDelegationTotalRewardsResponse is the response type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsResponse { + /** rewards defines all the rewards accrued by a delegator. */ + rewards: DelegationDelegatorReward[]; + /** total defines the sum of all the rewards. */ + total: DecCoin[]; +} +export interface QueryDelegationTotalRewardsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse"; + value: Uint8Array; +} +/** + * QueryDelegationTotalRewardsResponse is the response type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsResponseAmino { + /** rewards defines all the rewards accrued by a delegator. */ + rewards: DelegationDelegatorRewardAmino[]; + /** total defines the sum of all the rewards. */ + total: DecCoinAmino[]; +} +export interface QueryDelegationTotalRewardsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegationTotalRewardsResponse"; + value: QueryDelegationTotalRewardsResponseAmino; +} +/** + * QueryDelegationTotalRewardsResponse is the response type for the + * Query/DelegationTotalRewards RPC method. + */ +export interface QueryDelegationTotalRewardsResponseSDKType { + rewards: DelegationDelegatorRewardSDKType[]; + total: DecCoinSDKType[]; +} +/** + * QueryDelegatorValidatorsRequest is the request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; +} +export interface QueryDelegatorValidatorsRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorsRequest is the request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequestAmino { + /** delegator_address defines the delegator address to query for. */ + delegator_address?: string; +} +export interface QueryDelegatorValidatorsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest"; + value: QueryDelegatorValidatorsRequestAmino; +} +/** + * QueryDelegatorValidatorsRequest is the request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequestSDKType { + delegator_address: string; +} +/** + * QueryDelegatorValidatorsResponse is the response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators a delegator is delegating for. */ + validators: string[]; +} +export interface QueryDelegatorValidatorsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorsResponse is the response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponseAmino { + /** validators defines the validators a delegator is delegating for. */ + validators?: string[]; +} +export interface QueryDelegatorValidatorsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse"; + value: QueryDelegatorValidatorsResponseAmino; +} +/** + * QueryDelegatorValidatorsResponse is the response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponseSDKType { + validators: string[]; +} +/** + * QueryDelegatorWithdrawAddressRequest is the request type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressRequest { + /** delegator_address defines the delegator address to query for. */ + delegatorAddress: string; +} +export interface QueryDelegatorWithdrawAddressRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorWithdrawAddressRequest is the request type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressRequestAmino { + /** delegator_address defines the delegator address to query for. */ + delegator_address?: string; +} +export interface QueryDelegatorWithdrawAddressRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorWithdrawAddressRequest"; + value: QueryDelegatorWithdrawAddressRequestAmino; +} +/** + * QueryDelegatorWithdrawAddressRequest is the request type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressRequestSDKType { + delegator_address: string; +} +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdrawAddress: string; +} +export interface QueryDelegatorWithdrawAddressResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse"; + value: Uint8Array; +} +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponseAmino { + /** withdraw_address defines the delegator address to query for. */ + withdraw_address?: string; +} +export interface QueryDelegatorWithdrawAddressResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorWithdrawAddressResponse"; + value: QueryDelegatorWithdrawAddressResponseAmino; +} +/** + * QueryDelegatorWithdrawAddressResponse is the response type for the + * Query/DelegatorWithdrawAddress RPC method. + */ +export interface QueryDelegatorWithdrawAddressResponseSDKType { + withdraw_address: string; +} +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequest {} +export interface QueryCommunityPoolRequestProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest"; + value: Uint8Array; +} +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequestAmino {} +export interface QueryCommunityPoolRequestAminoMsg { + type: "cosmos-sdk/QueryCommunityPoolRequest"; + value: QueryCommunityPoolRequestAmino; +} +/** + * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC + * method. + */ +export interface QueryCommunityPoolRequestSDKType {} +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponse { + /** pool defines community pool's coins. */ + pool: DecCoin[]; +} +export interface QueryCommunityPoolResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse"; + value: Uint8Array; +} +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponseAmino { + /** pool defines community pool's coins. */ + pool: DecCoinAmino[]; +} +export interface QueryCommunityPoolResponseAminoMsg { + type: "cosmos-sdk/QueryCommunityPoolResponse"; + value: QueryCommunityPoolResponseAmino; +} +/** + * QueryCommunityPoolResponse is the response type for the Query/CommunityPool + * RPC method. + */ +export interface QueryCommunityPoolResponseSDKType { + pool: DecCoinSDKType[]; +} +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorDistributionInfoRequest(): QueryValidatorDistributionInfoRequest { + return { + validatorAddress: "" + }; +} +export const QueryValidatorDistributionInfoRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest", + aminoType: "cosmos-sdk/QueryValidatorDistributionInfoRequest", + encode(message: QueryValidatorDistributionInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: QueryValidatorDistributionInfoRequestAmino): QueryValidatorDistributionInfoRequest { + const message = createBaseQueryValidatorDistributionInfoRequest(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: QueryValidatorDistributionInfoRequest): QueryValidatorDistributionInfoRequestAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: QueryValidatorDistributionInfoRequestAminoMsg): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDistributionInfoRequest): QueryValidatorDistributionInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDistributionInfoRequest", + value: QueryValidatorDistributionInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDistributionInfoRequestProtoMsg): QueryValidatorDistributionInfoRequest { + return QueryValidatorDistributionInfoRequest.decode(message.value); + }, + toProto(message: QueryValidatorDistributionInfoRequest): Uint8Array { + return QueryValidatorDistributionInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDistributionInfoRequest): QueryValidatorDistributionInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest", + value: QueryValidatorDistributionInfoRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorDistributionInfoResponse(): QueryValidatorDistributionInfoResponse { + return { + operatorAddress: "", + selfBondRewards: [], + commission: [] + }; +} +export const QueryValidatorDistributionInfoResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse", + aminoType: "cosmos-sdk/QueryValidatorDistributionInfoResponse", + encode(message: QueryValidatorDistributionInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + for (const v of message.selfBondRewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDistributionInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDistributionInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operatorAddress = reader.string(); + break; + case 2: + message.selfBondRewards.push(DecCoin.decode(reader, reader.uint32())); + break; + case 3: + message.commission.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + message.operatorAddress = object.operatorAddress ?? ""; + message.selfBondRewards = object.selfBondRewards?.map(e => DecCoin.fromPartial(e)) || []; + message.commission = object.commission?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryValidatorDistributionInfoResponseAmino): QueryValidatorDistributionInfoResponse { + const message = createBaseQueryValidatorDistributionInfoResponse(); + if (object.operator_address !== undefined && object.operator_address !== null) { + message.operatorAddress = object.operator_address; + } + message.selfBondRewards = object.self_bond_rewards?.map(e => DecCoin.fromAmino(e)) || []; + message.commission = object.commission?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryValidatorDistributionInfoResponse): QueryValidatorDistributionInfoResponseAmino { + const obj: any = {}; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; + if (message.selfBondRewards) { + obj.self_bond_rewards = message.selfBondRewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.self_bond_rewards = message.selfBondRewards; + } + if (message.commission) { + obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.commission = message.commission; + } + return obj; + }, + fromAminoMsg(object: QueryValidatorDistributionInfoResponseAminoMsg): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDistributionInfoResponse): QueryValidatorDistributionInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDistributionInfoResponse", + value: QueryValidatorDistributionInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDistributionInfoResponseProtoMsg): QueryValidatorDistributionInfoResponse { + return QueryValidatorDistributionInfoResponse.decode(message.value); + }, + toProto(message: QueryValidatorDistributionInfoResponse): Uint8Array { + return QueryValidatorDistributionInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDistributionInfoResponse): QueryValidatorDistributionInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse", + value: QueryValidatorDistributionInfoResponse.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { + validatorAddress: "" + }; +} +export const QueryValidatorOutstandingRewardsRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", + aminoType: "cosmos-sdk/QueryValidatorOutstandingRewardsRequest", + encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: QueryValidatorOutstandingRewardsRequestAmino): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorOutstandingRewardsRequest", + value: QueryValidatorOutstandingRewardsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorOutstandingRewardsRequestProtoMsg): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.decode(message.value); + }, + toProto(message: QueryValidatorOutstandingRewardsRequest): Uint8Array { + return QueryValidatorOutstandingRewardsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest", + value: QueryValidatorOutstandingRewardsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { + rewards: ValidatorOutstandingRewards.fromPartial({}) + }; +} +export const QueryValidatorOutstandingRewardsResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", + aminoType: "cosmos-sdk/QueryValidatorOutstandingRewardsResponse", + encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorOutstandingRewardsResponse { + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorOutstandingRewards.fromPartial(object.rewards) : undefined; + return message; + }, + fromAmino(object: QueryValidatorOutstandingRewardsResponseAmino): QueryValidatorOutstandingRewardsResponse { + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + if (object.rewards !== undefined && object.rewards !== null) { + message.rewards = ValidatorOutstandingRewards.fromAmino(object.rewards); + } + return message; + }, + toAmino(message: QueryValidatorOutstandingRewardsResponse): QueryValidatorOutstandingRewardsResponseAmino { + const obj: any = {}; + obj.rewards = message.rewards ? ValidatorOutstandingRewards.toAmino(message.rewards) : ValidatorOutstandingRewards.toAmino(ValidatorOutstandingRewards.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryValidatorOutstandingRewardsResponseAminoMsg): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorOutstandingRewardsResponse): QueryValidatorOutstandingRewardsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorOutstandingRewardsResponse", + value: QueryValidatorOutstandingRewardsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorOutstandingRewardsResponseProtoMsg): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.decode(message.value); + }, + toProto(message: QueryValidatorOutstandingRewardsResponse): Uint8Array { + return QueryValidatorOutstandingRewardsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorOutstandingRewardsResponse): QueryValidatorOutstandingRewardsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse", + value: QueryValidatorOutstandingRewardsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRequest { + return { + validatorAddress: "" + }; +} +export const QueryValidatorCommissionRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", + aminoType: "cosmos-sdk/QueryValidatorCommissionRequest", + encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: QueryValidatorCommissionRequestAmino): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorCommissionRequest", + value: QueryValidatorCommissionRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorCommissionRequestProtoMsg): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.decode(message.value); + }, + toProto(message: QueryValidatorCommissionRequest): Uint8Array { + return QueryValidatorCommissionRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest", + value: QueryValidatorCommissionRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { + commission: ValidatorAccumulatedCommission.fromPartial({}) + }; +} +export const QueryValidatorCommissionResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", + aminoType: "cosmos-sdk/QueryValidatorCommissionResponse", + encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorCommissionResponse { + const message = createBaseQueryValidatorCommissionResponse(); + message.commission = object.commission !== undefined && object.commission !== null ? ValidatorAccumulatedCommission.fromPartial(object.commission) : undefined; + return message; + }, + fromAmino(object: QueryValidatorCommissionResponseAmino): QueryValidatorCommissionResponse { + const message = createBaseQueryValidatorCommissionResponse(); + if (object.commission !== undefined && object.commission !== null) { + message.commission = ValidatorAccumulatedCommission.fromAmino(object.commission); + } + return message; + }, + toAmino(message: QueryValidatorCommissionResponse): QueryValidatorCommissionResponseAmino { + const obj: any = {}; + obj.commission = message.commission ? ValidatorAccumulatedCommission.toAmino(message.commission) : ValidatorAccumulatedCommission.toAmino(ValidatorAccumulatedCommission.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryValidatorCommissionResponseAminoMsg): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorCommissionResponse): QueryValidatorCommissionResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorCommissionResponse", + value: QueryValidatorCommissionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorCommissionResponseProtoMsg): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.decode(message.value); + }, + toProto(message: QueryValidatorCommissionResponse): Uint8Array { + return QueryValidatorCommissionResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorCommissionResponse): QueryValidatorCommissionResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse", + value: QueryValidatorCommissionResponse.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest { + return { + validatorAddress: "", + startingHeight: BigInt(0), + endingHeight: BigInt(0), + pagination: undefined + }; +} +export const QueryValidatorSlashesRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", + aminoType: "cosmos-sdk/QueryValidatorSlashesRequest", + encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (message.startingHeight !== BigInt(0)) { + writer.uint32(16).uint64(message.startingHeight); + } + if (message.endingHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.endingHeight); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.startingHeight = reader.uint64(); + break; + case 3: + message.endingHeight = reader.uint64(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validatorAddress = object.validatorAddress ?? ""; + message.startingHeight = object.startingHeight !== undefined && object.startingHeight !== null ? BigInt(object.startingHeight.toString()) : BigInt(0); + message.endingHeight = object.endingHeight !== undefined && object.endingHeight !== null ? BigInt(object.endingHeight.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorSlashesRequestAmino): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.starting_height !== undefined && object.starting_height !== null) { + message.startingHeight = BigInt(object.starting_height); + } + if (object.ending_height !== undefined && object.ending_height !== null) { + message.endingHeight = BigInt(object.ending_height); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.starting_height = message.startingHeight !== BigInt(0) ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight !== BigInt(0) ? message.endingHeight.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorSlashesRequestAminoMsg): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorSlashesRequest", + value: QueryValidatorSlashesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorSlashesRequestProtoMsg): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.decode(message.value); + }, + toProto(message: QueryValidatorSlashesRequest): Uint8Array { + return QueryValidatorSlashesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest", + value: QueryValidatorSlashesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesResponse { + return { + slashes: [], + pagination: undefined + }; +} +export const QueryValidatorSlashesResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", + aminoType: "cosmos-sdk/QueryValidatorSlashesResponse", + encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.slashes.push(ValidatorSlashEvent.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: DeepPartial): QueryValidatorSlashesResponse { + const message = createBaseQueryValidatorSlashesResponse(); + message.slashes = object.slashes?.map(e => ValidatorSlashEvent.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorSlashesResponseAmino): QueryValidatorSlashesResponse { + const message = createBaseQueryValidatorSlashesResponse(); + message.slashes = object.slashes?.map(e => ValidatorSlashEvent.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorSlashesResponse): QueryValidatorSlashesResponseAmino { + const obj: any = {}; + if (message.slashes) { + obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); + } else { + obj.slashes = message.slashes; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorSlashesResponseAminoMsg): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorSlashesResponse): QueryValidatorSlashesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorSlashesResponse", + value: QueryValidatorSlashesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorSlashesResponseProtoMsg): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.decode(message.value); + }, + toProto(message: QueryValidatorSlashesResponse): Uint8Array { + return QueryValidatorSlashesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorSlashesResponse): QueryValidatorSlashesResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse", + value: QueryValidatorSlashesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsRequest { + return { + delegatorAddress: "", + validatorAddress: "" + }; +} +export const QueryDelegationRewardsRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", + aminoType: "cosmos-sdk/QueryDelegationRewardsRequest", + encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: QueryDelegationRewardsRequestAmino): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationRewardsRequest", + value: QueryDelegationRewardsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationRewardsRequestProtoMsg): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.decode(message.value); + }, + toProto(message: QueryDelegationRewardsRequest): Uint8Array { + return QueryDelegationRewardsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest", + value: QueryDelegationRewardsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { + rewards: [] + }; +} +export const QueryDelegationRewardsResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", + aminoType: "cosmos-sdk/QueryDelegationRewardsResponse", + encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryDelegationRewardsResponseAmino): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryDelegationRewardsResponse): QueryDelegationRewardsResponseAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = message.rewards; + } + return obj; + }, + fromAminoMsg(object: QueryDelegationRewardsResponseAminoMsg): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationRewardsResponse): QueryDelegationRewardsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationRewardsResponse", + value: QueryDelegationRewardsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationRewardsResponseProtoMsg): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.decode(message.value); + }, + toProto(message: QueryDelegationRewardsResponse): Uint8Array { + return QueryDelegationRewardsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationRewardsResponse): QueryDelegationRewardsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse", + value: QueryDelegationRewardsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { + delegatorAddress: "" + }; +} +export const QueryDelegationTotalRewardsRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", + aminoType: "cosmos-sdk/QueryDelegationTotalRewardsRequest", + encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, + fromAmino(object: QueryDelegationTotalRewardsRequestAmino): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + return message; + }, + toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationTotalRewardsRequest", + value: QueryDelegationTotalRewardsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationTotalRewardsRequestProtoMsg): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.decode(message.value); + }, + toProto(message: QueryDelegationTotalRewardsRequest): Uint8Array { + return QueryDelegationTotalRewardsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest", + value: QueryDelegationTotalRewardsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { + rewards: [], + total: [] + }; +} +export const QueryDelegationTotalRewardsResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", + aminoType: "cosmos-sdk/QueryDelegationTotalRewardsResponse", + encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + break; + case 2: + message.total.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegationTotalRewardsResponse { + const message = createBaseQueryDelegationTotalRewardsResponse(); + message.rewards = object.rewards?.map(e => DelegationDelegatorReward.fromPartial(e)) || []; + message.total = object.total?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryDelegationTotalRewardsResponseAmino): QueryDelegationTotalRewardsResponse { + const message = createBaseQueryDelegationTotalRewardsResponse(); + message.rewards = object.rewards?.map(e => DelegationDelegatorReward.fromAmino(e)) || []; + message.total = object.total?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryDelegationTotalRewardsResponse): QueryDelegationTotalRewardsResponseAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toAmino(e) : undefined); + } else { + obj.rewards = message.rewards; + } + if (message.total) { + obj.total = message.total.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.total = message.total; + } + return obj; + }, + fromAminoMsg(object: QueryDelegationTotalRewardsResponseAminoMsg): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationTotalRewardsResponse): QueryDelegationTotalRewardsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationTotalRewardsResponse", + value: QueryDelegationTotalRewardsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationTotalRewardsResponseProtoMsg): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.decode(message.value); + }, + toProto(message: QueryDelegationTotalRewardsResponse): Uint8Array { + return QueryDelegationTotalRewardsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationTotalRewardsResponse): QueryDelegationTotalRewardsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse", + value: QueryDelegationTotalRewardsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { + delegatorAddress: "" + }; +} +export const QueryDelegatorValidatorsRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", + aminoType: "cosmos-sdk/QueryDelegatorValidatorsRequest", + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, + fromAmino(object: QueryDelegatorValidatorsRequestAmino): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + return message; + }, + toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsRequestProtoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsRequest): Uint8Array { + return QueryDelegatorValidatorsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { + validators: [] + }; +} +export const QueryDelegatorValidatorsResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", + aminoType: "cosmos-sdk/QueryDelegatorValidatorsResponse", + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map(e => e) || []; + return message; + }, + fromAmino(object: QueryDelegatorValidatorsResponseAmino): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map(e => e) || []; + return message; + }, + toAmino(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e); + } else { + obj.validators = message.validators; + } + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsResponseAminoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsResponseProtoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsResponse): Uint8Array { + return QueryDelegatorValidatorsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { + delegatorAddress: "" + }; +} +export const QueryDelegatorWithdrawAddressRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", + aminoType: "cosmos-sdk/QueryDelegatorWithdrawAddressRequest", + encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegatorAddress = object.delegatorAddress ?? ""; + return message; + }, + fromAmino(object: QueryDelegatorWithdrawAddressRequestAmino): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + return message; + }, + toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorWithdrawAddressRequest", + value: QueryDelegatorWithdrawAddressRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorWithdrawAddressRequestProtoMsg): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.decode(message.value); + }, + toProto(message: QueryDelegatorWithdrawAddressRequest): Uint8Array { + return QueryDelegatorWithdrawAddressRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest", + value: QueryDelegatorWithdrawAddressRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { + withdrawAddress: "" + }; +} +export const QueryDelegatorWithdrawAddressResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", + aminoType: "cosmos-sdk/QueryDelegatorWithdrawAddressResponse", + encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.withdrawAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, + fromAmino(object: QueryDelegatorWithdrawAddressResponseAmino): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + if (object.withdraw_address !== undefined && object.withdraw_address !== null) { + message.withdrawAddress = object.withdraw_address; + } + return message; + }, + toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { + const obj: any = {}; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; + return obj; + }, + fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorWithdrawAddressResponse", + value: QueryDelegatorWithdrawAddressResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorWithdrawAddressResponseProtoMsg): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.decode(message.value); + }, + toProto(message: QueryDelegatorWithdrawAddressResponse): Uint8Array { + return QueryDelegatorWithdrawAddressResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse", + value: QueryDelegatorWithdrawAddressResponse.encode(message).finish() + }; + } +}; +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} +export const QueryCommunityPoolRequest = { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", + aminoType: "cosmos-sdk/QueryCommunityPoolRequest", + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, + fromAmino(_: QueryCommunityPoolRequestAmino): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, + toAmino(_: QueryCommunityPoolRequest): QueryCommunityPoolRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryCommunityPoolRequestAminoMsg): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCommunityPoolRequest): QueryCommunityPoolRequestAminoMsg { + return { + type: "cosmos-sdk/QueryCommunityPoolRequest", + value: QueryCommunityPoolRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCommunityPoolRequestProtoMsg): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.decode(message.value); + }, + toProto(message: QueryCommunityPoolRequest): Uint8Array { + return QueryCommunityPoolRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCommunityPoolRequest): QueryCommunityPoolRequestProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest", + value: QueryCommunityPoolRequest.encode(message).finish() + }; + } +}; +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { + pool: [] + }; +} +export const QueryCommunityPoolResponse = { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", + aminoType: "cosmos-sdk/QueryCommunityPoolResponse", + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryCommunityPoolResponse { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryCommunityPoolResponseAmino): QueryCommunityPoolResponse { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseAmino { + const obj: any = {}; + if (message.pool) { + obj.pool = message.pool.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.pool = message.pool; + } + return obj; + }, + fromAminoMsg(object: QueryCommunityPoolResponseAminoMsg): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseAminoMsg { + return { + type: "cosmos-sdk/QueryCommunityPoolResponse", + value: QueryCommunityPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCommunityPoolResponseProtoMsg): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.decode(message.value); + }, + toProto(message: QueryCommunityPoolResponse): Uint8Array { + return QueryCommunityPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCommunityPoolResponse): QueryCommunityPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse", + value: QueryCommunityPoolResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/tx.amino.ts b/util/inj-types/cosmos/distribution/v1beta1/tx.amino.ts new file mode 100644 index 00000000..adc1184d --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/tx.amino.ts @@ -0,0 +1,33 @@ +import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool, MsgUpdateParams, MsgCommunityPoolSpend } from "./tx"; +export const AminoConverter = { + "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress": { + aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", + toAmino: MsgSetWithdrawAddress.toAmino, + fromAmino: MsgSetWithdrawAddress.fromAmino + }, + "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": { + aminoType: "cosmos-sdk/MsgWithdrawDelegationReward", + toAmino: MsgWithdrawDelegatorReward.toAmino, + fromAmino: MsgWithdrawDelegatorReward.fromAmino + }, + "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission": { + aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", + toAmino: MsgWithdrawValidatorCommission.toAmino, + fromAmino: MsgWithdrawValidatorCommission.fromAmino + }, + "/cosmos.distribution.v1beta1.MsgFundCommunityPool": { + aminoType: "cosmos-sdk/MsgFundCommunityPool", + toAmino: MsgFundCommunityPool.toAmino, + fromAmino: MsgFundCommunityPool.fromAmino + }, + "/cosmos.distribution.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/distribution/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + }, + "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend": { + aminoType: "cosmos-sdk/distr/MsgCommunityPoolSpend", + toAmino: MsgCommunityPoolSpend.toAmino, + fromAmino: MsgCommunityPoolSpend.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/tx.registry.ts b/util/inj-types/cosmos/distribution/v1beta1/tx.registry.ts new file mode 100644 index 00000000..76932c04 --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/tx.registry.ts @@ -0,0 +1,125 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool, MsgUpdateParams, MsgCommunityPoolSpend } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool], ["/cosmos.distribution.v1beta1.MsgUpdateParams", MsgUpdateParams], ["/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", MsgCommunityPoolSpend]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + setWithdrawAddress(value: MsgSetWithdrawAddress) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + value: MsgSetWithdrawAddress.encode(value).finish() + }; + }, + withdrawDelegatorReward(value: MsgWithdrawDelegatorReward) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + value: MsgWithdrawDelegatorReward.encode(value).finish() + }; + }, + withdrawValidatorCommission(value: MsgWithdrawValidatorCommission) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.encode(value).finish() + }; + }, + fundCommunityPool(value: MsgFundCommunityPool) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + value: MsgFundCommunityPool.encode(value).finish() + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.encode(value).finish() + }; + } + }, + withTypeUrl: { + setWithdrawAddress(value: MsgSetWithdrawAddress) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + value + }; + }, + withdrawDelegatorReward(value: MsgWithdrawDelegatorReward) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + value + }; + }, + withdrawValidatorCommission(value: MsgWithdrawValidatorCommission) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + value + }; + }, + fundCommunityPool(value: MsgFundCommunityPool) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + value + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value + }; + } + }, + fromPartial: { + setWithdrawAddress(value: MsgSetWithdrawAddress) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + value: MsgSetWithdrawAddress.fromPartial(value) + }; + }, + withdrawDelegatorReward(value: MsgWithdrawDelegatorReward) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + value: MsgWithdrawDelegatorReward.fromPartial(value) + }; + }, + withdrawValidatorCommission(value: MsgWithdrawValidatorCommission) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.fromPartial(value) + }; + }, + fundCommunityPool(value: MsgFundCommunityPool) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + value: MsgFundCommunityPool.fromPartial(value) + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + }, + communityPoolSpend(value: MsgCommunityPoolSpend) { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/distribution/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..075c3b7a --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,96 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSetWithdrawAddress, MsgSetWithdrawAddressResponse, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardResponse, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionResponse, MsgFundCommunityPool, MsgFundCommunityPoolResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgCommunityPoolSpend, MsgCommunityPoolSpendResponse } from "./tx"; +/** Msg defines the distribution Msg service. */ +export interface Msg { + /** + * SetWithdrawAddress defines a method to change the withdraw address + * for a delegator (or validator self-delegation). + */ + setWithdrawAddress(request: MsgSetWithdrawAddress): Promise; + /** + * WithdrawDelegatorReward defines a method to withdraw rewards of delegator + * from a single validator. + */ + withdrawDelegatorReward(request: MsgWithdrawDelegatorReward): Promise; + /** + * WithdrawValidatorCommission defines a method to withdraw the + * full commission to the validator address. + */ + withdrawValidatorCommission(request: MsgWithdrawValidatorCommission): Promise; + /** + * FundCommunityPool defines a method to allow an account to directly + * fund the community pool. + */ + fundCommunityPool(request: MsgFundCommunityPool): Promise; + /** + * UpdateParams defines a governance operation for updating the x/distribution + * module parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + updateParams(request: MsgUpdateParams): Promise; + /** + * CommunityPoolSpend defines a governance operation for sending tokens from + * the community pool in the x/distribution module to another account, which + * could be the governance module itself. The authority is defined in the + * keeper. + * + * Since: cosmos-sdk 0.47 + */ + communityPoolSpend(request: MsgCommunityPoolSpend): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* SetWithdrawAddress defines a method to change the withdraw address + for a delegator (or validator self-delegation). */ + setWithdrawAddress = async (request: MsgSetWithdrawAddress): Promise => { + const data = MsgSetWithdrawAddress.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "SetWithdrawAddress", data); + return promise.then(data => MsgSetWithdrawAddressResponse.decode(new BinaryReader(data))); + }; + /* WithdrawDelegatorReward defines a method to withdraw rewards of delegator + from a single validator. */ + withdrawDelegatorReward = async (request: MsgWithdrawDelegatorReward): Promise => { + const data = MsgWithdrawDelegatorReward.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "WithdrawDelegatorReward", data); + return promise.then(data => MsgWithdrawDelegatorRewardResponse.decode(new BinaryReader(data))); + }; + /* WithdrawValidatorCommission defines a method to withdraw the + full commission to the validator address. */ + withdrawValidatorCommission = async (request: MsgWithdrawValidatorCommission): Promise => { + const data = MsgWithdrawValidatorCommission.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "WithdrawValidatorCommission", data); + return promise.then(data => MsgWithdrawValidatorCommissionResponse.decode(new BinaryReader(data))); + }; + /* FundCommunityPool defines a method to allow an account to directly + fund the community pool. */ + fundCommunityPool = async (request: MsgFundCommunityPool): Promise => { + const data = MsgFundCommunityPool.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "FundCommunityPool", data); + return promise.then(data => MsgFundCommunityPoolResponse.decode(new BinaryReader(data))); + }; + /* UpdateParams defines a governance operation for updating the x/distribution + module parameters. The authority is defined in the keeper. + + Since: cosmos-sdk 0.47 */ + updateParams = async (request: MsgUpdateParams): Promise => { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + }; + /* CommunityPoolSpend defines a governance operation for sending tokens from + the community pool in the x/distribution module to another account, which + could be the governance module itself. The authority is defined in the + keeper. + + Since: cosmos-sdk 0.47 */ + communityPoolSpend = async (request: MsgCommunityPoolSpend): Promise => { + const data = MsgCommunityPoolSpend.encode(request).finish(); + const promise = this.rpc.request("cosmos.distribution.v1beta1.Msg", "CommunityPoolSpend", data); + return promise.then(data => MsgCommunityPoolSpendResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/distribution/v1beta1/tx.ts b/util/inj-types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..9413039c --- /dev/null +++ b/util/inj-types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1247 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Params, ParamsAmino, ParamsSDKType } from "./distribution"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: string; +} +export interface MsgSetWithdrawAddressProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress"; + value: Uint8Array; +} +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddressAmino { + delegator_address?: string; + withdraw_address?: string; +} +export interface MsgSetWithdrawAddressAminoMsg { + type: "cosmos-sdk/MsgModifyWithdrawAddress"; + value: MsgSetWithdrawAddressAmino; +} +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddressSDKType { + delegator_address: string; + withdraw_address: string; +} +/** + * MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + * type. + */ +export interface MsgSetWithdrawAddressResponse {} +export interface MsgSetWithdrawAddressResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse"; + value: Uint8Array; +} +/** + * MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + * type. + */ +export interface MsgSetWithdrawAddressResponseAmino {} +export interface MsgSetWithdrawAddressResponseAminoMsg { + type: "cosmos-sdk/MsgSetWithdrawAddressResponse"; + value: MsgSetWithdrawAddressResponseAmino; +} +/** + * MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + * type. + */ +export interface MsgSetWithdrawAddressResponseSDKType {} +/** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ +export interface MsgWithdrawDelegatorReward { + delegatorAddress: string; + validatorAddress: string; +} +export interface MsgWithdrawDelegatorRewardProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"; + value: Uint8Array; +} +/** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ +export interface MsgWithdrawDelegatorRewardAmino { + delegator_address?: string; + validator_address?: string; +} +export interface MsgWithdrawDelegatorRewardAminoMsg { + type: "cosmos-sdk/MsgWithdrawDelegationReward"; + value: MsgWithdrawDelegatorRewardAmino; +} +/** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ +export interface MsgWithdrawDelegatorRewardSDKType { + delegator_address: string; + validator_address: string; +} +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} +export interface MsgWithdrawDelegatorRewardResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse"; + value: Uint8Array; +} +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponseAmino { + /** Since: cosmos-sdk 0.46 */ + amount: CoinAmino[]; +} +export interface MsgWithdrawDelegatorRewardResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse"; + value: MsgWithdrawDelegatorRewardResponseAmino; +} +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponseSDKType { + amount: CoinSDKType[]; +} +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} +export interface MsgWithdrawValidatorCommissionProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission"; + value: Uint8Array; +} +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommissionAmino { + validator_address?: string; +} +export interface MsgWithdrawValidatorCommissionAminoMsg { + type: "cosmos-sdk/MsgWithdrawValidatorCommission"; + value: MsgWithdrawValidatorCommissionAmino; +} +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommissionSDKType { + validator_address: string; +} +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} +export interface MsgWithdrawValidatorCommissionResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse"; + value: Uint8Array; +} +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponseAmino { + /** Since: cosmos-sdk 0.46 */ + amount: CoinAmino[]; +} +export interface MsgWithdrawValidatorCommissionResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse"; + value: MsgWithdrawValidatorCommissionResponseAmino; +} +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponseSDKType { + amount: CoinSDKType[]; +} +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPool { + amount: Coin[]; + depositor: string; +} +export interface MsgFundCommunityPoolProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool"; + value: Uint8Array; +} +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPoolAmino { + amount: CoinAmino[]; + depositor?: string; +} +export interface MsgFundCommunityPoolAminoMsg { + type: "cosmos-sdk/MsgFundCommunityPool"; + value: MsgFundCommunityPoolAmino; +} +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPoolSDKType { + amount: CoinSDKType[]; + depositor: string; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponse {} +export interface MsgFundCommunityPoolResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse"; + value: Uint8Array; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponseAmino {} +export interface MsgFundCommunityPoolResponseAminoMsg { + type: "cosmos-sdk/MsgFundCommunityPoolResponse"; + value: MsgFundCommunityPoolResponseAmino; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponseSDKType {} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/distribution/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseSDKType {} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} +export interface MsgCommunityPoolSpendProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend"; + value: Uint8Array; +} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + recipient?: string; + amount: CoinAmino[]; +} +export interface MsgCommunityPoolSpendAminoMsg { + type: "cosmos-sdk/distr/MsgCommunityPoolSpend"; + value: MsgCommunityPoolSpendAmino; +} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendSDKType { + authority: string; + recipient: string; + amount: CoinSDKType[]; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse {} +export interface MsgCommunityPoolSpendResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse"; + value: Uint8Array; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponseAmino {} +export interface MsgCommunityPoolSpendResponseAminoMsg { + type: "cosmos-sdk/MsgCommunityPoolSpendResponse"; + value: MsgCommunityPoolSpendResponseAmino; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponseSDKType {} +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { + delegatorAddress: "", + withdrawAddress: "" + }; +} +export const MsgSetWithdrawAddress = { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.withdrawAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, + fromAmino(object: MsgSetWithdrawAddressAmino): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.withdraw_address !== undefined && object.withdraw_address !== null) { + message.withdrawAddress = object.withdraw_address; + } + return message; + }, + toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; + return obj; + }, + fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAminoMsg { + return { + type: "cosmos-sdk/MsgModifyWithdrawAddress", + value: MsgSetWithdrawAddress.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetWithdrawAddressProtoMsg): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.decode(message.value); + }, + toProto(message: MsgSetWithdrawAddress): Uint8Array { + return MsgSetWithdrawAddress.encode(message).finish(); + }, + toProtoMsg(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + value: MsgSetWithdrawAddress.encode(message).finish() + }; + } +}; +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} +export const MsgSetWithdrawAddressResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", + aminoType: "cosmos-sdk/MsgSetWithdrawAddressResponse", + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, + fromAmino(_: MsgSetWithdrawAddressResponseAmino): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, + toAmino(_: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSetWithdrawAddressResponseAminoMsg): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSetWithdrawAddressResponse", + value: MsgSetWithdrawAddressResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetWithdrawAddressResponseProtoMsg): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.decode(message.value); + }, + toProto(message: MsgSetWithdrawAddressResponse): Uint8Array { + return MsgSetWithdrawAddressResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", + value: MsgSetWithdrawAddressResponse.encode(message).finish() + }; + } +}; +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { + delegatorAddress: "", + validatorAddress: "" + }; +} +export const MsgWithdrawDelegatorReward = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + aminoType: "cosmos-sdk/MsgWithdrawDelegationReward", + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: MsgWithdrawDelegatorRewardAmino): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawDelegationReward", + value: MsgWithdrawDelegatorReward.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawDelegatorRewardProtoMsg): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.decode(message.value); + }, + toProto(message: MsgWithdrawDelegatorReward): Uint8Array { + return MsgWithdrawDelegatorReward.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + value: MsgWithdrawDelegatorReward.encode(message).finish() + }; + } +}; +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { + amount: [] + }; +} +export const MsgWithdrawDelegatorRewardResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + aminoType: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse", + encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgWithdrawDelegatorRewardResponseAmino): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgWithdrawDelegatorRewardResponseAminoMsg): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse", + value: MsgWithdrawDelegatorRewardResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawDelegatorRewardResponseProtoMsg): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.decode(message.value); + }, + toProto(message: MsgWithdrawDelegatorRewardResponse): Uint8Array { + return MsgWithdrawDelegatorRewardResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + value: MsgWithdrawDelegatorRewardResponse.encode(message).finish() + }; + } +}; +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { + validatorAddress: "" + }; +} +export const MsgWithdrawValidatorCommission = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: MsgWithdrawValidatorCommissionAmino): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawValidatorCommissionProtoMsg): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.decode(message.value); + }, + toProto(message: MsgWithdrawValidatorCommission): Uint8Array { + return MsgWithdrawValidatorCommission.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.encode(message).finish() + }; + } +}; +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { + amount: [] + }; +} +export const MsgWithdrawValidatorCommissionResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + aminoType: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse", + encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawValidatorCommissionResponse { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgWithdrawValidatorCommissionResponseAmino): MsgWithdrawValidatorCommissionResponse { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgWithdrawValidatorCommissionResponseAminoMsg): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse", + value: MsgWithdrawValidatorCommissionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawValidatorCommissionResponseProtoMsg): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.decode(message.value); + }, + toProto(message: MsgWithdrawValidatorCommissionResponse): Uint8Array { + return MsgWithdrawValidatorCommissionResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + value: MsgWithdrawValidatorCommissionResponse.encode(message).finish() + }; + } +}; +function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { + return { + amount: [], + depositor: "" + }; +} +export const MsgFundCommunityPool = { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + aminoType: "cosmos-sdk/MsgFundCommunityPool", + encode(message: MsgFundCommunityPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + message.depositor = object.depositor ?? ""; + return message; + }, + fromAmino(object: MsgFundCommunityPoolAmino): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + return message; + }, + toAmino(message: MsgFundCommunityPool): MsgFundCommunityPoolAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + obj.depositor = message.depositor === "" ? undefined : message.depositor; + return obj; + }, + fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { + return MsgFundCommunityPool.fromAmino(object.value); + }, + toAminoMsg(message: MsgFundCommunityPool): MsgFundCommunityPoolAminoMsg { + return { + type: "cosmos-sdk/MsgFundCommunityPool", + value: MsgFundCommunityPool.toAmino(message) + }; + }, + fromProtoMsg(message: MsgFundCommunityPoolProtoMsg): MsgFundCommunityPool { + return MsgFundCommunityPool.decode(message.value); + }, + toProto(message: MsgFundCommunityPool): Uint8Array { + return MsgFundCommunityPool.encode(message).finish(); + }, + toProtoMsg(message: MsgFundCommunityPool): MsgFundCommunityPoolProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + value: MsgFundCommunityPool.encode(message).finish() + }; + } +}; +function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { + return {}; +} +export const MsgFundCommunityPoolResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", + aminoType: "cosmos-sdk/MsgFundCommunityPoolResponse", + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, + fromAmino(_: MsgFundCommunityPoolResponseAmino): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, + toAmino(_: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgFundCommunityPoolResponseAminoMsg): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseAminoMsg { + return { + type: "cosmos-sdk/MsgFundCommunityPoolResponse", + value: MsgFundCommunityPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgFundCommunityPoolResponseProtoMsg): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.decode(message.value); + }, + toProto(message: MsgFundCommunityPoolResponse): Uint8Array { + return MsgFundCommunityPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", + value: MsgFundCommunityPoolResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + aminoType: "cosmos-sdk/distribution/MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/distribution/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { + authority: "", + recipient: "", + amount: [] + }; +} +export const MsgCommunityPoolSpend = { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + aminoType: "cosmos-sdk/distr/MsgCommunityPoolSpend", + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.recipient = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgCommunityPoolSpendAmino): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgCommunityPoolSpendAminoMsg): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromAmino(object.value); + }, + toAminoMsg(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendAminoMsg { + return { + type: "cosmos-sdk/distr/MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCommunityPoolSpendProtoMsg): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.decode(message.value); + }, + toProto(message: MsgCommunityPoolSpend): Uint8Array { + return MsgCommunityPoolSpend.encode(message).finish(); + }, + toProtoMsg(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.encode(message).finish() + }; + } +}; +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} +export const MsgCommunityPoolSpendResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", + aminoType: "cosmos-sdk/MsgCommunityPoolSpendResponse", + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, + fromAmino(_: MsgCommunityPoolSpendResponseAmino): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, + toAmino(_: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCommunityPoolSpendResponseAminoMsg): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCommunityPoolSpendResponse", + value: MsgCommunityPoolSpendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCommunityPoolSpendResponseProtoMsg): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.decode(message.value); + }, + toProto(message: MsgCommunityPoolSpendResponse): Uint8Array { + return MsgCommunityPoolSpendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", + value: MsgCommunityPoolSpendResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/evidence/module/v1/module.ts b/util/inj-types/cosmos/evidence/module/v1/module.ts new file mode 100644 index 00000000..339e37c4 --- /dev/null +++ b/util/inj-types/cosmos/evidence/module/v1/module.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the evidence module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.evidence.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the evidence module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the evidence module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.evidence.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.evidence.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/module/v1/module.ts b/util/inj-types/cosmos/feegrant/module/v1/module.ts new file mode 100644 index 00000000..d3d6d5a2 --- /dev/null +++ b/util/inj-types/cosmos/feegrant/module/v1/module.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the feegrant module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.feegrant.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the feegrant module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the feegrant module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.feegrant.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.feegrant.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/feegrant.ts b/util/inj-types/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 00000000..eec11e58 --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,635 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; +/** + * BasicAllowance implements Allowance with a one-time grant of coins + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowance { + $typeUrl?: "/cosmos.feegrant.v1beta1.BasicAllowance"; + /** + * spend_limit specifies the maximum amount of coins that can be spent + * by this allowance and will be updated as coins are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spendLimit: Coin[]; + /** expiration specifies an optional time when this allowance expires */ + expiration?: Date; +} +export interface BasicAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance"; + value: Uint8Array; +} +/** + * BasicAllowance implements Allowance with a one-time grant of coins + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowanceAmino { + /** + * spend_limit specifies the maximum amount of coins that can be spent + * by this allowance and will be updated as coins are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spend_limit: CoinAmino[]; + /** expiration specifies an optional time when this allowance expires */ + expiration?: string; +} +export interface BasicAllowanceAminoMsg { + type: "cosmos-sdk/BasicAllowance"; + value: BasicAllowanceAmino; +} +/** + * BasicAllowance implements Allowance with a one-time grant of coins + * that optionally expires. The grantee can use up to SpendLimit to cover fees. + */ +export interface BasicAllowanceSDKType { + $typeUrl?: "/cosmos.feegrant.v1beta1.BasicAllowance"; + spend_limit: CoinSDKType[]; + expiration?: Date; +} +/** + * PeriodicAllowance extends Allowance to allow for both a maximum cap, + * as well as a limit per time period. + */ +export interface PeriodicAllowance { + $typeUrl?: "/cosmos.feegrant.v1beta1.PeriodicAllowance"; + /** basic specifies a struct of `BasicAllowance` */ + basic: BasicAllowance; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period: Duration; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + periodSpendLimit: Coin[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + periodCanSpend: Coin[]; + /** + * period_reset is the time at which this period resets and a new one begins, + * it is calculated from the start time of the first transaction after the + * last period ended + */ + periodReset: Date; +} +export interface PeriodicAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance"; + value: Uint8Array; +} +/** + * PeriodicAllowance extends Allowance to allow for both a maximum cap, + * as well as a limit per time period. + */ +export interface PeriodicAllowanceAmino { + /** basic specifies a struct of `BasicAllowance` */ + basic: BasicAllowanceAmino; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period: DurationAmino; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + period_spend_limit: CoinAmino[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + period_can_spend: CoinAmino[]; + /** + * period_reset is the time at which this period resets and a new one begins, + * it is calculated from the start time of the first transaction after the + * last period ended + */ + period_reset: string; +} +export interface PeriodicAllowanceAminoMsg { + type: "cosmos-sdk/PeriodicAllowance"; + value: PeriodicAllowanceAmino; +} +/** + * PeriodicAllowance extends Allowance to allow for both a maximum cap, + * as well as a limit per time period. + */ +export interface PeriodicAllowanceSDKType { + $typeUrl?: "/cosmos.feegrant.v1beta1.PeriodicAllowance"; + basic: BasicAllowanceSDKType; + period: DurationSDKType; + period_spend_limit: CoinSDKType[]; + period_can_spend: CoinSDKType[]; + period_reset: Date; +} +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowance { + $typeUrl?: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance"; + /** allowance can be any of basic and periodic fee allowance. */ + allowance?: BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any | undefined; + /** allowed_messages are the messages for which the grantee has the access. */ + allowedMessages: string[]; +} +export interface AllowedMsgAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance"; + value: Uint8Array; +} +export type AllowedMsgAllowanceEncoded = Omit & { + /** allowance can be any of basic and periodic fee allowance. */allowance?: BasicAllowanceProtoMsg | PeriodicAllowanceProtoMsg | AllowedMsgAllowanceProtoMsg | AnyProtoMsg | undefined; +}; +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowanceAmino { + /** allowance can be any of basic and periodic fee allowance. */ + allowance?: AnyAmino; + /** allowed_messages are the messages for which the grantee has the access. */ + allowed_messages?: string[]; +} +export interface AllowedMsgAllowanceAminoMsg { + type: "cosmos-sdk/AllowedMsgAllowance"; + value: AllowedMsgAllowanceAmino; +} +/** AllowedMsgAllowance creates allowance only for specified message types. */ +export interface AllowedMsgAllowanceSDKType { + $typeUrl?: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance"; + allowance?: BasicAllowanceSDKType | PeriodicAllowanceSDKType | AllowedMsgAllowanceSDKType | AnySDKType | undefined; + allowed_messages: string[]; +} +/** Grant is stored in the KVStore to record a grant with full context */ +export interface Grant { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + /** allowance can be any of basic, periodic, allowed fee allowance. */ + allowance?: BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any | undefined; +} +export interface GrantProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.Grant"; + value: Uint8Array; +} +export type GrantEncoded = Omit & { + /** allowance can be any of basic, periodic, allowed fee allowance. */allowance?: BasicAllowanceProtoMsg | PeriodicAllowanceProtoMsg | AllowedMsgAllowanceProtoMsg | AnyProtoMsg | undefined; +}; +/** Grant is stored in the KVStore to record a grant with full context */ +export interface GrantAmino { + /** granter is the address of the user granting an allowance of their funds. */ + granter?: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee?: string; + /** allowance can be any of basic, periodic, allowed fee allowance. */ + allowance?: AnyAmino; +} +export interface GrantAminoMsg { + type: "cosmos-sdk/Grant"; + value: GrantAmino; +} +/** Grant is stored in the KVStore to record a grant with full context */ +export interface GrantSDKType { + granter: string; + grantee: string; + allowance?: BasicAllowanceSDKType | PeriodicAllowanceSDKType | AllowedMsgAllowanceSDKType | AnySDKType | undefined; +} +function createBaseBasicAllowance(): BasicAllowance { + return { + $typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", + spendLimit: [], + expiration: undefined + }; +} +export const BasicAllowance = { + typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", + aminoType: "cosmos-sdk/BasicAllowance", + encode(message: BasicAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBasicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.spendLimit.push(Coin.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: DeepPartial): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || []; + message.expiration = object.expiration ?? undefined; + return message; + }, + fromAmino(object: BasicAllowanceAmino): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spendLimit = object.spend_limit?.map(e => Coin.fromAmino(e)) || []; + if (object.expiration !== undefined && object.expiration !== null) { + message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); + } + return message; + }, + toAmino(message: BasicAllowance): BasicAllowanceAmino { + const obj: any = {}; + if (message.spendLimit) { + obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.spend_limit = message.spendLimit; + } + obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; + return obj; + }, + fromAminoMsg(object: BasicAllowanceAminoMsg): BasicAllowance { + return BasicAllowance.fromAmino(object.value); + }, + toAminoMsg(message: BasicAllowance): BasicAllowanceAminoMsg { + return { + type: "cosmos-sdk/BasicAllowance", + value: BasicAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: BasicAllowanceProtoMsg): BasicAllowance { + return BasicAllowance.decode(message.value); + }, + toProto(message: BasicAllowance): Uint8Array { + return BasicAllowance.encode(message).finish(); + }, + toProtoMsg(message: BasicAllowance): BasicAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", + value: BasicAllowance.encode(message).finish() + }; + } +}; +function createBasePeriodicAllowance(): PeriodicAllowance { + return { + $typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", + basic: BasicAllowance.fromPartial({}), + period: Duration.fromPartial({}), + periodSpendLimit: [], + periodCanSpend: [], + periodReset: new Date() + }; +} +export const PeriodicAllowance = { + typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", + aminoType: "cosmos-sdk/PeriodicAllowance", + encode(message: PeriodicAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.basic !== undefined) { + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).ldelim(); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.periodSpendLimit) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.periodCanSpend) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.periodReset !== undefined) { + Timestamp.encode(toTimestamp(message.periodReset), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.basic = BasicAllowance.decode(reader, reader.uint32()); + break; + case 2: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.periodSpendLimit.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.periodCanSpend.push(Coin.decode(reader, reader.uint32())); + break; + case 5: + message.periodReset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PeriodicAllowance { + const message = createBasePeriodicAllowance(); + message.basic = object.basic !== undefined && object.basic !== null ? BasicAllowance.fromPartial(object.basic) : undefined; + message.period = object.period !== undefined && object.period !== null ? Duration.fromPartial(object.period) : undefined; + message.periodSpendLimit = object.periodSpendLimit?.map(e => Coin.fromPartial(e)) || []; + message.periodCanSpend = object.periodCanSpend?.map(e => Coin.fromPartial(e)) || []; + message.periodReset = object.periodReset ?? undefined; + return message; + }, + fromAmino(object: PeriodicAllowanceAmino): PeriodicAllowance { + const message = createBasePeriodicAllowance(); + if (object.basic !== undefined && object.basic !== null) { + message.basic = BasicAllowance.fromAmino(object.basic); + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + message.periodSpendLimit = object.period_spend_limit?.map(e => Coin.fromAmino(e)) || []; + message.periodCanSpend = object.period_can_spend?.map(e => Coin.fromAmino(e)) || []; + if (object.period_reset !== undefined && object.period_reset !== null) { + message.periodReset = fromTimestamp(Timestamp.fromAmino(object.period_reset)); + } + return message; + }, + toAmino(message: PeriodicAllowance): PeriodicAllowanceAmino { + const obj: any = {}; + obj.basic = message.basic ? BasicAllowance.toAmino(message.basic) : BasicAllowance.toAmino(BasicAllowance.fromPartial({})); + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); + if (message.periodSpendLimit) { + obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.period_spend_limit = message.periodSpendLimit; + } + if (message.periodCanSpend) { + obj.period_can_spend = message.periodCanSpend.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.period_can_spend = message.periodCanSpend; + } + obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : new Date(); + return obj; + }, + fromAminoMsg(object: PeriodicAllowanceAminoMsg): PeriodicAllowance { + return PeriodicAllowance.fromAmino(object.value); + }, + toAminoMsg(message: PeriodicAllowance): PeriodicAllowanceAminoMsg { + return { + type: "cosmos-sdk/PeriodicAllowance", + value: PeriodicAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: PeriodicAllowanceProtoMsg): PeriodicAllowance { + return PeriodicAllowance.decode(message.value); + }, + toProto(message: PeriodicAllowance): Uint8Array { + return PeriodicAllowance.encode(message).finish(); + }, + toProtoMsg(message: PeriodicAllowance): PeriodicAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", + value: PeriodicAllowance.encode(message).finish() + }; + } +}; +function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { + return { + $typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", + allowance: undefined, + allowedMessages: [] + }; +} +export const AllowedMsgAllowance = { + typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", + aminoType: "cosmos-sdk/AllowedMsgAllowance", + encode(message: AllowedMsgAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.allowance !== undefined) { + Any.encode((message.allowance as Any), writer.uint32(10).fork()).ldelim(); + } + for (const v of message.allowedMessages) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowedMsgAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowance = (Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder(reader) as Any); + break; + case 2: + message.allowedMessages.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + message.allowance = object.allowance !== undefined && object.allowance !== null ? Any.fromPartial(object.allowance) : undefined; + message.allowedMessages = object.allowedMessages?.map(e => e) || []; + return message; + }, + fromAmino(object: AllowedMsgAllowanceAmino): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino(object.allowance); + } + message.allowedMessages = object.allowed_messages?.map(e => e) || []; + return message; + }, + toAmino(message: AllowedMsgAllowance): AllowedMsgAllowanceAmino { + const obj: any = {}; + obj.allowance = message.allowance ? Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + if (message.allowedMessages) { + obj.allowed_messages = message.allowedMessages.map(e => e); + } else { + obj.allowed_messages = message.allowedMessages; + } + return obj; + }, + fromAminoMsg(object: AllowedMsgAllowanceAminoMsg): AllowedMsgAllowance { + return AllowedMsgAllowance.fromAmino(object.value); + }, + toAminoMsg(message: AllowedMsgAllowance): AllowedMsgAllowanceAminoMsg { + return { + type: "cosmos-sdk/AllowedMsgAllowance", + value: AllowedMsgAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: AllowedMsgAllowanceProtoMsg): AllowedMsgAllowance { + return AllowedMsgAllowance.decode(message.value); + }, + toProto(message: AllowedMsgAllowance): Uint8Array { + return AllowedMsgAllowance.encode(message).finish(); + }, + toProtoMsg(message: AllowedMsgAllowance): AllowedMsgAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", + value: AllowedMsgAllowance.encode(message).finish() + }; + } +}; +function createBaseGrant(): Grant { + return { + granter: "", + grantee: "", + allowance: undefined + }; +} +export const Grant = { + typeUrl: "/cosmos.feegrant.v1beta1.Grant", + aminoType: "cosmos-sdk/Grant", + encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode((message.allowance as Any), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.allowance = (Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Grant { + const message = createBaseGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = object.allowance !== undefined && object.allowance !== null ? Any.fromPartial(object.allowance) : undefined; + return message; + }, + fromAmino(object: GrantAmino): Grant { + const message = createBaseGrant(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino(object.allowance); + } + return message; + }, + toAmino(message: Grant): GrantAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.allowance = message.allowance ? Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: GrantAminoMsg): Grant { + return Grant.fromAmino(object.value); + }, + toAminoMsg(message: Grant): GrantAminoMsg { + return { + type: "cosmos-sdk/Grant", + value: Grant.toAmino(message) + }; + }, + fromProtoMsg(message: GrantProtoMsg): Grant { + return Grant.decode(message.value); + }, + toProto(message: Grant): Uint8Array { + return Grant.encode(message).finish(); + }, + toProtoMsg(message: Grant): GrantProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.Grant", + value: Grant.encode(message).finish() + }; + } +}; +export const Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.feegrant.v1beta1.BasicAllowance": + return BasicAllowance.decode(data.value); + case "/cosmos.feegrant.v1beta1.PeriodicAllowance": + return PeriodicAllowance.decode(data.value); + case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": + return AllowedMsgAllowance.decode(data.value); + default: + return data; + } +}; +export const Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/BasicAllowance": + return Any.fromPartial({ + typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", + value: BasicAllowance.encode(BasicAllowance.fromPartial(BasicAllowance.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/PeriodicAllowance": + return Any.fromPartial({ + typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", + value: PeriodicAllowance.encode(PeriodicAllowance.fromPartial(PeriodicAllowance.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/AllowedMsgAllowance": + return Any.fromPartial({ + typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", + value: AllowedMsgAllowance.encode(AllowedMsgAllowance.fromPartial(AllowedMsgAllowance.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.feegrant.v1beta1.BasicAllowance": + return { + type: "cosmos-sdk/BasicAllowance", + value: BasicAllowance.toAmino(BasicAllowance.decode(content.value, undefined)) + }; + case "/cosmos.feegrant.v1beta1.PeriodicAllowance": + return { + type: "cosmos-sdk/PeriodicAllowance", + value: PeriodicAllowance.toAmino(PeriodicAllowance.decode(content.value, undefined)) + }; + case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": + return { + type: "cosmos-sdk/AllowedMsgAllowance", + value: AllowedMsgAllowance.toAmino(AllowedMsgAllowance.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/genesis.ts b/util/inj-types/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 00000000..df9e605d --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,95 @@ +import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** GenesisState contains a set of fee allowances, persisted from the store */ +export interface GenesisState { + allowances: Grant[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState contains a set of fee allowances, persisted from the store */ +export interface GenesisStateAmino { + allowances: GrantAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState contains a set of fee allowances, persisted from the store */ +export interface GenesisStateSDKType { + allowances: GrantSDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + allowances: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.allowances.push(Grant.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.allowances = object.allowances?.map(e => Grant.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.allowances = object.allowances?.map(e => Grant.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); + } else { + obj.allowances = message.allowances; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/query.lcd.ts b/util/inj-types/cosmos/feegrant/v1beta1/query.lcd.ts new file mode 100644 index 00000000..39642202 --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/query.lcd.ts @@ -0,0 +1,42 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryAllowanceRequest, QueryAllowanceResponseSDKType, QueryAllowancesRequest, QueryAllowancesResponseSDKType, QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Allowance returns fee granted to the grantee by the granter. */ + allowance = async (params: QueryAllowanceRequest): Promise => { + const endpoint = `cosmos/feegrant/v1beta1/allowance/${params.granter}/${params.grantee}`; + return await this.req.get(endpoint); + }; + /* Allowances returns all the grants for address. */ + allowances = async (params: QueryAllowancesRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/feegrant/v1beta1/allowances/${params.grantee}`; + return await this.req.get(endpoint, options); + }; + /* AllowancesByGranter returns all the grants given by an address + + Since: cosmos-sdk 0.46 */ + allowancesByGranter = async (params: QueryAllowancesByGranterRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/feegrant/v1beta1/issued/${params.granter}`; + return await this.req.get(endpoint, options); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/feegrant/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..d9acd0cb --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/query.rpc.Query.ts @@ -0,0 +1,58 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryAllowanceRequest, QueryAllowanceResponse, QueryAllowancesRequest, QueryAllowancesResponse, QueryAllowancesByGranterRequest, QueryAllowancesByGranterResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Allowance returns fee granted to the grantee by the granter. */ + allowance(request: QueryAllowanceRequest): Promise; + /** Allowances returns all the grants for address. */ + allowances(request: QueryAllowancesRequest): Promise; + /** + * AllowancesByGranter returns all the grants given by an address + * + * Since: cosmos-sdk 0.46 + */ + allowancesByGranter(request: QueryAllowancesByGranterRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Allowance returns fee granted to the grantee by the granter. */ + allowance = async (request: QueryAllowanceRequest): Promise => { + const data = QueryAllowanceRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Query", "Allowance", data); + return promise.then(data => QueryAllowanceResponse.decode(new BinaryReader(data))); + }; + /* Allowances returns all the grants for address. */ + allowances = async (request: QueryAllowancesRequest): Promise => { + const data = QueryAllowancesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Query", "Allowances", data); + return promise.then(data => QueryAllowancesResponse.decode(new BinaryReader(data))); + }; + /* AllowancesByGranter returns all the grants given by an address + + Since: cosmos-sdk 0.46 */ + allowancesByGranter = async (request: QueryAllowancesByGranterRequest): Promise => { + const data = QueryAllowancesByGranterRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Query", "AllowancesByGranter", data); + return promise.then(data => QueryAllowancesByGranterResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + allowance(request: QueryAllowanceRequest): Promise { + return queryService.allowance(request); + }, + allowances(request: QueryAllowancesRequest): Promise { + return queryService.allowances(request); + }, + allowancesByGranter(request: QueryAllowancesByGranterRequest): Promise { + return queryService.allowancesByGranter(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/query.ts b/util/inj-types/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 00000000..a79f39ee --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,665 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ +export interface QueryAllowanceRequest { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; +} +export interface QueryAllowanceRequestProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest"; + value: Uint8Array; +} +/** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ +export interface QueryAllowanceRequestAmino { + /** granter is the address of the user granting an allowance of their funds. */ + granter?: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee?: string; +} +export interface QueryAllowanceRequestAminoMsg { + type: "cosmos-sdk/QueryAllowanceRequest"; + value: QueryAllowanceRequestAmino; +} +/** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ +export interface QueryAllowanceRequestSDKType { + granter: string; + grantee: string; +} +/** QueryAllowanceResponse is the response type for the Query/Allowance RPC method. */ +export interface QueryAllowanceResponse { + /** allowance is a allowance granted for grantee by granter. */ + allowance?: Grant; +} +export interface QueryAllowanceResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse"; + value: Uint8Array; +} +/** QueryAllowanceResponse is the response type for the Query/Allowance RPC method. */ +export interface QueryAllowanceResponseAmino { + /** allowance is a allowance granted for grantee by granter. */ + allowance?: GrantAmino; +} +export interface QueryAllowanceResponseAminoMsg { + type: "cosmos-sdk/QueryAllowanceResponse"; + value: QueryAllowanceResponseAmino; +} +/** QueryAllowanceResponse is the response type for the Query/Allowance RPC method. */ +export interface QueryAllowanceResponseSDKType { + allowance?: GrantSDKType; +} +/** QueryAllowancesRequest is the request type for the Query/Allowances RPC method. */ +export interface QueryAllowancesRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryAllowancesRequestProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest"; + value: Uint8Array; +} +/** QueryAllowancesRequest is the request type for the Query/Allowances RPC method. */ +export interface QueryAllowancesRequestAmino { + grantee?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAllowancesRequestAminoMsg { + type: "cosmos-sdk/QueryAllowancesRequest"; + value: QueryAllowancesRequestAmino; +} +/** QueryAllowancesRequest is the request type for the Query/Allowances RPC method. */ +export interface QueryAllowancesRequestSDKType { + grantee: string; + pagination?: PageRequestSDKType; +} +/** QueryAllowancesResponse is the response type for the Query/Allowances RPC method. */ +export interface QueryAllowancesResponse { + /** allowances are allowance's granted for grantee by granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} +export interface QueryAllowancesResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse"; + value: Uint8Array; +} +/** QueryAllowancesResponse is the response type for the Query/Allowances RPC method. */ +export interface QueryAllowancesResponseAmino { + /** allowances are allowance's granted for grantee by granter. */ + allowances?: GrantAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface QueryAllowancesResponseAminoMsg { + type: "cosmos-sdk/QueryAllowancesResponse"; + value: QueryAllowancesResponseAmino; +} +/** QueryAllowancesResponse is the response type for the Query/Allowances RPC method. */ +export interface QueryAllowancesResponseSDKType { + allowances: GrantSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryAllowancesByGranterRequestProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest"; + value: Uint8Array; +} +/** + * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterRequestAmino { + granter?: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAllowancesByGranterRequestAminoMsg { + type: "cosmos-sdk/QueryAllowancesByGranterRequest"; + value: QueryAllowancesByGranterRequestAmino; +} +/** + * QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterRequestSDKType { + granter: string; + pagination?: PageRequestSDKType; +} +/** + * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterResponse { + /** allowances that have been issued by the granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} +export interface QueryAllowancesByGranterResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse"; + value: Uint8Array; +} +/** + * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterResponseAmino { + /** allowances that have been issued by the granter. */ + allowances?: GrantAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface QueryAllowancesByGranterResponseAminoMsg { + type: "cosmos-sdk/QueryAllowancesByGranterResponse"; + value: QueryAllowancesByGranterResponseAmino; +} +/** + * QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAllowancesByGranterResponseSDKType { + allowances: GrantSDKType[]; + pagination?: PageResponseSDKType; +} +function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { + return { + granter: "", + grantee: "" + }; +} +export const QueryAllowanceRequest = { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", + aminoType: "cosmos-sdk/QueryAllowanceRequest", + encode(message: QueryAllowanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceRequest(); + 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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAllowanceRequest { + const message = createBaseQueryAllowanceRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, + fromAmino(object: QueryAllowanceRequestAmino): QueryAllowanceRequest { + const message = createBaseQueryAllowanceRequest(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + return obj; + }, + fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { + return QueryAllowanceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowanceRequest): QueryAllowanceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllowanceRequest", + value: QueryAllowanceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowanceRequestProtoMsg): QueryAllowanceRequest { + return QueryAllowanceRequest.decode(message.value); + }, + toProto(message: QueryAllowanceRequest): Uint8Array { + return QueryAllowanceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowanceRequest): QueryAllowanceRequestProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceRequest", + value: QueryAllowanceRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { + return { + allowance: undefined + }; +} +export const QueryAllowanceResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", + aminoType: "cosmos-sdk/QueryAllowanceResponse", + encode(message: QueryAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.allowance !== undefined) { + Grant.encode(message.allowance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowance = Grant.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAllowanceResponse { + const message = createBaseQueryAllowanceResponse(); + message.allowance = object.allowance !== undefined && object.allowance !== null ? Grant.fromPartial(object.allowance) : undefined; + return message; + }, + fromAmino(object: QueryAllowanceResponseAmino): QueryAllowanceResponse { + const message = createBaseQueryAllowanceResponse(); + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = Grant.fromAmino(object.allowance); + } + return message; + }, + toAmino(message: QueryAllowanceResponse): QueryAllowanceResponseAmino { + const obj: any = {}; + obj.allowance = message.allowance ? Grant.toAmino(message.allowance) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowanceResponseAminoMsg): QueryAllowanceResponse { + return QueryAllowanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowanceResponse): QueryAllowanceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllowanceResponse", + value: QueryAllowanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowanceResponseProtoMsg): QueryAllowanceResponse { + return QueryAllowanceResponse.decode(message.value); + }, + toProto(message: QueryAllowanceResponse): Uint8Array { + return QueryAllowanceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowanceResponse): QueryAllowanceResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowanceResponse", + value: QueryAllowanceResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { + return { + grantee: "", + pagination: undefined + }; +} +export const QueryAllowancesRequest = { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", + aminoType: "cosmos-sdk/QueryAllowancesRequest", + encode(message: QueryAllowancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesRequest(); + 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: DeepPartial): QueryAllowancesRequest { + const message = createBaseQueryAllowancesRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllowancesRequestAmino): QueryAllowancesRequest { + const message = createBaseQueryAllowancesRequest(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { + const obj: any = {}; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowancesRequestAminoMsg): QueryAllowancesRequest { + return QueryAllowancesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowancesRequest): QueryAllowancesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllowancesRequest", + value: QueryAllowancesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowancesRequestProtoMsg): QueryAllowancesRequest { + return QueryAllowancesRequest.decode(message.value); + }, + toProto(message: QueryAllowancesRequest): Uint8Array { + return QueryAllowancesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowancesRequest): QueryAllowancesRequestProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesRequest", + value: QueryAllowancesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { + return { + allowances: [], + pagination: undefined + }; +} +export const QueryAllowancesResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", + aminoType: "cosmos-sdk/QueryAllowancesResponse", + encode(message: QueryAllowancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.allowances) { + 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: BinaryReader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.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: DeepPartial): QueryAllowancesResponse { + const message = createBaseQueryAllowancesResponse(); + message.allowances = object.allowances?.map(e => Grant.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllowancesResponseAmino): QueryAllowancesResponse { + const message = createBaseQueryAllowancesResponse(); + message.allowances = object.allowances?.map(e => Grant.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllowancesResponse): QueryAllowancesResponseAmino { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); + } else { + obj.allowances = message.allowances; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowancesResponseAminoMsg): QueryAllowancesResponse { + return QueryAllowancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowancesResponse): QueryAllowancesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllowancesResponse", + value: QueryAllowancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowancesResponseProtoMsg): QueryAllowancesResponse { + return QueryAllowancesResponse.decode(message.value); + }, + toProto(message: QueryAllowancesResponse): Uint8Array { + return QueryAllowancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowancesResponse): QueryAllowancesResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesResponse", + value: QueryAllowancesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRequest { + return { + granter: "", + pagination: undefined + }; +} +export const QueryAllowancesByGranterRequest = { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", + aminoType: "cosmos-sdk/QueryAllowancesByGranterRequest", + encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterRequest(); + 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: DeepPartial): QueryAllowancesByGranterRequest { + const message = createBaseQueryAllowancesByGranterRequest(); + message.granter = object.granter ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllowancesByGranterRequestAmino): QueryAllowancesByGranterRequest { + const message = createBaseQueryAllowancesByGranterRequest(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowancesByGranterRequestAminoMsg): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllowancesByGranterRequest", + value: QueryAllowancesByGranterRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowancesByGranterRequestProtoMsg): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.decode(message.value); + }, + toProto(message: QueryAllowancesByGranterRequest): Uint8Array { + return QueryAllowancesByGranterRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest", + value: QueryAllowancesByGranterRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterResponse { + return { + allowances: [], + pagination: undefined + }; +} +export const QueryAllowancesByGranterResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", + aminoType: "cosmos-sdk/QueryAllowancesByGranterResponse", + encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.allowances) { + 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: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowances.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: DeepPartial): QueryAllowancesByGranterResponse { + const message = createBaseQueryAllowancesByGranterResponse(); + message.allowances = object.allowances?.map(e => Grant.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllowancesByGranterResponseAmino): QueryAllowancesByGranterResponse { + const message = createBaseQueryAllowancesByGranterResponse(); + message.allowances = object.allowances?.map(e => Grant.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllowancesByGranterResponse): QueryAllowancesByGranterResponseAmino { + const obj: any = {}; + if (message.allowances) { + obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); + } else { + obj.allowances = message.allowances; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllowancesByGranterResponseAminoMsg): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllowancesByGranterResponse): QueryAllowancesByGranterResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllowancesByGranterResponse", + value: QueryAllowancesByGranterResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllowancesByGranterResponseProtoMsg): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.decode(message.value); + }, + toProto(message: QueryAllowancesByGranterResponse): Uint8Array { + return QueryAllowancesByGranterResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllowancesByGranterResponse): QueryAllowancesByGranterResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse", + value: QueryAllowancesByGranterResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/tx.amino.ts b/util/inj-types/cosmos/feegrant/v1beta1/tx.amino.ts new file mode 100644 index 00000000..1a5cbbbd --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/tx.amino.ts @@ -0,0 +1,13 @@ +import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; +export const AminoConverter = { + "/cosmos.feegrant.v1beta1.MsgGrantAllowance": { + aminoType: "cosmos-sdk/MsgGrantAllowance", + toAmino: MsgGrantAllowance.toAmino, + fromAmino: MsgGrantAllowance.fromAmino + }, + "/cosmos.feegrant.v1beta1.MsgRevokeAllowance": { + aminoType: "cosmos-sdk/MsgRevokeAllowance", + toAmino: MsgRevokeAllowance.toAmino, + fromAmino: MsgRevokeAllowance.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/tx.registry.ts b/util/inj-types/cosmos/feegrant/v1beta1/tx.registry.ts new file mode 100644 index 00000000..0ef6e3bc --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/tx.registry.ts @@ -0,0 +1,53 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgGrantAllowance, MsgRevokeAllowance } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance], ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + grantAllowance(value: MsgGrantAllowance) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + value: MsgGrantAllowance.encode(value).finish() + }; + }, + revokeAllowance(value: MsgRevokeAllowance) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + value: MsgRevokeAllowance.encode(value).finish() + }; + } + }, + withTypeUrl: { + grantAllowance(value: MsgGrantAllowance) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + value + }; + }, + revokeAllowance(value: MsgRevokeAllowance) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + value + }; + } + }, + fromPartial: { + grantAllowance(value: MsgGrantAllowance) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + value: MsgGrantAllowance.fromPartial(value) + }; + }, + revokeAllowance(value: MsgRevokeAllowance) { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + value: MsgRevokeAllowance.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/feegrant/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..a8592d6b --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,36 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgGrantAllowance, MsgGrantAllowanceResponse, MsgRevokeAllowance, MsgRevokeAllowanceResponse } from "./tx"; +/** Msg defines the feegrant msg service. */ +export interface Msg { + /** + * GrantAllowance grants fee allowance to the grantee on the granter's + * account with the provided expiration time. + */ + grantAllowance(request: MsgGrantAllowance): Promise; + /** + * RevokeAllowance revokes any fee allowance of granter's account that + * has been granted to the grantee. + */ + revokeAllowance(request: MsgRevokeAllowance): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* GrantAllowance grants fee allowance to the grantee on the granter's + account with the provided expiration time. */ + grantAllowance = async (request: MsgGrantAllowance): Promise => { + const data = MsgGrantAllowance.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Msg", "GrantAllowance", data); + return promise.then(data => MsgGrantAllowanceResponse.decode(new BinaryReader(data))); + }; + /* RevokeAllowance revokes any fee allowance of granter's account that + has been granted to the grantee. */ + revokeAllowance = async (request: MsgRevokeAllowance): Promise => { + const data = MsgRevokeAllowance.encode(request).finish(); + const promise = this.rpc.request("cosmos.feegrant.v1beta1.Msg", "RevokeAllowance", data); + return promise.then(data => MsgRevokeAllowanceResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/feegrant/v1beta1/tx.ts b/util/inj-types/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 00000000..c7ebcbfe --- /dev/null +++ b/util/inj-types/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,449 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BasicAllowance, BasicAllowanceProtoMsg, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceProtoMsg, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceProtoMsg, AllowedMsgAllowanceSDKType } from "./feegrant"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * MsgGrantAllowance adds permission for Grantee to spend up to Allowance + * of fees from the account of Granter. + */ +export interface MsgGrantAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + /** allowance can be any of basic, periodic, allowed fee allowance. */ + allowance?: BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any | undefined; +} +export interface MsgGrantAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance"; + value: Uint8Array; +} +export type MsgGrantAllowanceEncoded = Omit & { + /** allowance can be any of basic, periodic, allowed fee allowance. */allowance?: BasicAllowanceProtoMsg | PeriodicAllowanceProtoMsg | AllowedMsgAllowanceProtoMsg | AnyProtoMsg | undefined; +}; +/** + * MsgGrantAllowance adds permission for Grantee to spend up to Allowance + * of fees from the account of Granter. + */ +export interface MsgGrantAllowanceAmino { + /** granter is the address of the user granting an allowance of their funds. */ + granter?: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee?: string; + /** allowance can be any of basic, periodic, allowed fee allowance. */ + allowance?: AnyAmino; +} +export interface MsgGrantAllowanceAminoMsg { + type: "cosmos-sdk/MsgGrantAllowance"; + value: MsgGrantAllowanceAmino; +} +/** + * MsgGrantAllowance adds permission for Grantee to spend up to Allowance + * of fees from the account of Granter. + */ +export interface MsgGrantAllowanceSDKType { + granter: string; + grantee: string; + allowance?: BasicAllowanceSDKType | PeriodicAllowanceSDKType | AllowedMsgAllowanceSDKType | AnySDKType | undefined; +} +/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ +export interface MsgGrantAllowanceResponse {} +export interface MsgGrantAllowanceResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse"; + value: Uint8Array; +} +/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ +export interface MsgGrantAllowanceResponseAmino {} +export interface MsgGrantAllowanceResponseAminoMsg { + type: "cosmos-sdk/MsgGrantAllowanceResponse"; + value: MsgGrantAllowanceResponseAmino; +} +/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ +export interface MsgGrantAllowanceResponseSDKType {} +/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ +export interface MsgRevokeAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; +} +export interface MsgRevokeAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance"; + value: Uint8Array; +} +/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ +export interface MsgRevokeAllowanceAmino { + /** granter is the address of the user granting an allowance of their funds. */ + granter?: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee?: string; +} +export interface MsgRevokeAllowanceAminoMsg { + type: "cosmos-sdk/MsgRevokeAllowance"; + value: MsgRevokeAllowanceAmino; +} +/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ +export interface MsgRevokeAllowanceSDKType { + granter: string; + grantee: string; +} +/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ +export interface MsgRevokeAllowanceResponse {} +export interface MsgRevokeAllowanceResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse"; + value: Uint8Array; +} +/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ +export interface MsgRevokeAllowanceResponseAmino {} +export interface MsgRevokeAllowanceResponseAminoMsg { + type: "cosmos-sdk/MsgRevokeAllowanceResponse"; + value: MsgRevokeAllowanceResponseAmino; +} +/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ +export interface MsgRevokeAllowanceResponseSDKType {} +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { + granter: "", + grantee: "", + allowance: undefined + }; +} +export const MsgGrantAllowance = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + aminoType: "cosmos-sdk/MsgGrantAllowance", + encode(message: MsgGrantAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode((message.allowance as Any), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowance(); + 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.allowance = (Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgGrantAllowance { + const message = createBaseMsgGrantAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = object.allowance !== undefined && object.allowance !== null ? Any.fromPartial(object.allowance) : undefined; + return message; + }, + fromAmino(object: MsgGrantAllowanceAmino): MsgGrantAllowance { + const message = createBaseMsgGrantAllowance(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino(object.allowance); + } + return message; + }, + toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.allowance = message.allowance ? Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGrantAllowanceAminoMsg): MsgGrantAllowance { + return MsgGrantAllowance.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantAllowance): MsgGrantAllowanceAminoMsg { + return { + type: "cosmos-sdk/MsgGrantAllowance", + value: MsgGrantAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantAllowanceProtoMsg): MsgGrantAllowance { + return MsgGrantAllowance.decode(message.value); + }, + toProto(message: MsgGrantAllowance): Uint8Array { + return MsgGrantAllowance.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantAllowance): MsgGrantAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + value: MsgGrantAllowance.encode(message).finish() + }; + } +}; +function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { + return {}; +} +export const MsgGrantAllowanceResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", + aminoType: "cosmos-sdk/MsgGrantAllowanceResponse", + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, + fromAmino(_: MsgGrantAllowanceResponseAmino): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, + toAmino(_: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGrantAllowanceResponseAminoMsg): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAminoMsg { + return { + type: "cosmos-sdk/MsgGrantAllowanceResponse", + value: MsgGrantAllowanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantAllowanceResponseProtoMsg): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.decode(message.value); + }, + toProto(message: MsgGrantAllowanceResponse): Uint8Array { + return MsgGrantAllowanceResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", + value: MsgGrantAllowanceResponse.encode(message).finish() + }; + } +}; +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { + granter: "", + grantee: "" + }; +} +export const MsgRevokeAllowance = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + aminoType: "cosmos-sdk/MsgRevokeAllowance", + encode(message: MsgRevokeAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowance(); + 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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRevokeAllowance { + const message = createBaseMsgRevokeAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, + fromAmino(object: MsgRevokeAllowanceAmino): MsgRevokeAllowance { + const message = createBaseMsgRevokeAllowance(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + return obj; + }, + fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { + return MsgRevokeAllowance.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeAllowance", + value: MsgRevokeAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeAllowanceProtoMsg): MsgRevokeAllowance { + return MsgRevokeAllowance.decode(message.value); + }, + toProto(message: MsgRevokeAllowance): Uint8Array { + return MsgRevokeAllowance.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + value: MsgRevokeAllowance.encode(message).finish() + }; + } +}; +function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { + return {}; +} +export const MsgRevokeAllowanceResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", + aminoType: "cosmos-sdk/MsgRevokeAllowanceResponse", + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, + fromAmino(_: MsgRevokeAllowanceResponseAmino): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, + toAmino(_: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRevokeAllowanceResponseAminoMsg): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeAllowanceResponse", + value: MsgRevokeAllowanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeAllowanceResponseProtoMsg): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.decode(message.value); + }, + toProto(message: MsgRevokeAllowanceResponse): Uint8Array { + return MsgRevokeAllowanceResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", + value: MsgRevokeAllowanceResponse.encode(message).finish() + }; + } +}; +export const Cosmos_feegrantv1beta1FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array): BasicAllowance | PeriodicAllowance | AllowedMsgAllowance | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.feegrant.v1beta1.BasicAllowance": + return BasicAllowance.decode(data.value); + case "/cosmos.feegrant.v1beta1.PeriodicAllowance": + return PeriodicAllowance.decode(data.value); + case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": + return AllowedMsgAllowance.decode(data.value); + default: + return data; + } +}; +export const Cosmos_feegrantv1beta1FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/BasicAllowance": + return Any.fromPartial({ + typeUrl: "/cosmos.feegrant.v1beta1.BasicAllowance", + value: BasicAllowance.encode(BasicAllowance.fromPartial(BasicAllowance.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/PeriodicAllowance": + return Any.fromPartial({ + typeUrl: "/cosmos.feegrant.v1beta1.PeriodicAllowance", + value: PeriodicAllowance.encode(PeriodicAllowance.fromPartial(PeriodicAllowance.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/AllowedMsgAllowance": + return Any.fromPartial({ + typeUrl: "/cosmos.feegrant.v1beta1.AllowedMsgAllowance", + value: AllowedMsgAllowance.encode(AllowedMsgAllowance.fromPartial(AllowedMsgAllowance.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_feegrantv1beta1FeeAllowanceI_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.feegrant.v1beta1.BasicAllowance": + return { + type: "cosmos-sdk/BasicAllowance", + value: BasicAllowance.toAmino(BasicAllowance.decode(content.value, undefined)) + }; + case "/cosmos.feegrant.v1beta1.PeriodicAllowance": + return { + type: "cosmos-sdk/PeriodicAllowance", + value: PeriodicAllowance.toAmino(PeriodicAllowance.decode(content.value, undefined)) + }; + case "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": + return { + type: "cosmos-sdk/AllowedMsgAllowance", + value: AllowedMsgAllowance.toAmino(AllowedMsgAllowance.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/genutil/module/v1/module.ts b/util/inj-types/cosmos/genutil/module/v1/module.ts new file mode 100644 index 00000000..59d90d91 --- /dev/null +++ b/util/inj-types/cosmos/genutil/module/v1/module.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object for the genutil module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.genutil.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object for the genutil module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object for the genutil module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.genutil.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.genutil.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/module/v1/module.ts b/util/inj-types/cosmos/gov/module/v1/module.ts new file mode 100644 index 00000000..73d7c248 --- /dev/null +++ b/util/inj-types/cosmos/gov/module/v1/module.ts @@ -0,0 +1,117 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the gov module. */ +export interface Module { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: bigint; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.gov.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the gov module. */ +export interface ModuleAmino { + /** + * max_metadata_len defines the maximum proposal metadata length. + * Defaults to 255 if not explicitly set. + */ + max_metadata_len?: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the gov module. */ +export interface ModuleSDKType { + max_metadata_len: bigint; + authority: string; +} +function createBaseModule(): Module { + return { + maxMetadataLen: BigInt(0), + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.gov.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxMetadataLen !== BigInt(0)) { + writer.uint32(8).uint64(message.maxMetadataLen); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxMetadataLen = reader.uint64(); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.maxMetadataLen = object.maxMetadataLen !== undefined && object.maxMetadataLen !== null ? BigInt(object.maxMetadataLen.toString()) : BigInt(0); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.max_metadata_len !== undefined && object.max_metadata_len !== null) { + message.maxMetadataLen = BigInt(object.max_metadata_len); + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.max_metadata_len = message.maxMetadataLen !== BigInt(0) ? message.maxMetadataLen.toString() : undefined; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.gov.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/genesis.ts b/util/inj-types/cosmos/gov/v1/genesis.ts new file mode 100644 index 00000000..b3484e1c --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/genesis.ts @@ -0,0 +1,255 @@ +import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Params, ParamsAmino, ParamsSDKType } from "./gov"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + startingProposalId: bigint; + /** deposits defines all the deposits present at genesis. */ + deposits: Deposit[]; + /** votes defines all the votes present at genesis. */ + votes: Vote[]; + /** proposals defines all the proposals present at genesis. */ + proposals: Proposal[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + */ + /** @deprecated */ + depositParams?: DepositParams; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + */ + /** @deprecated */ + votingParams?: VotingParams; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + */ + /** @deprecated */ + tallyParams?: TallyParams; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params?: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.gov.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisStateAmino { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id?: string; + /** deposits defines all the deposits present at genesis. */ + deposits?: DepositAmino[]; + /** votes defines all the votes present at genesis. */ + votes?: VoteAmino[]; + /** proposals defines all the proposals present at genesis. */ + proposals?: ProposalAmino[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + */ + /** @deprecated */ + deposit_params?: DepositParamsAmino; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + */ + /** @deprecated */ + voting_params?: VotingParamsAmino; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + */ + /** @deprecated */ + tally_params?: TallyParamsAmino; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/v1/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisStateSDKType { + starting_proposal_id: bigint; + deposits: DepositSDKType[]; + votes: VoteSDKType[]; + proposals: ProposalSDKType[]; + /** @deprecated */ + deposit_params?: DepositParamsSDKType; + /** @deprecated */ + voting_params?: VotingParamsSDKType; + /** @deprecated */ + tally_params?: TallyParamsSDKType; + params?: ParamsSDKType; +} +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: BigInt(0), + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + params: undefined + }; +} +export const GenesisState = { + typeUrl: "/cosmos.gov.v1.GenesisState", + aminoType: "cosmos-sdk/v1/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.startingProposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).ldelim(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startingProposalId = reader.uint64(); + break; + case 2: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 3: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 4: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + case 8: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId !== undefined && object.startingProposalId !== null ? BigInt(object.startingProposalId.toString()) : BigInt(0); + message.deposits = object.deposits?.map(e => Deposit.fromPartial(e)) || []; + message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; + message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; + message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; + message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; + message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.starting_proposal_id !== undefined && object.starting_proposal_id !== null) { + message.startingProposalId = BigInt(object.starting_proposal_id); + } + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = message.deposits; + } + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = message.proposals; + } + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/v1/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/gov.ts b/util/inj-types/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..7d2d52b4 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/gov.ts @@ -0,0 +1,1639 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionSDKType = VoteOption; +export const VoteOptionAmino = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} +export const ProposalStatusSDKType = ProposalStatus; +export const ProposalStatusAmino = ProposalStatus; +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionProtoMsg { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption"; + value: Uint8Array; +} +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOptionAmino { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option?: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight?: string; +} +export interface WeightedVoteOptionAminoMsg { + type: "cosmos-sdk/v1/WeightedVoteOption"; + value: WeightedVoteOptionAmino; +} +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOptionSDKType { + option: VoteOption; + weight: string; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface DepositProtoMsg { + typeUrl: "/cosmos.gov.v1.Deposit"; + value: Uint8Array; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface DepositAminoMsg { + type: "cosmos-sdk/v1/Deposit"; + value: DepositAmino; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositSDKType { + proposal_id: bigint; + depositor: string; + amount: CoinSDKType[]; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** id defines the unique id of the proposal. */ + id: bigint; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: Any[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult?: TallyResult; + /** submit_time is the time of proposal submission. */ + submitTime?: Date; + /** deposit_end_time is the end time for deposition. */ + depositEndTime?: Date; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime?: Date; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime?: Date; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * Proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.Proposal"; + value: Uint8Array; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalAmino { + /** id defines the unique id of the proposal. */ + id?: string; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages?: AnyAmino[]; + /** status defines the proposal status. */ + status?: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + final_tally_result?: TallyResultAmino; + /** submit_time is the time of proposal submission. */ + submit_time?: string; + /** deposit_end_time is the end time for deposition. */ + deposit_end_time?: string; + /** total_deposit is the total deposit on the proposal. */ + total_deposit: CoinAmino[]; + /** voting_start_time is the starting time to vote on a proposal. */ + voting_start_time?: string; + /** voting_end_time is the end time of voting on a proposal. */ + voting_end_time?: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata?: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title?: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary?: string; + /** + * Proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer?: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/v1/Proposal"; + value: ProposalAmino; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalSDKType { + id: bigint; + messages: AnySDKType[]; + status: ProposalStatus; + final_tally_result?: TallyResultSDKType; + submit_time?: Date; + deposit_end_time?: Date; + total_deposit: CoinSDKType[]; + voting_start_time?: Date; + voting_end_time?: Date; + metadata: string; + title: string; + summary: string; + proposer: string; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ + yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstainCount: string; + /** no_count is the number of no votes on a proposal. */ + noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + noWithVetoCount: string; +} +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.gov.v1.TallyResult"; + value: Uint8Array; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultAmino { + /** yes_count is the number of yes votes on a proposal. */ + yes_count?: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstain_count?: string; + /** no_count is the number of no votes on a proposal. */ + no_count?: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + no_with_veto_count?: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/v1/TallyResult"; + value: TallyResultAmino; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultSDKType { + yes_count: string; + abstain_count: string; + no_count: string; + no_with_veto_count: string; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface Vote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata to attached to the vote. */ + metadata: string; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.gov.v1.Vote"; + value: Uint8Array; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** voter is the voter address of the proposal. */ + voter?: string; + /** options is the weighted vote options. */ + options?: WeightedVoteOptionAmino[]; + /** metadata is any arbitrary metadata to attached to the vote. */ + metadata?: string; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/v1/Vote"; + value: VoteAmino; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteSDKType { + proposal_id: bigint; + voter: string; + options: WeightedVoteOptionSDKType[]; + metadata: string; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod?: Duration; +} +export interface DepositParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.DepositParams"; + value: Uint8Array; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit?: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; +} +export interface DepositParamsAminoMsg { + type: "cosmos-sdk/v1/DepositParams"; + value: DepositParamsAmino; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsSDKType { + min_deposit: CoinSDKType[]; + max_deposit_period?: DurationSDKType; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod?: Duration; +} +export interface VotingParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.VotingParams"; + value: Uint8Array; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsAmino { + /** Duration of the voting period. */ + voting_period?: DurationAmino; +} +export interface VotingParamsAminoMsg { + type: "cosmos-sdk/v1/VotingParams"; + value: VotingParamsAmino; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsSDKType { + voting_period?: DurationSDKType; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; +} +export interface TallyParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.TallyParams"; + value: Uint8Array; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsAmino { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum?: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold?: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold?: string; +} +export interface TallyParamsAminoMsg { + type: "cosmos-sdk/v1/TallyParams"; + value: TallyParamsAmino; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsSDKType { + quorum: string; + threshold: string; + veto_threshold: string; +} +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod?: Duration; + /** Duration of the voting period. */ + votingPeriod?: Duration; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.Params"; + value: Uint8Array; +} +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface ParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; + /** Duration of the voting period. */ + voting_period?: DurationAmino; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum?: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold?: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold?: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + min_initial_deposit_ratio?: string; + /** burn deposits if a proposal does not meet quorum */ + burn_vote_quorum?: boolean; + /** burn deposits if the proposal does not enter voting period */ + burn_proposal_deposit_prevote?: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burn_vote_veto?: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/v1/Params"; + value: ParamsAmino; +} +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface ParamsSDKType { + min_deposit: CoinSDKType[]; + max_deposit_period?: DurationSDKType; + voting_period?: DurationSDKType; + quorum: string; + threshold: string; + veto_threshold: string; + min_initial_deposit_ratio: string; + burn_vote_quorum: boolean; + burn_proposal_deposit_prevote: boolean; + burn_vote_veto: boolean; +} +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { + option: 0, + weight: "" + }; +} +export const WeightedVoteOption = { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption", + aminoType: "cosmos-sdk/v1/WeightedVoteOption", + encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.option = (reader.int32() as any); + break; + case 2: + message.weight = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, + fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + return message; + }, + toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { + const obj: any = {}; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; + return obj; + }, + fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { + return WeightedVoteOption.fromAmino(object.value); + }, + toAminoMsg(message: WeightedVoteOption): WeightedVoteOptionAminoMsg { + return { + type: "cosmos-sdk/v1/WeightedVoteOption", + value: WeightedVoteOption.toAmino(message) + }; + }, + fromProtoMsg(message: WeightedVoteOptionProtoMsg): WeightedVoteOption { + return WeightedVoteOption.decode(message.value); + }, + toProto(message: WeightedVoteOption): Uint8Array { + return WeightedVoteOption.encode(message).finish(); + }, + toProtoMsg(message: WeightedVoteOption): WeightedVoteOptionProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption", + value: WeightedVoteOption.encode(message).finish() + }; + } +}; +function createBaseDeposit(): Deposit { + return { + proposalId: BigInt(0), + depositor: "", + amount: [] + }; +} +export const Deposit = { + typeUrl: "/cosmos.gov.v1.Deposit", + aminoType: "cosmos-sdk/v1/Deposit", + encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Deposit { + const message = createBaseDeposit(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DepositAmino): Deposit { + const message = createBaseDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Deposit): DepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: DepositAminoMsg): Deposit { + return Deposit.fromAmino(object.value); + }, + toAminoMsg(message: Deposit): DepositAminoMsg { + return { + type: "cosmos-sdk/v1/Deposit", + value: Deposit.toAmino(message) + }; + }, + fromProtoMsg(message: DepositProtoMsg): Deposit { + return Deposit.decode(message.value); + }, + toProto(message: Deposit): Uint8Array { + return Deposit.encode(message).finish(); + }, + toProtoMsg(message: Deposit): DepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Deposit", + value: Deposit.encode(message).finish() + }; + } +}; +function createBaseProposal(): Proposal { + return { + id: BigInt(0), + messages: [], + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + metadata: "", + title: "", + summary: "", + proposer: "" + }; +} +export const Proposal = { + typeUrl: "/cosmos.gov.v1.Proposal", + aminoType: "cosmos-sdk/v1/Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).ldelim(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).ldelim(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).ldelim(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 3: + message.status = (reader.int32() as any); + break; + case 4: + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 9: + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 10: + message.metadata = reader.string(); + break; + case 11: + message.title = reader.string(); + break; + case 12: + message.summary = reader.string(); + break; + case 13: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map(e => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.deposit_end_time !== undefined && object.deposit_end_time !== null) { + message.depositEndTime = fromTimestamp(Timestamp.fromAmino(object.deposit_end_time)); + } + message.totalDeposit = object.total_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.voting_start_time !== undefined && object.voting_start_time !== null) { + message.votingStartTime = fromTimestamp(Timestamp.fromAmino(object.voting_start_time)); + } + if (object.voting_end_time !== undefined && object.voting_end_time !== null) { + message.votingEndTime = fromTimestamp(Timestamp.fromAmino(object.voting_end_time)); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + obj.status = message.status === 0 ? undefined : message.status; + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; + obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; + if (message.totalDeposit) { + obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_deposit = message.totalDeposit; + } + obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; + obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/v1/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +function createBaseTallyResult(): TallyResult { + return { + yesCount: "", + abstainCount: "", + noCount: "", + noWithVetoCount: "" + }; +} +export const TallyResult = { + typeUrl: "/cosmos.gov.v1.TallyResult", + aminoType: "cosmos-sdk/v1/TallyResult", + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yesCount = reader.string(); + break; + case 2: + message.abstainCount = reader.string(); + break; + case 3: + message.noCount = reader.string(); + break; + case 4: + message.noWithVetoCount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes_count !== undefined && object.yes_count !== null) { + message.yesCount = object.yes_count; + } + if (object.abstain_count !== undefined && object.abstain_count !== null) { + message.abstainCount = object.abstain_count; + } + if (object.no_count !== undefined && object.no_count !== null) { + message.noCount = object.no_count; + } + if (object.no_with_veto_count !== undefined && object.no_with_veto_count !== null) { + message.noWithVetoCount = object.no_with_veto_count; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/v1/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.TallyResult", + value: TallyResult.encode(message).finish() + }; + } +}; +function createBaseVote(): Vote { + return { + proposalId: BigInt(0), + voter: "", + options: [], + metadata: "" + }; +} +export const Vote = { + typeUrl: "/cosmos.gov.v1.Vote", + aminoType: "cosmos-sdk/v1/Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(42).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 4: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + case 5: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = message.options; + } + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/v1/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Vote", + value: Vote.encode(message).finish() + }; + } +}; +function createBaseDepositParams(): DepositParams { + return { + minDeposit: [], + maxDepositPeriod: undefined + }; +} +export const DepositParams = { + typeUrl: "/cosmos.gov.v1.DepositParams", + aminoType: "cosmos-sdk/v1/DepositParams", + encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; + return message; + }, + fromAmino(object: DepositParamsAmino): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + return message; + }, + toAmino(message: DepositParams): DepositParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = message.minDeposit; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: DepositParamsAminoMsg): DepositParams { + return DepositParams.fromAmino(object.value); + }, + toAminoMsg(message: DepositParams): DepositParamsAminoMsg { + return { + type: "cosmos-sdk/v1/DepositParams", + value: DepositParams.toAmino(message) + }; + }, + fromProtoMsg(message: DepositParamsProtoMsg): DepositParams { + return DepositParams.decode(message.value); + }, + toProto(message: DepositParams): Uint8Array { + return DepositParams.encode(message).finish(); + }, + toProtoMsg(message: DepositParams): DepositParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.DepositParams", + value: DepositParams.encode(message).finish() + }; + } +}; +function createBaseVotingParams(): VotingParams { + return { + votingPeriod: undefined + }; +} +export const VotingParams = { + typeUrl: "/cosmos.gov.v1.VotingParams", + aminoType: "cosmos-sdk/v1/VotingParams", + encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + return message; + }, + fromAmino(object: VotingParamsAmino): VotingParams { + const message = createBaseVotingParams(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + return message; + }, + toAmino(message: VotingParams): VotingParamsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: VotingParamsAminoMsg): VotingParams { + return VotingParams.fromAmino(object.value); + }, + toAminoMsg(message: VotingParams): VotingParamsAminoMsg { + return { + type: "cosmos-sdk/v1/VotingParams", + value: VotingParams.toAmino(message) + }; + }, + fromProtoMsg(message: VotingParamsProtoMsg): VotingParams { + return VotingParams.decode(message.value); + }, + toProto(message: VotingParams): Uint8Array { + return VotingParams.encode(message).finish(); + }, + toProtoMsg(message: VotingParams): VotingParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.VotingParams", + value: VotingParams.encode(message).finish() + }; + } +}; +function createBaseTallyParams(): TallyParams { + return { + quorum: "", + threshold: "", + vetoThreshold: "" + }; +} +export const TallyParams = { + typeUrl: "/cosmos.gov.v1.TallyParams", + aminoType: "cosmos-sdk/v1/TallyParams", + encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(26).string(message.vetoThreshold); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.quorum = reader.string(); + break; + case 2: + message.threshold = reader.string(); + break; + case 3: + message.vetoThreshold = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + return message; + }, + fromAmino(object: TallyParamsAmino): TallyParams { + const message = createBaseTallyParams(); + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = object.quorum; + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = object.veto_threshold; + } + return message; + }, + toAmino(message: TallyParams): TallyParamsAmino { + const obj: any = {}; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; + return obj; + }, + fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { + return TallyParams.fromAmino(object.value); + }, + toAminoMsg(message: TallyParams): TallyParamsAminoMsg { + return { + type: "cosmos-sdk/v1/TallyParams", + value: TallyParams.toAmino(message) + }; + }, + fromProtoMsg(message: TallyParamsProtoMsg): TallyParams { + return TallyParams.decode(message.value); + }, + toProto(message: TallyParams): Uint8Array { + return TallyParams.encode(message).finish(); + }, + toProtoMsg(message: TallyParams): TallyParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.TallyParams", + value: TallyParams.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false + }; +} +export const Params = { + typeUrl: "/cosmos.gov.v1.Params", + aminoType: "cosmos-sdk/v1/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).ldelim(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.burnVoteQuorum === true) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote === true) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto === true) { + writer.uint32(120).bool(message.burnVoteVeto); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.quorum = reader.string(); + break; + case 5: + message.threshold = reader.string(); + break; + case 6: + message.vetoThreshold = reader.string(); + break; + case 7: + message.minInitialDepositRatio = reader.string(); + break; + case 13: + message.burnVoteQuorum = reader.bool(); + break; + case 14: + message.burnProposalDepositPrevote = reader.bool(); + break; + case 15: + message.burnVoteVeto = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = object.quorum; + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = object.veto_threshold; + } + if (object.min_initial_deposit_ratio !== undefined && object.min_initial_deposit_ratio !== null) { + message.minInitialDepositRatio = object.min_initial_deposit_ratio; + } + if (object.burn_vote_quorum !== undefined && object.burn_vote_quorum !== null) { + message.burnVoteQuorum = object.burn_vote_quorum; + } + if (object.burn_proposal_deposit_prevote !== undefined && object.burn_proposal_deposit_prevote !== null) { + message.burnProposalDepositPrevote = object.burn_proposal_deposit_prevote; + } + if (object.burn_vote_veto !== undefined && object.burn_vote_veto !== null) { + message.burnVoteVeto = object.burn_vote_veto; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = message.minDeposit; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; + obj.min_initial_deposit_ratio = message.minInitialDepositRatio === "" ? undefined : message.minInitialDepositRatio; + obj.burn_vote_quorum = message.burnVoteQuorum === false ? undefined : message.burnVoteQuorum; + obj.burn_proposal_deposit_prevote = message.burnProposalDepositPrevote === false ? undefined : message.burnProposalDepositPrevote; + obj.burn_vote_veto = message.burnVoteVeto === false ? undefined : message.burnVoteVeto; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/v1/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/query.lcd.ts b/util/inj-types/cosmos/gov/v1/query.lcd.ts new file mode 100644 index 00000000..1bec0e5a --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/query.lcd.ts @@ -0,0 +1,80 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Proposal queries proposal details based on ProposalID. */ + proposal = async (params: QueryProposalRequest): Promise => { + const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}`; + return await this.req.get(endpoint); + }; + /* Proposals queries all proposals based on given status. */ + proposals = async (params: QueryProposalsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.proposalStatus !== "undefined") { + options.params.proposal_status = params.proposalStatus; + } + if (typeof params?.voter !== "undefined") { + options.params.voter = params.voter; + } + if (typeof params?.depositor !== "undefined") { + options.params.depositor = params.depositor; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/gov/v1/proposals`; + return await this.req.get(endpoint, options); + }; + /* Vote queries voted information based on proposalID, voterAddr. */ + vote = async (params: QueryVoteRequest): Promise => { + const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/votes/${params.voter}`; + return await this.req.get(endpoint); + }; + /* Votes queries votes of a given proposal. */ + votes = async (params: QueryVotesRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/votes`; + return await this.req.get(endpoint, options); + }; + /* Params queries all parameters of the gov module. */ + params = async (params: QueryParamsRequest): Promise => { + const endpoint = `cosmos/gov/v1/params/${params.paramsType}`; + return await this.req.get(endpoint); + }; + /* Deposit queries single deposit information based proposalID, depositAddr. */ + deposit = async (params: QueryDepositRequest): Promise => { + const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/deposits/${params.depositor}`; + return await this.req.get(endpoint); + }; + /* Deposits queries all deposits of a single proposal. */ + deposits = async (params: QueryDepositsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/deposits`; + return await this.req.get(endpoint, options); + }; + /* TallyResult queries the tally of a proposal vote. */ + tallyResult = async (params: QueryTallyResultRequest): Promise => { + const endpoint = `cosmos/gov/v1/proposals/${params.proposalId}/tally`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/query.rpc.Query.ts b/util/inj-types/cosmos/gov/v1/query.rpc.Query.ts new file mode 100644 index 00000000..ab0313a0 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/query.rpc.Query.ts @@ -0,0 +1,107 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Proposal queries proposal details based on ProposalID. */ + proposal(request: QueryProposalRequest): Promise; + /** Proposals queries all proposals based on given status. */ + proposals(request: QueryProposalsRequest): Promise; + /** Vote queries voted information based on proposalID, voterAddr. */ + vote(request: QueryVoteRequest): Promise; + /** Votes queries votes of a given proposal. */ + votes(request: QueryVotesRequest): Promise; + /** Params queries all parameters of the gov module. */ + params(request: QueryParamsRequest): Promise; + /** Deposit queries single deposit information based proposalID, depositAddr. */ + deposit(request: QueryDepositRequest): Promise; + /** Deposits queries all deposits of a single proposal. */ + deposits(request: QueryDepositsRequest): Promise; + /** TallyResult queries the tally of a proposal vote. */ + tallyResult(request: QueryTallyResultRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Proposal queries proposal details based on ProposalID. */ + proposal = async (request: QueryProposalRequest): Promise => { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Proposal", data); + return promise.then(data => QueryProposalResponse.decode(new BinaryReader(data))); + }; + /* Proposals queries all proposals based on given status. */ + proposals = async (request: QueryProposalsRequest): Promise => { + const data = QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Proposals", data); + return promise.then(data => QueryProposalsResponse.decode(new BinaryReader(data))); + }; + /* Vote queries voted information based on proposalID, voterAddr. */ + vote = async (request: QueryVoteRequest): Promise => { + const data = QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Vote", data); + return promise.then(data => QueryVoteResponse.decode(new BinaryReader(data))); + }; + /* Votes queries votes of a given proposal. */ + votes = async (request: QueryVotesRequest): Promise => { + const data = QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Votes", data); + return promise.then(data => QueryVotesResponse.decode(new BinaryReader(data))); + }; + /* Params queries all parameters of the gov module. */ + params = async (request: QueryParamsRequest): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; + /* Deposit queries single deposit information based proposalID, depositAddr. */ + deposit = async (request: QueryDepositRequest): Promise => { + const data = QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Deposit", data); + return promise.then(data => QueryDepositResponse.decode(new BinaryReader(data))); + }; + /* Deposits queries all deposits of a single proposal. */ + deposits = async (request: QueryDepositsRequest): Promise => { + const data = QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Deposits", data); + return promise.then(data => QueryDepositsResponse.decode(new BinaryReader(data))); + }; + /* TallyResult queries the tally of a proposal vote. */ + tallyResult = async (request: QueryTallyResultRequest): Promise => { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "TallyResult", data); + return promise.then(data => QueryTallyResultResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + proposal(request: QueryProposalRequest): Promise { + return queryService.proposal(request); + }, + proposals(request: QueryProposalsRequest): Promise { + return queryService.proposals(request); + }, + vote(request: QueryVoteRequest): Promise { + return queryService.vote(request); + }, + votes(request: QueryVotesRequest): Promise { + return queryService.votes(request); + }, + params(request: QueryParamsRequest): Promise { + return queryService.params(request); + }, + deposit(request: QueryDepositRequest): Promise { + return queryService.deposit(request); + }, + deposits(request: QueryDepositsRequest): Promise { + return queryService.deposits(request); + }, + tallyResult(request: QueryTallyResultRequest): Promise { + return queryService.tallyResult(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/query.ts b/util/inj-types/cosmos/gov/v1/query.ts new file mode 100644 index 00000000..e10e6dcf --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/query.ts @@ -0,0 +1,1753 @@ +import { ProposalStatus, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Params, ParamsAmino, ParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalRequest"; + value: Uint8Array; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/v1/QueryProposalRequest"; + value: QueryProposalRequestAmino; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestSDKType { + proposal_id: bigint; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + /** proposal is the requested governance proposal. */ + proposal?: Proposal; +} +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalResponse"; + value: Uint8Array; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseAmino { + /** proposal is the requested governance proposal. */ + proposal?: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/v1/QueryProposalResponse"; + value: QueryProposalResponseAmino; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseSDKType { + proposal?: ProposalSDKType; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus?: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter?: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryProposalsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalsRequest"; + value: Uint8Array; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestAmino { + /** proposal_status defines the status of the proposals. */ + proposal_status?: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter?: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryProposalsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryProposalsRequest"; + value: QueryProposalsRequestAmino; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestSDKType { + proposal_status?: ProposalStatus; + voter?: string; + depositor?: string; + pagination?: PageRequestSDKType; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryProposalsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalsResponse"; + value: Uint8Array; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseAmino { + /** proposals defines all the requested governance proposals. */ + proposals?: ProposalAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryProposalsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryProposalsResponse"; + value: QueryProposalsResponseAmino; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseSDKType { + proposals: ProposalSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter defines the voter address for the proposals. */ + voter: string; +} +export interface QueryVoteRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVoteRequest"; + value: Uint8Array; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** voter defines the voter address for the proposals. */ + voter?: string; +} +export interface QueryVoteRequestAminoMsg { + type: "cosmos-sdk/v1/QueryVoteRequest"; + value: QueryVoteRequestAmino; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestSDKType { + proposal_id: bigint; + voter: string; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defines the queried vote. */ + vote?: Vote; +} +export interface QueryVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVoteResponse"; + value: Uint8Array; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseAmino { + /** vote defines the queried vote. */ + vote?: VoteAmino; +} +export interface QueryVoteResponseAminoMsg { + type: "cosmos-sdk/v1/QueryVoteResponse"; + value: QueryVoteResponseAmino; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseSDKType { + vote?: VoteSDKType; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryVotesRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVotesRequest"; + value: Uint8Array; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryVotesRequestAminoMsg { + type: "cosmos-sdk/v1/QueryVotesRequest"; + value: QueryVotesRequestAmino; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestSDKType { + proposal_id: bigint; + pagination?: PageRequestSDKType; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryVotesResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVotesResponse"; + value: Uint8Array; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseAmino { + /** votes defines the queried votes. */ + votes?: VoteAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryVotesResponseAminoMsg { + type: "cosmos-sdk/v1/QueryVotesResponse"; + value: QueryVotesResponseAmino; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseSDKType { + votes: VoteSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + params_type?: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType { + params_type: string; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + */ + /** @deprecated */ + votingParams?: VotingParams; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + */ + /** @deprecated */ + depositParams?: DepositParams; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + */ + /** @deprecated */ + tallyParams?: TallyParams; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params?: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + */ + /** @deprecated */ + voting_params?: VotingParamsAmino; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + */ + /** @deprecated */ + deposit_params?: DepositParamsAmino; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + */ + /** @deprecated */ + tally_params?: TallyParamsAmino; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + /** @deprecated */ + voting_params?: VotingParamsSDKType; + /** @deprecated */ + deposit_params?: DepositParamsSDKType; + /** @deprecated */ + tally_params?: TallyParamsSDKType; + params?: ParamsSDKType; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} +export interface QueryDepositRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositRequest"; + value: Uint8Array; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; +} +export interface QueryDepositRequestAminoMsg { + type: "cosmos-sdk/v1/QueryDepositRequest"; + value: QueryDepositRequestAmino; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestSDKType { + proposal_id: bigint; + depositor: string; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit?: Deposit; +} +export interface QueryDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositResponse"; + value: Uint8Array; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseAmino { + /** deposit defines the requested deposit. */ + deposit?: DepositAmino; +} +export interface QueryDepositResponseAminoMsg { + type: "cosmos-sdk/v1/QueryDepositResponse"; + value: QueryDepositResponseAmino; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseSDKType { + deposit?: DepositSDKType; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDepositsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositsRequest"; + value: Uint8Array; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDepositsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryDepositsRequest"; + value: QueryDepositsRequestAmino; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestSDKType { + proposal_id: bigint; + pagination?: PageRequestSDKType; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDepositsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositsResponse"; + value: Uint8Array; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseAmino { + /** deposits defines the requested deposits. */ + deposits?: DepositAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDepositsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryDepositsResponse"; + value: QueryDepositsResponseAmino; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseSDKType { + deposits: DepositSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest"; + value: Uint8Array; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/v1/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestSDKType { + proposal_id: bigint; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse"; + value: Uint8Array; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseAmino { + /** tally defines the requested tally. */ + tally?: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/v1/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseSDKType { + tally?: TallyResultSDKType; +} +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { + proposalId: BigInt(0) + }; +} +export const QueryProposalRequest = { + typeUrl: "/cosmos.gov.v1.QueryProposalRequest", + aminoType: "cosmos-sdk/v1/QueryProposalRequest", + encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish() + }; + } +}; +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { + proposal: undefined + }; +} +export const QueryProposalResponse = { + typeUrl: "/cosmos.gov.v1.QueryProposalResponse", + aminoType: "cosmos-sdk/v1/QueryProposalResponse", + encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; + return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + return message; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish() + }; + } +}; +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { + proposalStatus: 0, + voter: "", + depositor: "", + pagination: undefined + }; +} +export const QueryProposalsRequest = { + typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", + aminoType: "cosmos-sdk/v1/QueryProposalsRequest", + encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalStatus = (reader.int32() as any); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.depositor = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + if (object.proposal_status !== undefined && object.proposal_status !== null) { + message.proposalStatus = object.proposal_status; + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { + const obj: any = {}; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsRequestAminoMsg): QueryProposalsRequest { + return QueryProposalsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsRequest): QueryProposalsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalsRequest", + value: QueryProposalsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsRequestProtoMsg): QueryProposalsRequest { + return QueryProposalsRequest.decode(message.value); + }, + toProto(message: QueryProposalsRequest): Uint8Array { + return QueryProposalsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsRequest): QueryProposalsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", + value: QueryProposalsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { + proposals: [], + pagination: undefined + }; +} +export const QueryProposalsResponse = { + typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", + aminoType: "cosmos-sdk/v1/QueryProposalsResponse", + encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryProposalsResponseAmino): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsResponse): QueryProposalsResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = message.proposals; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsResponseAminoMsg): QueryProposalsResponse { + return QueryProposalsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsResponse): QueryProposalsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalsResponse", + value: QueryProposalsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsResponseProtoMsg): QueryProposalsResponse { + return QueryProposalsResponse.decode(message.value); + }, + toProto(message: QueryProposalsResponse): Uint8Array { + return QueryProposalsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsResponse): QueryProposalsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", + value: QueryProposalsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { + proposalId: BigInt(0), + voter: "" + }; +} +export const QueryVoteRequest = { + typeUrl: "/cosmos.gov.v1.QueryVoteRequest", + aminoType: "cosmos-sdk/v1/QueryVoteRequest", + encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + return message; + }, + fromAmino(object: QueryVoteRequestAmino): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + return message; + }, + toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { + return QueryVoteRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteRequest): QueryVoteRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVoteRequest", + value: QueryVoteRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteRequestProtoMsg): QueryVoteRequest { + return QueryVoteRequest.decode(message.value); + }, + toProto(message: QueryVoteRequest): Uint8Array { + return QueryVoteRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteRequest): QueryVoteRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVoteRequest", + value: QueryVoteRequest.encode(message).finish() + }; + } +}; +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { + vote: undefined + }; +} +export const QueryVoteResponse = { + typeUrl: "/cosmos.gov.v1.QueryVoteResponse", + aminoType: "cosmos-sdk/v1/QueryVoteResponse", + encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; + return message; + }, + fromAmino(object: QueryVoteResponseAmino): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + return message; + }, + toAmino(message: QueryVoteResponse): QueryVoteResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVoteResponseAminoMsg): QueryVoteResponse { + return QueryVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteResponse): QueryVoteResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVoteResponse", + value: QueryVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteResponseProtoMsg): QueryVoteResponse { + return QueryVoteResponse.decode(message.value); + }, + toProto(message: QueryVoteResponse): Uint8Array { + return QueryVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteResponse): QueryVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVoteResponse", + value: QueryVoteResponse.encode(message).finish() + }; + } +}; +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { + proposalId: BigInt(0), + pagination: undefined + }; +} +export const QueryVotesRequest = { + typeUrl: "/cosmos.gov.v1.QueryVotesRequest", + aminoType: "cosmos-sdk/v1/QueryVotesRequest", + encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesRequestAmino): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesRequestAminoMsg): QueryVotesRequest { + return QueryVotesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesRequest): QueryVotesRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVotesRequest", + value: QueryVotesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesRequestProtoMsg): QueryVotesRequest { + return QueryVotesRequest.decode(message.value); + }, + toProto(message: QueryVotesRequest): Uint8Array { + return QueryVotesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesRequest): QueryVotesRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVotesRequest", + value: QueryVotesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { + votes: [], + pagination: undefined + }; +} +export const QueryVotesResponse = { + typeUrl: "/cosmos.gov.v1.QueryVotesResponse", + aminoType: "cosmos-sdk/v1/QueryVotesResponse", + encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesResponseAmino): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesResponse): QueryVotesResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesResponseAminoMsg): QueryVotesResponse { + return QueryVotesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesResponse): QueryVotesResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVotesResponse", + value: QueryVotesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesResponseProtoMsg): QueryVotesResponse { + return QueryVotesResponse.decode(message.value); + }, + toProto(message: QueryVotesResponse): Uint8Array { + return QueryVotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesResponse): QueryVotesResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVotesResponse", + value: QueryVotesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { + paramsType: "" + }; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.gov.v1.QueryParamsRequest", + aminoType: "cosmos-sdk/v1/QueryParamsRequest", + encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.paramsType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + if (object.params_type !== undefined && object.params_type !== null) { + message.paramsType = object.params_type; + } + return message; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + votingParams: undefined, + depositParams: undefined, + tallyParams: undefined, + params: undefined + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.gov.v1.QueryParamsResponse", + aminoType: "cosmos-sdk/v1/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + case 4: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; + message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; + message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { + proposalId: BigInt(0), + depositor: "" + }; +} +export const QueryDepositRequest = { + typeUrl: "/cosmos.gov.v1.QueryDepositRequest", + aminoType: "cosmos-sdk/v1/QueryDepositRequest", + encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + return message; + }, + fromAmino(object: QueryDepositRequestAmino): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + return message; + }, + toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + return obj; + }, + fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { + return QueryDepositRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositRequest): QueryDepositRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositRequest", + value: QueryDepositRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositRequestProtoMsg): QueryDepositRequest { + return QueryDepositRequest.decode(message.value); + }, + toProto(message: QueryDepositRequest): Uint8Array { + return QueryDepositRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositRequest): QueryDepositRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositRequest", + value: QueryDepositRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { + deposit: undefined + }; +} +export const QueryDepositResponse = { + typeUrl: "/cosmos.gov.v1.QueryDepositResponse", + aminoType: "cosmos-sdk/v1/QueryDepositResponse", + encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposit = Deposit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = object.deposit !== undefined && object.deposit !== null ? Deposit.fromPartial(object.deposit) : undefined; + return message; + }, + fromAmino(object: QueryDepositResponseAmino): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + if (object.deposit !== undefined && object.deposit !== null) { + message.deposit = Deposit.fromAmino(object.deposit); + } + return message; + }, + toAmino(message: QueryDepositResponse): QueryDepositResponseAmino { + const obj: any = {}; + obj.deposit = message.deposit ? Deposit.toAmino(message.deposit) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositResponseAminoMsg): QueryDepositResponse { + return QueryDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositResponse): QueryDepositResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositResponse", + value: QueryDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositResponseProtoMsg): QueryDepositResponse { + return QueryDepositResponse.decode(message.value); + }, + toProto(message: QueryDepositResponse): Uint8Array { + return QueryDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositResponse): QueryDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositResponse", + value: QueryDepositResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { + proposalId: BigInt(0), + pagination: undefined + }; +} +export const QueryDepositsRequest = { + typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", + aminoType: "cosmos-sdk/v1/QueryDepositsRequest", + encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDepositsRequestAmino): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsRequestAminoMsg): QueryDepositsRequest { + return QueryDepositsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsRequest): QueryDepositsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositsRequest", + value: QueryDepositsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsRequestProtoMsg): QueryDepositsRequest { + return QueryDepositsRequest.decode(message.value); + }, + toProto(message: QueryDepositsRequest): Uint8Array { + return QueryDepositsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsRequest): QueryDepositsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", + value: QueryDepositsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { + deposits: [], + pagination: undefined + }; +} +export const QueryDepositsResponse = { + typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", + aminoType: "cosmos-sdk/v1/QueryDepositsResponse", + encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map(e => Deposit.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDepositsResponseAmino): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsResponse): QueryDepositsResponseAmino { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = message.deposits; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsResponseAminoMsg): QueryDepositsResponse { + return QueryDepositsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsResponse): QueryDepositsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositsResponse", + value: QueryDepositsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsResponseProtoMsg): QueryDepositsResponse { + return QueryDepositsResponse.decode(message.value); + }, + toProto(message: QueryDepositsResponse): Uint8Array { + return QueryDepositsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsResponse): QueryDepositsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", + value: QueryDepositsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { + proposalId: BigInt(0) + }; +} +export const QueryTallyResultRequest = { + typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", + aminoType: "cosmos-sdk/v1/QueryTallyResultRequest", + encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultRequestProtoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish() + }; + } +}; +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { + tally: undefined + }; +} +export const QueryTallyResultResponse = { + typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", + aminoType: "cosmos-sdk/v1/QueryTallyResultResponse", + encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tally = TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = object.tally !== undefined && object.tally !== null ? TallyResult.fromPartial(object.tally) : undefined; + return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + if (object.tally !== undefined && object.tally !== null) { + message.tally = TallyResult.fromAmino(object.tally); + } + return message; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultResponseProtoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/tx.amino.ts b/util/inj-types/cosmos/gov/v1/tx.amino.ts new file mode 100644 index 00000000..aa71bfa2 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/tx.amino.ts @@ -0,0 +1,33 @@ +import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit, MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.gov.v1.MsgSubmitProposal": { + aminoType: "cosmos-sdk/v1/MsgSubmitProposal", + toAmino: MsgSubmitProposal.toAmino, + fromAmino: MsgSubmitProposal.fromAmino + }, + "/cosmos.gov.v1.MsgExecLegacyContent": { + aminoType: "cosmos-sdk/v1/MsgExecLegacyContent", + toAmino: MsgExecLegacyContent.toAmino, + fromAmino: MsgExecLegacyContent.fromAmino + }, + "/cosmos.gov.v1.MsgVote": { + aminoType: "cosmos-sdk/v1/MsgVote", + toAmino: MsgVote.toAmino, + fromAmino: MsgVote.fromAmino + }, + "/cosmos.gov.v1.MsgVoteWeighted": { + aminoType: "cosmos-sdk/v1/MsgVoteWeighted", + toAmino: MsgVoteWeighted.toAmino, + fromAmino: MsgVoteWeighted.fromAmino + }, + "/cosmos.gov.v1.MsgDeposit": { + aminoType: "cosmos-sdk/v1/MsgDeposit", + toAmino: MsgDeposit.toAmino, + fromAmino: MsgDeposit.fromAmino + }, + "/cosmos.gov.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/tx.registry.ts b/util/inj-types/cosmos/gov/v1/tx.registry.ts new file mode 100644 index 00000000..967549b8 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/tx.registry.ts @@ -0,0 +1,125 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit, MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1.MsgExecLegacyContent", MsgExecLegacyContent], ["/cosmos.gov.v1.MsgVote", MsgVote], ["/cosmos.gov.v1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1.MsgDeposit", MsgDeposit], ["/cosmos.gov.v1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(value).finish() + }; + }, + execLegacyContent(value: MsgExecLegacyContent) { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.encode(value).finish() + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.encode(value).finish() + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(value).finish() + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.encode(value).finish() + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value + }; + }, + execLegacyContent(value: MsgExecLegacyContent) { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.fromPartial(value) + }; + }, + execLegacyContent(value: MsgExecLegacyContent) { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.fromPartial(value) + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.fromPartial(value) + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.fromPartial(value) + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.fromPartial(value) + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/tx.rpc.msg.ts b/util/inj-types/cosmos/gov/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..45ca767b --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/tx.rpc.msg.ts @@ -0,0 +1,72 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSubmitProposal, MsgSubmitProposalResponse, MsgExecLegacyContent, MsgExecLegacyContentResponse, MsgVote, MsgVoteResponse, MsgVoteWeighted, MsgVoteWeightedResponse, MsgDeposit, MsgDepositResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given the messages. */ + submitProposal(request: MsgSubmitProposal): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + execLegacyContent(request: MsgExecLegacyContent): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + vote(request: MsgVote): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + voteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + deposit(request: MsgDeposit): Promise; + /** + * UpdateParams defines a governance operation for updating the x/gov module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* SubmitProposal defines a method to create new proposal given the messages. */ + submitProposal = async (request: MsgSubmitProposal): Promise => { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "SubmitProposal", data); + return promise.then(data => MsgSubmitProposalResponse.decode(new BinaryReader(data))); + }; + /* ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + to execute a legacy content-based proposal. */ + execLegacyContent = async (request: MsgExecLegacyContent): Promise => { + const data = MsgExecLegacyContent.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "ExecLegacyContent", data); + return promise.then(data => MsgExecLegacyContentResponse.decode(new BinaryReader(data))); + }; + /* Vote defines a method to add a vote on a specific proposal. */ + vote = async (request: MsgVote): Promise => { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "Vote", data); + return promise.then(data => MsgVoteResponse.decode(new BinaryReader(data))); + }; + /* VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + voteWeighted = async (request: MsgVoteWeighted): Promise => { + const data = MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "VoteWeighted", data); + return promise.then(data => MsgVoteWeightedResponse.decode(new BinaryReader(data))); + }; + /* Deposit defines a method to add deposit on a specific proposal. */ + deposit = async (request: MsgDeposit): Promise => { + const data = MsgDeposit.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "Deposit", data); + return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); + }; + /* UpdateParams defines a governance operation for updating the x/gov module + parameters. The authority is defined in the keeper. + + Since: cosmos-sdk 0.47 */ + updateParams = async (request: MsgUpdateParams): Promise => { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1/tx.ts b/util/inj-types/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..41f64f60 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1/tx.ts @@ -0,0 +1,1606 @@ +//@ts-nocheck +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType, Params, ParamsAmino, ParamsSDKType } from "./gov"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalSDKType, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg, CommunityPoolSpendProposalWithDepositSDKType } from "../../distribution/v1beta1/distribution"; +import { TextProposal, TextProposalProtoMsg, TextProposalSDKType } from "../v1beta1/gov"; +import { ParameterChangeProposal, ParameterChangeProposalProtoMsg, ParameterChangeProposalSDKType } from "../../params/v1beta1/params"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, SoftwareUpgradeProposalSDKType, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposalSDKType } from "../../upgrade/v1beta1/upgrade"; +import { StoreCodeProposal, StoreCodeProposalProtoMsg, StoreCodeProposalSDKType, InstantiateContractProposal, InstantiateContractProposalProtoMsg, InstantiateContractProposalSDKType, InstantiateContract2Proposal, InstantiateContract2ProposalProtoMsg, InstantiateContract2ProposalSDKType, MigrateContractProposal, MigrateContractProposalProtoMsg, MigrateContractProposalSDKType, SudoContractProposal, SudoContractProposalProtoMsg, SudoContractProposalSDKType, ExecuteContractProposal, ExecuteContractProposalProtoMsg, ExecuteContractProposalSDKType, UpdateAdminProposal, UpdateAdminProposalProtoMsg, UpdateAdminProposalSDKType, ClearAdminProposal, ClearAdminProposalProtoMsg, ClearAdminProposalSDKType, PinCodesProposal, PinCodesProposalProtoMsg, PinCodesProposalSDKType, UnpinCodesProposal, UnpinCodesProposalProtoMsg, UnpinCodesProposalSDKType, UpdateInstantiateConfigProposal, UpdateInstantiateConfigProposalProtoMsg, UpdateInstantiateConfigProposalSDKType, StoreAndInstantiateContractProposal, StoreAndInstantiateContractProposalProtoMsg, StoreAndInstantiateContractProposalSDKType } from "../../../cosmwasm/wasm/v1/proposal_legacy"; +import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, ClientUpdateProposalSDKType, UpgradeProposal, UpgradeProposalProtoMsg, UpgradeProposalSDKType } from "../../../ibc/core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal"; + value: Uint8Array; +} +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalAmino { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages?: AnyAmino[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initial_deposit: CoinAmino[]; + /** proposer is the account address of the proposer. */ + proposer?: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata?: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title?: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary?: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/v1/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalSDKType { + messages: AnySDKType[]; + initial_deposit: CoinSDKType[]; + proposer: string; + metadata: string; + title: string; + summary: string; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/v1/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseSDKType { + proposal_id: bigint; +} +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContent { + /** content is the proposal's content. */ + content?: CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | StoreCodeProposal | InstantiateContractProposal | InstantiateContract2Proposal | MigrateContractProposal | SudoContractProposal | ExecuteContractProposal | UpdateAdminProposal | ClearAdminProposal | PinCodesProposal | UnpinCodesProposal | UpdateInstantiateConfigProposal | StoreAndInstantiateContractProposal | ClientUpdateProposal | UpgradeProposal | Any | undefined; + /** authority must be the gov module address. */ + authority: string; +} +export interface MsgExecLegacyContentProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent"; + value: Uint8Array; +} +export type MsgExecLegacyContentEncoded = Omit & { + /** content is the proposal's content. */content?: CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | TextProposalProtoMsg | ParameterChangeProposalProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | StoreCodeProposalProtoMsg | InstantiateContractProposalProtoMsg | InstantiateContract2ProposalProtoMsg | MigrateContractProposalProtoMsg | SudoContractProposalProtoMsg | ExecuteContractProposalProtoMsg | UpdateAdminProposalProtoMsg | ClearAdminProposalProtoMsg | PinCodesProposalProtoMsg | UnpinCodesProposalProtoMsg | UpdateInstantiateConfigProposalProtoMsg | StoreAndInstantiateContractProposalProtoMsg | ClientUpdateProposalProtoMsg | UpgradeProposalProtoMsg | AnyProtoMsg | undefined; +}; +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContentAmino { + /** content is the proposal's content. */ + content?: AnyAmino; + /** authority must be the gov module address. */ + authority?: string; +} +export interface MsgExecLegacyContentAminoMsg { + type: "cosmos-sdk/v1/MsgExecLegacyContent"; + value: MsgExecLegacyContentAmino; +} +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContentSDKType { + content?: CommunityPoolSpendProposalSDKType | CommunityPoolSpendProposalWithDepositSDKType | TextProposalSDKType | ParameterChangeProposalSDKType | SoftwareUpgradeProposalSDKType | CancelSoftwareUpgradeProposalSDKType | StoreCodeProposalSDKType | InstantiateContractProposalSDKType | InstantiateContract2ProposalSDKType | MigrateContractProposalSDKType | SudoContractProposalSDKType | ExecuteContractProposalSDKType | UpdateAdminProposalSDKType | ClearAdminProposalSDKType | PinCodesProposalSDKType | UnpinCodesProposalSDKType | UpdateInstantiateConfigProposalSDKType | StoreAndInstantiateContractProposalSDKType | ClientUpdateProposalSDKType | UpgradeProposalSDKType | AnySDKType | undefined; + authority: string; +} +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse {} +export interface MsgExecLegacyContentResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse"; + value: Uint8Array; +} +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponseAmino {} +export interface MsgExecLegacyContentResponseAminoMsg { + type: "cosmos-sdk/v1/MsgExecLegacyContentResponse"; + value: MsgExecLegacyContentResponseAmino; +} +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponseSDKType {} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVote"; + value: Uint8Array; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter?: string; + /** option defines the vote option. */ + option?: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata?: string; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/v1/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteSDKType { + proposal_id: bigint; + voter: string; + option: VoteOption; + metadata: string; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/v1/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseSDKType {} +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} +export interface MsgVoteWeightedProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted"; + value: Uint8Array; +} +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeightedAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter?: string; + /** options defines the weighted vote options. */ + options?: WeightedVoteOptionAmino[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata?: string; +} +export interface MsgVoteWeightedAminoMsg { + type: "cosmos-sdk/v1/MsgVoteWeighted"; + value: MsgVoteWeightedAmino; +} +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeightedSDKType { + proposal_id: bigint; + voter: string; + options: WeightedVoteOptionSDKType[]; + metadata: string; +} +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse {} +export interface MsgVoteWeightedResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse"; + value: Uint8Array; +} +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponseAmino {} +export interface MsgVoteWeightedResponseAminoMsg { + type: "cosmos-sdk/v1/MsgVoteWeightedResponse"; + value: MsgVoteWeightedResponseAmino; +} +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponseSDKType {} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface MsgDepositProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgDeposit"; + value: Uint8Array; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface MsgDepositAminoMsg { + type: "cosmos-sdk/v1/MsgDeposit"; + value: MsgDepositAmino; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositSDKType { + proposal_id: bigint; + depositor: string; + amount: CoinSDKType[]; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse {} +export interface MsgDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse"; + value: Uint8Array; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseAmino {} +export interface MsgDepositResponseAminoMsg { + type: "cosmos-sdk/v1/MsgDepositResponse"; + value: MsgDepositResponseAmino; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseSDKType {} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/gov/v1/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/v1/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { + messages: [], + initialDeposit: [], + proposer: "", + metadata: "", + title: "", + summary: "" + }; +} +export const MsgSubmitProposal = { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + aminoType: "cosmos-sdk/v1/MsgSubmitProposal", + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 2: + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.title = reader.string(); + break; + case 6: + message.summary = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + if (message.initialDeposit) { + obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.initial_deposit = message.initialDeposit; + } + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/v1/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; + } +}; +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { + proposalId: BigInt(0) + }; +} +export const MsgSubmitProposalResponse = { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", + aminoType: "cosmos-sdk/v1/MsgSubmitProposalResponse", + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; + } +}; +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { + content: undefined, + authority: "" + }; +} +export const MsgExecLegacyContent = { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + aminoType: "cosmos-sdk/v1/MsgExecLegacyContent", + encode(message: MsgExecLegacyContent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.content !== undefined) { + Any.encode((message.content as Any), writer.uint32(10).fork()).ldelim(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = (Cosmos_govv1beta1Content_InterfaceDecoder(reader) as Any); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecLegacyContent { + const message = createBaseMsgExecLegacyContent(); + message.content = object.content !== undefined && object.content !== null ? Any.fromPartial(object.content) : undefined; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: MsgExecLegacyContentAmino): MsgExecLegacyContent { + const message = createBaseMsgExecLegacyContent(); + if (object.content !== undefined && object.content !== null) { + message.content = Cosmos_govv1beta1Content_FromAmino(object.content); + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { + const obj: any = {}; + obj.content = message.content ? Cosmos_govv1beta1Content_ToAmino((message.content as Any)) : undefined; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { + return MsgExecLegacyContent.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecLegacyContent): MsgExecLegacyContentAminoMsg { + return { + type: "cosmos-sdk/v1/MsgExecLegacyContent", + value: MsgExecLegacyContent.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecLegacyContentProtoMsg): MsgExecLegacyContent { + return MsgExecLegacyContent.decode(message.value); + }, + toProto(message: MsgExecLegacyContent): Uint8Array { + return MsgExecLegacyContent.encode(message).finish(); + }, + toProtoMsg(message: MsgExecLegacyContent): MsgExecLegacyContentProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.encode(message).finish() + }; + } +}; +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} +export const MsgExecLegacyContentResponse = { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", + aminoType: "cosmos-sdk/v1/MsgExecLegacyContentResponse", + encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, + fromAmino(_: MsgExecLegacyContentResponseAmino): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, + toAmino(_: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgExecLegacyContentResponseAminoMsg): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgExecLegacyContentResponse", + value: MsgExecLegacyContentResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecLegacyContentResponseProtoMsg): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.decode(message.value); + }, + toProto(message: MsgExecLegacyContentResponse): Uint8Array { + return MsgExecLegacyContentResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", + value: MsgExecLegacyContentResponse.encode(message).finish() + }; + } +}; +function createBaseMsgVote(): MsgVote { + return { + proposalId: BigInt(0), + voter: "", + option: 0, + metadata: "" + }; +} +export const MsgVote = { + typeUrl: "/cosmos.gov.v1.MsgVote", + aminoType: "cosmos-sdk/v1/MsgVote", + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.encode(message).finish() + }; + } +}; +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} +export const MsgVoteResponse = { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse", + aminoType: "cosmos-sdk/v1/MsgVoteResponse", + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; + } +}; +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { + proposalId: BigInt(0), + voter: "", + options: [], + metadata: "" + }; +} +export const MsgVoteWeighted = { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + aminoType: "cosmos-sdk/v1/MsgVoteWeighted", + encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = message.options; + } + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { + return MsgVoteWeighted.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeighted): MsgVoteWeightedAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteWeighted", + value: MsgVoteWeighted.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedProtoMsg): MsgVoteWeighted { + return MsgVoteWeighted.decode(message.value); + }, + toProto(message: MsgVoteWeighted): Uint8Array { + return MsgVoteWeighted.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeighted): MsgVoteWeightedProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(message).finish() + }; + } +}; +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} +export const MsgVoteWeightedResponse = { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", + aminoType: "cosmos-sdk/v1/MsgVoteWeightedResponse", + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + fromAmino(_: MsgVoteWeightedResponseAmino): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + toAmino(_: MsgVoteWeightedResponse): MsgVoteWeightedResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedResponseAminoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedResponseProtoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.decode(message.value); + }, + toProto(message: MsgVoteWeightedResponse): Uint8Array { + return MsgVoteWeightedResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.encode(message).finish() + }; + } +}; +function createBaseMsgDeposit(): MsgDeposit { + return { + proposalId: BigInt(0), + depositor: "", + amount: [] + }; +} +export const MsgDeposit = { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + aminoType: "cosmos-sdk/v1/MsgDeposit", + encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgDepositAmino): MsgDeposit { + const message = createBaseMsgDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgDeposit): MsgDepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgDepositAminoMsg): MsgDeposit { + return MsgDeposit.fromAmino(object.value); + }, + toAminoMsg(message: MsgDeposit): MsgDepositAminoMsg { + return { + type: "cosmos-sdk/v1/MsgDeposit", + value: MsgDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositProtoMsg): MsgDeposit { + return MsgDeposit.decode(message.value); + }, + toProto(message: MsgDeposit): Uint8Array { + return MsgDeposit.encode(message).finish(); + }, + toProtoMsg(message: MsgDeposit): MsgDepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.encode(message).finish() + }; + } +}; +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} +export const MsgDepositResponse = { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse", + aminoType: "cosmos-sdk/v1/MsgDepositResponse", + encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + fromAmino(_: MsgDepositResponseAmino): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + toAmino(_: MsgDepositResponse): MsgDepositResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositResponseAminoMsg): MsgDepositResponse { + return MsgDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositResponse): MsgDepositResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgDepositResponse", + value: MsgDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositResponseProtoMsg): MsgDepositResponse { + return MsgDepositResponse.decode(message.value); + }, + toProto(message: MsgDepositResponse): Uint8Array { + return MsgDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositResponse): MsgDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse", + value: MsgDepositResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + aminoType: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/v1/MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +export const Cosmos_govv1beta1Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | StoreCodeProposal | InstantiateContractProposal | InstantiateContract2Proposal | MigrateContractProposal | SudoContractProposal | ExecuteContractProposal | UpdateAdminProposal | ClearAdminProposal | PinCodesProposal | UnpinCodesProposal | UpdateInstantiateConfigProposal | StoreAndInstantiateContractProposal | ClientUpdateProposal | UpgradeProposal | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return CommunityPoolSpendProposal.decode(data.value); + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return CommunityPoolSpendProposalWithDeposit.decode(data.value); + case "/cosmos.gov.v1beta1.TextProposal": + return TextProposal.decode(data.value); + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return ParameterChangeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return SoftwareUpgradeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return CancelSoftwareUpgradeProposal.decode(data.value); + case "/cosmwasm.wasm.v1.StoreCodeProposal": + return StoreCodeProposal.decode(data.value); + case "/cosmwasm.wasm.v1.InstantiateContractProposal": + return InstantiateContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.InstantiateContract2Proposal": + return InstantiateContract2Proposal.decode(data.value); + case "/cosmwasm.wasm.v1.MigrateContractProposal": + return MigrateContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.SudoContractProposal": + return SudoContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.ExecuteContractProposal": + return ExecuteContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UpdateAdminProposal": + return UpdateAdminProposal.decode(data.value); + case "/cosmwasm.wasm.v1.ClearAdminProposal": + return ClearAdminProposal.decode(data.value); + case "/cosmwasm.wasm.v1.PinCodesProposal": + return PinCodesProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UnpinCodesProposal": + return UnpinCodesProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal": + return UpdateInstantiateConfigProposal.decode(data.value); + case "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal": + return StoreAndInstantiateContractProposal.decode(data.value); + case "/ibc.core.client.v1.ClientUpdateProposal": + return ClientUpdateProposal.decode(data.value); + case "/ibc.core.client.v1.UpgradeProposal": + return UpgradeProposal.decode(data.value); + default: + return data; + } +}; +export const Cosmos_govv1beta1Content_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/v1/CommunityPoolSpendProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(CommunityPoolSpendProposal.fromPartial(CommunityPoolSpendProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/v1/CommunityPoolSpendProposalWithDeposit": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(CommunityPoolSpendProposalWithDeposit.fromPartial(CommunityPoolSpendProposalWithDeposit.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/TextProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/ParameterChangeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + value: ParameterChangeProposal.encode(ParameterChangeProposal.fromPartial(ParameterChangeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/SoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(SoftwareUpgradeProposal.fromPartial(SoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CancelSoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(CancelSoftwareUpgradeProposal.fromPartial(CancelSoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "wasm/StoreCodeProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", + value: StoreCodeProposal.encode(StoreCodeProposal.fromPartial(StoreCodeProposal.fromAmino(content.value))).finish() + }); + case "wasm/InstantiateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", + value: InstantiateContractProposal.encode(InstantiateContractProposal.fromPartial(InstantiateContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/InstantiateContract2Proposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal", + value: InstantiateContract2Proposal.encode(InstantiateContract2Proposal.fromPartial(InstantiateContract2Proposal.fromAmino(content.value))).finish() + }); + case "wasm/MigrateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", + value: MigrateContractProposal.encode(MigrateContractProposal.fromPartial(MigrateContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/SudoContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", + value: SudoContractProposal.encode(SudoContractProposal.fromPartial(SudoContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/ExecuteContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", + value: ExecuteContractProposal.encode(ExecuteContractProposal.fromPartial(ExecuteContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/UpdateAdminProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", + value: UpdateAdminProposal.encode(UpdateAdminProposal.fromPartial(UpdateAdminProposal.fromAmino(content.value))).finish() + }); + case "wasm/ClearAdminProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", + value: ClearAdminProposal.encode(ClearAdminProposal.fromPartial(ClearAdminProposal.fromAmino(content.value))).finish() + }); + case "wasm/PinCodesProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", + value: PinCodesProposal.encode(PinCodesProposal.fromPartial(PinCodesProposal.fromAmino(content.value))).finish() + }); + case "wasm/UnpinCodesProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", + value: UnpinCodesProposal.encode(UnpinCodesProposal.fromPartial(UnpinCodesProposal.fromAmino(content.value))).finish() + }); + case "wasm/UpdateInstantiateConfigProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", + value: UpdateInstantiateConfigProposal.encode(UpdateInstantiateConfigProposal.fromPartial(UpdateInstantiateConfigProposal.fromAmino(content.value))).finish() + }); + case "wasm/StoreAndInstantiateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", + value: StoreAndInstantiateContractProposal.encode(StoreAndInstantiateContractProposal.fromPartial(StoreAndInstantiateContractProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/ClientUpdateProposal": + return Any.fromPartial({ + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/UpgradeProposal": + return Any.fromPartial({ + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_govv1beta1Content_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return { + type: "cosmos-sdk/v1/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(CommunityPoolSpendProposal.decode(content.value, undefined)) + }; + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return { + type: "cosmos-sdk/v1/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(CommunityPoolSpendProposalWithDeposit.decode(content.value, undefined)) + }; + case "/cosmos.gov.v1beta1.TextProposal": + return { + type: "cosmos-sdk/TextProposal", + value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) + }; + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return { + type: "cosmos-sdk/ParameterChangeProposal", + value: ParameterChangeProposal.toAmino(ParameterChangeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(SoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(CancelSoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.StoreCodeProposal": + return { + type: "wasm/StoreCodeProposal", + value: StoreCodeProposal.toAmino(StoreCodeProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.InstantiateContractProposal": + return { + type: "wasm/InstantiateContractProposal", + value: InstantiateContractProposal.toAmino(InstantiateContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.InstantiateContract2Proposal": + return { + type: "wasm/InstantiateContract2Proposal", + value: InstantiateContract2Proposal.toAmino(InstantiateContract2Proposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.MigrateContractProposal": + return { + type: "wasm/MigrateContractProposal", + value: MigrateContractProposal.toAmino(MigrateContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.SudoContractProposal": + return { + type: "wasm/SudoContractProposal", + value: SudoContractProposal.toAmino(SudoContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.ExecuteContractProposal": + return { + type: "wasm/ExecuteContractProposal", + value: ExecuteContractProposal.toAmino(ExecuteContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UpdateAdminProposal": + return { + type: "wasm/UpdateAdminProposal", + value: UpdateAdminProposal.toAmino(UpdateAdminProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.ClearAdminProposal": + return { + type: "wasm/ClearAdminProposal", + value: ClearAdminProposal.toAmino(ClearAdminProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.PinCodesProposal": + return { + type: "wasm/PinCodesProposal", + value: PinCodesProposal.toAmino(PinCodesProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UnpinCodesProposal": + return { + type: "wasm/UnpinCodesProposal", + value: UnpinCodesProposal.toAmino(UnpinCodesProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal": + return { + type: "wasm/UpdateInstantiateConfigProposal", + value: UpdateInstantiateConfigProposal.toAmino(UpdateInstantiateConfigProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal": + return { + type: "wasm/StoreAndInstantiateContractProposal", + value: StoreAndInstantiateContractProposal.toAmino(StoreAndInstantiateContractProposal.decode(content.value, undefined)) + }; + case "/ibc.core.client.v1.ClientUpdateProposal": + return { + type: "cosmos-sdk/ClientUpdateProposal", + value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined)) + }; + case "/ibc.core.client.v1.UpgradeProposal": + return { + type: "cosmos-sdk/UpgradeProposal", + value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/genesis.ts b/util/inj-types/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 00000000..3c317855 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,203 @@ +import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + startingProposalId: bigint; + /** deposits defines all the deposits present at genesis. */ + deposits: Deposit[]; + /** votes defines all the votes present at genesis. */ + votes: Vote[]; + /** proposals defines all the proposals present at genesis. */ + proposals: Proposal[]; + /** params defines all the parameters of related to deposit. */ + depositParams: DepositParams; + /** params defines all the parameters of related to voting. */ + votingParams: VotingParams; + /** params defines all the parameters of related to tally. */ + tallyParams: TallyParams; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisStateAmino { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id?: string; + /** deposits defines all the deposits present at genesis. */ + deposits: DepositAmino[]; + /** votes defines all the votes present at genesis. */ + votes: VoteAmino[]; + /** proposals defines all the proposals present at genesis. */ + proposals: ProposalAmino[]; + /** params defines all the parameters of related to deposit. */ + deposit_params: DepositParamsAmino; + /** params defines all the parameters of related to voting. */ + voting_params: VotingParamsAmino; + /** params defines all the parameters of related to tally. */ + tally_params: TallyParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisStateSDKType { + starting_proposal_id: bigint; + deposits: DepositSDKType[]; + votes: VoteSDKType[]; + proposals: ProposalSDKType[]; + deposit_params: DepositParamsSDKType; + voting_params: VotingParamsSDKType; + tally_params: TallyParamsSDKType; +} +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: BigInt(0), + deposits: [], + votes: [], + proposals: [], + depositParams: DepositParams.fromPartial({}), + votingParams: VotingParams.fromPartial({}), + tallyParams: TallyParams.fromPartial({}) + }; +} +export const GenesisState = { + typeUrl: "/cosmos.gov.v1beta1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.startingProposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(42).fork()).ldelim(); + } + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(50).fork()).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startingProposalId = reader.uint64(); + break; + case 2: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 3: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 4: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = object.startingProposalId !== undefined && object.startingProposalId !== null ? BigInt(object.startingProposalId.toString()) : BigInt(0); + message.deposits = object.deposits?.map(e => Deposit.fromPartial(e)) || []; + message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; + message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; + message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; + message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; + message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.starting_proposal_id !== undefined && object.starting_proposal_id !== null) { + message.startingProposalId = BigInt(object.starting_proposal_id); + } + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = message.deposits; + } + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = message.proposals; + } + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : DepositParams.toAmino(DepositParams.fromPartial({})); + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : VotingParams.toAmino(VotingParams.fromPartial({})); + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : TallyParams.toAmino(TallyParams.fromPartial({})); + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/gov.ts b/util/inj-types/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..bbd471f7 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1690 @@ +//@ts-nocheck +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalSDKType, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg, CommunityPoolSpendProposalWithDepositSDKType } from "../../distribution/v1beta1/distribution"; +import { ParameterChangeProposal, ParameterChangeProposalProtoMsg, ParameterChangeProposalSDKType } from "../../params/v1beta1/params"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, SoftwareUpgradeProposalSDKType, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposalSDKType } from "../../upgrade/v1beta1/upgrade"; +import { StoreCodeProposal, StoreCodeProposalProtoMsg, StoreCodeProposalSDKType, InstantiateContractProposal, InstantiateContractProposalProtoMsg, InstantiateContractProposalSDKType, InstantiateContract2Proposal, InstantiateContract2ProposalProtoMsg, InstantiateContract2ProposalSDKType, MigrateContractProposal, MigrateContractProposalProtoMsg, MigrateContractProposalSDKType, SudoContractProposal, SudoContractProposalProtoMsg, SudoContractProposalSDKType, ExecuteContractProposal, ExecuteContractProposalProtoMsg, ExecuteContractProposalSDKType, UpdateAdminProposal, UpdateAdminProposalProtoMsg, UpdateAdminProposalSDKType, ClearAdminProposal, ClearAdminProposalProtoMsg, ClearAdminProposalSDKType, PinCodesProposal, PinCodesProposalProtoMsg, PinCodesProposalSDKType, UnpinCodesProposal, UnpinCodesProposalProtoMsg, UnpinCodesProposalSDKType, UpdateInstantiateConfigProposal, UpdateInstantiateConfigProposalProtoMsg, UpdateInstantiateConfigProposalSDKType, StoreAndInstantiateContractProposal, StoreAndInstantiateContractProposalProtoMsg, StoreAndInstantiateContractProposalSDKType } from "../../../cosmwasm/wasm/v1/proposal_legacy"; +import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, ClientUpdateProposalSDKType, UpgradeProposal, UpgradeProposalProtoMsg, UpgradeProposalSDKType } from "../../../ibc/core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionSDKType = VoteOption; +export const VoteOptionAmino = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} +export const ProposalStatusSDKType = ProposalStatus; +export const ProposalStatusAmino = ProposalStatus; +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption"; + value: Uint8Array; +} +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOptionAmino { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option?: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight?: string; +} +export interface WeightedVoteOptionAminoMsg { + type: "cosmos-sdk/WeightedVoteOption"; + value: WeightedVoteOptionAmino; +} +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOptionSDKType { + option: VoteOption; + weight: string; +} +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + $typeUrl?: "/cosmos.gov.v1beta1.TextProposal"; + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} +export interface TextProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TextProposal"; + value: Uint8Array; +} +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposalAmino { + /** title of the proposal. */ + title?: string; + /** description associated with the proposal. */ + description?: string; +} +export interface TextProposalAminoMsg { + type: "cosmos-sdk/TextProposal"; + value: TextProposalAmino; +} +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposalSDKType { + $typeUrl?: "/cosmos.gov.v1beta1.TextProposal"; + title: string; + description: string; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface DepositProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Deposit"; + value: Uint8Array; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface DepositAminoMsg { + type: "cosmos-sdk/Deposit"; + value: DepositAmino; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositSDKType { + proposal_id: bigint; + depositor: string; + amount: CoinSDKType[]; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** content is the proposal's content. */ + content?: TextProposal | CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | StoreCodeProposal | InstantiateContractProposal | InstantiateContract2Proposal | MigrateContractProposal | SudoContractProposal | ExecuteContractProposal | UpdateAdminProposal | ClearAdminProposal | PinCodesProposal | UnpinCodesProposal | UpdateInstantiateConfigProposal | StoreAndInstantiateContractProposal | ClientUpdateProposal | UpgradeProposal | Any | undefined; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: TallyResult; + /** submit_time is the time of proposal submission. */ + submitTime: Date; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: Date; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: Date; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: Date; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Proposal"; + value: Uint8Array; +} +export type ProposalEncoded = Omit & { + /** content is the proposal's content. */content?: TextProposalProtoMsg | CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | ParameterChangeProposalProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | StoreCodeProposalProtoMsg | InstantiateContractProposalProtoMsg | InstantiateContract2ProposalProtoMsg | MigrateContractProposalProtoMsg | SudoContractProposalProtoMsg | ExecuteContractProposalProtoMsg | UpdateAdminProposalProtoMsg | ClearAdminProposalProtoMsg | PinCodesProposalProtoMsg | UnpinCodesProposalProtoMsg | UpdateInstantiateConfigProposalProtoMsg | StoreAndInstantiateContractProposalProtoMsg | ClientUpdateProposalProtoMsg | UpgradeProposalProtoMsg | AnyProtoMsg | undefined; +}; +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** content is the proposal's content. */ + content?: AnyAmino; + /** status defines the proposal status. */ + status?: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + final_tally_result: TallyResultAmino; + /** submit_time is the time of proposal submission. */ + submit_time: string; + /** deposit_end_time is the end time for deposition. */ + deposit_end_time: string; + /** total_deposit is the total deposit on the proposal. */ + total_deposit: CoinAmino[]; + /** voting_start_time is the starting time to vote on a proposal. */ + voting_start_time: string; + /** voting_end_time is the end time of voting on a proposal. */ + voting_end_time: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/Proposal"; + value: ProposalAmino; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalSDKType { + proposal_id: bigint; + content?: TextProposalSDKType | CommunityPoolSpendProposalSDKType | CommunityPoolSpendProposalWithDepositSDKType | ParameterChangeProposalSDKType | SoftwareUpgradeProposalSDKType | CancelSoftwareUpgradeProposalSDKType | StoreCodeProposalSDKType | InstantiateContractProposalSDKType | InstantiateContract2ProposalSDKType | MigrateContractProposalSDKType | SudoContractProposalSDKType | ExecuteContractProposalSDKType | UpdateAdminProposalSDKType | ClearAdminProposalSDKType | PinCodesProposalSDKType | UnpinCodesProposalSDKType | UpdateInstantiateConfigProposalSDKType | StoreAndInstantiateContractProposalSDKType | ClientUpdateProposalSDKType | UpgradeProposalSDKType | AnySDKType | undefined; + status: ProposalStatus; + final_tally_result: TallyResultSDKType; + submit_time: Date; + deposit_end_time: Date; + total_deposit: CoinSDKType[]; + voting_start_time: Date; + voting_end_time: Date; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + noWithVeto: string; +} +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TallyResult"; + value: Uint8Array; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultAmino { + /** yes is the number of yes votes on a proposal. */ + yes?: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain?: string; + /** no is the number of no votes on a proposal. */ + no?: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + no_with_veto?: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/TallyResult"; + value: TallyResultAmino; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultSDKType { + yes: string; + abstain: string; + no: string; + no_with_veto: string; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface Vote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + */ + /** @deprecated */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOption[]; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Vote"; + value: Uint8Array; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address of the proposal. */ + voter?: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + */ + /** @deprecated */ + option?: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOptionAmino[]; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/Vote"; + value: VoteAmino; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteSDKType { + proposal_id: bigint; + voter: string; + /** @deprecated */ + option: VoteOption; + options: WeightedVoteOptionSDKType[]; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration; +} +export interface DepositParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.DepositParams"; + value: Uint8Array; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit?: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; +} +export interface DepositParamsAminoMsg { + type: "cosmos-sdk/DepositParams"; + value: DepositParamsAmino; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsSDKType { + min_deposit: CoinSDKType[]; + max_deposit_period: DurationSDKType; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration; +} +export interface VotingParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.VotingParams"; + value: Uint8Array; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsAmino { + /** Duration of the voting period. */ + voting_period?: DurationAmino; +} +export interface VotingParamsAminoMsg { + type: "cosmos-sdk/VotingParams"; + value: VotingParamsAmino; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsSDKType { + voting_period: DurationSDKType; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: Uint8Array; +} +export interface TallyParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TallyParams"; + value: Uint8Array; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsAmino { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum?: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold?: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold?: string; +} +export interface TallyParamsAminoMsg { + type: "cosmos-sdk/TallyParams"; + value: TallyParamsAmino; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsSDKType { + quorum: Uint8Array; + threshold: Uint8Array; + veto_threshold: Uint8Array; +} +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { + option: 0, + weight: "" + }; +} +export const WeightedVoteOption = { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", + aminoType: "cosmos-sdk/WeightedVoteOption", + encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.weight, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.option = (reader.int32() as any); + break; + case 2: + message.weight = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, + fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + return message; + }, + toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { + const obj: any = {}; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; + return obj; + }, + fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { + return WeightedVoteOption.fromAmino(object.value); + }, + toAminoMsg(message: WeightedVoteOption): WeightedVoteOptionAminoMsg { + return { + type: "cosmos-sdk/WeightedVoteOption", + value: WeightedVoteOption.toAmino(message) + }; + }, + fromProtoMsg(message: WeightedVoteOptionProtoMsg): WeightedVoteOption { + return WeightedVoteOption.decode(message.value); + }, + toProto(message: WeightedVoteOption): Uint8Array { + return WeightedVoteOption.encode(message).finish(); + }, + toProtoMsg(message: WeightedVoteOption): WeightedVoteOptionProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", + value: WeightedVoteOption.encode(message).finish() + }; + } +}; +function createBaseTextProposal(): TextProposal { + return { + $typeUrl: "/cosmos.gov.v1beta1.TextProposal", + title: "", + description: "" + }; +} +export const TextProposal = { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + aminoType: "cosmos-sdk/TextProposal", + encode(message: TextProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, + fromAmino(object: TextProposalAmino): TextProposal { + const message = createBaseTextProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: TextProposal): TextProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + return obj; + }, + fromAminoMsg(object: TextProposalAminoMsg): TextProposal { + return TextProposal.fromAmino(object.value); + }, + toAminoMsg(message: TextProposal): TextProposalAminoMsg { + return { + type: "cosmos-sdk/TextProposal", + value: TextProposal.toAmino(message) + }; + }, + fromProtoMsg(message: TextProposalProtoMsg): TextProposal { + return TextProposal.decode(message.value); + }, + toProto(message: TextProposal): Uint8Array { + return TextProposal.encode(message).finish(); + }, + toProtoMsg(message: TextProposal): TextProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(message).finish() + }; + } +}; +function createBaseDeposit(): Deposit { + return { + proposalId: BigInt(0), + depositor: "", + amount: [] + }; +} +export const Deposit = { + typeUrl: "/cosmos.gov.v1beta1.Deposit", + aminoType: "cosmos-sdk/Deposit", + encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Deposit { + const message = createBaseDeposit(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DepositAmino): Deposit { + const message = createBaseDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Deposit): DepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: DepositAminoMsg): Deposit { + return Deposit.fromAmino(object.value); + }, + toAminoMsg(message: Deposit): DepositAminoMsg { + return { + type: "cosmos-sdk/Deposit", + value: Deposit.toAmino(message) + }; + }, + fromProtoMsg(message: DepositProtoMsg): Deposit { + return Deposit.decode(message.value); + }, + toProto(message: Deposit): Uint8Array { + return Deposit.encode(message).finish(); + }, + toProtoMsg(message: Deposit): DepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Deposit", + value: Deposit.encode(message).finish() + }; + } +}; +function createBaseProposal(): Proposal { + return { + proposalId: BigInt(0), + content: undefined, + status: 0, + finalTallyResult: TallyResult.fromPartial({}), + submitTime: new Date(), + depositEndTime: new Date(), + totalDeposit: [], + votingStartTime: new Date(), + votingEndTime: new Date() + }; +} +export const Proposal = { + typeUrl: "/cosmos.gov.v1beta1.Proposal", + aminoType: "cosmos-sdk/Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + Any.encode((message.content as Any), writer.uint32(18).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).ldelim(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).ldelim(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).ldelim(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.content = (Cosmos_govv1beta1Content_InterfaceDecoder(reader) as Any); + break; + case 3: + message.status = (reader.int32() as any); + break; + case 4: + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 9: + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.content = object.content !== undefined && object.content !== null ? Any.fromPartial(object.content) : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map(e => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.content !== undefined && object.content !== null) { + message.content = Cosmos_govv1beta1Content_FromAmino(object.content); + } + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.deposit_end_time !== undefined && object.deposit_end_time !== null) { + message.depositEndTime = fromTimestamp(Timestamp.fromAmino(object.deposit_end_time)); + } + message.totalDeposit = object.total_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.voting_start_time !== undefined && object.voting_start_time !== null) { + message.votingStartTime = fromTimestamp(Timestamp.fromAmino(object.voting_start_time)); + } + if (object.voting_end_time !== undefined && object.voting_end_time !== null) { + message.votingEndTime = fromTimestamp(Timestamp.fromAmino(object.voting_end_time)); + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.content = message.content ? Cosmos_govv1beta1Content_ToAmino((message.content as Any)) : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : TallyResult.toAmino(TallyResult.fromPartial({})); + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); + obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : new Date(); + if (message.totalDeposit) { + obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_deposit = message.totalDeposit; + } + obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : new Date(); + obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +function createBaseTallyResult(): TallyResult { + return { + yes: "", + abstain: "", + no: "", + noWithVeto: "" + }; +} +export const TallyResult = { + typeUrl: "/cosmos.gov.v1beta1.TallyResult", + aminoType: "cosmos-sdk/TallyResult", + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yes = reader.string(); + break; + case 2: + message.abstain = reader.string(); + break; + case 3: + message.no = reader.string(); + break; + case 4: + message.noWithVeto = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes !== undefined && object.yes !== null) { + message.yes = object.yes; + } + if (object.abstain !== undefined && object.abstain !== null) { + message.abstain = object.abstain; + } + if (object.no !== undefined && object.no !== null) { + message.no = object.no; + } + if (object.no_with_veto !== undefined && object.no_with_veto !== null) { + message.noWithVeto = object.no_with_veto; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes = message.yes === "" ? undefined : message.yes; + obj.abstain = message.abstain === "" ? undefined : message.abstain; + obj.no = message.no === "" ? undefined : message.no; + obj.no_with_veto = message.noWithVeto === "" ? undefined : message.noWithVeto; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TallyResult", + value: TallyResult.encode(message).finish() + }; + } +}; +function createBaseVote(): Vote { + return { + proposalId: BigInt(0), + voter: "", + option: 0, + options: [] + }; +} +export const Vote = { + typeUrl: "/cosmos.gov.v1beta1.Vote", + aminoType: "cosmos-sdk/Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + case 4: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = message.options; + } + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Vote", + value: Vote.encode(message).finish() + }; + } +}; +function createBaseDepositParams(): DepositParams { + return { + minDeposit: [], + maxDepositPeriod: Duration.fromPartial({}) + }; +} +export const DepositParams = { + typeUrl: "/cosmos.gov.v1beta1.DepositParams", + aminoType: "cosmos-sdk/DepositParams", + encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; + return message; + }, + fromAmino(object: DepositParamsAmino): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + return message; + }, + toAmino(message: DepositParams): DepositParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = message.minDeposit; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: DepositParamsAminoMsg): DepositParams { + return DepositParams.fromAmino(object.value); + }, + toAminoMsg(message: DepositParams): DepositParamsAminoMsg { + return { + type: "cosmos-sdk/DepositParams", + value: DepositParams.toAmino(message) + }; + }, + fromProtoMsg(message: DepositParamsProtoMsg): DepositParams { + return DepositParams.decode(message.value); + }, + toProto(message: DepositParams): Uint8Array { + return DepositParams.encode(message).finish(); + }, + toProtoMsg(message: DepositParams): DepositParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.DepositParams", + value: DepositParams.encode(message).finish() + }; + } +}; +function createBaseVotingParams(): VotingParams { + return { + votingPeriod: Duration.fromPartial({}) + }; +} +export const VotingParams = { + typeUrl: "/cosmos.gov.v1beta1.VotingParams", + aminoType: "cosmos-sdk/VotingParams", + encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + return message; + }, + fromAmino(object: VotingParamsAmino): VotingParams { + const message = createBaseVotingParams(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + return message; + }, + toAmino(message: VotingParams): VotingParamsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: VotingParamsAminoMsg): VotingParams { + return VotingParams.fromAmino(object.value); + }, + toAminoMsg(message: VotingParams): VotingParamsAminoMsg { + return { + type: "cosmos-sdk/VotingParams", + value: VotingParams.toAmino(message) + }; + }, + fromProtoMsg(message: VotingParamsProtoMsg): VotingParams { + return VotingParams.decode(message.value); + }, + toProto(message: VotingParams): Uint8Array { + return VotingParams.encode(message).finish(); + }, + toProtoMsg(message: VotingParams): VotingParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.VotingParams", + value: VotingParams.encode(message).finish() + }; + } +}; +function createBaseTallyParams(): TallyParams { + return { + quorum: new Uint8Array(), + threshold: new Uint8Array(), + vetoThreshold: new Uint8Array() + }; +} +export const TallyParams = { + typeUrl: "/cosmos.gov.v1beta1.TallyParams", + aminoType: "cosmos-sdk/TallyParams", + encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.quorum = reader.bytes(); + break; + case 2: + message.threshold = reader.bytes(); + break; + case 3: + message.vetoThreshold = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? new Uint8Array(); + message.threshold = object.threshold ?? new Uint8Array(); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(); + return message; + }, + fromAmino(object: TallyParamsAmino): TallyParams { + const message = createBaseTallyParams(); + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = bytesFromBase64(object.quorum); + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = bytesFromBase64(object.threshold); + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = bytesFromBase64(object.veto_threshold); + } + return message; + }, + toAmino(message: TallyParams): TallyParamsAmino { + const obj: any = {}; + obj.quorum = message.quorum ? base64FromBytes(message.quorum) : undefined; + obj.threshold = message.threshold ? base64FromBytes(message.threshold) : undefined; + obj.veto_threshold = message.vetoThreshold ? base64FromBytes(message.vetoThreshold) : undefined; + return obj; + }, + fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { + return TallyParams.fromAmino(object.value); + }, + toAminoMsg(message: TallyParams): TallyParamsAminoMsg { + return { + type: "cosmos-sdk/TallyParams", + value: TallyParams.toAmino(message) + }; + }, + fromProtoMsg(message: TallyParamsProtoMsg): TallyParams { + return TallyParams.decode(message.value); + }, + toProto(message: TallyParams): Uint8Array { + return TallyParams.encode(message).finish(); + }, + toProtoMsg(message: TallyParams): TallyParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TallyParams", + value: TallyParams.encode(message).finish() + }; + } +}; +export const Cosmos_govv1beta1Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | StoreCodeProposal | InstantiateContractProposal | InstantiateContract2Proposal | MigrateContractProposal | SudoContractProposal | ExecuteContractProposal | UpdateAdminProposal | ClearAdminProposal | PinCodesProposal | UnpinCodesProposal | UpdateInstantiateConfigProposal | StoreAndInstantiateContractProposal | ClientUpdateProposal | UpgradeProposal | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return CommunityPoolSpendProposal.decode(data.value); + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return CommunityPoolSpendProposalWithDeposit.decode(data.value); + case "/cosmos.gov.v1beta1.TextProposal": + return TextProposal.decode(data.value); + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return ParameterChangeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return SoftwareUpgradeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return CancelSoftwareUpgradeProposal.decode(data.value); + case "/cosmwasm.wasm.v1.StoreCodeProposal": + return StoreCodeProposal.decode(data.value); + case "/cosmwasm.wasm.v1.InstantiateContractProposal": + return InstantiateContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.InstantiateContract2Proposal": + return InstantiateContract2Proposal.decode(data.value); + case "/cosmwasm.wasm.v1.MigrateContractProposal": + return MigrateContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.SudoContractProposal": + return SudoContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.ExecuteContractProposal": + return ExecuteContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UpdateAdminProposal": + return UpdateAdminProposal.decode(data.value); + case "/cosmwasm.wasm.v1.ClearAdminProposal": + return ClearAdminProposal.decode(data.value); + case "/cosmwasm.wasm.v1.PinCodesProposal": + return PinCodesProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UnpinCodesProposal": + return UnpinCodesProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal": + return UpdateInstantiateConfigProposal.decode(data.value); + case "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal": + return StoreAndInstantiateContractProposal.decode(data.value); + case "/ibc.core.client.v1.ClientUpdateProposal": + return ClientUpdateProposal.decode(data.value); + case "/ibc.core.client.v1.UpgradeProposal": + return UpgradeProposal.decode(data.value); + default: + return data; + } +}; +export const Cosmos_govv1beta1Content_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/CommunityPoolSpendProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(CommunityPoolSpendProposal.fromPartial(CommunityPoolSpendProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CommunityPoolSpendProposalWithDeposit": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(CommunityPoolSpendProposalWithDeposit.fromPartial(CommunityPoolSpendProposalWithDeposit.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/TextProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/ParameterChangeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + value: ParameterChangeProposal.encode(ParameterChangeProposal.fromPartial(ParameterChangeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/SoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(SoftwareUpgradeProposal.fromPartial(SoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CancelSoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(CancelSoftwareUpgradeProposal.fromPartial(CancelSoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "wasm/StoreCodeProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", + value: StoreCodeProposal.encode(StoreCodeProposal.fromPartial(StoreCodeProposal.fromAmino(content.value))).finish() + }); + case "wasm/InstantiateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", + value: InstantiateContractProposal.encode(InstantiateContractProposal.fromPartial(InstantiateContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/InstantiateContract2Proposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal", + value: InstantiateContract2Proposal.encode(InstantiateContract2Proposal.fromPartial(InstantiateContract2Proposal.fromAmino(content.value))).finish() + }); + case "wasm/MigrateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", + value: MigrateContractProposal.encode(MigrateContractProposal.fromPartial(MigrateContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/SudoContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", + value: SudoContractProposal.encode(SudoContractProposal.fromPartial(SudoContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/ExecuteContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", + value: ExecuteContractProposal.encode(ExecuteContractProposal.fromPartial(ExecuteContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/UpdateAdminProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", + value: UpdateAdminProposal.encode(UpdateAdminProposal.fromPartial(UpdateAdminProposal.fromAmino(content.value))).finish() + }); + case "wasm/ClearAdminProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", + value: ClearAdminProposal.encode(ClearAdminProposal.fromPartial(ClearAdminProposal.fromAmino(content.value))).finish() + }); + case "wasm/PinCodesProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", + value: PinCodesProposal.encode(PinCodesProposal.fromPartial(PinCodesProposal.fromAmino(content.value))).finish() + }); + case "wasm/UnpinCodesProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", + value: UnpinCodesProposal.encode(UnpinCodesProposal.fromPartial(UnpinCodesProposal.fromAmino(content.value))).finish() + }); + case "wasm/UpdateInstantiateConfigProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", + value: UpdateInstantiateConfigProposal.encode(UpdateInstantiateConfigProposal.fromPartial(UpdateInstantiateConfigProposal.fromAmino(content.value))).finish() + }); + case "wasm/StoreAndInstantiateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", + value: StoreAndInstantiateContractProposal.encode(StoreAndInstantiateContractProposal.fromPartial(StoreAndInstantiateContractProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/ClientUpdateProposal": + return Any.fromPartial({ + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/UpgradeProposal": + return Any.fromPartial({ + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_govv1beta1Content_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return { + type: "cosmos-sdk/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(CommunityPoolSpendProposal.decode(content.value, undefined)) + }; + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(CommunityPoolSpendProposalWithDeposit.decode(content.value, undefined)) + }; + case "/cosmos.gov.v1beta1.TextProposal": + return { + type: "cosmos-sdk/TextProposal", + value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) + }; + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return { + type: "cosmos-sdk/ParameterChangeProposal", + value: ParameterChangeProposal.toAmino(ParameterChangeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(SoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(CancelSoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.StoreCodeProposal": + return { + type: "wasm/StoreCodeProposal", + value: StoreCodeProposal.toAmino(StoreCodeProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.InstantiateContractProposal": + return { + type: "wasm/InstantiateContractProposal", + value: InstantiateContractProposal.toAmino(InstantiateContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.InstantiateContract2Proposal": + return { + type: "wasm/InstantiateContract2Proposal", + value: InstantiateContract2Proposal.toAmino(InstantiateContract2Proposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.MigrateContractProposal": + return { + type: "wasm/MigrateContractProposal", + value: MigrateContractProposal.toAmino(MigrateContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.SudoContractProposal": + return { + type: "wasm/SudoContractProposal", + value: SudoContractProposal.toAmino(SudoContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.ExecuteContractProposal": + return { + type: "wasm/ExecuteContractProposal", + value: ExecuteContractProposal.toAmino(ExecuteContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UpdateAdminProposal": + return { + type: "wasm/UpdateAdminProposal", + value: UpdateAdminProposal.toAmino(UpdateAdminProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.ClearAdminProposal": + return { + type: "wasm/ClearAdminProposal", + value: ClearAdminProposal.toAmino(ClearAdminProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.PinCodesProposal": + return { + type: "wasm/PinCodesProposal", + value: PinCodesProposal.toAmino(PinCodesProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UnpinCodesProposal": + return { + type: "wasm/UnpinCodesProposal", + value: UnpinCodesProposal.toAmino(UnpinCodesProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal": + return { + type: "wasm/UpdateInstantiateConfigProposal", + value: UpdateInstantiateConfigProposal.toAmino(UpdateInstantiateConfigProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal": + return { + type: "wasm/StoreAndInstantiateContractProposal", + value: StoreAndInstantiateContractProposal.toAmino(StoreAndInstantiateContractProposal.decode(content.value, undefined)) + }; + case "/ibc.core.client.v1.ClientUpdateProposal": + return { + type: "cosmos-sdk/ClientUpdateProposal", + value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined)) + }; + case "/ibc.core.client.v1.UpgradeProposal": + return { + type: "cosmos-sdk/UpgradeProposal", + value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/query.lcd.ts b/util/inj-types/cosmos/gov/v1beta1/query.lcd.ts new file mode 100644 index 00000000..ad9718b9 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/query.lcd.ts @@ -0,0 +1,80 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsRequest, QueryProposalsResponseSDKType, QueryVoteRequest, QueryVoteResponseSDKType, QueryVotesRequest, QueryVotesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDepositRequest, QueryDepositResponseSDKType, QueryDepositsRequest, QueryDepositsResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Proposal queries proposal details based on ProposalID. */ + proposal = async (params: QueryProposalRequest): Promise => { + const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}`; + return await this.req.get(endpoint); + }; + /* Proposals queries all proposals based on given status. */ + proposals = async (params: QueryProposalsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.proposalStatus !== "undefined") { + options.params.proposal_status = params.proposalStatus; + } + if (typeof params?.voter !== "undefined") { + options.params.voter = params.voter; + } + if (typeof params?.depositor !== "undefined") { + options.params.depositor = params.depositor; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/gov/v1beta1/proposals`; + return await this.req.get(endpoint, options); + }; + /* Vote queries voted information based on proposalID, voterAddr. */ + vote = async (params: QueryVoteRequest): Promise => { + const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/votes/${params.voter}`; + return await this.req.get(endpoint); + }; + /* Votes queries votes of a given proposal. */ + votes = async (params: QueryVotesRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/votes`; + return await this.req.get(endpoint, options); + }; + /* Params queries all parameters of the gov module. */ + params = async (params: QueryParamsRequest): Promise => { + const endpoint = `cosmos/gov/v1beta1/params/${params.paramsType}`; + return await this.req.get(endpoint); + }; + /* Deposit queries single deposit information based proposalID, depositAddr. */ + deposit = async (params: QueryDepositRequest): Promise => { + const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/deposits/${params.depositor}`; + return await this.req.get(endpoint); + }; + /* Deposits queries all deposits of a single proposal. */ + deposits = async (params: QueryDepositsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/deposits`; + return await this.req.get(endpoint, options); + }; + /* TallyResult queries the tally of a proposal vote. */ + tallyResult = async (params: QueryTallyResultRequest): Promise => { + const endpoint = `cosmos/gov/v1beta1/proposals/${params.proposalId}/tally`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/gov/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..c4fb912e --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/query.rpc.Query.ts @@ -0,0 +1,107 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Proposal queries proposal details based on ProposalID. */ + proposal(request: QueryProposalRequest): Promise; + /** Proposals queries all proposals based on given status. */ + proposals(request: QueryProposalsRequest): Promise; + /** Vote queries voted information based on proposalID, voterAddr. */ + vote(request: QueryVoteRequest): Promise; + /** Votes queries votes of a given proposal. */ + votes(request: QueryVotesRequest): Promise; + /** Params queries all parameters of the gov module. */ + params(request: QueryParamsRequest): Promise; + /** Deposit queries single deposit information based proposalID, depositAddr. */ + deposit(request: QueryDepositRequest): Promise; + /** Deposits queries all deposits of a single proposal. */ + deposits(request: QueryDepositsRequest): Promise; + /** TallyResult queries the tally of a proposal vote. */ + tallyResult(request: QueryTallyResultRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Proposal queries proposal details based on ProposalID. */ + proposal = async (request: QueryProposalRequest): Promise => { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Proposal", data); + return promise.then(data => QueryProposalResponse.decode(new BinaryReader(data))); + }; + /* Proposals queries all proposals based on given status. */ + proposals = async (request: QueryProposalsRequest): Promise => { + const data = QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Proposals", data); + return promise.then(data => QueryProposalsResponse.decode(new BinaryReader(data))); + }; + /* Vote queries voted information based on proposalID, voterAddr. */ + vote = async (request: QueryVoteRequest): Promise => { + const data = QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Vote", data); + return promise.then(data => QueryVoteResponse.decode(new BinaryReader(data))); + }; + /* Votes queries votes of a given proposal. */ + votes = async (request: QueryVotesRequest): Promise => { + const data = QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Votes", data); + return promise.then(data => QueryVotesResponse.decode(new BinaryReader(data))); + }; + /* Params queries all parameters of the gov module. */ + params = async (request: QueryParamsRequest): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; + /* Deposit queries single deposit information based proposalID, depositAddr. */ + deposit = async (request: QueryDepositRequest): Promise => { + const data = QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Deposit", data); + return promise.then(data => QueryDepositResponse.decode(new BinaryReader(data))); + }; + /* Deposits queries all deposits of a single proposal. */ + deposits = async (request: QueryDepositsRequest): Promise => { + const data = QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Deposits", data); + return promise.then(data => QueryDepositsResponse.decode(new BinaryReader(data))); + }; + /* TallyResult queries the tally of a proposal vote. */ + tallyResult = async (request: QueryTallyResultRequest): Promise => { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "TallyResult", data); + return promise.then(data => QueryTallyResultResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + proposal(request: QueryProposalRequest): Promise { + return queryService.proposal(request); + }, + proposals(request: QueryProposalsRequest): Promise { + return queryService.proposals(request); + }, + vote(request: QueryVoteRequest): Promise { + return queryService.vote(request); + }, + votes(request: QueryVotesRequest): Promise { + return queryService.votes(request); + }, + params(request: QueryParamsRequest): Promise { + return queryService.params(request); + }, + deposit(request: QueryDepositRequest): Promise { + return queryService.deposit(request); + }, + deposits(request: QueryDepositsRequest): Promise { + return queryService.deposits(request); + }, + tallyResult(request: QueryTallyResultRequest): Promise { + return queryService.tallyResult(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/query.ts b/util/inj-types/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..e78e7e4e --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1699 @@ +import { ProposalStatus, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./gov"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest"; + value: Uint8Array; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/QueryProposalRequest"; + value: QueryProposalRequestAmino; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestSDKType { + proposal_id: bigint; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal: Proposal; +} +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse"; + value: Uint8Array; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseAmino { + proposal: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/QueryProposalResponse"; + value: QueryProposalResponseAmino; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseSDKType { + proposal: ProposalSDKType; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus?: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter?: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryProposalsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest"; + value: Uint8Array; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestAmino { + /** proposal_status defines the status of the proposals. */ + proposal_status?: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter?: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryProposalsRequestAminoMsg { + type: "cosmos-sdk/QueryProposalsRequest"; + value: QueryProposalsRequestAmino; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestSDKType { + proposal_status?: ProposalStatus; + voter?: string; + depositor?: string; + pagination?: PageRequestSDKType; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryProposalsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse"; + value: Uint8Array; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseAmino { + /** proposals defines all the requested governance proposals. */ + proposals: ProposalAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryProposalsResponseAminoMsg { + type: "cosmos-sdk/QueryProposalsResponse"; + value: QueryProposalsResponseAmino; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseSDKType { + proposals: ProposalSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter defines the voter address for the proposals. */ + voter: string; +} +export interface QueryVoteRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest"; + value: Uint8Array; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** voter defines the voter address for the proposals. */ + voter?: string; +} +export interface QueryVoteRequestAminoMsg { + type: "cosmos-sdk/QueryVoteRequest"; + value: QueryVoteRequestAmino; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestSDKType { + proposal_id: bigint; + voter: string; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defines the queried vote. */ + vote: Vote; +} +export interface QueryVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse"; + value: Uint8Array; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseAmino { + /** vote defines the queried vote. */ + vote: VoteAmino; +} +export interface QueryVoteResponseAminoMsg { + type: "cosmos-sdk/QueryVoteResponse"; + value: QueryVoteResponseAmino; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseSDKType { + vote: VoteSDKType; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryVotesRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest"; + value: Uint8Array; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryVotesRequestAminoMsg { + type: "cosmos-sdk/QueryVotesRequest"; + value: QueryVotesRequestAmino; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestSDKType { + proposal_id: bigint; + pagination?: PageRequestSDKType; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryVotesResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse"; + value: Uint8Array; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseAmino { + /** votes defines the queried votes. */ + votes: VoteAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryVotesResponseAminoMsg { + type: "cosmos-sdk/QueryVotesResponse"; + value: QueryVotesResponseAmino; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseSDKType { + votes: VoteSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + params_type?: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType { + params_type: string; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + votingParams: VotingParams; + /** deposit_params defines the parameters related to deposit. */ + depositParams: DepositParams; + /** tally_params defines the parameters related to tally. */ + tallyParams: TallyParams; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** voting_params defines the parameters related to voting. */ + voting_params: VotingParamsAmino; + /** deposit_params defines the parameters related to deposit. */ + deposit_params: DepositParamsAmino; + /** tally_params defines the parameters related to tally. */ + tally_params: TallyParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + voting_params: VotingParamsSDKType; + deposit_params: DepositParamsSDKType; + tally_params: TallyParamsSDKType; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} +export interface QueryDepositRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest"; + value: Uint8Array; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; +} +export interface QueryDepositRequestAminoMsg { + type: "cosmos-sdk/QueryDepositRequest"; + value: QueryDepositRequestAmino; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestSDKType { + proposal_id: bigint; + depositor: string; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit: Deposit; +} +export interface QueryDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse"; + value: Uint8Array; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseAmino { + /** deposit defines the requested deposit. */ + deposit: DepositAmino; +} +export interface QueryDepositResponseAminoMsg { + type: "cosmos-sdk/QueryDepositResponse"; + value: QueryDepositResponseAmino; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseSDKType { + deposit: DepositSDKType; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDepositsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest"; + value: Uint8Array; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDepositsRequestAminoMsg { + type: "cosmos-sdk/QueryDepositsRequest"; + value: QueryDepositsRequestAmino; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestSDKType { + proposal_id: bigint; + pagination?: PageRequestSDKType; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDepositsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse"; + value: Uint8Array; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseAmino { + /** deposits defines the requested deposits. */ + deposits: DepositAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDepositsResponseAminoMsg { + type: "cosmos-sdk/QueryDepositsResponse"; + value: QueryDepositsResponseAmino; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseSDKType { + deposits: DepositSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest"; + value: Uint8Array; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestSDKType { + proposal_id: bigint; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult; +} +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse"; + value: Uint8Array; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseAmino { + /** tally defines the requested tally. */ + tally: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseSDKType { + tally: TallyResultSDKType; +} +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { + proposalId: BigInt(0) + }; +} +export const QueryProposalRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", + aminoType: "cosmos-sdk/QueryProposalRequest", + encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish() + }; + } +}; +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { + proposal: Proposal.fromPartial({}) + }; +} +export const QueryProposalResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", + aminoType: "cosmos-sdk/QueryProposalResponse", + encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; + return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + return message; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : Proposal.toAmino(Proposal.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish() + }; + } +}; +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { + proposalStatus: 0, + voter: "", + depositor: "", + pagination: undefined + }; +} +export const QueryProposalsRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", + aminoType: "cosmos-sdk/QueryProposalsRequest", + encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalStatus = (reader.int32() as any); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.depositor = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + if (object.proposal_status !== undefined && object.proposal_status !== null) { + message.proposalStatus = object.proposal_status; + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { + const obj: any = {}; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsRequestAminoMsg): QueryProposalsRequest { + return QueryProposalsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsRequest): QueryProposalsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsRequest", + value: QueryProposalsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsRequestProtoMsg): QueryProposalsRequest { + return QueryProposalsRequest.decode(message.value); + }, + toProto(message: QueryProposalsRequest): Uint8Array { + return QueryProposalsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsRequest): QueryProposalsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", + value: QueryProposalsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { + proposals: [], + pagination: undefined + }; +} +export const QueryProposalsResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", + aminoType: "cosmos-sdk/QueryProposalsResponse", + encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryProposalsResponseAmino): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsResponse): QueryProposalsResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = message.proposals; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsResponseAminoMsg): QueryProposalsResponse { + return QueryProposalsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsResponse): QueryProposalsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsResponse", + value: QueryProposalsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsResponseProtoMsg): QueryProposalsResponse { + return QueryProposalsResponse.decode(message.value); + }, + toProto(message: QueryProposalsResponse): Uint8Array { + return QueryProposalsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsResponse): QueryProposalsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", + value: QueryProposalsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { + proposalId: BigInt(0), + voter: "" + }; +} +export const QueryVoteRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", + aminoType: "cosmos-sdk/QueryVoteRequest", + encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + return message; + }, + fromAmino(object: QueryVoteRequestAmino): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + return message; + }, + toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { + return QueryVoteRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteRequest): QueryVoteRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVoteRequest", + value: QueryVoteRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteRequestProtoMsg): QueryVoteRequest { + return QueryVoteRequest.decode(message.value); + }, + toProto(message: QueryVoteRequest): Uint8Array { + return QueryVoteRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteRequest): QueryVoteRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", + value: QueryVoteRequest.encode(message).finish() + }; + } +}; +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { + vote: Vote.fromPartial({}) + }; +} +export const QueryVoteResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", + aminoType: "cosmos-sdk/QueryVoteResponse", + encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; + return message; + }, + fromAmino(object: QueryVoteResponseAmino): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + return message; + }, + toAmino(message: QueryVoteResponse): QueryVoteResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : Vote.toAmino(Vote.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryVoteResponseAminoMsg): QueryVoteResponse { + return QueryVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteResponse): QueryVoteResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVoteResponse", + value: QueryVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteResponseProtoMsg): QueryVoteResponse { + return QueryVoteResponse.decode(message.value); + }, + toProto(message: QueryVoteResponse): Uint8Array { + return QueryVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteResponse): QueryVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", + value: QueryVoteResponse.encode(message).finish() + }; + } +}; +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { + proposalId: BigInt(0), + pagination: undefined + }; +} +export const QueryVotesRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", + aminoType: "cosmos-sdk/QueryVotesRequest", + encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesRequestAmino): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesRequestAminoMsg): QueryVotesRequest { + return QueryVotesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesRequest): QueryVotesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVotesRequest", + value: QueryVotesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesRequestProtoMsg): QueryVotesRequest { + return QueryVotesRequest.decode(message.value); + }, + toProto(message: QueryVotesRequest): Uint8Array { + return QueryVotesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesRequest): QueryVotesRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", + value: QueryVotesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { + votes: [], + pagination: undefined + }; +} +export const QueryVotesResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", + aminoType: "cosmos-sdk/QueryVotesResponse", + encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesResponseAmino): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesResponse): QueryVotesResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesResponseAminoMsg): QueryVotesResponse { + return QueryVotesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesResponse): QueryVotesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVotesResponse", + value: QueryVotesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesResponseProtoMsg): QueryVotesResponse { + return QueryVotesResponse.decode(message.value); + }, + toProto(message: QueryVotesResponse): Uint8Array { + return QueryVotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesResponse): QueryVotesResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", + value: QueryVotesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { + paramsType: "" + }; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.paramsType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + if (object.params_type !== undefined && object.params_type !== null) { + message.paramsType = object.params_type; + } + return message; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + votingParams: VotingParams.fromPartial({}), + depositParams: DepositParams.fromPartial({}), + tallyParams: TallyParams.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; + message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; + message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : VotingParams.toAmino(VotingParams.fromPartial({})); + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : DepositParams.toAmino(DepositParams.fromPartial({})); + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : TallyParams.toAmino(TallyParams.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { + proposalId: BigInt(0), + depositor: "" + }; +} +export const QueryDepositRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", + aminoType: "cosmos-sdk/QueryDepositRequest", + encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + return message; + }, + fromAmino(object: QueryDepositRequestAmino): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + return message; + }, + toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + return obj; + }, + fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { + return QueryDepositRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositRequest): QueryDepositRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDepositRequest", + value: QueryDepositRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositRequestProtoMsg): QueryDepositRequest { + return QueryDepositRequest.decode(message.value); + }, + toProto(message: QueryDepositRequest): Uint8Array { + return QueryDepositRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositRequest): QueryDepositRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", + value: QueryDepositRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { + deposit: Deposit.fromPartial({}) + }; +} +export const QueryDepositResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", + aminoType: "cosmos-sdk/QueryDepositResponse", + encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposit = Deposit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = object.deposit !== undefined && object.deposit !== null ? Deposit.fromPartial(object.deposit) : undefined; + return message; + }, + fromAmino(object: QueryDepositResponseAmino): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + if (object.deposit !== undefined && object.deposit !== null) { + message.deposit = Deposit.fromAmino(object.deposit); + } + return message; + }, + toAmino(message: QueryDepositResponse): QueryDepositResponseAmino { + const obj: any = {}; + obj.deposit = message.deposit ? Deposit.toAmino(message.deposit) : Deposit.toAmino(Deposit.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryDepositResponseAminoMsg): QueryDepositResponse { + return QueryDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositResponse): QueryDepositResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDepositResponse", + value: QueryDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositResponseProtoMsg): QueryDepositResponse { + return QueryDepositResponse.decode(message.value); + }, + toProto(message: QueryDepositResponse): Uint8Array { + return QueryDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositResponse): QueryDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", + value: QueryDepositResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { + proposalId: BigInt(0), + pagination: undefined + }; +} +export const QueryDepositsRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", + aminoType: "cosmos-sdk/QueryDepositsRequest", + encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDepositsRequestAmino): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsRequestAminoMsg): QueryDepositsRequest { + return QueryDepositsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsRequest): QueryDepositsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDepositsRequest", + value: QueryDepositsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsRequestProtoMsg): QueryDepositsRequest { + return QueryDepositsRequest.decode(message.value); + }, + toProto(message: QueryDepositsRequest): Uint8Array { + return QueryDepositsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsRequest): QueryDepositsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", + value: QueryDepositsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { + deposits: [], + pagination: undefined + }; +} +export const QueryDepositsResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", + aminoType: "cosmos-sdk/QueryDepositsResponse", + encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map(e => Deposit.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDepositsResponseAmino): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsResponse): QueryDepositsResponseAmino { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = message.deposits; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsResponseAminoMsg): QueryDepositsResponse { + return QueryDepositsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsResponse): QueryDepositsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDepositsResponse", + value: QueryDepositsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsResponseProtoMsg): QueryDepositsResponse { + return QueryDepositsResponse.decode(message.value); + }, + toProto(message: QueryDepositsResponse): Uint8Array { + return QueryDepositsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsResponse): QueryDepositsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", + value: QueryDepositsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { + proposalId: BigInt(0) + }; +} +export const QueryTallyResultRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", + aminoType: "cosmos-sdk/QueryTallyResultRequest", + encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultRequestProtoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish() + }; + } +}; +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { + tally: TallyResult.fromPartial({}) + }; +} +export const QueryTallyResultResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", + aminoType: "cosmos-sdk/QueryTallyResultResponse", + encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tally = TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = object.tally !== undefined && object.tally !== null ? TallyResult.fromPartial(object.tally) : undefined; + return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + if (object.tally !== undefined && object.tally !== null) { + message.tally = TallyResult.fromAmino(object.tally); + } + return message; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : TallyResult.toAmino(TallyResult.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultResponseProtoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/tx.amino.ts b/util/inj-types/cosmos/gov/v1beta1/tx.amino.ts new file mode 100644 index 00000000..1d618905 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/tx.amino.ts @@ -0,0 +1,23 @@ +import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +export const AminoConverter = { + "/cosmos.gov.v1beta1.MsgSubmitProposal": { + aminoType: "cosmos-sdk/MsgSubmitProposal", + toAmino: MsgSubmitProposal.toAmino, + fromAmino: MsgSubmitProposal.fromAmino + }, + "/cosmos.gov.v1beta1.MsgVote": { + aminoType: "cosmos-sdk/MsgVote", + toAmino: MsgVote.toAmino, + fromAmino: MsgVote.fromAmino + }, + "/cosmos.gov.v1beta1.MsgVoteWeighted": { + aminoType: "cosmos-sdk/MsgVoteWeighted", + toAmino: MsgVoteWeighted.toAmino, + fromAmino: MsgVoteWeighted.fromAmino + }, + "/cosmos.gov.v1beta1.MsgDeposit": { + aminoType: "cosmos-sdk/MsgDeposit", + toAmino: MsgDeposit.toAmino, + fromAmino: MsgDeposit.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/tx.registry.ts b/util/inj-types/cosmos/gov/v1beta1/tx.registry.ts new file mode 100644 index 00000000..604c0b30 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/tx.registry.ts @@ -0,0 +1,89 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(value).finish() + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.encode(value).finish() + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(value).finish() + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.encode(value).finish() + }; + } + }, + withTypeUrl: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value + }; + } + }, + fromPartial: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.fromPartial(value) + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.fromPartial(value) + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.fromPartial(value) + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/gov/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..fca174a0 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,50 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSubmitProposal, MsgSubmitProposalResponse, MsgVote, MsgVoteResponse, MsgVoteWeighted, MsgVoteWeightedResponse, MsgDeposit, MsgDepositResponse } from "./tx"; +/** Msg defines the bank Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + submitProposal(request: MsgSubmitProposal): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + vote(request: MsgVote): Promise; + /** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + */ + voteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + deposit(request: MsgDeposit): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* SubmitProposal defines a method to create new proposal given a content. */ + submitProposal = async (request: MsgSubmitProposal): Promise => { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "SubmitProposal", data); + return promise.then(data => MsgSubmitProposalResponse.decode(new BinaryReader(data))); + }; + /* Vote defines a method to add a vote on a specific proposal. */ + vote = async (request: MsgVote): Promise => { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "Vote", data); + return promise.then(data => MsgVoteResponse.decode(new BinaryReader(data))); + }; + /* VoteWeighted defines a method to add a weighted vote on a specific proposal. + + Since: cosmos-sdk 0.43 */ + voteWeighted = async (request: MsgVoteWeighted): Promise => { + const data = MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "VoteWeighted", data); + return promise.then(data => MsgVoteWeightedResponse.decode(new BinaryReader(data))); + }; + /* Deposit defines a method to add deposit on a specific proposal. */ + deposit = async (request: MsgDeposit): Promise => { + const data = MsgDeposit.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "Deposit", data); + return promise.then(data => MsgDepositResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/gov/v1beta1/tx.ts b/util/inj-types/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..82fde354 --- /dev/null +++ b/util/inj-types/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,1122 @@ +//@ts-nocheck +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType, TextProposal, TextProposalProtoMsg, TextProposalSDKType } from "./gov"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalSDKType, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg, CommunityPoolSpendProposalWithDepositSDKType } from "../../distribution/v1beta1/distribution"; +import { ParameterChangeProposal, ParameterChangeProposalProtoMsg, ParameterChangeProposalSDKType } from "../../params/v1beta1/params"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, SoftwareUpgradeProposalSDKType, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposalSDKType } from "../../upgrade/v1beta1/upgrade"; +import { StoreCodeProposal, StoreCodeProposalProtoMsg, StoreCodeProposalSDKType, InstantiateContractProposal, InstantiateContractProposalProtoMsg, InstantiateContractProposalSDKType, InstantiateContract2Proposal, InstantiateContract2ProposalProtoMsg, InstantiateContract2ProposalSDKType, MigrateContractProposal, MigrateContractProposalProtoMsg, MigrateContractProposalSDKType, SudoContractProposal, SudoContractProposalProtoMsg, SudoContractProposalSDKType, ExecuteContractProposal, ExecuteContractProposalProtoMsg, ExecuteContractProposalSDKType, UpdateAdminProposal, UpdateAdminProposalProtoMsg, UpdateAdminProposalSDKType, ClearAdminProposal, ClearAdminProposalProtoMsg, ClearAdminProposalSDKType, PinCodesProposal, PinCodesProposalProtoMsg, PinCodesProposalSDKType, UnpinCodesProposal, UnpinCodesProposalProtoMsg, UnpinCodesProposalSDKType, UpdateInstantiateConfigProposal, UpdateInstantiateConfigProposalProtoMsg, UpdateInstantiateConfigProposalSDKType, StoreAndInstantiateContractProposal, StoreAndInstantiateContractProposalProtoMsg, StoreAndInstantiateContractProposalSDKType } from "../../../cosmwasm/wasm/v1/proposal_legacy"; +import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, ClientUpdateProposalSDKType, UpgradeProposal, UpgradeProposalProtoMsg, UpgradeProposalSDKType } from "../../../ibc/core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** content is the proposal's content. */ + content?: CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | StoreCodeProposal | InstantiateContractProposal | InstantiateContract2Proposal | MigrateContractProposal | SudoContractProposal | ExecuteContractProposal | UpdateAdminProposal | ClearAdminProposal | PinCodesProposal | UnpinCodesProposal | UpdateInstantiateConfigProposal | StoreAndInstantiateContractProposal | ClientUpdateProposal | UpgradeProposal | Any | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal"; + value: Uint8Array; +} +export type MsgSubmitProposalEncoded = Omit & { + /** content is the proposal's content. */content?: CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | TextProposalProtoMsg | ParameterChangeProposalProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | StoreCodeProposalProtoMsg | InstantiateContractProposalProtoMsg | InstantiateContract2ProposalProtoMsg | MigrateContractProposalProtoMsg | SudoContractProposalProtoMsg | ExecuteContractProposalProtoMsg | UpdateAdminProposalProtoMsg | ClearAdminProposalProtoMsg | PinCodesProposalProtoMsg | UnpinCodesProposalProtoMsg | UpdateInstantiateConfigProposalProtoMsg | StoreAndInstantiateContractProposalProtoMsg | ClientUpdateProposalProtoMsg | UpgradeProposalProtoMsg | AnyProtoMsg | undefined; +}; +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalAmino { + /** content is the proposal's content. */ + content?: AnyAmino; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initial_deposit: CoinAmino[]; + /** proposer is the account address of the proposer. */ + proposer?: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalSDKType { + content?: CommunityPoolSpendProposalSDKType | CommunityPoolSpendProposalWithDepositSDKType | TextProposalSDKType | ParameterChangeProposalSDKType | SoftwareUpgradeProposalSDKType | CancelSoftwareUpgradeProposalSDKType | StoreCodeProposalSDKType | InstantiateContractProposalSDKType | InstantiateContract2ProposalSDKType | MigrateContractProposalSDKType | SudoContractProposalSDKType | ExecuteContractProposalSDKType | UpdateAdminProposalSDKType | ClearAdminProposalSDKType | PinCodesProposalSDKType | UnpinCodesProposalSDKType | UpdateInstantiateConfigProposalSDKType | StoreAndInstantiateContractProposalSDKType | ClientUpdateProposalSDKType | UpgradeProposalSDKType | AnySDKType | undefined; + initial_deposit: CoinSDKType[]; + proposer: string; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseSDKType { + proposal_id: bigint; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVote"; + value: Uint8Array; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id?: string; + /** voter is the voter address for the proposal. */ + voter?: string; + /** option defines the vote option. */ + option?: VoteOption; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteSDKType { + proposal_id: bigint; + voter: string; + option: VoteOption; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseSDKType {} +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; +} +export interface MsgVoteWeightedProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted"; + value: Uint8Array; +} +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter?: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOptionAmino[]; +} +export interface MsgVoteWeightedAminoMsg { + type: "cosmos-sdk/MsgVoteWeighted"; + value: MsgVoteWeightedAmino; +} +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedSDKType { + proposal_id: bigint; + voter: string; + options: WeightedVoteOptionSDKType[]; +} +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponse {} +export interface MsgVoteWeightedResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse"; + value: Uint8Array; +} +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponseAmino {} +export interface MsgVoteWeightedResponseAminoMsg { + type: "cosmos-sdk/MsgVoteWeightedResponse"; + value: MsgVoteWeightedResponseAmino; +} +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponseSDKType {} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface MsgDepositProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit"; + value: Uint8Array; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor?: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface MsgDepositAminoMsg { + type: "cosmos-sdk/MsgDeposit"; + value: MsgDepositAmino; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositSDKType { + proposal_id: bigint; + depositor: string; + amount: CoinSDKType[]; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse {} +export interface MsgDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse"; + value: Uint8Array; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseAmino {} +export interface MsgDepositResponseAminoMsg { + type: "cosmos-sdk/MsgDepositResponse"; + value: MsgDepositResponseAmino; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseSDKType {} +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { + content: undefined, + initialDeposit: [], + proposer: "" + }; +} +export const MsgSubmitProposal = { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + aminoType: "cosmos-sdk/MsgSubmitProposal", + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.content !== undefined) { + Any.encode((message.content as Any), writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = (Cosmos_govv1beta1Content_InterfaceDecoder(reader) as Any); + break; + case 2: + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = object.content !== undefined && object.content !== null ? Any.fromPartial(object.content) : undefined; + message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + if (object.content !== undefined && object.content !== null) { + message.content = Cosmos_govv1beta1Content_FromAmino(object.content); + } + message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + obj.content = message.content ? Cosmos_govv1beta1Content_ToAmino((message.content as Any)) : undefined; + if (message.initialDeposit) { + obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.initial_deposit = message.initialDeposit; + } + obj.proposer = message.proposer === "" ? undefined : message.proposer; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; + } +}; +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { + proposalId: BigInt(0) + }; +} +export const MsgSubmitProposalResponse = { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", + aminoType: "cosmos-sdk/MsgSubmitProposalResponse", + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; + } +}; +function createBaseMsgVote(): MsgVote { + return { + proposalId: BigInt(0), + voter: "", + option: 0 + }; +} +export const MsgVote = { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + aminoType: "cosmos-sdk/MsgVote", + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.encode(message).finish() + }; + } +}; +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} +export const MsgVoteResponse = { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", + aminoType: "cosmos-sdk/MsgVoteResponse", + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; + } +}; +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { + proposalId: BigInt(0), + voter: "", + options: [] + }; +} +export const MsgVoteWeighted = { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + aminoType: "cosmos-sdk/MsgVoteWeighted", + encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = message.options; + } + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { + return MsgVoteWeighted.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeighted): MsgVoteWeightedAminoMsg { + return { + type: "cosmos-sdk/MsgVoteWeighted", + value: MsgVoteWeighted.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedProtoMsg): MsgVoteWeighted { + return MsgVoteWeighted.decode(message.value); + }, + toProto(message: MsgVoteWeighted): Uint8Array { + return MsgVoteWeighted.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeighted): MsgVoteWeightedProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(message).finish() + }; + } +}; +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} +export const MsgVoteWeightedResponse = { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", + aminoType: "cosmos-sdk/MsgVoteWeightedResponse", + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + fromAmino(_: MsgVoteWeightedResponseAmino): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + toAmino(_: MsgVoteWeightedResponse): MsgVoteWeightedResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedResponseAminoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedResponseProtoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.decode(message.value); + }, + toProto(message: MsgVoteWeightedResponse): Uint8Array { + return MsgVoteWeightedResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.encode(message).finish() + }; + } +}; +function createBaseMsgDeposit(): MsgDeposit { + return { + proposalId: BigInt(0), + depositor: "", + amount: [] + }; +} +export const MsgDeposit = { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + aminoType: "cosmos-sdk/MsgDeposit", + encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgDepositAmino): MsgDeposit { + const message = createBaseMsgDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgDeposit): MsgDepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgDepositAminoMsg): MsgDeposit { + return MsgDeposit.fromAmino(object.value); + }, + toAminoMsg(message: MsgDeposit): MsgDepositAminoMsg { + return { + type: "cosmos-sdk/MsgDeposit", + value: MsgDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositProtoMsg): MsgDeposit { + return MsgDeposit.decode(message.value); + }, + toProto(message: MsgDeposit): Uint8Array { + return MsgDeposit.encode(message).finish(); + }, + toProtoMsg(message: MsgDeposit): MsgDepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.encode(message).finish() + }; + } +}; +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} +export const MsgDepositResponse = { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", + aminoType: "cosmos-sdk/MsgDepositResponse", + encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + fromAmino(_: MsgDepositResponseAmino): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + toAmino(_: MsgDepositResponse): MsgDepositResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositResponseAminoMsg): MsgDepositResponse { + return MsgDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositResponse): MsgDepositResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDepositResponse", + value: MsgDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositResponseProtoMsg): MsgDepositResponse { + return MsgDepositResponse.decode(message.value); + }, + toProto(message: MsgDepositResponse): Uint8Array { + return MsgDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositResponse): MsgDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", + value: MsgDepositResponse.encode(message).finish() + }; + } +}; +export const Cosmos_govv1beta1Content_InterfaceDecoder = (input: BinaryReader | Uint8Array): CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | StoreCodeProposal | InstantiateContractProposal | InstantiateContract2Proposal | MigrateContractProposal | SudoContractProposal | ExecuteContractProposal | UpdateAdminProposal | ClearAdminProposal | PinCodesProposal | UnpinCodesProposal | UpdateInstantiateConfigProposal | StoreAndInstantiateContractProposal | ClientUpdateProposal | UpgradeProposal | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return CommunityPoolSpendProposal.decode(data.value); + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return CommunityPoolSpendProposalWithDeposit.decode(data.value); + case "/cosmos.gov.v1beta1.TextProposal": + return TextProposal.decode(data.value); + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return ParameterChangeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return SoftwareUpgradeProposal.decode(data.value); + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return CancelSoftwareUpgradeProposal.decode(data.value); + case "/cosmwasm.wasm.v1.StoreCodeProposal": + return StoreCodeProposal.decode(data.value); + case "/cosmwasm.wasm.v1.InstantiateContractProposal": + return InstantiateContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.InstantiateContract2Proposal": + return InstantiateContract2Proposal.decode(data.value); + case "/cosmwasm.wasm.v1.MigrateContractProposal": + return MigrateContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.SudoContractProposal": + return SudoContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.ExecuteContractProposal": + return ExecuteContractProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UpdateAdminProposal": + return UpdateAdminProposal.decode(data.value); + case "/cosmwasm.wasm.v1.ClearAdminProposal": + return ClearAdminProposal.decode(data.value); + case "/cosmwasm.wasm.v1.PinCodesProposal": + return PinCodesProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UnpinCodesProposal": + return UnpinCodesProposal.decode(data.value); + case "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal": + return UpdateInstantiateConfigProposal.decode(data.value); + case "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal": + return StoreAndInstantiateContractProposal.decode(data.value); + case "/ibc.core.client.v1.ClientUpdateProposal": + return ClientUpdateProposal.decode(data.value); + case "/ibc.core.client.v1.UpgradeProposal": + return UpgradeProposal.decode(data.value); + default: + return data; + } +}; +export const Cosmos_govv1beta1Content_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/CommunityPoolSpendProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(CommunityPoolSpendProposal.fromPartial(CommunityPoolSpendProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CommunityPoolSpendProposalWithDeposit": + return Any.fromPartial({ + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(CommunityPoolSpendProposalWithDeposit.fromPartial(CommunityPoolSpendProposalWithDeposit.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/TextProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(TextProposal.fromPartial(TextProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/ParameterChangeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + value: ParameterChangeProposal.encode(ParameterChangeProposal.fromPartial(ParameterChangeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/SoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(SoftwareUpgradeProposal.fromPartial(SoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/CancelSoftwareUpgradeProposal": + return Any.fromPartial({ + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(CancelSoftwareUpgradeProposal.fromPartial(CancelSoftwareUpgradeProposal.fromAmino(content.value))).finish() + }); + case "wasm/StoreCodeProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", + value: StoreCodeProposal.encode(StoreCodeProposal.fromPartial(StoreCodeProposal.fromAmino(content.value))).finish() + }); + case "wasm/InstantiateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", + value: InstantiateContractProposal.encode(InstantiateContractProposal.fromPartial(InstantiateContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/InstantiateContract2Proposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal", + value: InstantiateContract2Proposal.encode(InstantiateContract2Proposal.fromPartial(InstantiateContract2Proposal.fromAmino(content.value))).finish() + }); + case "wasm/MigrateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", + value: MigrateContractProposal.encode(MigrateContractProposal.fromPartial(MigrateContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/SudoContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", + value: SudoContractProposal.encode(SudoContractProposal.fromPartial(SudoContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/ExecuteContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", + value: ExecuteContractProposal.encode(ExecuteContractProposal.fromPartial(ExecuteContractProposal.fromAmino(content.value))).finish() + }); + case "wasm/UpdateAdminProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", + value: UpdateAdminProposal.encode(UpdateAdminProposal.fromPartial(UpdateAdminProposal.fromAmino(content.value))).finish() + }); + case "wasm/ClearAdminProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", + value: ClearAdminProposal.encode(ClearAdminProposal.fromPartial(ClearAdminProposal.fromAmino(content.value))).finish() + }); + case "wasm/PinCodesProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", + value: PinCodesProposal.encode(PinCodesProposal.fromPartial(PinCodesProposal.fromAmino(content.value))).finish() + }); + case "wasm/UnpinCodesProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", + value: UnpinCodesProposal.encode(UnpinCodesProposal.fromPartial(UnpinCodesProposal.fromAmino(content.value))).finish() + }); + case "wasm/UpdateInstantiateConfigProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", + value: UpdateInstantiateConfigProposal.encode(UpdateInstantiateConfigProposal.fromPartial(UpdateInstantiateConfigProposal.fromAmino(content.value))).finish() + }); + case "wasm/StoreAndInstantiateContractProposal": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", + value: StoreAndInstantiateContractProposal.encode(StoreAndInstantiateContractProposal.fromPartial(StoreAndInstantiateContractProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/ClientUpdateProposal": + return Any.fromPartial({ + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + value: ClientUpdateProposal.encode(ClientUpdateProposal.fromPartial(ClientUpdateProposal.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/UpgradeProposal": + return Any.fromPartial({ + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + value: UpgradeProposal.encode(UpgradeProposal.fromPartial(UpgradeProposal.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_govv1beta1Content_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal": + return { + type: "cosmos-sdk/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(CommunityPoolSpendProposal.decode(content.value, undefined)) + }; + case "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit": + return { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(CommunityPoolSpendProposalWithDeposit.decode(content.value, undefined)) + }; + case "/cosmos.gov.v1beta1.TextProposal": + return { + type: "cosmos-sdk/TextProposal", + value: TextProposal.toAmino(TextProposal.decode(content.value, undefined)) + }; + case "/cosmos.params.v1beta1.ParameterChangeProposal": + return { + type: "cosmos-sdk/ParameterChangeProposal", + value: ParameterChangeProposal.toAmino(ParameterChangeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(SoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(CancelSoftwareUpgradeProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.StoreCodeProposal": + return { + type: "wasm/StoreCodeProposal", + value: StoreCodeProposal.toAmino(StoreCodeProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.InstantiateContractProposal": + return { + type: "wasm/InstantiateContractProposal", + value: InstantiateContractProposal.toAmino(InstantiateContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.InstantiateContract2Proposal": + return { + type: "wasm/InstantiateContract2Proposal", + value: InstantiateContract2Proposal.toAmino(InstantiateContract2Proposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.MigrateContractProposal": + return { + type: "wasm/MigrateContractProposal", + value: MigrateContractProposal.toAmino(MigrateContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.SudoContractProposal": + return { + type: "wasm/SudoContractProposal", + value: SudoContractProposal.toAmino(SudoContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.ExecuteContractProposal": + return { + type: "wasm/ExecuteContractProposal", + value: ExecuteContractProposal.toAmino(ExecuteContractProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UpdateAdminProposal": + return { + type: "wasm/UpdateAdminProposal", + value: UpdateAdminProposal.toAmino(UpdateAdminProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.ClearAdminProposal": + return { + type: "wasm/ClearAdminProposal", + value: ClearAdminProposal.toAmino(ClearAdminProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.PinCodesProposal": + return { + type: "wasm/PinCodesProposal", + value: PinCodesProposal.toAmino(PinCodesProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UnpinCodesProposal": + return { + type: "wasm/UnpinCodesProposal", + value: UnpinCodesProposal.toAmino(UnpinCodesProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal": + return { + type: "wasm/UpdateInstantiateConfigProposal", + value: UpdateInstantiateConfigProposal.toAmino(UpdateInstantiateConfigProposal.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal": + return { + type: "wasm/StoreAndInstantiateContractProposal", + value: StoreAndInstantiateContractProposal.toAmino(StoreAndInstantiateContractProposal.decode(content.value, undefined)) + }; + case "/ibc.core.client.v1.ClientUpdateProposal": + return { + type: "cosmos-sdk/ClientUpdateProposal", + value: ClientUpdateProposal.toAmino(ClientUpdateProposal.decode(content.value, undefined)) + }; + case "/ibc.core.client.v1.UpgradeProposal": + return { + type: "cosmos-sdk/UpgradeProposal", + value: UpgradeProposal.toAmino(UpgradeProposal.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/module/v1/module.ts b/util/inj-types/cosmos/group/module/v1/module.ts new file mode 100644 index 00000000..62d88685 --- /dev/null +++ b/util/inj-types/cosmos/group/module/v1/module.ts @@ -0,0 +1,124 @@ +import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the group module. */ +export interface Module { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + maxExecutionPeriod: Duration; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + maxMetadataLen: bigint; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.group.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the group module. */ +export interface ModuleAmino { + /** + * max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec + * to execute the proposal. + */ + max_execution_period: DurationAmino; + /** + * max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. + * Defaults to 255 if not explicitly set. + */ + max_metadata_len?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the group module. */ +export interface ModuleSDKType { + max_execution_period: DurationSDKType; + max_metadata_len: bigint; +} +function createBaseModule(): Module { + return { + maxExecutionPeriod: Duration.fromPartial({}), + maxMetadataLen: BigInt(0) + }; +} +export const Module = { + typeUrl: "/cosmos.group.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxExecutionPeriod !== undefined) { + Duration.encode(message.maxExecutionPeriod, writer.uint32(10).fork()).ldelim(); + } + if (message.maxMetadataLen !== BigInt(0)) { + writer.uint32(16).uint64(message.maxMetadataLen); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxExecutionPeriod = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.maxMetadataLen = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.maxExecutionPeriod = object.maxExecutionPeriod !== undefined && object.maxExecutionPeriod !== null ? Duration.fromPartial(object.maxExecutionPeriod) : undefined; + message.maxMetadataLen = object.maxMetadataLen !== undefined && object.maxMetadataLen !== null ? BigInt(object.maxMetadataLen.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.max_execution_period !== undefined && object.max_execution_period !== null) { + message.maxExecutionPeriod = Duration.fromAmino(object.max_execution_period); + } + if (object.max_metadata_len !== undefined && object.max_metadata_len !== null) { + message.maxMetadataLen = BigInt(object.max_metadata_len); + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.max_execution_period = message.maxExecutionPeriod ? Duration.toAmino(message.maxExecutionPeriod) : Duration.toAmino(Duration.fromPartial({})); + obj.max_metadata_len = message.maxMetadataLen !== BigInt(0) ? message.maxMetadataLen.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.group.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/events.ts b/util/inj-types/cosmos/group/v1/events.ts new file mode 100644 index 00000000..1f484a84 --- /dev/null +++ b/util/inj-types/cosmos/group/v1/events.ts @@ -0,0 +1,1008 @@ +import { ProposalExecutorResult, ProposalStatus, TallyResult, TallyResultAmino, TallyResultSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroup { + /** group_id is the unique ID of the group. */ + groupId: bigint; +} +export interface EventCreateGroupProtoMsg { + typeUrl: "/cosmos.group.v1.EventCreateGroup"; + value: Uint8Array; +} +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroupAmino { + /** group_id is the unique ID of the group. */ + group_id?: string; +} +export interface EventCreateGroupAminoMsg { + type: "cosmos-sdk/EventCreateGroup"; + value: EventCreateGroupAmino; +} +/** EventCreateGroup is an event emitted when a group is created. */ +export interface EventCreateGroupSDKType { + group_id: bigint; +} +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroup { + /** group_id is the unique ID of the group. */ + groupId: bigint; +} +export interface EventUpdateGroupProtoMsg { + typeUrl: "/cosmos.group.v1.EventUpdateGroup"; + value: Uint8Array; +} +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroupAmino { + /** group_id is the unique ID of the group. */ + group_id?: string; +} +export interface EventUpdateGroupAminoMsg { + type: "cosmos-sdk/EventUpdateGroup"; + value: EventUpdateGroupAmino; +} +/** EventUpdateGroup is an event emitted when a group is updated. */ +export interface EventUpdateGroupSDKType { + group_id: bigint; +} +/** EventCreateGroupPolicy is an event emitted when a group policy is created. */ +export interface EventCreateGroupPolicy { + /** address is the account address of the group policy. */ + address: string; +} +export interface EventCreateGroupPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy"; + value: Uint8Array; +} +/** EventCreateGroupPolicy is an event emitted when a group policy is created. */ +export interface EventCreateGroupPolicyAmino { + /** address is the account address of the group policy. */ + address?: string; +} +export interface EventCreateGroupPolicyAminoMsg { + type: "cosmos-sdk/EventCreateGroupPolicy"; + value: EventCreateGroupPolicyAmino; +} +/** EventCreateGroupPolicy is an event emitted when a group policy is created. */ +export interface EventCreateGroupPolicySDKType { + address: string; +} +/** EventUpdateGroupPolicy is an event emitted when a group policy is updated. */ +export interface EventUpdateGroupPolicy { + /** address is the account address of the group policy. */ + address: string; +} +export interface EventUpdateGroupPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy"; + value: Uint8Array; +} +/** EventUpdateGroupPolicy is an event emitted when a group policy is updated. */ +export interface EventUpdateGroupPolicyAmino { + /** address is the account address of the group policy. */ + address?: string; +} +export interface EventUpdateGroupPolicyAminoMsg { + type: "cosmos-sdk/EventUpdateGroupPolicy"; + value: EventUpdateGroupPolicyAmino; +} +/** EventUpdateGroupPolicy is an event emitted when a group policy is updated. */ +export interface EventUpdateGroupPolicySDKType { + address: string; +} +/** EventSubmitProposal is an event emitted when a proposal is created. */ +export interface EventSubmitProposal { + /** proposal_id is the unique ID of the proposal. */ + proposalId: bigint; +} +export interface EventSubmitProposalProtoMsg { + typeUrl: "/cosmos.group.v1.EventSubmitProposal"; + value: Uint8Array; +} +/** EventSubmitProposal is an event emitted when a proposal is created. */ +export interface EventSubmitProposalAmino { + /** proposal_id is the unique ID of the proposal. */ + proposal_id?: string; +} +export interface EventSubmitProposalAminoMsg { + type: "cosmos-sdk/EventSubmitProposal"; + value: EventSubmitProposalAmino; +} +/** EventSubmitProposal is an event emitted when a proposal is created. */ +export interface EventSubmitProposalSDKType { + proposal_id: bigint; +} +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposal { + /** proposal_id is the unique ID of the proposal. */ + proposalId: bigint; +} +export interface EventWithdrawProposalProtoMsg { + typeUrl: "/cosmos.group.v1.EventWithdrawProposal"; + value: Uint8Array; +} +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposalAmino { + /** proposal_id is the unique ID of the proposal. */ + proposal_id?: string; +} +export interface EventWithdrawProposalAminoMsg { + type: "cosmos-sdk/EventWithdrawProposal"; + value: EventWithdrawProposalAmino; +} +/** EventWithdrawProposal is an event emitted when a proposal is withdrawn. */ +export interface EventWithdrawProposalSDKType { + proposal_id: bigint; +} +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVote { + /** proposal_id is the unique ID of the proposal. */ + proposalId: bigint; +} +export interface EventVoteProtoMsg { + typeUrl: "/cosmos.group.v1.EventVote"; + value: Uint8Array; +} +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVoteAmino { + /** proposal_id is the unique ID of the proposal. */ + proposal_id?: string; +} +export interface EventVoteAminoMsg { + type: "cosmos-sdk/EventVote"; + value: EventVoteAmino; +} +/** EventVote is an event emitted when a voter votes on a proposal. */ +export interface EventVoteSDKType { + proposal_id: bigint; +} +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExec { + /** proposal_id is the unique ID of the proposal. */ + proposalId: bigint; + /** result is the proposal execution result. */ + result: ProposalExecutorResult; + /** logs contains error logs in case the execution result is FAILURE. */ + logs: string; +} +export interface EventExecProtoMsg { + typeUrl: "/cosmos.group.v1.EventExec"; + value: Uint8Array; +} +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExecAmino { + /** proposal_id is the unique ID of the proposal. */ + proposal_id?: string; + /** result is the proposal execution result. */ + result?: ProposalExecutorResult; + /** logs contains error logs in case the execution result is FAILURE. */ + logs?: string; +} +export interface EventExecAminoMsg { + type: "cosmos-sdk/EventExec"; + value: EventExecAmino; +} +/** EventExec is an event emitted when a proposal is executed. */ +export interface EventExecSDKType { + proposal_id: bigint; + result: ProposalExecutorResult; + logs: string; +} +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroup { + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** address is the account address of the group member. */ + address: string; +} +export interface EventLeaveGroupProtoMsg { + typeUrl: "/cosmos.group.v1.EventLeaveGroup"; + value: Uint8Array; +} +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroupAmino { + /** group_id is the unique ID of the group. */ + group_id?: string; + /** address is the account address of the group member. */ + address?: string; +} +export interface EventLeaveGroupAminoMsg { + type: "cosmos-sdk/EventLeaveGroup"; + value: EventLeaveGroupAmino; +} +/** EventLeaveGroup is an event emitted when group member leaves the group. */ +export interface EventLeaveGroupSDKType { + group_id: bigint; + address: string; +} +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPruned { + /** proposal_id is the unique ID of the proposal. */ + proposalId: bigint; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tallyResult?: TallyResult; +} +export interface EventProposalPrunedProtoMsg { + typeUrl: "/cosmos.group.v1.EventProposalPruned"; + value: Uint8Array; +} +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPrunedAmino { + /** proposal_id is the unique ID of the proposal. */ + proposal_id?: string; + /** status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). */ + status?: ProposalStatus; + /** tally_result is the proposal tally result (when applicable). */ + tally_result?: TallyResultAmino; +} +export interface EventProposalPrunedAminoMsg { + type: "cosmos-sdk/EventProposalPruned"; + value: EventProposalPrunedAmino; +} +/** EventProposalPruned is an event emitted when a proposal is pruned. */ +export interface EventProposalPrunedSDKType { + proposal_id: bigint; + status: ProposalStatus; + tally_result?: TallyResultSDKType; +} +function createBaseEventCreateGroup(): EventCreateGroup { + return { + groupId: BigInt(0) + }; +} +export const EventCreateGroup = { + typeUrl: "/cosmos.group.v1.EventCreateGroup", + aminoType: "cosmos-sdk/EventCreateGroup", + encode(message: EventCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventCreateGroup { + const message = createBaseEventCreateGroup(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EventCreateGroupAmino): EventCreateGroup { + const message = createBaseEventCreateGroup(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: EventCreateGroup): EventCreateGroupAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { + return EventCreateGroup.fromAmino(object.value); + }, + toAminoMsg(message: EventCreateGroup): EventCreateGroupAminoMsg { + return { + type: "cosmos-sdk/EventCreateGroup", + value: EventCreateGroup.toAmino(message) + }; + }, + fromProtoMsg(message: EventCreateGroupProtoMsg): EventCreateGroup { + return EventCreateGroup.decode(message.value); + }, + toProto(message: EventCreateGroup): Uint8Array { + return EventCreateGroup.encode(message).finish(); + }, + toProtoMsg(message: EventCreateGroup): EventCreateGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventCreateGroup", + value: EventCreateGroup.encode(message).finish() + }; + } +}; +function createBaseEventUpdateGroup(): EventUpdateGroup { + return { + groupId: BigInt(0) + }; +} +export const EventUpdateGroup = { + typeUrl: "/cosmos.group.v1.EventUpdateGroup", + aminoType: "cosmos-sdk/EventUpdateGroup", + encode(message: EventUpdateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EventUpdateGroupAmino): EventUpdateGroup { + const message = createBaseEventUpdateGroup(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { + return EventUpdateGroup.fromAmino(object.value); + }, + toAminoMsg(message: EventUpdateGroup): EventUpdateGroupAminoMsg { + return { + type: "cosmos-sdk/EventUpdateGroup", + value: EventUpdateGroup.toAmino(message) + }; + }, + fromProtoMsg(message: EventUpdateGroupProtoMsg): EventUpdateGroup { + return EventUpdateGroup.decode(message.value); + }, + toProto(message: EventUpdateGroup): Uint8Array { + return EventUpdateGroup.encode(message).finish(); + }, + toProtoMsg(message: EventUpdateGroup): EventUpdateGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventUpdateGroup", + value: EventUpdateGroup.encode(message).finish() + }; + } +}; +function createBaseEventCreateGroupPolicy(): EventCreateGroupPolicy { + return { + address: "" + }; +} +export const EventCreateGroupPolicy = { + typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", + aminoType: "cosmos-sdk/EventCreateGroupPolicy", + encode(message: EventCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCreateGroupPolicy(); + 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: DeepPartial): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: EventCreateGroupPolicyAmino): EventCreateGroupPolicy { + const message = createBaseEventCreateGroupPolicy(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { + return EventCreateGroupPolicy.fromAmino(object.value); + }, + toAminoMsg(message: EventCreateGroupPolicy): EventCreateGroupPolicyAminoMsg { + return { + type: "cosmos-sdk/EventCreateGroupPolicy", + value: EventCreateGroupPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: EventCreateGroupPolicyProtoMsg): EventCreateGroupPolicy { + return EventCreateGroupPolicy.decode(message.value); + }, + toProto(message: EventCreateGroupPolicy): Uint8Array { + return EventCreateGroupPolicy.encode(message).finish(); + }, + toProtoMsg(message: EventCreateGroupPolicy): EventCreateGroupPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventCreateGroupPolicy", + value: EventCreateGroupPolicy.encode(message).finish() + }; + } +}; +function createBaseEventUpdateGroupPolicy(): EventUpdateGroupPolicy { + return { + address: "" + }; +} +export const EventUpdateGroupPolicy = { + typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", + aminoType: "cosmos-sdk/EventUpdateGroupPolicy", + encode(message: EventUpdateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventUpdateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUpdateGroupPolicy(); + 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: DeepPartial): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: EventUpdateGroupPolicyAmino): EventUpdateGroupPolicy { + const message = createBaseEventUpdateGroupPolicy(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.fromAmino(object.value); + }, + toAminoMsg(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAminoMsg { + return { + type: "cosmos-sdk/EventUpdateGroupPolicy", + value: EventUpdateGroupPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: EventUpdateGroupPolicyProtoMsg): EventUpdateGroupPolicy { + return EventUpdateGroupPolicy.decode(message.value); + }, + toProto(message: EventUpdateGroupPolicy): Uint8Array { + return EventUpdateGroupPolicy.encode(message).finish(); + }, + toProtoMsg(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventUpdateGroupPolicy", + value: EventUpdateGroupPolicy.encode(message).finish() + }; + } +}; +function createBaseEventSubmitProposal(): EventSubmitProposal { + return { + proposalId: BigInt(0) + }; +} +export const EventSubmitProposal = { + typeUrl: "/cosmos.group.v1.EventSubmitProposal", + aminoType: "cosmos-sdk/EventSubmitProposal", + encode(message: EventSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EventSubmitProposalAmino): EventSubmitProposal { + const message = createBaseEventSubmitProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { + return EventSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: EventSubmitProposal): EventSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/EventSubmitProposal", + value: EventSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: EventSubmitProposalProtoMsg): EventSubmitProposal { + return EventSubmitProposal.decode(message.value); + }, + toProto(message: EventSubmitProposal): Uint8Array { + return EventSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: EventSubmitProposal): EventSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventSubmitProposal", + value: EventSubmitProposal.encode(message).finish() + }; + } +}; +function createBaseEventWithdrawProposal(): EventWithdrawProposal { + return { + proposalId: BigInt(0) + }; +} +export const EventWithdrawProposal = { + typeUrl: "/cosmos.group.v1.EventWithdrawProposal", + aminoType: "cosmos-sdk/EventWithdrawProposal", + encode(message: EventWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EventWithdrawProposalAmino): EventWithdrawProposal { + const message = createBaseEventWithdrawProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { + return EventWithdrawProposal.fromAmino(object.value); + }, + toAminoMsg(message: EventWithdrawProposal): EventWithdrawProposalAminoMsg { + return { + type: "cosmos-sdk/EventWithdrawProposal", + value: EventWithdrawProposal.toAmino(message) + }; + }, + fromProtoMsg(message: EventWithdrawProposalProtoMsg): EventWithdrawProposal { + return EventWithdrawProposal.decode(message.value); + }, + toProto(message: EventWithdrawProposal): Uint8Array { + return EventWithdrawProposal.encode(message).finish(); + }, + toProtoMsg(message: EventWithdrawProposal): EventWithdrawProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventWithdrawProposal", + value: EventWithdrawProposal.encode(message).finish() + }; + } +}; +function createBaseEventVote(): EventVote { + return { + proposalId: BigInt(0) + }; +} +export const EventVote = { + typeUrl: "/cosmos.group.v1.EventVote", + aminoType: "cosmos-sdk/EventVote", + encode(message: EventVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventVote { + const message = createBaseEventVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EventVoteAmino): EventVote { + const message = createBaseEventVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: EventVote): EventVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EventVoteAminoMsg): EventVote { + return EventVote.fromAmino(object.value); + }, + toAminoMsg(message: EventVote): EventVoteAminoMsg { + return { + type: "cosmos-sdk/EventVote", + value: EventVote.toAmino(message) + }; + }, + fromProtoMsg(message: EventVoteProtoMsg): EventVote { + return EventVote.decode(message.value); + }, + toProto(message: EventVote): Uint8Array { + return EventVote.encode(message).finish(); + }, + toProtoMsg(message: EventVote): EventVoteProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventVote", + value: EventVote.encode(message).finish() + }; + } +}; +function createBaseEventExec(): EventExec { + return { + proposalId: BigInt(0), + result: 0, + logs: "" + }; +} +export const EventExec = { + typeUrl: "/cosmos.group.v1.EventExec", + aminoType: "cosmos-sdk/EventExec", + encode(message: EventExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + if (message.logs !== "") { + writer.uint32(26).string(message.logs); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.result = (reader.int32() as any); + break; + case 3: + message.logs = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventExec { + const message = createBaseEventExec(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.result = object.result ?? 0; + message.logs = object.logs ?? ""; + return message; + }, + fromAmino(object: EventExecAmino): EventExec { + const message = createBaseEventExec(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + if (object.logs !== undefined && object.logs !== null) { + message.logs = object.logs; + } + return message; + }, + toAmino(message: EventExec): EventExecAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.result = message.result === 0 ? undefined : message.result; + obj.logs = message.logs === "" ? undefined : message.logs; + return obj; + }, + fromAminoMsg(object: EventExecAminoMsg): EventExec { + return EventExec.fromAmino(object.value); + }, + toAminoMsg(message: EventExec): EventExecAminoMsg { + return { + type: "cosmos-sdk/EventExec", + value: EventExec.toAmino(message) + }; + }, + fromProtoMsg(message: EventExecProtoMsg): EventExec { + return EventExec.decode(message.value); + }, + toProto(message: EventExec): Uint8Array { + return EventExec.encode(message).finish(); + }, + toProtoMsg(message: EventExec): EventExecProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventExec", + value: EventExec.encode(message).finish() + }; + } +}; +function createBaseEventLeaveGroup(): EventLeaveGroup { + return { + groupId: BigInt(0), + address: "" + }; +} +export const EventLeaveGroup = { + typeUrl: "/cosmos.group.v1.EventLeaveGroup", + aminoType: "cosmos-sdk/EventLeaveGroup", + encode(message: EventLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: EventLeaveGroupAmino): EventLeaveGroup { + const message = createBaseEventLeaveGroup(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { + return EventLeaveGroup.fromAmino(object.value); + }, + toAminoMsg(message: EventLeaveGroup): EventLeaveGroupAminoMsg { + return { + type: "cosmos-sdk/EventLeaveGroup", + value: EventLeaveGroup.toAmino(message) + }; + }, + fromProtoMsg(message: EventLeaveGroupProtoMsg): EventLeaveGroup { + return EventLeaveGroup.decode(message.value); + }, + toProto(message: EventLeaveGroup): Uint8Array { + return EventLeaveGroup.encode(message).finish(); + }, + toProtoMsg(message: EventLeaveGroup): EventLeaveGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventLeaveGroup", + value: EventLeaveGroup.encode(message).finish() + }; + } +}; +function createBaseEventProposalPruned(): EventProposalPruned { + return { + proposalId: BigInt(0), + status: 0, + tallyResult: undefined + }; +} +export const EventProposalPruned = { + typeUrl: "/cosmos.group.v1.EventProposalPruned", + aminoType: "cosmos-sdk/EventProposalPruned", + encode(message: EventProposalPruned, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.status !== 0) { + writer.uint32(16).int32(message.status); + } + if (message.tallyResult !== undefined) { + TallyResult.encode(message.tallyResult, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventProposalPruned { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventProposalPruned(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.status = (reader.int32() as any); + break; + case 3: + message.tallyResult = TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventProposalPruned { + const message = createBaseEventProposalPruned(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.status = object.status ?? 0; + message.tallyResult = object.tallyResult !== undefined && object.tallyResult !== null ? TallyResult.fromPartial(object.tallyResult) : undefined; + return message; + }, + fromAmino(object: EventProposalPrunedAmino): EventProposalPruned { + const message = createBaseEventProposalPruned(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.tally_result !== undefined && object.tally_result !== null) { + message.tallyResult = TallyResult.fromAmino(object.tally_result); + } + return message; + }, + toAmino(message: EventProposalPruned): EventProposalPrunedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.tally_result = message.tallyResult ? TallyResult.toAmino(message.tallyResult) : undefined; + return obj; + }, + fromAminoMsg(object: EventProposalPrunedAminoMsg): EventProposalPruned { + return EventProposalPruned.fromAmino(object.value); + }, + toAminoMsg(message: EventProposalPruned): EventProposalPrunedAminoMsg { + return { + type: "cosmos-sdk/EventProposalPruned", + value: EventProposalPruned.toAmino(message) + }; + }, + fromProtoMsg(message: EventProposalPrunedProtoMsg): EventProposalPruned { + return EventProposalPruned.decode(message.value); + }, + toProto(message: EventProposalPruned): Uint8Array { + return EventProposalPruned.encode(message).finish(); + }, + toProtoMsg(message: EventProposalPruned): EventProposalPrunedProtoMsg { + return { + typeUrl: "/cosmos.group.v1.EventProposalPruned", + value: EventProposalPruned.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/genesis.ts b/util/inj-types/cosmos/group/v1/genesis.ts new file mode 100644 index 00000000..5eefe95b --- /dev/null +++ b/util/inj-types/cosmos/group/v1/genesis.ts @@ -0,0 +1,242 @@ +import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** GenesisState defines the group module's genesis state. */ +export interface GenesisState { + /** + * group_seq is the group table orm.Sequence, + * it is used to get the next group ID. + */ + groupSeq: bigint; + /** groups is the list of groups info. */ + groups: GroupInfo[]; + /** group_members is the list of groups members. */ + groupMembers: GroupMember[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + groupPolicySeq: bigint; + /** group_policies is the list of group policies info. */ + groupPolicies: GroupPolicyInfo[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposalSeq: bigint; + /** proposals is the list of proposals. */ + proposals: Proposal[]; + /** votes is the list of votes. */ + votes: Vote[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.group.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the group module's genesis state. */ +export interface GenesisStateAmino { + /** + * group_seq is the group table orm.Sequence, + * it is used to get the next group ID. + */ + group_seq?: string; + /** groups is the list of groups info. */ + groups?: GroupInfoAmino[]; + /** group_members is the list of groups members. */ + group_members?: GroupMemberAmino[]; + /** + * group_policy_seq is the group policy table orm.Sequence, + * it is used to generate the next group policy account address. + */ + group_policy_seq?: string; + /** group_policies is the list of group policies info. */ + group_policies?: GroupPolicyInfoAmino[]; + /** + * proposal_seq is the proposal table orm.Sequence, + * it is used to get the next proposal ID. + */ + proposal_seq?: string; + /** proposals is the list of proposals. */ + proposals?: ProposalAmino[]; + /** votes is the list of votes. */ + votes?: VoteAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the group module's genesis state. */ +export interface GenesisStateSDKType { + group_seq: bigint; + groups: GroupInfoSDKType[]; + group_members: GroupMemberSDKType[]; + group_policy_seq: bigint; + group_policies: GroupPolicyInfoSDKType[]; + proposal_seq: bigint; + proposals: ProposalSDKType[]; + votes: VoteSDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + groupSeq: BigInt(0), + groups: [], + groupMembers: [], + groupPolicySeq: BigInt(0), + groupPolicies: [], + proposalSeq: BigInt(0), + proposals: [], + votes: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmos.group.v1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupSeq !== BigInt(0)) { + writer.uint32(8).uint64(message.groupSeq); + } + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.groupMembers) { + GroupMember.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.groupPolicySeq !== BigInt(0)) { + writer.uint32(32).uint64(message.groupPolicySeq); + } + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(42).fork()).ldelim(); + } + if (message.proposalSeq !== BigInt(0)) { + writer.uint32(48).uint64(message.proposalSeq); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.groupSeq = reader.uint64(); + break; + case 2: + message.groups.push(GroupInfo.decode(reader, reader.uint32())); + break; + case 3: + message.groupMembers.push(GroupMember.decode(reader, reader.uint32())); + break; + case 4: + message.groupPolicySeq = reader.uint64(); + break; + case 5: + message.groupPolicies.push(GroupPolicyInfo.decode(reader, reader.uint32())); + break; + case 6: + message.proposalSeq = reader.uint64(); + break; + case 7: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 8: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.groupSeq = object.groupSeq !== undefined && object.groupSeq !== null ? BigInt(object.groupSeq.toString()) : BigInt(0); + message.groups = object.groups?.map(e => GroupInfo.fromPartial(e)) || []; + message.groupMembers = object.groupMembers?.map(e => GroupMember.fromPartial(e)) || []; + message.groupPolicySeq = object.groupPolicySeq !== undefined && object.groupPolicySeq !== null ? BigInt(object.groupPolicySeq.toString()) : BigInt(0); + message.groupPolicies = object.groupPolicies?.map(e => GroupPolicyInfo.fromPartial(e)) || []; + message.proposalSeq = object.proposalSeq !== undefined && object.proposalSeq !== null ? BigInt(object.proposalSeq.toString()) : BigInt(0); + message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; + message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.group_seq !== undefined && object.group_seq !== null) { + message.groupSeq = BigInt(object.group_seq); + } + message.groups = object.groups?.map(e => GroupInfo.fromAmino(e)) || []; + message.groupMembers = object.group_members?.map(e => GroupMember.fromAmino(e)) || []; + if (object.group_policy_seq !== undefined && object.group_policy_seq !== null) { + message.groupPolicySeq = BigInt(object.group_policy_seq); + } + message.groupPolicies = object.group_policies?.map(e => GroupPolicyInfo.fromAmino(e)) || []; + if (object.proposal_seq !== undefined && object.proposal_seq !== null) { + message.proposalSeq = BigInt(object.proposal_seq); + } + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.group_seq = message.groupSeq !== BigInt(0) ? message.groupSeq.toString() : undefined; + if (message.groups) { + obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); + } else { + obj.groups = message.groups; + } + if (message.groupMembers) { + obj.group_members = message.groupMembers.map(e => e ? GroupMember.toAmino(e) : undefined); + } else { + obj.group_members = message.groupMembers; + } + obj.group_policy_seq = message.groupPolicySeq !== BigInt(0) ? message.groupPolicySeq.toString() : undefined; + if (message.groupPolicies) { + obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); + } else { + obj.group_policies = message.groupPolicies; + } + obj.proposal_seq = message.proposalSeq !== BigInt(0) ? message.proposalSeq.toString() : undefined; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = message.proposals; + } + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/query.lcd.ts b/util/inj-types/cosmos/group/v1/query.lcd.ts new file mode 100644 index 00000000..bed0e6ad --- /dev/null +++ b/util/inj-types/cosmos/group/v1/query.lcd.ts @@ -0,0 +1,145 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryGroupInfoRequest, QueryGroupInfoResponseSDKType, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponseSDKType, QueryGroupMembersRequest, QueryGroupMembersResponseSDKType, QueryGroupsByAdminRequest, QueryGroupsByAdminResponseSDKType, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponseSDKType, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponseSDKType, QueryProposalRequest, QueryProposalResponseSDKType, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponseSDKType, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponseSDKType, QueryVotesByProposalRequest, QueryVotesByProposalResponseSDKType, QueryVotesByVoterRequest, QueryVotesByVoterResponseSDKType, QueryGroupsByMemberRequest, QueryGroupsByMemberResponseSDKType, QueryTallyResultRequest, QueryTallyResultResponseSDKType, QueryGroupsRequest, QueryGroupsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* GroupInfo queries group info based on group id. */ + groupInfo = async (params: QueryGroupInfoRequest): Promise => { + const endpoint = `cosmos/group/v1/group_info/${params.groupId}`; + return await this.req.get(endpoint); + }; + /* GroupPolicyInfo queries group policy info based on account address of group policy. */ + groupPolicyInfo = async (params: QueryGroupPolicyInfoRequest): Promise => { + const endpoint = `cosmos/group/v1/group_policy_info/${params.address}`; + return await this.req.get(endpoint); + }; + /* GroupMembers queries members of a group by group id. */ + groupMembers = async (params: QueryGroupMembersRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/group_members/${params.groupId}`; + return await this.req.get(endpoint, options); + }; + /* GroupsByAdmin queries groups by admin address. */ + groupsByAdmin = async (params: QueryGroupsByAdminRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/groups_by_admin/${params.admin}`; + return await this.req.get(endpoint, options); + }; + /* GroupPoliciesByGroup queries group policies by group id. */ + groupPoliciesByGroup = async (params: QueryGroupPoliciesByGroupRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/group_policies_by_group/${params.groupId}`; + return await this.req.get(endpoint, options); + }; + /* GroupPoliciesByAdmin queries group policies by admin address. */ + groupPoliciesByAdmin = async (params: QueryGroupPoliciesByAdminRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/group_policies_by_admin/${params.admin}`; + return await this.req.get(endpoint, options); + }; + /* Proposal queries a proposal based on proposal id. */ + proposal = async (params: QueryProposalRequest): Promise => { + const endpoint = `cosmos/group/v1/proposal/${params.proposalId}`; + return await this.req.get(endpoint); + }; + /* ProposalsByGroupPolicy queries proposals based on account address of group policy. */ + proposalsByGroupPolicy = async (params: QueryProposalsByGroupPolicyRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/proposals_by_group_policy/${params.address}`; + return await this.req.get(endpoint, options); + }; + /* VoteByProposalVoter queries a vote by proposal id and voter. */ + voteByProposalVoter = async (params: QueryVoteByProposalVoterRequest): Promise => { + const endpoint = `cosmos/group/v1/vote_by_proposal_voter/${params.proposalId}/${params.voter}`; + return await this.req.get(endpoint); + }; + /* VotesByProposal queries a vote by proposal id. */ + votesByProposal = async (params: QueryVotesByProposalRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/votes_by_proposal/${params.proposalId}`; + return await this.req.get(endpoint, options); + }; + /* VotesByVoter queries a vote by voter. */ + votesByVoter = async (params: QueryVotesByVoterRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/votes_by_voter/${params.voter}`; + return await this.req.get(endpoint, options); + }; + /* GroupsByMember queries groups by member address. */ + groupsByMember = async (params: QueryGroupsByMemberRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/groups_by_member/${params.address}`; + return await this.req.get(endpoint, options); + }; + /* TallyResult returns the tally result of a proposal. If the proposal is + still in voting period, then this query computes the current tally state, + which might not be final. On the other hand, if the proposal is final, + then it simply returns the `final_tally_result` state stored in the + proposal itself. */ + tallyResult = async (params: QueryTallyResultRequest): Promise => { + const endpoint = `cosmos/group/v1/proposals/${params.proposalId}/tally`; + return await this.req.get(endpoint); + }; + /* Groups queries all groups in state. + + Since: cosmos-sdk 0.47.1 */ + groups = async (params: QueryGroupsRequest = { + pagination: undefined + }): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/group/v1/groups`; + return await this.req.get(endpoint, options); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/query.rpc.Query.ts b/util/inj-types/cosmos/group/v1/query.rpc.Query.ts new file mode 100644 index 00000000..2d7d9476 --- /dev/null +++ b/util/inj-types/cosmos/group/v1/query.rpc.Query.ts @@ -0,0 +1,191 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryGroupInfoRequest, QueryGroupInfoResponse, QueryGroupPolicyInfoRequest, QueryGroupPolicyInfoResponse, QueryGroupMembersRequest, QueryGroupMembersResponse, QueryGroupsByAdminRequest, QueryGroupsByAdminResponse, QueryGroupPoliciesByGroupRequest, QueryGroupPoliciesByGroupResponse, QueryGroupPoliciesByAdminRequest, QueryGroupPoliciesByAdminResponse, QueryProposalRequest, QueryProposalResponse, QueryProposalsByGroupPolicyRequest, QueryProposalsByGroupPolicyResponse, QueryVoteByProposalVoterRequest, QueryVoteByProposalVoterResponse, QueryVotesByProposalRequest, QueryVotesByProposalResponse, QueryVotesByVoterRequest, QueryVotesByVoterResponse, QueryGroupsByMemberRequest, QueryGroupsByMemberResponse, QueryTallyResultRequest, QueryTallyResultResponse, QueryGroupsRequest, QueryGroupsResponse } from "./query"; +/** Query is the cosmos.group.v1 Query service. */ +export interface Query { + /** GroupInfo queries group info based on group id. */ + groupInfo(request: QueryGroupInfoRequest): Promise; + /** GroupPolicyInfo queries group policy info based on account address of group policy. */ + groupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise; + /** GroupMembers queries members of a group by group id. */ + groupMembers(request: QueryGroupMembersRequest): Promise; + /** GroupsByAdmin queries groups by admin address. */ + groupsByAdmin(request: QueryGroupsByAdminRequest): Promise; + /** GroupPoliciesByGroup queries group policies by group id. */ + groupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise; + /** GroupPoliciesByAdmin queries group policies by admin address. */ + groupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise; + /** Proposal queries a proposal based on proposal id. */ + proposal(request: QueryProposalRequest): Promise; + /** ProposalsByGroupPolicy queries proposals based on account address of group policy. */ + proposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise; + /** VoteByProposalVoter queries a vote by proposal id and voter. */ + voteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise; + /** VotesByProposal queries a vote by proposal id. */ + votesByProposal(request: QueryVotesByProposalRequest): Promise; + /** VotesByVoter queries a vote by voter. */ + votesByVoter(request: QueryVotesByVoterRequest): Promise; + /** GroupsByMember queries groups by member address. */ + groupsByMember(request: QueryGroupsByMemberRequest): Promise; + /** + * TallyResult returns the tally result of a proposal. If the proposal is + * still in voting period, then this query computes the current tally state, + * which might not be final. On the other hand, if the proposal is final, + * then it simply returns the `final_tally_result` state stored in the + * proposal itself. + */ + tallyResult(request: QueryTallyResultRequest): Promise; + /** + * Groups queries all groups in state. + * + * Since: cosmos-sdk 0.47.1 + */ + groups(request?: QueryGroupsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* GroupInfo queries group info based on group id. */ + groupInfo = async (request: QueryGroupInfoRequest): Promise => { + const data = QueryGroupInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "GroupInfo", data); + return promise.then(data => QueryGroupInfoResponse.decode(new BinaryReader(data))); + }; + /* GroupPolicyInfo queries group policy info based on account address of group policy. */ + groupPolicyInfo = async (request: QueryGroupPolicyInfoRequest): Promise => { + const data = QueryGroupPolicyInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "GroupPolicyInfo", data); + return promise.then(data => QueryGroupPolicyInfoResponse.decode(new BinaryReader(data))); + }; + /* GroupMembers queries members of a group by group id. */ + groupMembers = async (request: QueryGroupMembersRequest): Promise => { + const data = QueryGroupMembersRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "GroupMembers", data); + return promise.then(data => QueryGroupMembersResponse.decode(new BinaryReader(data))); + }; + /* GroupsByAdmin queries groups by admin address. */ + groupsByAdmin = async (request: QueryGroupsByAdminRequest): Promise => { + const data = QueryGroupsByAdminRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "GroupsByAdmin", data); + return promise.then(data => QueryGroupsByAdminResponse.decode(new BinaryReader(data))); + }; + /* GroupPoliciesByGroup queries group policies by group id. */ + groupPoliciesByGroup = async (request: QueryGroupPoliciesByGroupRequest): Promise => { + const data = QueryGroupPoliciesByGroupRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "GroupPoliciesByGroup", data); + return promise.then(data => QueryGroupPoliciesByGroupResponse.decode(new BinaryReader(data))); + }; + /* GroupPoliciesByAdmin queries group policies by admin address. */ + groupPoliciesByAdmin = async (request: QueryGroupPoliciesByAdminRequest): Promise => { + const data = QueryGroupPoliciesByAdminRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "GroupPoliciesByAdmin", data); + return promise.then(data => QueryGroupPoliciesByAdminResponse.decode(new BinaryReader(data))); + }; + /* Proposal queries a proposal based on proposal id. */ + proposal = async (request: QueryProposalRequest): Promise => { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "Proposal", data); + return promise.then(data => QueryProposalResponse.decode(new BinaryReader(data))); + }; + /* ProposalsByGroupPolicy queries proposals based on account address of group policy. */ + proposalsByGroupPolicy = async (request: QueryProposalsByGroupPolicyRequest): Promise => { + const data = QueryProposalsByGroupPolicyRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "ProposalsByGroupPolicy", data); + return promise.then(data => QueryProposalsByGroupPolicyResponse.decode(new BinaryReader(data))); + }; + /* VoteByProposalVoter queries a vote by proposal id and voter. */ + voteByProposalVoter = async (request: QueryVoteByProposalVoterRequest): Promise => { + const data = QueryVoteByProposalVoterRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "VoteByProposalVoter", data); + return promise.then(data => QueryVoteByProposalVoterResponse.decode(new BinaryReader(data))); + }; + /* VotesByProposal queries a vote by proposal id. */ + votesByProposal = async (request: QueryVotesByProposalRequest): Promise => { + const data = QueryVotesByProposalRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "VotesByProposal", data); + return promise.then(data => QueryVotesByProposalResponse.decode(new BinaryReader(data))); + }; + /* VotesByVoter queries a vote by voter. */ + votesByVoter = async (request: QueryVotesByVoterRequest): Promise => { + const data = QueryVotesByVoterRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "VotesByVoter", data); + return promise.then(data => QueryVotesByVoterResponse.decode(new BinaryReader(data))); + }; + /* GroupsByMember queries groups by member address. */ + groupsByMember = async (request: QueryGroupsByMemberRequest): Promise => { + const data = QueryGroupsByMemberRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "GroupsByMember", data); + return promise.then(data => QueryGroupsByMemberResponse.decode(new BinaryReader(data))); + }; + /* TallyResult returns the tally result of a proposal. If the proposal is + still in voting period, then this query computes the current tally state, + which might not be final. On the other hand, if the proposal is final, + then it simply returns the `final_tally_result` state stored in the + proposal itself. */ + tallyResult = async (request: QueryTallyResultRequest): Promise => { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "TallyResult", data); + return promise.then(data => QueryTallyResultResponse.decode(new BinaryReader(data))); + }; + /* Groups queries all groups in state. + + Since: cosmos-sdk 0.47.1 */ + groups = async (request: QueryGroupsRequest = { + pagination: undefined + }): Promise => { + const data = QueryGroupsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Query", "Groups", data); + return promise.then(data => QueryGroupsResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + groupInfo(request: QueryGroupInfoRequest): Promise { + return queryService.groupInfo(request); + }, + groupPolicyInfo(request: QueryGroupPolicyInfoRequest): Promise { + return queryService.groupPolicyInfo(request); + }, + groupMembers(request: QueryGroupMembersRequest): Promise { + return queryService.groupMembers(request); + }, + groupsByAdmin(request: QueryGroupsByAdminRequest): Promise { + return queryService.groupsByAdmin(request); + }, + groupPoliciesByGroup(request: QueryGroupPoliciesByGroupRequest): Promise { + return queryService.groupPoliciesByGroup(request); + }, + groupPoliciesByAdmin(request: QueryGroupPoliciesByAdminRequest): Promise { + return queryService.groupPoliciesByAdmin(request); + }, + proposal(request: QueryProposalRequest): Promise { + return queryService.proposal(request); + }, + proposalsByGroupPolicy(request: QueryProposalsByGroupPolicyRequest): Promise { + return queryService.proposalsByGroupPolicy(request); + }, + voteByProposalVoter(request: QueryVoteByProposalVoterRequest): Promise { + return queryService.voteByProposalVoter(request); + }, + votesByProposal(request: QueryVotesByProposalRequest): Promise { + return queryService.votesByProposal(request); + }, + votesByVoter(request: QueryVotesByVoterRequest): Promise { + return queryService.votesByVoter(request); + }, + groupsByMember(request: QueryGroupsByMemberRequest): Promise { + return queryService.groupsByMember(request); + }, + tallyResult(request: QueryTallyResultRequest): Promise { + return queryService.tallyResult(request); + }, + groups(request?: QueryGroupsRequest): Promise { + return queryService.groups(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/query.ts b/util/inj-types/cosmos/group/v1/query.ts new file mode 100644 index 00000000..8255ba85 --- /dev/null +++ b/util/inj-types/cosmos/group/v1/query.ts @@ -0,0 +1,2928 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequest { + /** group_id is the unique ID of the group. */ + groupId: bigint; +} +export interface QueryGroupInfoRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest"; + value: Uint8Array; +} +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequestAmino { + /** group_id is the unique ID of the group. */ + group_id?: string; +} +export interface QueryGroupInfoRequestAminoMsg { + type: "cosmos-sdk/QueryGroupInfoRequest"; + value: QueryGroupInfoRequestAmino; +} +/** QueryGroupInfoRequest is the Query/GroupInfo request type. */ +export interface QueryGroupInfoRequestSDKType { + group_id: bigint; +} +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponse { + /** info is the GroupInfo of the group. */ + info?: GroupInfo; +} +export interface QueryGroupInfoResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse"; + value: Uint8Array; +} +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponseAmino { + /** info is the GroupInfo of the group. */ + info?: GroupInfoAmino; +} +export interface QueryGroupInfoResponseAminoMsg { + type: "cosmos-sdk/QueryGroupInfoResponse"; + value: QueryGroupInfoResponseAmino; +} +/** QueryGroupInfoResponse is the Query/GroupInfo response type. */ +export interface QueryGroupInfoResponseSDKType { + info?: GroupInfoSDKType; +} +/** QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. */ +export interface QueryGroupPolicyInfoRequest { + /** address is the account address of the group policy. */ + address: string; +} +export interface QueryGroupPolicyInfoRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest"; + value: Uint8Array; +} +/** QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. */ +export interface QueryGroupPolicyInfoRequestAmino { + /** address is the account address of the group policy. */ + address?: string; +} +export interface QueryGroupPolicyInfoRequestAminoMsg { + type: "cosmos-sdk/QueryGroupPolicyInfoRequest"; + value: QueryGroupPolicyInfoRequestAmino; +} +/** QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type. */ +export interface QueryGroupPolicyInfoRequestSDKType { + address: string; +} +/** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ +export interface QueryGroupPolicyInfoResponse { + /** info is the GroupPolicyInfo of the group policy. */ + info?: GroupPolicyInfo; +} +export interface QueryGroupPolicyInfoResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse"; + value: Uint8Array; +} +/** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ +export interface QueryGroupPolicyInfoResponseAmino { + /** info is the GroupPolicyInfo of the group policy. */ + info?: GroupPolicyInfoAmino; +} +export interface QueryGroupPolicyInfoResponseAminoMsg { + type: "cosmos-sdk/QueryGroupPolicyInfoResponse"; + value: QueryGroupPolicyInfoResponseAmino; +} +/** QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. */ +export interface QueryGroupPolicyInfoResponseSDKType { + info?: GroupPolicyInfoSDKType; +} +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequest { + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGroupMembersRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest"; + value: Uint8Array; +} +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequestAmino { + /** group_id is the unique ID of the group. */ + group_id?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGroupMembersRequestAminoMsg { + type: "cosmos-sdk/QueryGroupMembersRequest"; + value: QueryGroupMembersRequestAmino; +} +/** QueryGroupMembersRequest is the Query/GroupMembers request type. */ +export interface QueryGroupMembersRequestSDKType { + group_id: bigint; + pagination?: PageRequestSDKType; +} +/** QueryGroupMembersResponse is the Query/GroupMembersResponse response type. */ +export interface QueryGroupMembersResponse { + /** members are the members of the group with given group_id. */ + members: GroupMember[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryGroupMembersResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse"; + value: Uint8Array; +} +/** QueryGroupMembersResponse is the Query/GroupMembersResponse response type. */ +export interface QueryGroupMembersResponseAmino { + /** members are the members of the group with given group_id. */ + members?: GroupMemberAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGroupMembersResponseAminoMsg { + type: "cosmos-sdk/QueryGroupMembersResponse"; + value: QueryGroupMembersResponseAmino; +} +/** QueryGroupMembersResponse is the Query/GroupMembersResponse response type. */ +export interface QueryGroupMembersResponseSDKType { + members: GroupMemberSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. */ +export interface QueryGroupsByAdminRequest { + /** admin is the account address of a group's admin. */ + admin: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGroupsByAdminRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest"; + value: Uint8Array; +} +/** QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. */ +export interface QueryGroupsByAdminRequestAmino { + /** admin is the account address of a group's admin. */ + admin?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGroupsByAdminRequestAminoMsg { + type: "cosmos-sdk/QueryGroupsByAdminRequest"; + value: QueryGroupsByAdminRequestAmino; +} +/** QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type. */ +export interface QueryGroupsByAdminRequestSDKType { + admin: string; + pagination?: PageRequestSDKType; +} +/** QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. */ +export interface QueryGroupsByAdminResponse { + /** groups are the groups info with the provided admin. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryGroupsByAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse"; + value: Uint8Array; +} +/** QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. */ +export interface QueryGroupsByAdminResponseAmino { + /** groups are the groups info with the provided admin. */ + groups?: GroupInfoAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGroupsByAdminResponseAminoMsg { + type: "cosmos-sdk/QueryGroupsByAdminResponse"; + value: QueryGroupsByAdminResponseAmino; +} +/** QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type. */ +export interface QueryGroupsByAdminResponseSDKType { + groups: GroupInfoSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequest { + /** group_id is the unique ID of the group policy's group. */ + groupId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGroupPoliciesByGroupRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest"; + value: Uint8Array; +} +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequestAmino { + /** group_id is the unique ID of the group policy's group. */ + group_id?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGroupPoliciesByGroupRequestAminoMsg { + type: "cosmos-sdk/QueryGroupPoliciesByGroupRequest"; + value: QueryGroupPoliciesByGroupRequestAmino; +} +/** QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type. */ +export interface QueryGroupPoliciesByGroupRequestSDKType { + group_id: bigint; + pagination?: PageRequestSDKType; +} +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponse { + /** group_policies are the group policies info associated with the provided group. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryGroupPoliciesByGroupResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse"; + value: Uint8Array; +} +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponseAmino { + /** group_policies are the group policies info associated with the provided group. */ + group_policies?: GroupPolicyInfoAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGroupPoliciesByGroupResponseAminoMsg { + type: "cosmos-sdk/QueryGroupPoliciesByGroupResponse"; + value: QueryGroupPoliciesByGroupResponseAmino; +} +/** QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type. */ +export interface QueryGroupPoliciesByGroupResponseSDKType { + group_policies: GroupPolicyInfoSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. */ +export interface QueryGroupPoliciesByAdminRequest { + /** admin is the admin address of the group policy. */ + admin: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGroupPoliciesByAdminRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest"; + value: Uint8Array; +} +/** QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. */ +export interface QueryGroupPoliciesByAdminRequestAmino { + /** admin is the admin address of the group policy. */ + admin?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGroupPoliciesByAdminRequestAminoMsg { + type: "cosmos-sdk/QueryGroupPoliciesByAdminRequest"; + value: QueryGroupPoliciesByAdminRequestAmino; +} +/** QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type. */ +export interface QueryGroupPoliciesByAdminRequestSDKType { + admin: string; + pagination?: PageRequestSDKType; +} +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponse { + /** group_policies are the group policies info with provided admin. */ + groupPolicies: GroupPolicyInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryGroupPoliciesByAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse"; + value: Uint8Array; +} +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponseAmino { + /** group_policies are the group policies info with provided admin. */ + group_policies?: GroupPolicyInfoAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGroupPoliciesByAdminResponseAminoMsg { + type: "cosmos-sdk/QueryGroupPoliciesByAdminResponse"; + value: QueryGroupPoliciesByAdminResponseAmino; +} +/** QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type. */ +export interface QueryGroupPoliciesByAdminResponseSDKType { + group_policies: GroupPolicyInfoSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: bigint; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryProposalRequest"; + value: Uint8Array; +} +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequestAmino { + /** proposal_id is the unique ID of a proposal. */ + proposal_id?: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/QueryProposalRequest"; + value: QueryProposalRequestAmino; +} +/** QueryProposalRequest is the Query/Proposal request type. */ +export interface QueryProposalRequestSDKType { + proposal_id: bigint; +} +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponse { + /** proposal is the proposal info. */ + proposal?: Proposal; +} +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryProposalResponse"; + value: Uint8Array; +} +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponseAmino { + /** proposal is the proposal info. */ + proposal?: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/QueryProposalResponse"; + value: QueryProposalResponseAmino; +} +/** QueryProposalResponse is the Query/Proposal response type. */ +export interface QueryProposalResponseSDKType { + proposal?: ProposalSDKType; +} +/** QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. */ +export interface QueryProposalsByGroupPolicyRequest { + /** address is the account address of the group policy related to proposals. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryProposalsByGroupPolicyRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest"; + value: Uint8Array; +} +/** QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. */ +export interface QueryProposalsByGroupPolicyRequestAmino { + /** address is the account address of the group policy related to proposals. */ + address?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryProposalsByGroupPolicyRequestAminoMsg { + type: "cosmos-sdk/QueryProposalsByGroupPolicyRequest"; + value: QueryProposalsByGroupPolicyRequestAmino; +} +/** QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type. */ +export interface QueryProposalsByGroupPolicyRequestSDKType { + address: string; + pagination?: PageRequestSDKType; +} +/** QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. */ +export interface QueryProposalsByGroupPolicyResponse { + /** proposals are the proposals with given group policy. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryProposalsByGroupPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse"; + value: Uint8Array; +} +/** QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. */ +export interface QueryProposalsByGroupPolicyResponseAmino { + /** proposals are the proposals with given group policy. */ + proposals?: ProposalAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryProposalsByGroupPolicyResponseAminoMsg { + type: "cosmos-sdk/QueryProposalsByGroupPolicyResponse"; + value: QueryProposalsByGroupPolicyResponseAmino; +} +/** QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type. */ +export interface QueryProposalsByGroupPolicyResponseSDKType { + proposals: ProposalSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: bigint; + /** voter is a proposal voter account address. */ + voter: string; +} +export interface QueryVoteByProposalVoterRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest"; + value: Uint8Array; +} +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequestAmino { + /** proposal_id is the unique ID of a proposal. */ + proposal_id?: string; + /** voter is a proposal voter account address. */ + voter?: string; +} +export interface QueryVoteByProposalVoterRequestAminoMsg { + type: "cosmos-sdk/QueryVoteByProposalVoterRequest"; + value: QueryVoteByProposalVoterRequestAmino; +} +/** QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type. */ +export interface QueryVoteByProposalVoterRequestSDKType { + proposal_id: bigint; + voter: string; +} +/** QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. */ +export interface QueryVoteByProposalVoterResponse { + /** vote is the vote with given proposal_id and voter. */ + vote?: Vote; +} +export interface QueryVoteByProposalVoterResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse"; + value: Uint8Array; +} +/** QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. */ +export interface QueryVoteByProposalVoterResponseAmino { + /** vote is the vote with given proposal_id and voter. */ + vote?: VoteAmino; +} +export interface QueryVoteByProposalVoterResponseAminoMsg { + type: "cosmos-sdk/QueryVoteByProposalVoterResponse"; + value: QueryVoteByProposalVoterResponseAmino; +} +/** QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. */ +export interface QueryVoteByProposalVoterResponseSDKType { + vote?: VoteSDKType; +} +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequest { + /** proposal_id is the unique ID of a proposal. */ + proposalId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryVotesByProposalRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest"; + value: Uint8Array; +} +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequestAmino { + /** proposal_id is the unique ID of a proposal. */ + proposal_id?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryVotesByProposalRequestAminoMsg { + type: "cosmos-sdk/QueryVotesByProposalRequest"; + value: QueryVotesByProposalRequestAmino; +} +/** QueryVotesByProposalRequest is the Query/VotesByProposal request type. */ +export interface QueryVotesByProposalRequestSDKType { + proposal_id: bigint; + pagination?: PageRequestSDKType; +} +/** QueryVotesByProposalResponse is the Query/VotesByProposal response type. */ +export interface QueryVotesByProposalResponse { + /** votes are the list of votes for given proposal_id. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryVotesByProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse"; + value: Uint8Array; +} +/** QueryVotesByProposalResponse is the Query/VotesByProposal response type. */ +export interface QueryVotesByProposalResponseAmino { + /** votes are the list of votes for given proposal_id. */ + votes?: VoteAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryVotesByProposalResponseAminoMsg { + type: "cosmos-sdk/QueryVotesByProposalResponse"; + value: QueryVotesByProposalResponseAmino; +} +/** QueryVotesByProposalResponse is the Query/VotesByProposal response type. */ +export interface QueryVotesByProposalResponseSDKType { + votes: VoteSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryVotesByVoterRequest is the Query/VotesByVoter request type. */ +export interface QueryVotesByVoterRequest { + /** voter is a proposal voter account address. */ + voter: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryVotesByVoterRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest"; + value: Uint8Array; +} +/** QueryVotesByVoterRequest is the Query/VotesByVoter request type. */ +export interface QueryVotesByVoterRequestAmino { + /** voter is a proposal voter account address. */ + voter?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryVotesByVoterRequestAminoMsg { + type: "cosmos-sdk/QueryVotesByVoterRequest"; + value: QueryVotesByVoterRequestAmino; +} +/** QueryVotesByVoterRequest is the Query/VotesByVoter request type. */ +export interface QueryVotesByVoterRequestSDKType { + voter: string; + pagination?: PageRequestSDKType; +} +/** QueryVotesByVoterResponse is the Query/VotesByVoter response type. */ +export interface QueryVotesByVoterResponse { + /** votes are the list of votes by given voter. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryVotesByVoterResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse"; + value: Uint8Array; +} +/** QueryVotesByVoterResponse is the Query/VotesByVoter response type. */ +export interface QueryVotesByVoterResponseAmino { + /** votes are the list of votes by given voter. */ + votes?: VoteAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryVotesByVoterResponseAminoMsg { + type: "cosmos-sdk/QueryVotesByVoterResponse"; + value: QueryVotesByVoterResponseAmino; +} +/** QueryVotesByVoterResponse is the Query/VotesByVoter response type. */ +export interface QueryVotesByVoterResponseSDKType { + votes: VoteSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryGroupsByMemberRequest is the Query/GroupsByMember request type. */ +export interface QueryGroupsByMemberRequest { + /** address is the group member address. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGroupsByMemberRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest"; + value: Uint8Array; +} +/** QueryGroupsByMemberRequest is the Query/GroupsByMember request type. */ +export interface QueryGroupsByMemberRequestAmino { + /** address is the group member address. */ + address?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGroupsByMemberRequestAminoMsg { + type: "cosmos-sdk/QueryGroupsByMemberRequest"; + value: QueryGroupsByMemberRequestAmino; +} +/** QueryGroupsByMemberRequest is the Query/GroupsByMember request type. */ +export interface QueryGroupsByMemberRequestSDKType { + address: string; + pagination?: PageRequestSDKType; +} +/** QueryGroupsByMemberResponse is the Query/GroupsByMember response type. */ +export interface QueryGroupsByMemberResponse { + /** groups are the groups info with the provided group member. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryGroupsByMemberResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse"; + value: Uint8Array; +} +/** QueryGroupsByMemberResponse is the Query/GroupsByMember response type. */ +export interface QueryGroupsByMemberResponseAmino { + /** groups are the groups info with the provided group member. */ + groups?: GroupInfoAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGroupsByMemberResponseAminoMsg { + type: "cosmos-sdk/QueryGroupsByMemberResponse"; + value: QueryGroupsByMemberResponseAmino; +} +/** QueryGroupsByMemberResponse is the Query/GroupsByMember response type. */ +export interface QueryGroupsByMemberResponseSDKType { + groups: GroupInfoSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequest { + /** proposal_id is the unique id of a proposal. */ + proposalId: bigint; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryTallyResultRequest"; + value: Uint8Array; +} +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequestAmino { + /** proposal_id is the unique id of a proposal. */ + proposal_id?: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultRequest is the Query/TallyResult request type. */ +export interface QueryTallyResultRequestSDKType { + proposal_id: bigint; +} +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult; +} +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryTallyResultResponse"; + value: Uint8Array; +} +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponseAmino { + /** tally defines the requested tally. */ + tally: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; +} +/** QueryTallyResultResponse is the Query/TallyResult response type. */ +export interface QueryTallyResultResponseSDKType { + tally: TallyResultSDKType; +} +/** + * QueryGroupsRequest is the Query/Groups request type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryGroupsRequestProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsRequest"; + value: Uint8Array; +} +/** + * QueryGroupsRequest is the Query/Groups request type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGroupsRequestAminoMsg { + type: "cosmos-sdk/QueryGroupsRequest"; + value: QueryGroupsRequestAmino; +} +/** + * QueryGroupsRequest is the Query/Groups request type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * QueryGroupsResponse is the Query/Groups response type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsResponse { + /** `groups` is all the groups present in state. */ + groups: GroupInfo[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryGroupsResponseProtoMsg { + typeUrl: "/cosmos.group.v1.QueryGroupsResponse"; + value: Uint8Array; +} +/** + * QueryGroupsResponse is the Query/Groups response type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsResponseAmino { + /** `groups` is all the groups present in state. */ + groups?: GroupInfoAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGroupsResponseAminoMsg { + type: "cosmos-sdk/QueryGroupsResponse"; + value: QueryGroupsResponseAmino; +} +/** + * QueryGroupsResponse is the Query/Groups response type. + * + * Since: cosmos-sdk 0.47.1 + */ +export interface QueryGroupsResponseSDKType { + groups: GroupInfoSDKType[]; + pagination?: PageResponseSDKType; +} +function createBaseQueryGroupInfoRequest(): QueryGroupInfoRequest { + return { + groupId: BigInt(0) + }; +} +export const QueryGroupInfoRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", + aminoType: "cosmos-sdk/QueryGroupInfoRequest", + encode(message: QueryGroupInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryGroupInfoRequestAmino): QueryGroupInfoRequest { + const message = createBaseQueryGroupInfoRequest(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { + return QueryGroupInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupInfoRequest): QueryGroupInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupInfoRequest", + value: QueryGroupInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupInfoRequestProtoMsg): QueryGroupInfoRequest { + return QueryGroupInfoRequest.decode(message.value); + }, + toProto(message: QueryGroupInfoRequest): Uint8Array { + return QueryGroupInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupInfoRequest): QueryGroupInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupInfoRequest", + value: QueryGroupInfoRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupInfoResponse(): QueryGroupInfoResponse { + return { + info: undefined + }; +} +export const QueryGroupInfoResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", + aminoType: "cosmos-sdk/QueryGroupInfoResponse", + encode(message: QueryGroupInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.info !== undefined) { + GroupInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = GroupInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryGroupInfoResponse { + const message = createBaseQueryGroupInfoResponse(); + message.info = object.info !== undefined && object.info !== null ? GroupInfo.fromPartial(object.info) : undefined; + return message; + }, + fromAmino(object: QueryGroupInfoResponseAmino): QueryGroupInfoResponse { + const message = createBaseQueryGroupInfoResponse(); + if (object.info !== undefined && object.info !== null) { + message.info = GroupInfo.fromAmino(object.info); + } + return message; + }, + toAmino(message: QueryGroupInfoResponse): QueryGroupInfoResponseAmino { + const obj: any = {}; + obj.info = message.info ? GroupInfo.toAmino(message.info) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupInfoResponseAminoMsg): QueryGroupInfoResponse { + return QueryGroupInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupInfoResponse): QueryGroupInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupInfoResponse", + value: QueryGroupInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupInfoResponseProtoMsg): QueryGroupInfoResponse { + return QueryGroupInfoResponse.decode(message.value); + }, + toProto(message: QueryGroupInfoResponse): Uint8Array { + return QueryGroupInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupInfoResponse): QueryGroupInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupInfoResponse", + value: QueryGroupInfoResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGroupPolicyInfoRequest(): QueryGroupPolicyInfoRequest { + return { + address: "" + }; +} +export const QueryGroupPolicyInfoRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", + aminoType: "cosmos-sdk/QueryGroupPolicyInfoRequest", + encode(message: QueryGroupPolicyInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPolicyInfoRequest(); + 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: DeepPartial): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryGroupPolicyInfoRequestAmino): QueryGroupPolicyInfoRequest { + const message = createBaseQueryGroupPolicyInfoRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPolicyInfoRequest", + value: QueryGroupPolicyInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPolicyInfoRequestProtoMsg): QueryGroupPolicyInfoRequest { + return QueryGroupPolicyInfoRequest.decode(message.value); + }, + toProto(message: QueryGroupPolicyInfoRequest): Uint8Array { + return QueryGroupPolicyInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoRequest", + value: QueryGroupPolicyInfoRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupPolicyInfoResponse(): QueryGroupPolicyInfoResponse { + return { + info: undefined + }; +} +export const QueryGroupPolicyInfoResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", + aminoType: "cosmos-sdk/QueryGroupPolicyInfoResponse", + encode(message: QueryGroupPolicyInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.info !== undefined) { + GroupPolicyInfo.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPolicyInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPolicyInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = GroupPolicyInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryGroupPolicyInfoResponse { + const message = createBaseQueryGroupPolicyInfoResponse(); + message.info = object.info !== undefined && object.info !== null ? GroupPolicyInfo.fromPartial(object.info) : undefined; + return message; + }, + fromAmino(object: QueryGroupPolicyInfoResponseAmino): QueryGroupPolicyInfoResponse { + const message = createBaseQueryGroupPolicyInfoResponse(); + if (object.info !== undefined && object.info !== null) { + message.info = GroupPolicyInfo.fromAmino(object.info); + } + return message; + }, + toAmino(message: QueryGroupPolicyInfoResponse): QueryGroupPolicyInfoResponseAmino { + const obj: any = {}; + obj.info = message.info ? GroupPolicyInfo.toAmino(message.info) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPolicyInfoResponseAminoMsg): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPolicyInfoResponse): QueryGroupPolicyInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPolicyInfoResponse", + value: QueryGroupPolicyInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPolicyInfoResponseProtoMsg): QueryGroupPolicyInfoResponse { + return QueryGroupPolicyInfoResponse.decode(message.value); + }, + toProto(message: QueryGroupPolicyInfoResponse): Uint8Array { + return QueryGroupPolicyInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPolicyInfoResponse): QueryGroupPolicyInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPolicyInfoResponse", + value: QueryGroupPolicyInfoResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGroupMembersRequest(): QueryGroupMembersRequest { + return { + groupId: BigInt(0), + pagination: undefined + }; +} +export const QueryGroupMembersRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", + aminoType: "cosmos-sdk/QueryGroupMembersRequest", + encode(message: QueryGroupMembersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupMembersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupMembersRequestAmino): QueryGroupMembersRequest { + const message = createBaseQueryGroupMembersRequest(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupMembersRequestAminoMsg): QueryGroupMembersRequest { + return QueryGroupMembersRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupMembersRequest): QueryGroupMembersRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupMembersRequest", + value: QueryGroupMembersRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupMembersRequestProtoMsg): QueryGroupMembersRequest { + return QueryGroupMembersRequest.decode(message.value); + }, + toProto(message: QueryGroupMembersRequest): Uint8Array { + return QueryGroupMembersRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupMembersRequest): QueryGroupMembersRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupMembersRequest", + value: QueryGroupMembersRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupMembersResponse(): QueryGroupMembersResponse { + return { + members: [], + pagination: undefined + }; +} +export const QueryGroupMembersResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", + aminoType: "cosmos-sdk/QueryGroupMembersResponse", + encode(message: QueryGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.members) { + GroupMember.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.members.push(GroupMember.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: DeepPartial): QueryGroupMembersResponse { + const message = createBaseQueryGroupMembersResponse(); + message.members = object.members?.map(e => GroupMember.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupMembersResponseAmino): QueryGroupMembersResponse { + const message = createBaseQueryGroupMembersResponse(); + message.members = object.members?.map(e => GroupMember.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupMembersResponse): QueryGroupMembersResponseAmino { + const obj: any = {}; + if (message.members) { + obj.members = message.members.map(e => e ? GroupMember.toAmino(e) : undefined); + } else { + obj.members = message.members; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupMembersResponseAminoMsg): QueryGroupMembersResponse { + return QueryGroupMembersResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupMembersResponse): QueryGroupMembersResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupMembersResponse", + value: QueryGroupMembersResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupMembersResponseProtoMsg): QueryGroupMembersResponse { + return QueryGroupMembersResponse.decode(message.value); + }, + toProto(message: QueryGroupMembersResponse): Uint8Array { + return QueryGroupMembersResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupMembersResponse): QueryGroupMembersResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupMembersResponse", + value: QueryGroupMembersResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGroupsByAdminRequest(): QueryGroupsByAdminRequest { + return { + admin: "", + pagination: undefined + }; +} +export const QueryGroupsByAdminRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", + aminoType: "cosmos-sdk/QueryGroupsByAdminRequest", + encode(message: QueryGroupsByAdminRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByAdminRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryGroupsByAdminRequest { + const message = createBaseQueryGroupsByAdminRequest(); + message.admin = object.admin ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupsByAdminRequestAmino): QueryGroupsByAdminRequest { + const message = createBaseQueryGroupsByAdminRequest(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsByAdminRequestAminoMsg): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsByAdminRequest", + value: QueryGroupsByAdminRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsByAdminRequestProtoMsg): QueryGroupsByAdminRequest { + return QueryGroupsByAdminRequest.decode(message.value); + }, + toProto(message: QueryGroupsByAdminRequest): Uint8Array { + return QueryGroupsByAdminRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminRequest", + value: QueryGroupsByAdminRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupsByAdminResponse(): QueryGroupsByAdminResponse { + return { + groups: [], + pagination: undefined + }; +} +export const QueryGroupsByAdminResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", + aminoType: "cosmos-sdk/QueryGroupsByAdminResponse", + encode(message: QueryGroupsByAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groups.push(GroupInfo.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: DeepPartial): QueryGroupsByAdminResponse { + const message = createBaseQueryGroupsByAdminResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupsByAdminResponseAmino): QueryGroupsByAdminResponse { + const message = createBaseQueryGroupsByAdminResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsByAdminResponse): QueryGroupsByAdminResponseAmino { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); + } else { + obj.groups = message.groups; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsByAdminResponseAminoMsg): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsByAdminResponse): QueryGroupsByAdminResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsByAdminResponse", + value: QueryGroupsByAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsByAdminResponseProtoMsg): QueryGroupsByAdminResponse { + return QueryGroupsByAdminResponse.decode(message.value); + }, + toProto(message: QueryGroupsByAdminResponse): Uint8Array { + return QueryGroupsByAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsByAdminResponse): QueryGroupsByAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsByAdminResponse", + value: QueryGroupsByAdminResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGroupPoliciesByGroupRequest(): QueryGroupPoliciesByGroupRequest { + return { + groupId: BigInt(0), + pagination: undefined + }; +} +export const QueryGroupPoliciesByGroupRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", + aminoType: "cosmos-sdk/QueryGroupPoliciesByGroupRequest", + encode(message: QueryGroupPoliciesByGroupRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByGroupRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupPoliciesByGroupRequestAmino): QueryGroupPoliciesByGroupRequest { + const message = createBaseQueryGroupPoliciesByGroupRequest(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPoliciesByGroupRequestAminoMsg): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPoliciesByGroupRequest", + value: QueryGroupPoliciesByGroupRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPoliciesByGroupRequestProtoMsg): QueryGroupPoliciesByGroupRequest { + return QueryGroupPoliciesByGroupRequest.decode(message.value); + }, + toProto(message: QueryGroupPoliciesByGroupRequest): Uint8Array { + return QueryGroupPoliciesByGroupRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest", + value: QueryGroupPoliciesByGroupRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupPoliciesByGroupResponse(): QueryGroupPoliciesByGroupResponse { + return { + groupPolicies: [], + pagination: undefined + }; +} +export const QueryGroupPoliciesByGroupResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", + aminoType: "cosmos-sdk/QueryGroupPoliciesByGroupResponse", + encode(message: QueryGroupPoliciesByGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupPolicies.push(GroupPolicyInfo.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: DeepPartial): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.groupPolicies = object.groupPolicies?.map(e => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupPoliciesByGroupResponseAmino): QueryGroupPoliciesByGroupResponse { + const message = createBaseQueryGroupPoliciesByGroupResponse(); + message.groupPolicies = object.group_policies?.map(e => GroupPolicyInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupPoliciesByGroupResponse): QueryGroupPoliciesByGroupResponseAmino { + const obj: any = {}; + if (message.groupPolicies) { + obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); + } else { + obj.group_policies = message.groupPolicies; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPoliciesByGroupResponseAminoMsg): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPoliciesByGroupResponse): QueryGroupPoliciesByGroupResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPoliciesByGroupResponse", + value: QueryGroupPoliciesByGroupResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPoliciesByGroupResponseProtoMsg): QueryGroupPoliciesByGroupResponse { + return QueryGroupPoliciesByGroupResponse.decode(message.value); + }, + toProto(message: QueryGroupPoliciesByGroupResponse): Uint8Array { + return QueryGroupPoliciesByGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPoliciesByGroupResponse): QueryGroupPoliciesByGroupResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse", + value: QueryGroupPoliciesByGroupResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGroupPoliciesByAdminRequest(): QueryGroupPoliciesByAdminRequest { + return { + admin: "", + pagination: undefined + }; +} +export const QueryGroupPoliciesByAdminRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", + aminoType: "cosmos-sdk/QueryGroupPoliciesByAdminRequest", + encode(message: QueryGroupPoliciesByAdminRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByAdminRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryGroupPoliciesByAdminRequest { + const message = createBaseQueryGroupPoliciesByAdminRequest(); + message.admin = object.admin ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupPoliciesByAdminRequestAmino): QueryGroupPoliciesByAdminRequest { + const message = createBaseQueryGroupPoliciesByAdminRequest(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPoliciesByAdminRequestAminoMsg): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPoliciesByAdminRequest", + value: QueryGroupPoliciesByAdminRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPoliciesByAdminRequestProtoMsg): QueryGroupPoliciesByAdminRequest { + return QueryGroupPoliciesByAdminRequest.decode(message.value); + }, + toProto(message: QueryGroupPoliciesByAdminRequest): Uint8Array { + return QueryGroupPoliciesByAdminRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest", + value: QueryGroupPoliciesByAdminRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupPoliciesByAdminResponse(): QueryGroupPoliciesByAdminResponse { + return { + groupPolicies: [], + pagination: undefined + }; +} +export const QueryGroupPoliciesByAdminResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", + aminoType: "cosmos-sdk/QueryGroupPoliciesByAdminResponse", + encode(message: QueryGroupPoliciesByAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.groupPolicies) { + GroupPolicyInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupPoliciesByAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupPoliciesByAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupPolicies.push(GroupPolicyInfo.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: DeepPartial): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.groupPolicies = object.groupPolicies?.map(e => GroupPolicyInfo.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupPoliciesByAdminResponseAmino): QueryGroupPoliciesByAdminResponse { + const message = createBaseQueryGroupPoliciesByAdminResponse(); + message.groupPolicies = object.group_policies?.map(e => GroupPolicyInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupPoliciesByAdminResponse): QueryGroupPoliciesByAdminResponseAmino { + const obj: any = {}; + if (message.groupPolicies) { + obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); + } else { + obj.group_policies = message.groupPolicies; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupPoliciesByAdminResponseAminoMsg): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupPoliciesByAdminResponse): QueryGroupPoliciesByAdminResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupPoliciesByAdminResponse", + value: QueryGroupPoliciesByAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupPoliciesByAdminResponseProtoMsg): QueryGroupPoliciesByAdminResponse { + return QueryGroupPoliciesByAdminResponse.decode(message.value); + }, + toProto(message: QueryGroupPoliciesByAdminResponse): Uint8Array { + return QueryGroupPoliciesByAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupPoliciesByAdminResponse): QueryGroupPoliciesByAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse", + value: QueryGroupPoliciesByAdminResponse.encode(message).finish() + }; + } +}; +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { + proposalId: BigInt(0) + }; +} +export const QueryProposalRequest = { + typeUrl: "/cosmos.group.v1.QueryProposalRequest", + aminoType: "cosmos-sdk/QueryProposalRequest", + encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish() + }; + } +}; +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { + proposal: undefined + }; +} +export const QueryProposalResponse = { + typeUrl: "/cosmos.group.v1.QueryProposalResponse", + aminoType: "cosmos-sdk/QueryProposalResponse", + encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; + return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + return message; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish() + }; + } +}; +function createBaseQueryProposalsByGroupPolicyRequest(): QueryProposalsByGroupPolicyRequest { + return { + address: "", + pagination: undefined + }; +} +export const QueryProposalsByGroupPolicyRequest = { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", + aminoType: "cosmos-sdk/QueryProposalsByGroupPolicyRequest", + encode(message: QueryProposalsByGroupPolicyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsByGroupPolicyRequest(); + 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: DeepPartial): QueryProposalsByGroupPolicyRequest { + const message = createBaseQueryProposalsByGroupPolicyRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryProposalsByGroupPolicyRequestAmino): QueryProposalsByGroupPolicyRequest { + const message = createBaseQueryProposalsByGroupPolicyRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsByGroupPolicyRequestAminoMsg): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsByGroupPolicyRequest", + value: QueryProposalsByGroupPolicyRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsByGroupPolicyRequestProtoMsg): QueryProposalsByGroupPolicyRequest { + return QueryProposalsByGroupPolicyRequest.decode(message.value); + }, + toProto(message: QueryProposalsByGroupPolicyRequest): Uint8Array { + return QueryProposalsByGroupPolicyRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest", + value: QueryProposalsByGroupPolicyRequest.encode(message).finish() + }; + } +}; +function createBaseQueryProposalsByGroupPolicyResponse(): QueryProposalsByGroupPolicyResponse { + return { + proposals: [], + pagination: undefined + }; +} +export const QueryProposalsByGroupPolicyResponse = { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", + aminoType: "cosmos-sdk/QueryProposalsByGroupPolicyResponse", + encode(message: QueryProposalsByGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsByGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsByGroupPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalsByGroupPolicyResponse { + const message = createBaseQueryProposalsByGroupPolicyResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryProposalsByGroupPolicyResponseAmino): QueryProposalsByGroupPolicyResponse { + const message = createBaseQueryProposalsByGroupPolicyResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsByGroupPolicyResponse): QueryProposalsByGroupPolicyResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = message.proposals; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsByGroupPolicyResponseAminoMsg): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsByGroupPolicyResponse): QueryProposalsByGroupPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsByGroupPolicyResponse", + value: QueryProposalsByGroupPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsByGroupPolicyResponseProtoMsg): QueryProposalsByGroupPolicyResponse { + return QueryProposalsByGroupPolicyResponse.decode(message.value); + }, + toProto(message: QueryProposalsByGroupPolicyResponse): Uint8Array { + return QueryProposalsByGroupPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsByGroupPolicyResponse): QueryProposalsByGroupPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse", + value: QueryProposalsByGroupPolicyResponse.encode(message).finish() + }; + } +}; +function createBaseQueryVoteByProposalVoterRequest(): QueryVoteByProposalVoterRequest { + return { + proposalId: BigInt(0), + voter: "" + }; +} +export const QueryVoteByProposalVoterRequest = { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", + aminoType: "cosmos-sdk/QueryVoteByProposalVoterRequest", + encode(message: QueryVoteByProposalVoterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteByProposalVoterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + return message; + }, + fromAmino(object: QueryVoteByProposalVoterRequestAmino): QueryVoteByProposalVoterRequest { + const message = createBaseQueryVoteByProposalVoterRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + return message; + }, + toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVoteByProposalVoterRequest", + value: QueryVoteByProposalVoterRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteByProposalVoterRequestProtoMsg): QueryVoteByProposalVoterRequest { + return QueryVoteByProposalVoterRequest.decode(message.value); + }, + toProto(message: QueryVoteByProposalVoterRequest): Uint8Array { + return QueryVoteByProposalVoterRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterRequest", + value: QueryVoteByProposalVoterRequest.encode(message).finish() + }; + } +}; +function createBaseQueryVoteByProposalVoterResponse(): QueryVoteByProposalVoterResponse { + return { + vote: undefined + }; +} +export const QueryVoteByProposalVoterResponse = { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", + aminoType: "cosmos-sdk/QueryVoteByProposalVoterResponse", + encode(message: QueryVoteByProposalVoterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteByProposalVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteByProposalVoterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVoteByProposalVoterResponse { + const message = createBaseQueryVoteByProposalVoterResponse(); + message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; + return message; + }, + fromAmino(object: QueryVoteByProposalVoterResponseAmino): QueryVoteByProposalVoterResponse { + const message = createBaseQueryVoteByProposalVoterResponse(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + return message; + }, + toAmino(message: QueryVoteByProposalVoterResponse): QueryVoteByProposalVoterResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVoteByProposalVoterResponseAminoMsg): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteByProposalVoterResponse): QueryVoteByProposalVoterResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVoteByProposalVoterResponse", + value: QueryVoteByProposalVoterResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteByProposalVoterResponseProtoMsg): QueryVoteByProposalVoterResponse { + return QueryVoteByProposalVoterResponse.decode(message.value); + }, + toProto(message: QueryVoteByProposalVoterResponse): Uint8Array { + return QueryVoteByProposalVoterResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteByProposalVoterResponse): QueryVoteByProposalVoterResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVoteByProposalVoterResponse", + value: QueryVoteByProposalVoterResponse.encode(message).finish() + }; + } +}; +function createBaseQueryVotesByProposalRequest(): QueryVotesByProposalRequest { + return { + proposalId: BigInt(0), + pagination: undefined + }; +} +export const QueryVotesByProposalRequest = { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", + aminoType: "cosmos-sdk/QueryVotesByProposalRequest", + encode(message: QueryVotesByProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesByProposalRequestAmino): QueryVotesByProposalRequest { + const message = createBaseQueryVotesByProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesByProposalRequestAminoMsg): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVotesByProposalRequest", + value: QueryVotesByProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesByProposalRequestProtoMsg): QueryVotesByProposalRequest { + return QueryVotesByProposalRequest.decode(message.value); + }, + toProto(message: QueryVotesByProposalRequest): Uint8Array { + return QueryVotesByProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalRequest", + value: QueryVotesByProposalRequest.encode(message).finish() + }; + } +}; +function createBaseQueryVotesByProposalResponse(): QueryVotesByProposalResponse { + return { + votes: [], + pagination: undefined + }; +} +export const QueryVotesByProposalResponse = { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", + aminoType: "cosmos-sdk/QueryVotesByProposalResponse", + encode(message: QueryVotesByProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesByProposalResponse { + const message = createBaseQueryVotesByProposalResponse(); + message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesByProposalResponseAmino): QueryVotesByProposalResponse { + const message = createBaseQueryVotesByProposalResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesByProposalResponse): QueryVotesByProposalResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesByProposalResponseAminoMsg): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesByProposalResponse): QueryVotesByProposalResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVotesByProposalResponse", + value: QueryVotesByProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesByProposalResponseProtoMsg): QueryVotesByProposalResponse { + return QueryVotesByProposalResponse.decode(message.value); + }, + toProto(message: QueryVotesByProposalResponse): Uint8Array { + return QueryVotesByProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesByProposalResponse): QueryVotesByProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVotesByProposalResponse", + value: QueryVotesByProposalResponse.encode(message).finish() + }; + } +}; +function createBaseQueryVotesByVoterRequest(): QueryVotesByVoterRequest { + return { + voter: "", + pagination: undefined + }; +} +export const QueryVotesByVoterRequest = { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", + aminoType: "cosmos-sdk/QueryVotesByVoterRequest", + encode(message: QueryVotesByVoterRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.voter !== "") { + writer.uint32(10).string(message.voter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByVoterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voter = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesByVoterRequest { + const message = createBaseQueryVotesByVoterRequest(); + message.voter = object.voter ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesByVoterRequestAmino): QueryVotesByVoterRequest { + const message = createBaseQueryVotesByVoterRequest(); + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { + const obj: any = {}; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesByVoterRequestAminoMsg): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVotesByVoterRequest", + value: QueryVotesByVoterRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesByVoterRequestProtoMsg): QueryVotesByVoterRequest { + return QueryVotesByVoterRequest.decode(message.value); + }, + toProto(message: QueryVotesByVoterRequest): Uint8Array { + return QueryVotesByVoterRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterRequest", + value: QueryVotesByVoterRequest.encode(message).finish() + }; + } +}; +function createBaseQueryVotesByVoterResponse(): QueryVotesByVoterResponse { + return { + votes: [], + pagination: undefined + }; +} +export const QueryVotesByVoterResponse = { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", + aminoType: "cosmos-sdk/QueryVotesByVoterResponse", + encode(message: QueryVotesByVoterResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesByVoterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesByVoterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesByVoterResponse { + const message = createBaseQueryVotesByVoterResponse(); + message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesByVoterResponseAmino): QueryVotesByVoterResponse { + const message = createBaseQueryVotesByVoterResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesByVoterResponse): QueryVotesByVoterResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesByVoterResponseAminoMsg): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesByVoterResponse): QueryVotesByVoterResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVotesByVoterResponse", + value: QueryVotesByVoterResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesByVoterResponseProtoMsg): QueryVotesByVoterResponse { + return QueryVotesByVoterResponse.decode(message.value); + }, + toProto(message: QueryVotesByVoterResponse): Uint8Array { + return QueryVotesByVoterResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesByVoterResponse): QueryVotesByVoterResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryVotesByVoterResponse", + value: QueryVotesByVoterResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGroupsByMemberRequest(): QueryGroupsByMemberRequest { + return { + address: "", + pagination: undefined + }; +} +export const QueryGroupsByMemberRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", + aminoType: "cosmos-sdk/QueryGroupsByMemberRequest", + encode(message: QueryGroupsByMemberRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByMemberRequest(); + 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: DeepPartial): QueryGroupsByMemberRequest { + const message = createBaseQueryGroupsByMemberRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupsByMemberRequestAmino): QueryGroupsByMemberRequest { + const message = createBaseQueryGroupsByMemberRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsByMemberRequestAminoMsg): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsByMemberRequest", + value: QueryGroupsByMemberRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsByMemberRequestProtoMsg): QueryGroupsByMemberRequest { + return QueryGroupsByMemberRequest.decode(message.value); + }, + toProto(message: QueryGroupsByMemberRequest): Uint8Array { + return QueryGroupsByMemberRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberRequest", + value: QueryGroupsByMemberRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupsByMemberResponse(): QueryGroupsByMemberResponse { + return { + groups: [], + pagination: undefined + }; +} +export const QueryGroupsByMemberResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", + aminoType: "cosmos-sdk/QueryGroupsByMemberResponse", + encode(message: QueryGroupsByMemberResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsByMemberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsByMemberResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groups.push(GroupInfo.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: DeepPartial): QueryGroupsByMemberResponse { + const message = createBaseQueryGroupsByMemberResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupsByMemberResponseAmino): QueryGroupsByMemberResponse { + const message = createBaseQueryGroupsByMemberResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsByMemberResponse): QueryGroupsByMemberResponseAmino { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); + } else { + obj.groups = message.groups; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsByMemberResponseAminoMsg): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsByMemberResponse): QueryGroupsByMemberResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsByMemberResponse", + value: QueryGroupsByMemberResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsByMemberResponseProtoMsg): QueryGroupsByMemberResponse { + return QueryGroupsByMemberResponse.decode(message.value); + }, + toProto(message: QueryGroupsByMemberResponse): Uint8Array { + return QueryGroupsByMemberResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsByMemberResponse): QueryGroupsByMemberResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsByMemberResponse", + value: QueryGroupsByMemberResponse.encode(message).finish() + }; + } +}; +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { + proposalId: BigInt(0) + }; +} +export const QueryTallyResultRequest = { + typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", + aminoType: "cosmos-sdk/QueryTallyResultRequest", + encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultRequestProtoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish() + }; + } +}; +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { + tally: TallyResult.fromPartial({}) + }; +} +export const QueryTallyResultResponse = { + typeUrl: "/cosmos.group.v1.QueryTallyResultResponse", + aminoType: "cosmos-sdk/QueryTallyResultResponse", + encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tally = TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = object.tally !== undefined && object.tally !== null ? TallyResult.fromPartial(object.tally) : undefined; + return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + if (object.tally !== undefined && object.tally !== null) { + message.tally = TallyResult.fromAmino(object.tally); + } + return message; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : TallyResult.toAmino(TallyResult.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultResponseProtoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish() + }; + } +}; +function createBaseQueryGroupsRequest(): QueryGroupsRequest { + return { + pagination: undefined + }; +} +export const QueryGroupsRequest = { + typeUrl: "/cosmos.group.v1.QueryGroupsRequest", + aminoType: "cosmos-sdk/QueryGroupsRequest", + encode(message: QueryGroupsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupsRequestAmino): QueryGroupsRequest { + const message = createBaseQueryGroupsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsRequest): QueryGroupsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsRequestAminoMsg): QueryGroupsRequest { + return QueryGroupsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsRequest): QueryGroupsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsRequest", + value: QueryGroupsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsRequestProtoMsg): QueryGroupsRequest { + return QueryGroupsRequest.decode(message.value); + }, + toProto(message: QueryGroupsRequest): Uint8Array { + return QueryGroupsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsRequest): QueryGroupsRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsRequest", + value: QueryGroupsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryGroupsResponse(): QueryGroupsResponse { + return { + groups: [], + pagination: undefined + }; +} +export const QueryGroupsResponse = { + typeUrl: "/cosmos.group.v1.QueryGroupsResponse", + aminoType: "cosmos-sdk/QueryGroupsResponse", + encode(message: QueryGroupsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.groups) { + GroupInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryGroupsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGroupsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groups.push(GroupInfo.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: DeepPartial): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryGroupsResponseAmino): QueryGroupsResponse { + const message = createBaseQueryGroupsResponse(); + message.groups = object.groups?.map(e => GroupInfo.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryGroupsResponse): QueryGroupsResponseAmino { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); + } else { + obj.groups = message.groups; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryGroupsResponseAminoMsg): QueryGroupsResponse { + return QueryGroupsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGroupsResponse): QueryGroupsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGroupsResponse", + value: QueryGroupsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryGroupsResponseProtoMsg): QueryGroupsResponse { + return QueryGroupsResponse.decode(message.value); + }, + toProto(message: QueryGroupsResponse): Uint8Array { + return QueryGroupsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGroupsResponse): QueryGroupsResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.QueryGroupsResponse", + value: QueryGroupsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/tx.amino.ts b/util/inj-types/cosmos/group/v1/tx.amino.ts new file mode 100644 index 00000000..3a5c0e59 --- /dev/null +++ b/util/inj-types/cosmos/group/v1/tx.amino.ts @@ -0,0 +1,73 @@ +import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; +export const AminoConverter = { + "/cosmos.group.v1.MsgCreateGroup": { + aminoType: "cosmos-sdk/MsgCreateGroup", + toAmino: MsgCreateGroup.toAmino, + fromAmino: MsgCreateGroup.fromAmino + }, + "/cosmos.group.v1.MsgUpdateGroupMembers": { + aminoType: "cosmos-sdk/MsgUpdateGroupMembers", + toAmino: MsgUpdateGroupMembers.toAmino, + fromAmino: MsgUpdateGroupMembers.fromAmino + }, + "/cosmos.group.v1.MsgUpdateGroupAdmin": { + aminoType: "cosmos-sdk/MsgUpdateGroupAdmin", + toAmino: MsgUpdateGroupAdmin.toAmino, + fromAmino: MsgUpdateGroupAdmin.fromAmino + }, + "/cosmos.group.v1.MsgUpdateGroupMetadata": { + aminoType: "cosmos-sdk/MsgUpdateGroupMetadata", + toAmino: MsgUpdateGroupMetadata.toAmino, + fromAmino: MsgUpdateGroupMetadata.fromAmino + }, + "/cosmos.group.v1.MsgCreateGroupPolicy": { + aminoType: "cosmos-sdk/MsgCreateGroupPolicy", + toAmino: MsgCreateGroupPolicy.toAmino, + fromAmino: MsgCreateGroupPolicy.fromAmino + }, + "/cosmos.group.v1.MsgCreateGroupWithPolicy": { + aminoType: "cosmos-sdk/MsgCreateGroupWithPolicy", + toAmino: MsgCreateGroupWithPolicy.toAmino, + fromAmino: MsgCreateGroupWithPolicy.fromAmino + }, + "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin": { + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", + toAmino: MsgUpdateGroupPolicyAdmin.toAmino, + fromAmino: MsgUpdateGroupPolicyAdmin.fromAmino + }, + "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy": { + aminoType: "cosmos-sdk/MsgUpdateGroupDecisionPolicy", + toAmino: MsgUpdateGroupPolicyDecisionPolicy.toAmino, + fromAmino: MsgUpdateGroupPolicyDecisionPolicy.fromAmino + }, + "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata": { + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", + toAmino: MsgUpdateGroupPolicyMetadata.toAmino, + fromAmino: MsgUpdateGroupPolicyMetadata.fromAmino + }, + "/cosmos.group.v1.MsgSubmitProposal": { + aminoType: "cosmos-sdk/group/MsgSubmitProposal", + toAmino: MsgSubmitProposal.toAmino, + fromAmino: MsgSubmitProposal.fromAmino + }, + "/cosmos.group.v1.MsgWithdrawProposal": { + aminoType: "cosmos-sdk/group/MsgWithdrawProposal", + toAmino: MsgWithdrawProposal.toAmino, + fromAmino: MsgWithdrawProposal.fromAmino + }, + "/cosmos.group.v1.MsgVote": { + aminoType: "cosmos-sdk/group/MsgVote", + toAmino: MsgVote.toAmino, + fromAmino: MsgVote.fromAmino + }, + "/cosmos.group.v1.MsgExec": { + aminoType: "cosmos-sdk/group/MsgExec", + toAmino: MsgExec.toAmino, + fromAmino: MsgExec.fromAmino + }, + "/cosmos.group.v1.MsgLeaveGroup": { + aminoType: "cosmos-sdk/group/MsgLeaveGroup", + toAmino: MsgLeaveGroup.toAmino, + fromAmino: MsgLeaveGroup.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/tx.registry.ts b/util/inj-types/cosmos/group/v1/tx.registry.ts new file mode 100644 index 00000000..f40d6969 --- /dev/null +++ b/util/inj-types/cosmos/group/v1/tx.registry.ts @@ -0,0 +1,269 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.group.v1.MsgCreateGroup", MsgCreateGroup], ["/cosmos.group.v1.MsgUpdateGroupMembers", MsgUpdateGroupMembers], ["/cosmos.group.v1.MsgUpdateGroupAdmin", MsgUpdateGroupAdmin], ["/cosmos.group.v1.MsgUpdateGroupMetadata", MsgUpdateGroupMetadata], ["/cosmos.group.v1.MsgCreateGroupPolicy", MsgCreateGroupPolicy], ["/cosmos.group.v1.MsgCreateGroupWithPolicy", MsgCreateGroupWithPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", MsgUpdateGroupPolicyAdmin], ["/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", MsgUpdateGroupPolicyDecisionPolicy], ["/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", MsgUpdateGroupPolicyMetadata], ["/cosmos.group.v1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.group.v1.MsgWithdrawProposal", MsgWithdrawProposal], ["/cosmos.group.v1.MsgVote", MsgVote], ["/cosmos.group.v1.MsgExec", MsgExec], ["/cosmos.group.v1.MsgLeaveGroup", MsgLeaveGroup]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + createGroup(value: MsgCreateGroup) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + value: MsgCreateGroup.encode(value).finish() + }; + }, + updateGroupMembers(value: MsgUpdateGroupMembers) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + value: MsgUpdateGroupMembers.encode(value).finish() + }; + }, + updateGroupAdmin(value: MsgUpdateGroupAdmin) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + value: MsgUpdateGroupAdmin.encode(value).finish() + }; + }, + updateGroupMetadata(value: MsgUpdateGroupMetadata) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + value: MsgUpdateGroupMetadata.encode(value).finish() + }; + }, + createGroupPolicy(value: MsgCreateGroupPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + value: MsgCreateGroupPolicy.encode(value).finish() + }; + }, + createGroupWithPolicy(value: MsgCreateGroupWithPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + value: MsgCreateGroupWithPolicy.encode(value).finish() + }; + }, + updateGroupPolicyAdmin(value: MsgUpdateGroupPolicyAdmin) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + value: MsgUpdateGroupPolicyAdmin.encode(value).finish() + }; + }, + updateGroupPolicyDecisionPolicy(value: MsgUpdateGroupPolicyDecisionPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + value: MsgUpdateGroupPolicyDecisionPolicy.encode(value).finish() + }; + }, + updateGroupPolicyMetadata(value: MsgUpdateGroupPolicyMetadata) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + value: MsgUpdateGroupPolicyMetadata.encode(value).finish() + }; + }, + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(value).finish() + }; + }, + withdrawProposal(value: MsgWithdrawProposal) { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + value: MsgWithdrawProposal.encode(value).finish() + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.group.v1.MsgVote", + value: MsgVote.encode(value).finish() + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.group.v1.MsgExec", + value: MsgExec.encode(value).finish() + }; + }, + leaveGroup(value: MsgLeaveGroup) { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + value: MsgLeaveGroup.encode(value).finish() + }; + } + }, + withTypeUrl: { + createGroup(value: MsgCreateGroup) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + value + }; + }, + updateGroupMembers(value: MsgUpdateGroupMembers) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + value + }; + }, + updateGroupAdmin(value: MsgUpdateGroupAdmin) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + value + }; + }, + updateGroupMetadata(value: MsgUpdateGroupMetadata) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + value + }; + }, + createGroupPolicy(value: MsgCreateGroupPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + value + }; + }, + createGroupWithPolicy(value: MsgCreateGroupWithPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + value + }; + }, + updateGroupPolicyAdmin(value: MsgUpdateGroupPolicyAdmin) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + value + }; + }, + updateGroupPolicyDecisionPolicy(value: MsgUpdateGroupPolicyDecisionPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + value + }; + }, + updateGroupPolicyMetadata(value: MsgUpdateGroupPolicyMetadata) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + value + }; + }, + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + value + }; + }, + withdrawProposal(value: MsgWithdrawProposal) { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + value + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.group.v1.MsgVote", + value + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.group.v1.MsgExec", + value + }; + }, + leaveGroup(value: MsgLeaveGroup) { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + value + }; + } + }, + fromPartial: { + createGroup(value: MsgCreateGroup) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + value: MsgCreateGroup.fromPartial(value) + }; + }, + updateGroupMembers(value: MsgUpdateGroupMembers) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + value: MsgUpdateGroupMembers.fromPartial(value) + }; + }, + updateGroupAdmin(value: MsgUpdateGroupAdmin) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + value: MsgUpdateGroupAdmin.fromPartial(value) + }; + }, + updateGroupMetadata(value: MsgUpdateGroupMetadata) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + value: MsgUpdateGroupMetadata.fromPartial(value) + }; + }, + createGroupPolicy(value: MsgCreateGroupPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + value: MsgCreateGroupPolicy.fromPartial(value) + }; + }, + createGroupWithPolicy(value: MsgCreateGroupWithPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + value: MsgCreateGroupWithPolicy.fromPartial(value) + }; + }, + updateGroupPolicyAdmin(value: MsgUpdateGroupPolicyAdmin) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + value: MsgUpdateGroupPolicyAdmin.fromPartial(value) + }; + }, + updateGroupPolicyDecisionPolicy(value: MsgUpdateGroupPolicyDecisionPolicy) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + value: MsgUpdateGroupPolicyDecisionPolicy.fromPartial(value) + }; + }, + updateGroupPolicyMetadata(value: MsgUpdateGroupPolicyMetadata) { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + value: MsgUpdateGroupPolicyMetadata.fromPartial(value) + }; + }, + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + value: MsgSubmitProposal.fromPartial(value) + }; + }, + withdrawProposal(value: MsgWithdrawProposal) { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + value: MsgWithdrawProposal.fromPartial(value) + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.group.v1.MsgVote", + value: MsgVote.fromPartial(value) + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.group.v1.MsgExec", + value: MsgExec.fromPartial(value) + }; + }, + leaveGroup(value: MsgLeaveGroup) { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + value: MsgLeaveGroup.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/tx.rpc.msg.ts b/util/inj-types/cosmos/group/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..30035247 --- /dev/null +++ b/util/inj-types/cosmos/group/v1/tx.rpc.msg.ts @@ -0,0 +1,124 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgCreateGroup, MsgCreateGroupResponse, MsgUpdateGroupMembers, MsgUpdateGroupMembersResponse, MsgUpdateGroupAdmin, MsgUpdateGroupAdminResponse, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataResponse, MsgCreateGroupPolicy, MsgCreateGroupPolicyResponse, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicyResponse, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataResponse, MsgSubmitProposal, MsgSubmitProposalResponse, MsgWithdrawProposal, MsgWithdrawProposalResponse, MsgVote, MsgVoteResponse, MsgExec, MsgExecResponse, MsgLeaveGroup, MsgLeaveGroupResponse } from "./tx"; +/** Msg is the cosmos.group.v1 Msg service. */ +export interface Msg { + /** CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. */ + createGroup(request: MsgCreateGroup): Promise; + /** UpdateGroupMembers updates the group members with given group id and admin address. */ + updateGroupMembers(request: MsgUpdateGroupMembers): Promise; + /** UpdateGroupAdmin updates the group admin with given group id and previous admin address. */ + updateGroupAdmin(request: MsgUpdateGroupAdmin): Promise; + /** UpdateGroupMetadata updates the group metadata with given group id and admin address. */ + updateGroupMetadata(request: MsgUpdateGroupMetadata): Promise; + /** CreateGroupPolicy creates a new group policy using given DecisionPolicy. */ + createGroupPolicy(request: MsgCreateGroupPolicy): Promise; + /** CreateGroupWithPolicy creates a new group with policy. */ + createGroupWithPolicy(request: MsgCreateGroupWithPolicy): Promise; + /** UpdateGroupPolicyAdmin updates a group policy admin. */ + updateGroupPolicyAdmin(request: MsgUpdateGroupPolicyAdmin): Promise; + /** UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. */ + updateGroupPolicyDecisionPolicy(request: MsgUpdateGroupPolicyDecisionPolicy): Promise; + /** UpdateGroupPolicyMetadata updates a group policy metadata. */ + updateGroupPolicyMetadata(request: MsgUpdateGroupPolicyMetadata): Promise; + /** SubmitProposal submits a new proposal. */ + submitProposal(request: MsgSubmitProposal): Promise; + /** WithdrawProposal withdraws a proposal. */ + withdrawProposal(request: MsgWithdrawProposal): Promise; + /** Vote allows a voter to vote on a proposal. */ + vote(request: MsgVote): Promise; + /** Exec executes a proposal. */ + exec(request: MsgExec): Promise; + /** LeaveGroup allows a group member to leave the group. */ + leaveGroup(request: MsgLeaveGroup): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. */ + createGroup = async (request: MsgCreateGroup): Promise => { + const data = MsgCreateGroup.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "CreateGroup", data); + return promise.then(data => MsgCreateGroupResponse.decode(new BinaryReader(data))); + }; + /* UpdateGroupMembers updates the group members with given group id and admin address. */ + updateGroupMembers = async (request: MsgUpdateGroupMembers): Promise => { + const data = MsgUpdateGroupMembers.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "UpdateGroupMembers", data); + return promise.then(data => MsgUpdateGroupMembersResponse.decode(new BinaryReader(data))); + }; + /* UpdateGroupAdmin updates the group admin with given group id and previous admin address. */ + updateGroupAdmin = async (request: MsgUpdateGroupAdmin): Promise => { + const data = MsgUpdateGroupAdmin.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "UpdateGroupAdmin", data); + return promise.then(data => MsgUpdateGroupAdminResponse.decode(new BinaryReader(data))); + }; + /* UpdateGroupMetadata updates the group metadata with given group id and admin address. */ + updateGroupMetadata = async (request: MsgUpdateGroupMetadata): Promise => { + const data = MsgUpdateGroupMetadata.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "UpdateGroupMetadata", data); + return promise.then(data => MsgUpdateGroupMetadataResponse.decode(new BinaryReader(data))); + }; + /* CreateGroupPolicy creates a new group policy using given DecisionPolicy. */ + createGroupPolicy = async (request: MsgCreateGroupPolicy): Promise => { + const data = MsgCreateGroupPolicy.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "CreateGroupPolicy", data); + return promise.then(data => MsgCreateGroupPolicyResponse.decode(new BinaryReader(data))); + }; + /* CreateGroupWithPolicy creates a new group with policy. */ + createGroupWithPolicy = async (request: MsgCreateGroupWithPolicy): Promise => { + const data = MsgCreateGroupWithPolicy.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "CreateGroupWithPolicy", data); + return promise.then(data => MsgCreateGroupWithPolicyResponse.decode(new BinaryReader(data))); + }; + /* UpdateGroupPolicyAdmin updates a group policy admin. */ + updateGroupPolicyAdmin = async (request: MsgUpdateGroupPolicyAdmin): Promise => { + const data = MsgUpdateGroupPolicyAdmin.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "UpdateGroupPolicyAdmin", data); + return promise.then(data => MsgUpdateGroupPolicyAdminResponse.decode(new BinaryReader(data))); + }; + /* UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. */ + updateGroupPolicyDecisionPolicy = async (request: MsgUpdateGroupPolicyDecisionPolicy): Promise => { + const data = MsgUpdateGroupPolicyDecisionPolicy.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "UpdateGroupPolicyDecisionPolicy", data); + return promise.then(data => MsgUpdateGroupPolicyDecisionPolicyResponse.decode(new BinaryReader(data))); + }; + /* UpdateGroupPolicyMetadata updates a group policy metadata. */ + updateGroupPolicyMetadata = async (request: MsgUpdateGroupPolicyMetadata): Promise => { + const data = MsgUpdateGroupPolicyMetadata.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "UpdateGroupPolicyMetadata", data); + return promise.then(data => MsgUpdateGroupPolicyMetadataResponse.decode(new BinaryReader(data))); + }; + /* SubmitProposal submits a new proposal. */ + submitProposal = async (request: MsgSubmitProposal): Promise => { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "SubmitProposal", data); + return promise.then(data => MsgSubmitProposalResponse.decode(new BinaryReader(data))); + }; + /* WithdrawProposal withdraws a proposal. */ + withdrawProposal = async (request: MsgWithdrawProposal): Promise => { + const data = MsgWithdrawProposal.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "WithdrawProposal", data); + return promise.then(data => MsgWithdrawProposalResponse.decode(new BinaryReader(data))); + }; + /* Vote allows a voter to vote on a proposal. */ + vote = async (request: MsgVote): Promise => { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "Vote", data); + return promise.then(data => MsgVoteResponse.decode(new BinaryReader(data))); + }; + /* Exec executes a proposal. */ + exec = async (request: MsgExec): Promise => { + const data = MsgExec.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "Exec", data); + return promise.then(data => MsgExecResponse.decode(new BinaryReader(data))); + }; + /* LeaveGroup allows a group member to leave the group. */ + leaveGroup = async (request: MsgLeaveGroup): Promise => { + const data = MsgLeaveGroup.encode(request).finish(); + const promise = this.rpc.request("cosmos.group.v1.Msg", "LeaveGroup", data); + return promise.then(data => MsgLeaveGroupResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/tx.ts b/util/inj-types/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..3512cfc8 --- /dev/null +++ b/util/inj-types/cosmos/group/v1/tx.ts @@ -0,0 +1,3157 @@ +import { MemberRequest, MemberRequestAmino, MemberRequestSDKType, VoteOption, ProposalExecutorResult, ThresholdDecisionPolicy, ThresholdDecisionPolicyProtoMsg, ThresholdDecisionPolicySDKType, PercentageDecisionPolicy, PercentageDecisionPolicyProtoMsg, PercentageDecisionPolicySDKType } from "./types"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** Exec defines modes of execution of a proposal on creation or on new vote. */ +export enum Exec { + /** + * EXEC_UNSPECIFIED - An empty value means that there should be a separate + * MsgExec request for the proposal to execute. + */ + EXEC_UNSPECIFIED = 0, + /** + * EXEC_TRY - Try to execute the proposal immediately. + * If the proposal is not allowed per the DecisionPolicy, + * the proposal will still be open and could + * be executed at a later point. + */ + EXEC_TRY = 1, + UNRECOGNIZED = -1, +} +export const ExecSDKType = Exec; +export const ExecAmino = Exec; +export function execFromJSON(object: any): Exec { + switch (object) { + case 0: + case "EXEC_UNSPECIFIED": + return Exec.EXEC_UNSPECIFIED; + case 1: + case "EXEC_TRY": + return Exec.EXEC_TRY; + case -1: + case "UNRECOGNIZED": + default: + return Exec.UNRECOGNIZED; + } +} +export function execToJSON(object: Exec): string { + switch (object) { + case Exec.EXEC_UNSPECIFIED: + return "EXEC_UNSPECIFIED"; + case Exec.EXEC_TRY: + return "EXEC_TRY"; + case Exec.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** MsgCreateGroup is the Msg/CreateGroup request type. */ +export interface MsgCreateGroup { + /** admin is the account address of the group admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** metadata is any arbitrary metadata to attached to the group. */ + metadata: string; +} +export interface MsgCreateGroupProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroup"; + value: Uint8Array; +} +/** MsgCreateGroup is the Msg/CreateGroup request type. */ +export interface MsgCreateGroupAmino { + /** admin is the account address of the group admin. */ + admin?: string; + /** members defines the group members. */ + members: MemberRequestAmino[]; + /** metadata is any arbitrary metadata to attached to the group. */ + metadata?: string; +} +export interface MsgCreateGroupAminoMsg { + type: "cosmos-sdk/MsgCreateGroup"; + value: MsgCreateGroupAmino; +} +/** MsgCreateGroup is the Msg/CreateGroup request type. */ +export interface MsgCreateGroupSDKType { + admin: string; + members: MemberRequestSDKType[]; + metadata: string; +} +/** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ +export interface MsgCreateGroupResponse { + /** group_id is the unique ID of the newly created group. */ + groupId: bigint; +} +export interface MsgCreateGroupResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse"; + value: Uint8Array; +} +/** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ +export interface MsgCreateGroupResponseAmino { + /** group_id is the unique ID of the newly created group. */ + group_id?: string; +} +export interface MsgCreateGroupResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupResponse"; + value: MsgCreateGroupResponseAmino; +} +/** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ +export interface MsgCreateGroupResponseSDKType { + group_id: bigint; +} +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembers { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + memberUpdates: MemberRequest[]; +} +export interface MsgUpdateGroupMembersProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers"; + value: Uint8Array; +} +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembersAmino { + /** admin is the account address of the group admin. */ + admin?: string; + /** group_id is the unique ID of the group. */ + group_id?: string; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + member_updates: MemberRequestAmino[]; +} +export interface MsgUpdateGroupMembersAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMembers"; + value: MsgUpdateGroupMembersAmino; +} +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembersSDKType { + admin: string; + group_id: bigint; + member_updates: MemberRequestSDKType[]; +} +/** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ +export interface MsgUpdateGroupMembersResponse {} +export interface MsgUpdateGroupMembersResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ +export interface MsgUpdateGroupMembersResponseAmino {} +export interface MsgUpdateGroupMembersResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMembersResponse"; + value: MsgUpdateGroupMembersResponseAmino; +} +/** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ +export interface MsgUpdateGroupMembersResponseSDKType {} +/** MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type. */ +export interface MsgUpdateGroupAdmin { + /** admin is the current account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** new_admin is the group new admin account address. */ + newAdmin: string; +} +export interface MsgUpdateGroupAdminProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin"; + value: Uint8Array; +} +/** MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type. */ +export interface MsgUpdateGroupAdminAmino { + /** admin is the current account address of the group admin. */ + admin?: string; + /** group_id is the unique ID of the group. */ + group_id?: string; + /** new_admin is the group new admin account address. */ + new_admin?: string; +} +export interface MsgUpdateGroupAdminAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupAdmin"; + value: MsgUpdateGroupAdminAmino; +} +/** MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type. */ +export interface MsgUpdateGroupAdminSDKType { + admin: string; + group_id: bigint; + new_admin: string; +} +/** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ +export interface MsgUpdateGroupAdminResponse {} +export interface MsgUpdateGroupAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ +export interface MsgUpdateGroupAdminResponseAmino {} +export interface MsgUpdateGroupAdminResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupAdminResponse"; + value: MsgUpdateGroupAdminResponseAmino; +} +/** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ +export interface MsgUpdateGroupAdminResponseSDKType {} +/** MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type. */ +export interface MsgUpdateGroupMetadata { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** metadata is the updated group's metadata. */ + metadata: string; +} +export interface MsgUpdateGroupMetadataProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata"; + value: Uint8Array; +} +/** MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type. */ +export interface MsgUpdateGroupMetadataAmino { + /** admin is the account address of the group admin. */ + admin?: string; + /** group_id is the unique ID of the group. */ + group_id?: string; + /** metadata is the updated group's metadata. */ + metadata?: string; +} +export interface MsgUpdateGroupMetadataAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMetadata"; + value: MsgUpdateGroupMetadataAmino; +} +/** MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type. */ +export interface MsgUpdateGroupMetadataSDKType { + admin: string; + group_id: bigint; + metadata: string; +} +/** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ +export interface MsgUpdateGroupMetadataResponse {} +export interface MsgUpdateGroupMetadataResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ +export interface MsgUpdateGroupMetadataResponseAmino {} +export interface MsgUpdateGroupMetadataResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMetadataResponse"; + value: MsgUpdateGroupMetadataResponseAmino; +} +/** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ +export interface MsgUpdateGroupMetadataResponseSDKType {} +/** MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type. */ +export interface MsgCreateGroupPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata: string; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined; +} +export interface MsgCreateGroupPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy"; + value: Uint8Array; +} +export type MsgCreateGroupPolicyEncoded = Omit & { + /** decision_policy specifies the group policy's decision policy. */decisionPolicy?: ThresholdDecisionPolicyProtoMsg | PercentageDecisionPolicyProtoMsg | AnyProtoMsg | undefined; +}; +/** MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type. */ +export interface MsgCreateGroupPolicyAmino { + /** admin is the account address of the group admin. */ + admin?: string; + /** group_id is the unique ID of the group. */ + group_id?: string; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata?: string; + /** decision_policy specifies the group policy's decision policy. */ + decision_policy?: AnyAmino; +} +export interface MsgCreateGroupPolicyAminoMsg { + type: "cosmos-sdk/MsgCreateGroupPolicy"; + value: MsgCreateGroupPolicyAmino; +} +/** MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type. */ +export interface MsgCreateGroupPolicySDKType { + admin: string; + group_id: bigint; + metadata: string; + decision_policy?: ThresholdDecisionPolicySDKType | PercentageDecisionPolicySDKType | AnySDKType | undefined; +} +/** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ +export interface MsgCreateGroupPolicyResponse { + /** address is the account address of the newly created group policy. */ + address: string; +} +export interface MsgCreateGroupPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse"; + value: Uint8Array; +} +/** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ +export interface MsgCreateGroupPolicyResponseAmino { + /** address is the account address of the newly created group policy. */ + address?: string; +} +export interface MsgCreateGroupPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupPolicyResponse"; + value: MsgCreateGroupPolicyResponseAmino; +} +/** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ +export interface MsgCreateGroupPolicyResponseSDKType { + address: string; +} +/** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ +export interface MsgUpdateGroupPolicyAdmin { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of the group policy. */ + groupPolicyAddress: string; + /** new_admin is the new group policy admin. */ + newAdmin: string; +} +export interface MsgUpdateGroupPolicyAdminProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ +export interface MsgUpdateGroupPolicyAdminAmino { + /** admin is the account address of the group admin. */ + admin?: string; + /** group_policy_address is the account address of the group policy. */ + group_policy_address?: string; + /** new_admin is the new group policy admin. */ + new_admin?: string; +} +export interface MsgUpdateGroupPolicyAdminAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdmin"; + value: MsgUpdateGroupPolicyAdminAmino; +} +/** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ +export interface MsgUpdateGroupPolicyAdminSDKType { + admin: string; + group_policy_address: string; + new_admin: string; +} +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse {} +export interface MsgUpdateGroupPolicyAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponseAmino {} +export interface MsgUpdateGroupPolicyAdminResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse"; + value: MsgUpdateGroupPolicyAdminResponseAmino; +} +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponseSDKType {} +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicy { + /** admin is the account address of the group and group policy admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + groupMetadata: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + groupPolicyMetadata: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + groupPolicyAsAdmin: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined; +} +export interface MsgCreateGroupWithPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy"; + value: Uint8Array; +} +export type MsgCreateGroupWithPolicyEncoded = Omit & { + /** decision_policy specifies the group policy's decision policy. */decisionPolicy?: ThresholdDecisionPolicyProtoMsg | PercentageDecisionPolicyProtoMsg | AnyProtoMsg | undefined; +}; +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicyAmino { + /** admin is the account address of the group and group policy admin. */ + admin?: string; + /** members defines the group members. */ + members: MemberRequestAmino[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + group_metadata?: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + group_policy_metadata?: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + group_policy_as_admin?: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decision_policy?: AnyAmino; +} +export interface MsgCreateGroupWithPolicyAminoMsg { + type: "cosmos-sdk/MsgCreateGroupWithPolicy"; + value: MsgCreateGroupWithPolicyAmino; +} +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicySDKType { + admin: string; + members: MemberRequestSDKType[]; + group_metadata: string; + group_policy_metadata: string; + group_policy_as_admin: boolean; + decision_policy?: ThresholdDecisionPolicySDKType | PercentageDecisionPolicySDKType | AnySDKType | undefined; +} +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** group_id is the unique ID of the newly created group with policy. */ + groupId: bigint; + /** group_policy_address is the account address of the newly created group policy. */ + groupPolicyAddress: string; +} +export interface MsgCreateGroupWithPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse"; + value: Uint8Array; +} +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponseAmino { + /** group_id is the unique ID of the newly created group with policy. */ + group_id?: string; + /** group_policy_address is the account address of the newly created group policy. */ + group_policy_address?: string; +} +export interface MsgCreateGroupWithPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupWithPolicyResponse"; + value: MsgCreateGroupWithPolicyResponseAmino; +} +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponseSDKType { + group_id: bigint; + group_policy_address: string; +} +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** decision_policy is the updated group policy's decision policy. */ + decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined; +} +export interface MsgUpdateGroupPolicyDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy"; + value: Uint8Array; +} +export type MsgUpdateGroupPolicyDecisionPolicyEncoded = Omit & { + /** decision_policy is the updated group policy's decision policy. */decisionPolicy?: ThresholdDecisionPolicyProtoMsg | PercentageDecisionPolicyProtoMsg | AnyProtoMsg | undefined; +}; +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyAmino { + /** admin is the account address of the group admin. */ + admin?: string; + /** group_policy_address is the account address of group policy. */ + group_policy_address?: string; + /** decision_policy is the updated group policy's decision policy. */ + decision_policy?: AnyAmino; +} +export interface MsgUpdateGroupPolicyDecisionPolicyAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupDecisionPolicy"; + value: MsgUpdateGroupPolicyDecisionPolicyAmino; +} +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicySDKType { + admin: string; + group_policy_address: string; + decision_policy?: ThresholdDecisionPolicySDKType | PercentageDecisionPolicySDKType | AnySDKType | undefined; +} +/** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyResponse {} +export interface MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyResponseAmino {} +export interface MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse"; + value: MsgUpdateGroupPolicyDecisionPolicyResponseAmino; +} +/** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyResponseSDKType {} +/** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ +export interface MsgUpdateGroupPolicyMetadata { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** metadata is the group policy metadata to be updated. */ + metadata: string; +} +export interface MsgUpdateGroupPolicyMetadataProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ +export interface MsgUpdateGroupPolicyMetadataAmino { + /** admin is the account address of the group admin. */ + admin?: string; + /** group_policy_address is the account address of group policy. */ + group_policy_address?: string; + /** metadata is the group policy metadata to be updated. */ + metadata?: string; +} +export interface MsgUpdateGroupPolicyMetadataAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadata"; + value: MsgUpdateGroupPolicyMetadataAmino; +} +/** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ +export interface MsgUpdateGroupPolicyMetadataSDKType { + admin: string; + group_policy_address: string; + metadata: string; +} +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse {} +export interface MsgUpdateGroupPolicyMetadataResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponseAmino {} +export interface MsgUpdateGroupPolicyMetadataResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse"; + value: MsgUpdateGroupPolicyMetadataResponseAmino; +} +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponseSDKType {} +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal"; + value: Uint8Array; +} +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposalAmino { + /** group_policy_address is the account address of group policy. */ + group_policy_address?: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers?: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata?: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages?: AnyAmino[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec?: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title?: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary?: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/group/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposalSDKType { + group_policy_address: string; + proposers: string[]; + metadata: string; + messages: AnySDKType[]; + exec: Exec; + title: string; + summary: string; +} +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id?: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseSDKType { + proposal_id: bigint; +} +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; + /** address is the admin of the group policy or one of the proposer of the proposal. */ + address: string; +} +export interface MsgWithdrawProposalProtoMsg { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal"; + value: Uint8Array; +} +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposalAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id?: string; + /** address is the admin of the group policy or one of the proposer of the proposal. */ + address?: string; +} +export interface MsgWithdrawProposalAminoMsg { + type: "cosmos-sdk/group/MsgWithdrawProposal"; + value: MsgWithdrawProposalAmino; +} +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposalSDKType { + proposal_id: bigint; + address: string; +} +/** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ +export interface MsgWithdrawProposalResponse {} +export interface MsgWithdrawProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse"; + value: Uint8Array; +} +/** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ +export interface MsgWithdrawProposalResponseAmino {} +export interface MsgWithdrawProposalResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawProposalResponse"; + value: MsgWithdrawProposalResponseAmino; +} +/** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ +export interface MsgWithdrawProposalResponseSDKType {} +/** MsgVote is the Msg/Vote request type. */ +export interface MsgVote { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; + /** voter is the voter account address. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.group.v1.MsgVote"; + value: Uint8Array; +} +/** MsgVote is the Msg/Vote request type. */ +export interface MsgVoteAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id?: string; + /** voter is the voter account address. */ + voter?: string; + /** option is the voter's choice on the proposal. */ + option?: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata?: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec?: Exec; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/group/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVote is the Msg/Vote request type. */ +export interface MsgVoteSDKType { + proposal_id: bigint; + voter: string; + option: VoteOption; + metadata: string; + exec: Exec; +} +/** MsgVoteResponse is the Msg/Vote response type. */ +export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse is the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} +/** MsgVoteResponse is the Msg/Vote response type. */ +export interface MsgVoteResponseSDKType {} +/** MsgExec is the Msg/Exec request type. */ +export interface MsgExec { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; + /** executor is the account address used to execute the proposal. */ + executor: string; +} +export interface MsgExecProtoMsg { + typeUrl: "/cosmos.group.v1.MsgExec"; + value: Uint8Array; +} +/** MsgExec is the Msg/Exec request type. */ +export interface MsgExecAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id?: string; + /** executor is the account address used to execute the proposal. */ + executor?: string; +} +export interface MsgExecAminoMsg { + type: "cosmos-sdk/group/MsgExec"; + value: MsgExecAmino; +} +/** MsgExec is the Msg/Exec request type. */ +export interface MsgExecSDKType { + proposal_id: bigint; + executor: string; +} +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { + /** result is the final result of the proposal execution. */ + result: ProposalExecutorResult; +} +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgExecResponse"; + value: Uint8Array; +} +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponseAmino { + /** result is the final result of the proposal execution. */ + result?: ProposalExecutorResult; +} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponseSDKType { + result: ProposalExecutorResult; +} +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroup { + /** address is the account address of the group member. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; +} +export interface MsgLeaveGroupProtoMsg { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup"; + value: Uint8Array; +} +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroupAmino { + /** address is the account address of the group member. */ + address?: string; + /** group_id is the unique ID of the group. */ + group_id?: string; +} +export interface MsgLeaveGroupAminoMsg { + type: "cosmos-sdk/group/MsgLeaveGroup"; + value: MsgLeaveGroupAmino; +} +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroupSDKType { + address: string; + group_id: bigint; +} +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse {} +export interface MsgLeaveGroupResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse"; + value: Uint8Array; +} +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponseAmino {} +export interface MsgLeaveGroupResponseAminoMsg { + type: "cosmos-sdk/MsgLeaveGroupResponse"; + value: MsgLeaveGroupResponseAmino; +} +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponseSDKType {} +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { + admin: "", + members: [], + metadata: "" + }; +} +export const MsgCreateGroup = { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + aminoType: "cosmos-sdk/MsgCreateGroup", + encode(message: MsgCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.members.push(MemberRequest.decode(reader, reader.uint32())); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map(e => MemberRequest.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgCreateGroupAmino): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + message.members = object.members?.map(e => MemberRequest.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + if (message.members) { + obj.members = message.members.map(e => e ? MemberRequest.toAmino(e) : undefined); + } else { + obj.members = message.members; + } + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { + return MsgCreateGroup.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroup): MsgCreateGroupAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroup", + value: MsgCreateGroup.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupProtoMsg): MsgCreateGroup { + return MsgCreateGroup.decode(message.value); + }, + toProto(message: MsgCreateGroup): Uint8Array { + return MsgCreateGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroup): MsgCreateGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + value: MsgCreateGroup.encode(message).finish() + }; + } +}; +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { + groupId: BigInt(0) + }; +} +export const MsgCreateGroupResponse = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", + aminoType: "cosmos-sdk/MsgCreateGroupResponse", + encode(message: MsgCreateGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgCreateGroupResponseAmino): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { + return MsgCreateGroupResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupResponse): MsgCreateGroupResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupResponse", + value: MsgCreateGroupResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupResponseProtoMsg): MsgCreateGroupResponse { + return MsgCreateGroupResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupResponse): Uint8Array { + return MsgCreateGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupResponse): MsgCreateGroupResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", + value: MsgCreateGroupResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { + admin: "", + groupId: BigInt(0), + memberUpdates: [] + }; +} +export const MsgUpdateGroupMembers = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + aminoType: "cosmos-sdk/MsgUpdateGroupMembers", + encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + for (const v of message.memberUpdates) { + MemberRequest.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.memberUpdates.push(MemberRequest.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.memberUpdates = object.memberUpdates?.map(e => MemberRequest.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgUpdateGroupMembersAmino): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + message.memberUpdates = object.member_updates?.map(e => MemberRequest.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + if (message.memberUpdates) { + obj.member_updates = message.memberUpdates.map(e => e ? MemberRequest.toAmino(e) : undefined); + } else { + obj.member_updates = message.memberUpdates; + } + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMembersAminoMsg): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMembers", + value: MsgUpdateGroupMembers.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMembersProtoMsg): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.decode(message.value); + }, + toProto(message: MsgUpdateGroupMembers): Uint8Array { + return MsgUpdateGroupMembers.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + value: MsgUpdateGroupMembers.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} +export const MsgUpdateGroupMembersResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupMembersResponse", + encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupMembersResponseAmino): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMembersResponseAminoMsg): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMembersResponse", + value: MsgUpdateGroupMembersResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMembersResponseProtoMsg): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupMembersResponse): Uint8Array { + return MsgUpdateGroupMembersResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", + value: MsgUpdateGroupMembersResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { + admin: "", + groupId: BigInt(0), + newAdmin: "" + }; +} +export const MsgUpdateGroupAdmin = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + aminoType: "cosmos-sdk/MsgUpdateGroupAdmin", + encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.newAdmin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.newAdmin = object.newAdmin ?? ""; + return message; + }, + fromAmino(object: MsgUpdateGroupAdminAmino): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + return message; + }, + toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupAdmin", + value: MsgUpdateGroupAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupAdminProtoMsg): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.decode(message.value); + }, + toProto(message: MsgUpdateGroupAdmin): Uint8Array { + return MsgUpdateGroupAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + value: MsgUpdateGroupAdmin.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} +export const MsgUpdateGroupAdminResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupAdminResponse", + encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupAdminResponseAmino): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupAdminResponseAminoMsg): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupAdminResponse", + value: MsgUpdateGroupAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupAdminResponseProtoMsg): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupAdminResponse): Uint8Array { + return MsgUpdateGroupAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", + value: MsgUpdateGroupAdminResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { + admin: "", + groupId: BigInt(0), + metadata: "" + }; +} +export const MsgUpdateGroupMetadata = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + aminoType: "cosmos-sdk/MsgUpdateGroupMetadata", + encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgUpdateGroupMetadataAmino): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMetadata", + value: MsgUpdateGroupMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMetadataProtoMsg): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.decode(message.value); + }, + toProto(message: MsgUpdateGroupMetadata): Uint8Array { + return MsgUpdateGroupMetadata.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + value: MsgUpdateGroupMetadata.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} +export const MsgUpdateGroupMetadataResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupMetadataResponse", + encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupMetadataResponseAmino): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMetadataResponseAminoMsg): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMetadataResponse", + value: MsgUpdateGroupMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMetadataResponseProtoMsg): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupMetadataResponse): Uint8Array { + return MsgUpdateGroupMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", + value: MsgUpdateGroupMetadataResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { + admin: "", + groupId: BigInt(0), + metadata: "", + decisionPolicy: undefined + }; +} +export const MsgCreateGroupPolicy = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + aminoType: "cosmos-sdk/MsgCreateGroupPolicy", + encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decisionPolicy !== undefined) { + Any.encode((message.decisionPolicy as Any), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.decisionPolicy = (Cosmos_groupv1DecisionPolicy_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.metadata = object.metadata ?? ""; + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; + return message; + }, + fromAmino(object: MsgCreateGroupPolicyAmino): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = Cosmos_groupv1DecisionPolicy_FromAmino(object.decision_policy); + } + return message; + }, + toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.decision_policy = message.decisionPolicy ? Cosmos_groupv1DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupPolicyAminoMsg): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupPolicy", + value: MsgCreateGroupPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupPolicyProtoMsg): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.decode(message.value); + }, + toProto(message: MsgCreateGroupPolicy): Uint8Array { + return MsgCreateGroupPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + value: MsgCreateGroupPolicy.encode(message).finish() + }; + } +}; +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { + address: "" + }; +} +export const MsgCreateGroupPolicyResponse = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", + aminoType: "cosmos-sdk/MsgCreateGroupPolicyResponse", + encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicyResponse(); + 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: DeepPartial): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: MsgCreateGroupPolicyResponseAmino): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupPolicyResponse", + value: MsgCreateGroupPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupPolicyResponseProtoMsg): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupPolicyResponse): Uint8Array { + return MsgCreateGroupPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", + value: MsgCreateGroupPolicyResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { + admin: "", + groupPolicyAddress: "", + newAdmin: "" + }; +} +export const MsgUpdateGroupPolicyAdmin = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", + encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + case 3: + message.newAdmin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, + fromAmino(object: MsgUpdateGroupPolicyAdminAmino): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", + value: MsgUpdateGroupPolicyAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyAdminProtoMsg): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyAdmin): Uint8Array { + return MsgUpdateGroupPolicyAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + value: MsgUpdateGroupPolicyAdmin.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} +export const MsgUpdateGroupPolicyAdminResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse", + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupPolicyAdminResponseAmino): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyAdminResponseAminoMsg): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse", + value: MsgUpdateGroupPolicyAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyAdminResponseProtoMsg): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyAdminResponse): Uint8Array { + return MsgUpdateGroupPolicyAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", + value: MsgUpdateGroupPolicyAdminResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + groupMetadata: "", + groupPolicyMetadata: "", + groupPolicyAsAdmin: false, + decisionPolicy: undefined + }; +} +export const MsgCreateGroupWithPolicy = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + aminoType: "cosmos-sdk/MsgCreateGroupWithPolicy", + encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.groupMetadata !== "") { + writer.uint32(26).string(message.groupMetadata); + } + if (message.groupPolicyMetadata !== "") { + writer.uint32(34).string(message.groupPolicyMetadata); + } + if (message.groupPolicyAsAdmin === true) { + writer.uint32(40).bool(message.groupPolicyAsAdmin); + } + if (message.decisionPolicy !== undefined) { + Any.encode((message.decisionPolicy as Any), writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.members.push(MemberRequest.decode(reader, reader.uint32())); + break; + case 3: + message.groupMetadata = reader.string(); + break; + case 4: + message.groupPolicyMetadata = reader.string(); + break; + case 5: + message.groupPolicyAsAdmin = reader.bool(); + break; + case 6: + message.decisionPolicy = (Cosmos_groupv1DecisionPolicy_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map(e => MemberRequest.fromPartial(e)) || []; + message.groupMetadata = object.groupMetadata ?? ""; + message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; + message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; + return message; + }, + fromAmino(object: MsgCreateGroupWithPolicyAmino): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + message.members = object.members?.map(e => MemberRequest.fromAmino(e)) || []; + if (object.group_metadata !== undefined && object.group_metadata !== null) { + message.groupMetadata = object.group_metadata; + } + if (object.group_policy_metadata !== undefined && object.group_policy_metadata !== null) { + message.groupPolicyMetadata = object.group_policy_metadata; + } + if (object.group_policy_as_admin !== undefined && object.group_policy_as_admin !== null) { + message.groupPolicyAsAdmin = object.group_policy_as_admin; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = Cosmos_groupv1DecisionPolicy_FromAmino(object.decision_policy); + } + return message; + }, + toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + if (message.members) { + obj.members = message.members.map(e => e ? MemberRequest.toAmino(e) : undefined); + } else { + obj.members = message.members; + } + obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; + obj.decision_policy = message.decisionPolicy ? Cosmos_groupv1DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupWithPolicyAminoMsg): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupWithPolicy", + value: MsgCreateGroupWithPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupWithPolicyProtoMsg): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.decode(message.value); + }, + toProto(message: MsgCreateGroupWithPolicy): Uint8Array { + return MsgCreateGroupWithPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + value: MsgCreateGroupWithPolicy.encode(message).finish() + }; + } +}; +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { + groupId: BigInt(0), + groupPolicyAddress: "" + }; +} +export const MsgCreateGroupWithPolicyResponse = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", + aminoType: "cosmos-sdk/MsgCreateGroupWithPolicyResponse", + encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + return message; + }, + fromAmino(object: MsgCreateGroupWithPolicyResponseAmino): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + return message; + }, + toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupWithPolicyResponse", + value: MsgCreateGroupWithPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupWithPolicyResponseProtoMsg): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupWithPolicyResponse): Uint8Array { + return MsgCreateGroupWithPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", + value: MsgCreateGroupWithPolicyResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: "", + groupPolicyAddress: "", + decisionPolicy: undefined + }; +} +export const MsgUpdateGroupPolicyDecisionPolicy = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + aminoType: "cosmos-sdk/MsgUpdateGroupDecisionPolicy", + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.decisionPolicy !== undefined) { + Any.encode((message.decisionPolicy as Any), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + case 3: + message.decisionPolicy = (Cosmos_groupv1DecisionPolicy_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; + return message; + }, + fromAmino(object: MsgUpdateGroupPolicyDecisionPolicyAmino): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = Cosmos_groupv1DecisionPolicy_FromAmino(object.decision_policy); + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + obj.decision_policy = message.decisionPolicy ? Cosmos_groupv1DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyDecisionPolicyAminoMsg): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupDecisionPolicy", + value: MsgUpdateGroupPolicyDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyProtoMsg): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyDecisionPolicy): Uint8Array { + return MsgUpdateGroupPolicyDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + value: MsgUpdateGroupPolicyDecisionPolicy.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} +export const MsgUpdateGroupPolicyDecisionPolicyResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse", + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupPolicyDecisionPolicyResponseAmino): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse", + value: MsgUpdateGroupPolicyDecisionPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyDecisionPolicyResponse): Uint8Array { + return MsgUpdateGroupPolicyDecisionPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", + value: MsgUpdateGroupPolicyDecisionPolicyResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { + admin: "", + groupPolicyAddress: "", + metadata: "" + }; +} +export const MsgUpdateGroupPolicyMetadata = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", + encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgUpdateGroupPolicyMetadataAmino): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", + value: MsgUpdateGroupPolicyMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyMetadataProtoMsg): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyMetadata): Uint8Array { + return MsgUpdateGroupPolicyMetadata.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + value: MsgUpdateGroupPolicyMetadata.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} +export const MsgUpdateGroupPolicyMetadataResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse", + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupPolicyMetadataResponseAmino): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyMetadataResponseAminoMsg): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse", + value: MsgUpdateGroupPolicyMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyMetadataResponseProtoMsg): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyMetadataResponse): Uint8Array { + return MsgUpdateGroupPolicyMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", + value: MsgUpdateGroupPolicyMetadataResponse.encode(message).finish() + }; + } +}; +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { + groupPolicyAddress: "", + proposers: [], + metadata: "", + messages: [], + exec: 0, + title: "", + summary: "" + }; +} +export const MsgSubmitProposal = { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + aminoType: "cosmos-sdk/group/MsgSubmitProposal", + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupPolicyAddress !== "") { + writer.uint32(10).string(message.groupPolicyAddress); + } + for (const v of message.proposers) { + writer.uint32(18).string(v!); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + if (message.title !== "") { + writer.uint32(50).string(message.title); + } + if (message.summary !== "") { + writer.uint32(58).string(message.summary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupPolicyAddress = reader.string(); + break; + case 2: + message.proposers.push(reader.string()); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 5: + message.exec = (reader.int32() as any); + break; + case 6: + message.title = reader.string(); + break; + case 7: + message.summary = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.proposers = object.proposers?.map(e => e) || []; + message.metadata = object.metadata ?? ""; + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.exec = object.exec ?? 0; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + message.proposers = object.proposers?.map(e => e) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.exec !== undefined && object.exec !== null) { + message.exec = object.exec; + } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + if (message.proposers) { + obj.proposers = message.proposers.map(e => e); + } else { + obj.proposers = message.proposers; + } + obj.metadata = message.metadata === "" ? undefined : message.metadata; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + obj.exec = message.exec === 0 ? undefined : message.exec; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/group/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; + } +}; +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { + proposalId: BigInt(0) + }; +} +export const MsgSubmitProposalResponse = { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", + aminoType: "cosmos-sdk/MsgSubmitProposalResponse", + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; + } +}; +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { + proposalId: BigInt(0), + address: "" + }; +} +export const MsgWithdrawProposal = { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + aminoType: "cosmos-sdk/group/MsgWithdrawProposal", + encode(message: MsgWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: MsgWithdrawProposalAmino): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { + return MsgWithdrawProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawProposal): MsgWithdrawProposalAminoMsg { + return { + type: "cosmos-sdk/group/MsgWithdrawProposal", + value: MsgWithdrawProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawProposalProtoMsg): MsgWithdrawProposal { + return MsgWithdrawProposal.decode(message.value); + }, + toProto(message: MsgWithdrawProposal): Uint8Array { + return MsgWithdrawProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawProposal): MsgWithdrawProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + value: MsgWithdrawProposal.encode(message).finish() + }; + } +}; +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} +export const MsgWithdrawProposalResponse = { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", + aminoType: "cosmos-sdk/MsgWithdrawProposalResponse", + encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, + fromAmino(_: MsgWithdrawProposalResponseAmino): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, + toAmino(_: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgWithdrawProposalResponseAminoMsg): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawProposalResponse", + value: MsgWithdrawProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawProposalResponseProtoMsg): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.decode(message.value); + }, + toProto(message: MsgWithdrawProposalResponse): Uint8Array { + return MsgWithdrawProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", + value: MsgWithdrawProposalResponse.encode(message).finish() + }; + } +}; +function createBaseMsgVote(): MsgVote { + return { + proposalId: BigInt(0), + voter: "", + option: 0, + metadata: "", + exec: 0 + }; +} +export const MsgVote = { + typeUrl: "/cosmos.group.v1.MsgVote", + aminoType: "cosmos-sdk/group/MsgVote", + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.exec = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.exec = object.exec ?? 0; + return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.exec !== undefined && object.exec !== null) { + message.exec = object.exec; + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.exec = message.exec === 0 ? undefined : message.exec; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/group/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgVote", + value: MsgVote.encode(message).finish() + }; + } +}; +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} +export const MsgVoteResponse = { + typeUrl: "/cosmos.group.v1.MsgVoteResponse", + aminoType: "cosmos-sdk/MsgVoteResponse", + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; + } +}; +function createBaseMsgExec(): MsgExec { + return { + proposalId: BigInt(0), + executor: "" + }; +} +export const MsgExec = { + typeUrl: "/cosmos.group.v1.MsgExec", + aminoType: "cosmos-sdk/group/MsgExec", + encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.executor !== "") { + writer.uint32(18).string(message.executor); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.proposalId = reader.uint64(); + break; + case 2: + message.executor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExec { + const message = createBaseMsgExec(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.executor = object.executor ?? ""; + return message; + }, + fromAmino(object: MsgExecAmino): MsgExec { + const message = createBaseMsgExec(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.executor !== undefined && object.executor !== null) { + message.executor = object.executor; + } + return message; + }, + toAmino(message: MsgExec): MsgExecAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.executor = message.executor === "" ? undefined : message.executor; + return obj; + }, + fromAminoMsg(object: MsgExecAminoMsg): MsgExec { + return MsgExec.fromAmino(object.value); + }, + toAminoMsg(message: MsgExec): MsgExecAminoMsg { + return { + type: "cosmos-sdk/group/MsgExec", + value: MsgExec.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecProtoMsg): MsgExec { + return MsgExec.decode(message.value); + }, + toProto(message: MsgExec): Uint8Array { + return MsgExec.encode(message).finish(); + }, + toProtoMsg(message: MsgExec): MsgExecProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgExec", + value: MsgExec.encode(message).finish() + }; + } +}; +function createBaseMsgExecResponse(): MsgExecResponse { + return { + result: 0 + }; +} +export const MsgExecResponse = { + typeUrl: "/cosmos.group.v1.MsgExecResponse", + aminoType: "cosmos-sdk/MsgExecResponse", + encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 2: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgExecResponseAmino): MsgExecResponse { + const message = createBaseMsgExecResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgExecResponse): MsgExecResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); + }, + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish() + }; + } +}; +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { + address: "", + groupId: BigInt(0) + }; +} +export const MsgLeaveGroup = { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + aminoType: "cosmos-sdk/group/MsgLeaveGroup", + encode(message: MsgLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgLeaveGroupAmino): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { + return MsgLeaveGroup.fromAmino(object.value); + }, + toAminoMsg(message: MsgLeaveGroup): MsgLeaveGroupAminoMsg { + return { + type: "cosmos-sdk/group/MsgLeaveGroup", + value: MsgLeaveGroup.toAmino(message) + }; + }, + fromProtoMsg(message: MsgLeaveGroupProtoMsg): MsgLeaveGroup { + return MsgLeaveGroup.decode(message.value); + }, + toProto(message: MsgLeaveGroup): Uint8Array { + return MsgLeaveGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgLeaveGroup): MsgLeaveGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + value: MsgLeaveGroup.encode(message).finish() + }; + } +}; +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} +export const MsgLeaveGroupResponse = { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", + aminoType: "cosmos-sdk/MsgLeaveGroupResponse", + encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgLeaveGroupResponse { + const message = createBaseMsgLeaveGroupResponse(); + return message; + }, + fromAmino(_: MsgLeaveGroupResponseAmino): MsgLeaveGroupResponse { + const message = createBaseMsgLeaveGroupResponse(); + return message; + }, + toAmino(_: MsgLeaveGroupResponse): MsgLeaveGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgLeaveGroupResponseAminoMsg): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgLeaveGroupResponse): MsgLeaveGroupResponseAminoMsg { + return { + type: "cosmos-sdk/MsgLeaveGroupResponse", + value: MsgLeaveGroupResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgLeaveGroupResponseProtoMsg): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.decode(message.value); + }, + toProto(message: MsgLeaveGroupResponse): Uint8Array { + return MsgLeaveGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgLeaveGroupResponse): MsgLeaveGroupResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", + value: MsgLeaveGroupResponse.encode(message).finish() + }; + } +}; +export const Cosmos_groupv1DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.group.v1.ThresholdDecisionPolicy": + return ThresholdDecisionPolicy.decode(data.value); + case "/cosmos.group.v1.PercentageDecisionPolicy": + return PercentageDecisionPolicy.decode(data.value); + default: + return data; + } +}; +export const Cosmos_groupv1DecisionPolicy_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/ThresholdDecisionPolicy": + return Any.fromPartial({ + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.encode(ThresholdDecisionPolicy.fromPartial(ThresholdDecisionPolicy.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/PercentageDecisionPolicy": + return Any.fromPartial({ + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + value: PercentageDecisionPolicy.encode(PercentageDecisionPolicy.fromPartial(PercentageDecisionPolicy.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_groupv1DecisionPolicy_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.group.v1.ThresholdDecisionPolicy": + return { + type: "cosmos-sdk/ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.toAmino(ThresholdDecisionPolicy.decode(content.value, undefined)) + }; + case "/cosmos.group.v1.PercentageDecisionPolicy": + return { + type: "cosmos-sdk/PercentageDecisionPolicy", + value: PercentageDecisionPolicy.toAmino(PercentageDecisionPolicy.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/group/v1/types.ts b/util/inj-types/cosmos/group/v1/types.ts new file mode 100644 index 00000000..87e82106 --- /dev/null +++ b/util/inj-types/cosmos/group/v1/types.ts @@ -0,0 +1,2143 @@ +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; +/** VoteOption enumerates the valid vote options for a given proposal. */ +export enum VoteOption { + /** + * VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will + * return an error. + */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionSDKType = VoteOption; +export const VoteOptionAmino = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalStatus defines proposal statuses. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when submitted. */ + PROPOSAL_STATUS_SUBMITTED = 1, + /** + * PROPOSAL_STATUS_ACCEPTED - Final status of a proposal when the final tally is done and the outcome + * passes the group policy's decision policy. + */ + PROPOSAL_STATUS_ACCEPTED = 2, + /** + * PROPOSAL_STATUS_REJECTED - Final status of a proposal when the final tally is done and the outcome + * is rejected by the group policy's decision policy. + */ + PROPOSAL_STATUS_REJECTED = 3, + /** + * PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group policy is modified before the + * final tally. + */ + PROPOSAL_STATUS_ABORTED = 4, + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be withdrawn before the voting start time by the owner. + * When this happens the final status is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = 5, + UNRECOGNIZED = -1, +} +export const ProposalStatusSDKType = ProposalStatus; +export const ProposalStatusAmino = ProposalStatus; +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_SUBMITTED": + return ProposalStatus.PROPOSAL_STATUS_SUBMITTED; + case 2: + case "PROPOSAL_STATUS_ACCEPTED": + return ProposalStatus.PROPOSAL_STATUS_ACCEPTED; + case 3: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 4: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 5: + case "PROPOSAL_STATUS_WITHDRAWN": + return ProposalStatus.PROPOSAL_STATUS_WITHDRAWN; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: + return "PROPOSAL_STATUS_SUBMITTED"; + case ProposalStatus.PROPOSAL_STATUS_ACCEPTED: + return "PROPOSAL_STATUS_ACCEPTED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalExecutorResult defines types of proposal executor results. */ +export enum ProposalExecutorResult { + /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ + PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, + /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ + PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, + /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ + PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, + /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ + PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, + UNRECOGNIZED = -1, +} +export const ProposalExecutorResultSDKType = ProposalExecutorResult; +export const ProposalExecutorResultAmino = ProposalExecutorResult; +export function proposalExecutorResultFromJSON(object: any): ProposalExecutorResult { + switch (object) { + case 0: + case "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_EXECUTOR_RESULT_NOT_RUN": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN; + case 2: + case "PROPOSAL_EXECUTOR_RESULT_SUCCESS": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS; + case 3: + case "PROPOSAL_EXECUTOR_RESULT_FAILURE": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ProposalExecutorResult.UNRECOGNIZED; + } +} +export function proposalExecutorResultToJSON(object: ProposalExecutorResult): string { + switch (object) { + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: + return "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN: + return "PROPOSAL_EXECUTOR_RESULT_NOT_RUN"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS: + return "PROPOSAL_EXECUTOR_RESULT_SUCCESS"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE: + return "PROPOSAL_EXECUTOR_RESULT_FAILURE"; + case ProposalExecutorResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface Member { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + addedAt: Date; +} +export interface MemberProtoMsg { + typeUrl: "/cosmos.group.v1.Member"; + value: Uint8Array; +} +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface MemberAmino { + /** address is the member's account address. */ + address?: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight?: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata?: string; + /** added_at is a timestamp specifying when a member was added. */ + added_at: string; +} +export interface MemberAminoMsg { + type: "cosmos-sdk/Member"; + value: MemberAmino; +} +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface MemberSDKType { + address: string; + weight: string; + metadata: string; + added_at: Date; +} +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequest { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; +} +export interface MemberRequestProtoMsg { + typeUrl: "/cosmos.group.v1.MemberRequest"; + value: Uint8Array; +} +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequestAmino { + /** address is the member's account address. */ + address?: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight?: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata?: string; +} +export interface MemberRequestAminoMsg { + type: "cosmos-sdk/MemberRequest"; + value: MemberRequestAmino; +} +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequestSDKType { + address: string; + weight: string; + metadata: string; +} +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicy { + $typeUrl?: "/cosmos.group.v1.ThresholdDecisionPolicy"; + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold: string; + /** windows defines the different windows for voting and execution. */ + windows?: DecisionPolicyWindows; +} +export interface ThresholdDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy"; + value: Uint8Array; +} +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicyAmino { + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold?: string; + /** windows defines the different windows for voting and execution. */ + windows?: DecisionPolicyWindowsAmino; +} +export interface ThresholdDecisionPolicyAminoMsg { + type: "cosmos-sdk/ThresholdDecisionPolicy"; + value: ThresholdDecisionPolicyAmino; +} +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicySDKType { + $typeUrl?: "/cosmos.group.v1.ThresholdDecisionPolicy"; + threshold: string; + windows?: DecisionPolicyWindowsSDKType; +} +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicy { + $typeUrl?: "/cosmos.group.v1.PercentageDecisionPolicy"; + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage: string; + /** windows defines the different windows for voting and execution. */ + windows?: DecisionPolicyWindows; +} +export interface PercentageDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy"; + value: Uint8Array; +} +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicyAmino { + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage?: string; + /** windows defines the different windows for voting and execution. */ + windows?: DecisionPolicyWindowsAmino; +} +export interface PercentageDecisionPolicyAminoMsg { + type: "cosmos-sdk/PercentageDecisionPolicy"; + value: PercentageDecisionPolicyAmino; +} +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicySDKType { + $typeUrl?: "/cosmos.group.v1.PercentageDecisionPolicy"; + percentage: string; + windows?: DecisionPolicyWindowsSDKType; +} +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindows { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + votingPeriod: Duration; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + minExecutionPeriod: Duration; +} +export interface DecisionPolicyWindowsProtoMsg { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows"; + value: Uint8Array; +} +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindowsAmino { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + voting_period: DurationAmino; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + min_execution_period: DurationAmino; +} +export interface DecisionPolicyWindowsAminoMsg { + type: "cosmos-sdk/DecisionPolicyWindows"; + value: DecisionPolicyWindowsAmino; +} +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindowsSDKType { + voting_period: DurationSDKType; + min_execution_period: DurationSDKType; +} +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** id is the unique ID of the group. */ + id: bigint; + /** admin is the account address of the group's admin. */ + admin: string; + /** metadata is any arbitrary metadata to attached to the group. */ + metadata: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version: bigint; + /** total_weight is the sum of the group members' weights. */ + totalWeight: string; + /** created_at is a timestamp specifying when a group was created. */ + createdAt: Date; +} +export interface GroupInfoProtoMsg { + typeUrl: "/cosmos.group.v1.GroupInfo"; + value: Uint8Array; +} +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfoAmino { + /** id is the unique ID of the group. */ + id?: string; + /** admin is the account address of the group's admin. */ + admin?: string; + /** metadata is any arbitrary metadata to attached to the group. */ + metadata?: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version?: string; + /** total_weight is the sum of the group members' weights. */ + total_weight?: string; + /** created_at is a timestamp specifying when a group was created. */ + created_at: string; +} +export interface GroupInfoAminoMsg { + type: "cosmos-sdk/GroupInfo"; + value: GroupInfoAmino; +} +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfoSDKType { + id: bigint; + admin: string; + metadata: string; + version: bigint; + total_weight: string; + created_at: Date; +} +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** member is the member data. */ + member?: Member; +} +export interface GroupMemberProtoMsg { + typeUrl: "/cosmos.group.v1.GroupMember"; + value: Uint8Array; +} +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMemberAmino { + /** group_id is the unique ID of the group. */ + group_id?: string; + /** member is the member data. */ + member?: MemberAmino; +} +export interface GroupMemberAminoMsg { + type: "cosmos-sdk/GroupMember"; + value: GroupMemberAmino; +} +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMemberSDKType { + group_id: bigint; + member?: MemberSDKType; +} +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfo { + /** address is the account address of group policy. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** admin is the account address of the group admin. */ + admin: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version: bigint; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined; + /** created_at is a timestamp specifying when a group policy was created. */ + createdAt: Date; +} +export interface GroupPolicyInfoProtoMsg { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo"; + value: Uint8Array; +} +export type GroupPolicyInfoEncoded = Omit & { + /** decision_policy specifies the group policy's decision policy. */decisionPolicy?: ThresholdDecisionPolicyProtoMsg | PercentageDecisionPolicyProtoMsg | AnyProtoMsg | undefined; +}; +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfoAmino { + /** address is the account address of group policy. */ + address?: string; + /** group_id is the unique ID of the group. */ + group_id?: string; + /** admin is the account address of the group admin. */ + admin?: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata?: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version?: string; + /** decision_policy specifies the group policy's decision policy. */ + decision_policy?: AnyAmino; + /** created_at is a timestamp specifying when a group policy was created. */ + created_at: string; +} +export interface GroupPolicyInfoAminoMsg { + type: "cosmos-sdk/GroupPolicyInfo"; + value: GroupPolicyInfoAmino; +} +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfoSDKType { + address: string; + group_id: bigint; + admin: string; + metadata: string; + version: bigint; + decision_policy?: ThresholdDecisionPolicySDKType | PercentageDecisionPolicySDKType | AnySDKType | undefined; + created_at: Date; +} +/** + * Proposal defines a group proposal. Any member of a group can submit a proposal + * for a group policy to decide upon. + * A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal + * passes as well as some optional metadata associated with the proposal. + */ +export interface Proposal { + /** id is the unique id of the proposal. */ + id: bigint; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata: string; + /** proposers are the account addresses of the proposers. */ + proposers: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submitTime: Date; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + groupVersion: bigint; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + groupPolicyVersion: bigint; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + finalTallyResult: TallyResult; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + votingPeriodEnd: Date; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executorResult: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.group.v1.Proposal"; + value: Uint8Array; +} +/** + * Proposal defines a group proposal. Any member of a group can submit a proposal + * for a group policy to decide upon. + * A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal + * passes as well as some optional metadata associated with the proposal. + */ +export interface ProposalAmino { + /** id is the unique id of the proposal. */ + id?: string; + /** group_policy_address is the account address of group policy. */ + group_policy_address?: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata?: string; + /** proposers are the account addresses of the proposers. */ + proposers?: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submit_time: string; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + group_version?: string; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + group_policy_version?: string; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status?: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + final_tally_result: TallyResultAmino; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + voting_period_end: string; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executor_result?: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages?: AnyAmino[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title?: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary?: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/Proposal"; + value: ProposalAmino; +} +/** + * Proposal defines a group proposal. Any member of a group can submit a proposal + * for a group policy to decide upon. + * A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal + * passes as well as some optional metadata associated with the proposal. + */ +export interface ProposalSDKType { + id: bigint; + group_policy_address: string; + metadata: string; + proposers: string[]; + submit_time: Date; + group_version: bigint; + group_policy_version: bigint; + status: ProposalStatus; + final_tally_result: TallyResultSDKType; + voting_period_end: Date; + executor_result: ProposalExecutorResult; + messages: AnySDKType[]; + title: string; + summary: string; +} +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yesCount: string; + /** abstain_count is the weighted sum of abstainers. */ + abstainCount: string; + /** no_count is the weighted sum of no votes. */ + noCount: string; + /** no_with_veto_count is the weighted sum of veto. */ + noWithVetoCount: string; +} +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.group.v1.TallyResult"; + value: Uint8Array; +} +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResultAmino { + /** yes_count is the weighted sum of yes votes. */ + yes_count?: string; + /** abstain_count is the weighted sum of abstainers. */ + abstain_count?: string; + /** no_count is the weighted sum of no votes. */ + no_count?: string; + /** no_with_veto_count is the weighted sum of veto. */ + no_with_veto_count?: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/TallyResult"; + value: TallyResultAmino; +} +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResultSDKType { + yes_count: string; + abstain_count: string; + no_count: string; + no_with_veto_count: string; +} +/** Vote represents a vote for a proposal. */ +export interface Vote { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; + /** voter is the account address of the voter. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submitTime: Date; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.group.v1.Vote"; + value: Uint8Array; +} +/** Vote represents a vote for a proposal. */ +export interface VoteAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id?: string; + /** voter is the account address of the voter. */ + voter?: string; + /** option is the voter's choice on the proposal. */ + option?: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata?: string; + /** submit_time is the timestamp when the vote was submitted. */ + submit_time: string; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/Vote"; + value: VoteAmino; +} +/** Vote represents a vote for a proposal. */ +export interface VoteSDKType { + proposal_id: bigint; + voter: string; + option: VoteOption; + metadata: string; + submit_time: Date; +} +function createBaseMember(): Member { + return { + address: "", + weight: "", + metadata: "", + addedAt: new Date() + }; +} +export const Member = { + typeUrl: "/cosmos.group.v1.Member", + aminoType: "cosmos-sdk/Member", + encode(message: Member, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.addedAt !== undefined) { + Timestamp.encode(toTimestamp(message.addedAt), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Member { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.weight = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.addedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.addedAt = object.addedAt ?? undefined; + return message; + }, + fromAmino(object: MemberAmino): Member { + const message = createBaseMember(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.added_at !== undefined && object.added_at !== null) { + message.addedAt = fromTimestamp(Timestamp.fromAmino(object.added_at)); + } + return message; + }, + toAmino(message: Member): MemberAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : new Date(); + return obj; + }, + fromAminoMsg(object: MemberAminoMsg): Member { + return Member.fromAmino(object.value); + }, + toAminoMsg(message: Member): MemberAminoMsg { + return { + type: "cosmos-sdk/Member", + value: Member.toAmino(message) + }; + }, + fromProtoMsg(message: MemberProtoMsg): Member { + return Member.decode(message.value); + }, + toProto(message: Member): Uint8Array { + return Member.encode(message).finish(); + }, + toProtoMsg(message: Member): MemberProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Member", + value: Member.encode(message).finish() + }; + } +}; +function createBaseMemberRequest(): MemberRequest { + return { + address: "", + weight: "", + metadata: "" + }; +} +export const MemberRequest = { + typeUrl: "/cosmos.group.v1.MemberRequest", + aminoType: "cosmos-sdk/MemberRequest", + encode(message: MemberRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.weight = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MemberRequest { + const message = createBaseMemberRequest(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MemberRequestAmino): MemberRequest { + const message = createBaseMemberRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MemberRequest): MemberRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MemberRequestAminoMsg): MemberRequest { + return MemberRequest.fromAmino(object.value); + }, + toAminoMsg(message: MemberRequest): MemberRequestAminoMsg { + return { + type: "cosmos-sdk/MemberRequest", + value: MemberRequest.toAmino(message) + }; + }, + fromProtoMsg(message: MemberRequestProtoMsg): MemberRequest { + return MemberRequest.decode(message.value); + }, + toProto(message: MemberRequest): Uint8Array { + return MemberRequest.encode(message).finish(); + }, + toProtoMsg(message: MemberRequest): MemberRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MemberRequest", + value: MemberRequest.encode(message).finish() + }; + } +}; +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { + $typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + threshold: "", + windows: undefined + }; +} +export const ThresholdDecisionPolicy = { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + aminoType: "cosmos-sdk/ThresholdDecisionPolicy", + encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.threshold !== "") { + writer.uint32(10).string(message.threshold); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThresholdDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.threshold = reader.string(); + break; + case 2: + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ThresholdDecisionPolicy { + const message = createBaseThresholdDecisionPolicy(); + message.threshold = object.threshold ?? ""; + message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; + return message; + }, + fromAmino(object: ThresholdDecisionPolicyAmino): ThresholdDecisionPolicy { + const message = createBaseThresholdDecisionPolicy(); + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.windows !== undefined && object.windows !== null) { + message.windows = DecisionPolicyWindows.fromAmino(object.windows); + } + return message; + }, + toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { + const obj: any = {}; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; + return obj; + }, + fromAminoMsg(object: ThresholdDecisionPolicyAminoMsg): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: ThresholdDecisionPolicyProtoMsg): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.decode(message.value); + }, + toProto(message: ThresholdDecisionPolicy): Uint8Array { + return ThresholdDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.encode(message).finish() + }; + } +}; +function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { + return { + $typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + percentage: "", + windows: undefined + }; +} +export const PercentageDecisionPolicy = { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + aminoType: "cosmos-sdk/PercentageDecisionPolicy", + encode(message: PercentageDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.percentage !== "") { + writer.uint32(10).string(message.percentage); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePercentageDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.percentage = reader.string(); + break; + case 2: + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PercentageDecisionPolicy { + const message = createBasePercentageDecisionPolicy(); + message.percentage = object.percentage ?? ""; + message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; + return message; + }, + fromAmino(object: PercentageDecisionPolicyAmino): PercentageDecisionPolicy { + const message = createBasePercentageDecisionPolicy(); + if (object.percentage !== undefined && object.percentage !== null) { + message.percentage = object.percentage; + } + if (object.windows !== undefined && object.windows !== null) { + message.windows = DecisionPolicyWindows.fromAmino(object.windows); + } + return message; + }, + toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { + const obj: any = {}; + obj.percentage = message.percentage === "" ? undefined : message.percentage; + obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; + return obj; + }, + fromAminoMsg(object: PercentageDecisionPolicyAminoMsg): PercentageDecisionPolicy { + return PercentageDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: PercentageDecisionPolicy): PercentageDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/PercentageDecisionPolicy", + value: PercentageDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: PercentageDecisionPolicyProtoMsg): PercentageDecisionPolicy { + return PercentageDecisionPolicy.decode(message.value); + }, + toProto(message: PercentageDecisionPolicy): Uint8Array { + return PercentageDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: PercentageDecisionPolicy): PercentageDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + value: PercentageDecisionPolicy.encode(message).finish() + }; + } +}; +function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { + return { + votingPeriod: Duration.fromPartial({}), + minExecutionPeriod: Duration.fromPartial({}) + }; +} +export const DecisionPolicyWindows = { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", + aminoType: "cosmos-sdk/DecisionPolicyWindows", + encode(message: DecisionPolicyWindows, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + if (message.minExecutionPeriod !== undefined) { + Duration.encode(message.minExecutionPeriod, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecisionPolicyWindows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.minExecutionPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + message.minExecutionPeriod = object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null ? Duration.fromPartial(object.minExecutionPeriod) : undefined; + return message; + }, + fromAmino(object: DecisionPolicyWindowsAmino): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + if (object.min_execution_period !== undefined && object.min_execution_period !== null) { + message.minExecutionPeriod = Duration.fromAmino(object.min_execution_period); + } + return message; + }, + toAmino(message: DecisionPolicyWindows): DecisionPolicyWindowsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : Duration.toAmino(Duration.fromPartial({})); + obj.min_execution_period = message.minExecutionPeriod ? Duration.toAmino(message.minExecutionPeriod) : Duration.toAmino(Duration.fromPartial({})); + return obj; + }, + fromAminoMsg(object: DecisionPolicyWindowsAminoMsg): DecisionPolicyWindows { + return DecisionPolicyWindows.fromAmino(object.value); + }, + toAminoMsg(message: DecisionPolicyWindows): DecisionPolicyWindowsAminoMsg { + return { + type: "cosmos-sdk/DecisionPolicyWindows", + value: DecisionPolicyWindows.toAmino(message) + }; + }, + fromProtoMsg(message: DecisionPolicyWindowsProtoMsg): DecisionPolicyWindows { + return DecisionPolicyWindows.decode(message.value); + }, + toProto(message: DecisionPolicyWindows): Uint8Array { + return DecisionPolicyWindows.encode(message).finish(); + }, + toProtoMsg(message: DecisionPolicyWindows): DecisionPolicyWindowsProtoMsg { + return { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", + value: DecisionPolicyWindows.encode(message).finish() + }; + } +}; +function createBaseGroupInfo(): GroupInfo { + return { + id: BigInt(0), + admin: "", + metadata: "", + version: BigInt(0), + totalWeight: "", + createdAt: new Date() + }; +} +export const GroupInfo = { + typeUrl: "/cosmos.group.v1.GroupInfo", + aminoType: "cosmos-sdk/GroupInfo", + encode(message: GroupInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { + writer.uint32(8).uint64(message.id); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.version !== BigInt(0)) { + writer.uint32(32).uint64(message.version); + } + if (message.totalWeight !== "") { + writer.uint32(42).string(message.totalWeight); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.version = reader.uint64(); + break; + case 5: + message.totalWeight = reader.string(); + break; + case 6: + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GroupInfo { + const message = createBaseGroupInfo(); + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + message.totalWeight = object.totalWeight ?? ""; + message.createdAt = object.createdAt ?? undefined; + return message; + }, + fromAmino(object: GroupInfoAmino): GroupInfo { + const message = createBaseGroupInfo(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.total_weight !== undefined && object.total_weight !== null) { + message.totalWeight = object.total_weight; + } + if (object.created_at !== undefined && object.created_at !== null) { + message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); + } + return message; + }, + toAmino(message: GroupInfo): GroupInfoAmino { + const obj: any = {}; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; + obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : new Date(); + return obj; + }, + fromAminoMsg(object: GroupInfoAminoMsg): GroupInfo { + return GroupInfo.fromAmino(object.value); + }, + toAminoMsg(message: GroupInfo): GroupInfoAminoMsg { + return { + type: "cosmos-sdk/GroupInfo", + value: GroupInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GroupInfoProtoMsg): GroupInfo { + return GroupInfo.decode(message.value); + }, + toProto(message: GroupInfo): Uint8Array { + return GroupInfo.encode(message).finish(); + }, + toProtoMsg(message: GroupInfo): GroupInfoProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupInfo", + value: GroupInfo.encode(message).finish() + }; + } +}; +function createBaseGroupMember(): GroupMember { + return { + groupId: BigInt(0), + member: undefined + }; +} +export const GroupMember = { + typeUrl: "/cosmos.group.v1.GroupMember", + aminoType: "cosmos-sdk/GroupMember", + encode(message: GroupMember, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + case 2: + message.member = Member.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GroupMember { + const message = createBaseGroupMember(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.member = object.member !== undefined && object.member !== null ? Member.fromPartial(object.member) : undefined; + return message; + }, + fromAmino(object: GroupMemberAmino): GroupMember { + const message = createBaseGroupMember(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.member !== undefined && object.member !== null) { + message.member = Member.fromAmino(object.member); + } + return message; + }, + toAmino(message: GroupMember): GroupMemberAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.member = message.member ? Member.toAmino(message.member) : undefined; + return obj; + }, + fromAminoMsg(object: GroupMemberAminoMsg): GroupMember { + return GroupMember.fromAmino(object.value); + }, + toAminoMsg(message: GroupMember): GroupMemberAminoMsg { + return { + type: "cosmos-sdk/GroupMember", + value: GroupMember.toAmino(message) + }; + }, + fromProtoMsg(message: GroupMemberProtoMsg): GroupMember { + return GroupMember.decode(message.value); + }, + toProto(message: GroupMember): Uint8Array { + return GroupMember.encode(message).finish(); + }, + toProtoMsg(message: GroupMember): GroupMemberProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupMember", + value: GroupMember.encode(message).finish() + }; + } +}; +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + groupId: BigInt(0), + admin: "", + metadata: "", + version: BigInt(0), + decisionPolicy: undefined, + createdAt: new Date() + }; +} +export const GroupPolicyInfo = { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo", + aminoType: "cosmos-sdk/GroupPolicyInfo", + encode(message: GroupPolicyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== BigInt(0)) { + writer.uint32(40).uint64(message.version); + } + if (message.decisionPolicy !== undefined) { + Any.encode((message.decisionPolicy as Any), writer.uint32(50).fork()).ldelim(); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupPolicyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.admin = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.version = reader.uint64(); + break; + case 6: + message.decisionPolicy = (Cosmos_groupv1DecisionPolicy_InterfaceDecoder(reader) as Any); + break; + case 7: + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined; + message.createdAt = object.createdAt ?? undefined; + return message; + }, + fromAmino(object: GroupPolicyInfoAmino): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = Cosmos_groupv1DecisionPolicy_FromAmino(object.decision_policy); + } + if (object.created_at !== undefined && object.created_at !== null) { + message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); + } + return message; + }, + toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; + obj.decision_policy = message.decisionPolicy ? Cosmos_groupv1DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; + obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : new Date(); + return obj; + }, + fromAminoMsg(object: GroupPolicyInfoAminoMsg): GroupPolicyInfo { + return GroupPolicyInfo.fromAmino(object.value); + }, + toAminoMsg(message: GroupPolicyInfo): GroupPolicyInfoAminoMsg { + return { + type: "cosmos-sdk/GroupPolicyInfo", + value: GroupPolicyInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GroupPolicyInfoProtoMsg): GroupPolicyInfo { + return GroupPolicyInfo.decode(message.value); + }, + toProto(message: GroupPolicyInfo): Uint8Array { + return GroupPolicyInfo.encode(message).finish(); + }, + toProtoMsg(message: GroupPolicyInfo): GroupPolicyInfoProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo", + value: GroupPolicyInfo.encode(message).finish() + }; + } +}; +function createBaseProposal(): Proposal { + return { + id: BigInt(0), + groupPolicyAddress: "", + metadata: "", + proposers: [], + submitTime: new Date(), + groupVersion: BigInt(0), + groupPolicyVersion: BigInt(0), + status: 0, + finalTallyResult: TallyResult.fromPartial({}), + votingPeriodEnd: new Date(), + executorResult: 0, + messages: [], + title: "", + summary: "" + }; +} +export const Proposal = { + typeUrl: "/cosmos.group.v1.Proposal", + aminoType: "cosmos-sdk/Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { + writer.uint32(8).uint64(message.id); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); + } + if (message.groupVersion !== BigInt(0)) { + writer.uint32(48).uint64(message.groupVersion); + } + if (message.groupPolicyVersion !== BigInt(0)) { + writer.uint32(56).uint64(message.groupPolicyVersion); + } + if (message.status !== 0) { + writer.uint32(64).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(74).fork()).ldelim(); + } + if (message.votingPeriodEnd !== undefined) { + Timestamp.encode(toTimestamp(message.votingPeriodEnd), writer.uint32(82).fork()).ldelim(); + } + if (message.executorResult !== 0) { + writer.uint32(88).int32(message.executorResult); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(98).fork()).ldelim(); + } + if (message.title !== "") { + writer.uint32(106).string(message.title); + } + if (message.summary !== "") { + writer.uint32(114).string(message.summary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.proposers.push(reader.string()); + break; + case 5: + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.groupVersion = reader.uint64(); + break; + case 7: + message.groupPolicyVersion = reader.uint64(); + break; + case 8: + message.status = (reader.int32() as any); + break; + case 9: + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + break; + case 10: + message.votingPeriodEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 11: + message.executorResult = (reader.int32() as any); + break; + case 12: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 13: + message.title = reader.string(); + break; + case 14: + message.summary = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map(e => e) || []; + message.submitTime = object.submitTime ?? undefined; + message.groupVersion = object.groupVersion !== undefined && object.groupVersion !== null ? BigInt(object.groupVersion.toString()) : BigInt(0); + message.groupPolicyVersion = object.groupPolicyVersion !== undefined && object.groupPolicyVersion !== null ? BigInt(object.groupPolicyVersion.toString()) : BigInt(0); + message.status = object.status ?? 0; + message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; + message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; + message.executorResult = object.executorResult ?? 0; + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + message.proposers = object.proposers?.map(e => e) || []; + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.group_version !== undefined && object.group_version !== null) { + message.groupVersion = BigInt(object.group_version); + } + if (object.group_policy_version !== undefined && object.group_policy_version !== null) { + message.groupPolicyVersion = BigInt(object.group_policy_version); + } + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.voting_period_end !== undefined && object.voting_period_end !== null) { + message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); + } + if (object.executor_result !== undefined && object.executor_result !== null) { + message.executorResult = object.executor_result; + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + if (message.proposers) { + obj.proposers = message.proposers.map(e => e); + } else { + obj.proposers = message.proposers; + } + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); + obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : TallyResult.toAmino(TallyResult.fromPartial({})); + obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : new Date(); + obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +function createBaseTallyResult(): TallyResult { + return { + yesCount: "", + abstainCount: "", + noCount: "", + noWithVetoCount: "" + }; +} +export const TallyResult = { + typeUrl: "/cosmos.group.v1.TallyResult", + aminoType: "cosmos-sdk/TallyResult", + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yesCount = reader.string(); + break; + case 2: + message.abstainCount = reader.string(); + break; + case 3: + message.noCount = reader.string(); + break; + case 4: + message.noWithVetoCount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes_count !== undefined && object.yes_count !== null) { + message.yesCount = object.yes_count; + } + if (object.abstain_count !== undefined && object.abstain_count !== null) { + message.abstainCount = object.abstain_count; + } + if (object.no_count !== undefined && object.no_count !== null) { + message.noCount = object.no_count; + } + if (object.no_with_veto_count !== undefined && object.no_with_veto_count !== null) { + message.noWithVetoCount = object.no_with_veto_count; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.group.v1.TallyResult", + value: TallyResult.encode(message).finish() + }; + } +}; +function createBaseVote(): Vote { + return { + proposalId: BigInt(0), + voter: "", + option: 0, + metadata: "", + submitTime: new Date() + }; +} +export const Vote = { + typeUrl: "/cosmos.group.v1.Vote", + aminoType: "cosmos-sdk/Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.submitTime = object.submitTime ?? undefined; + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Vote", + value: Vote.encode(message).finish() + }; + } +}; +export const Cosmos_groupv1DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array): ThresholdDecisionPolicy | PercentageDecisionPolicy | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmos.group.v1.ThresholdDecisionPolicy": + return ThresholdDecisionPolicy.decode(data.value); + case "/cosmos.group.v1.PercentageDecisionPolicy": + return PercentageDecisionPolicy.decode(data.value); + default: + return data; + } +}; +export const Cosmos_groupv1DecisionPolicy_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "cosmos-sdk/ThresholdDecisionPolicy": + return Any.fromPartial({ + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.encode(ThresholdDecisionPolicy.fromPartial(ThresholdDecisionPolicy.fromAmino(content.value))).finish() + }); + case "cosmos-sdk/PercentageDecisionPolicy": + return Any.fromPartial({ + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + value: PercentageDecisionPolicy.encode(PercentageDecisionPolicy.fromPartial(PercentageDecisionPolicy.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmos_groupv1DecisionPolicy_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmos.group.v1.ThresholdDecisionPolicy": + return { + type: "cosmos-sdk/ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.toAmino(ThresholdDecisionPolicy.decode(content.value, undefined)) + }; + case "/cosmos.group.v1.PercentageDecisionPolicy": + return { + type: "cosmos-sdk/PercentageDecisionPolicy", + value: PercentageDecisionPolicy.toAmino(PercentageDecisionPolicy.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/ics23/v1/proofs.ts b/util/inj-types/cosmos/ics23/v1/proofs.ts new file mode 100644 index 00000000..3b9ac509 --- /dev/null +++ b/util/inj-types/cosmos/ics23/v1/proofs.ts @@ -0,0 +1,2104 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +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, + KECCAK256 = 3, + RIPEMD160 = 4, + /** BITCOIN - ripemd160(sha256(x)) */ + BITCOIN = 5, + SHA512_256 = 6, + BLAKE2B_512 = 7, + BLAKE2S_256 = 8, + BLAKE3 = 9, + UNRECOGNIZED = -1, +} +export const HashOpSDKType = HashOp; +export const HashOpAmino = HashOp; +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 "KECCAK256": + return HashOp.KECCAK256; + case 4: + case "RIPEMD160": + return HashOp.RIPEMD160; + case 5: + case "BITCOIN": + return HashOp.BITCOIN; + case 6: + case "SHA512_256": + return HashOp.SHA512_256; + case 7: + case "BLAKE2B_512": + return HashOp.BLAKE2B_512; + case 8: + case "BLAKE2S_256": + return HashOp.BLAKE2S_256; + case 9: + case "BLAKE3": + return HashOp.BLAKE3; + 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.KECCAK256: + return "KECCAK256"; + case HashOp.RIPEMD160: + return "RIPEMD160"; + case HashOp.BITCOIN: + return "BITCOIN"; + case HashOp.SHA512_256: + return "SHA512_256"; + case HashOp.BLAKE2B_512: + return "BLAKE2B_512"; + case HashOp.BLAKE2S_256: + return "BLAKE2S_256"; + case HashOp.BLAKE3: + return "BLAKE3"; + 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, +} +export const LengthOpSDKType = LengthOp; +export const LengthOpAmino = LengthOp; +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; + path: InnerOp[]; +} +export interface ExistenceProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.ExistenceProof"; + value: Uint8Array; +} +/** + * ExistenceProof takes a key and a value and a set of steps to perform on it. + * The result of peforming all these steps will provide a "root hash", which can + * be compared to the value in a header. + * + * Since it is computationally infeasible to produce a hash collission for any of the used + * cryptographic hash functions, if someone can provide a series of operations to transform + * a given key and value into a root hash that matches some trusted root, these key and values + * must be in the referenced merkle tree. + * + * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, + * which should be controlled by a spec. Eg. with lengthOp as NONE, + * prefix = FOO, key = BAR, value = CHOICE + * and + * prefix = F, key = OOBAR, value = CHOICE + * would produce the same value. + * + * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field + * in the ProofSpec is valuable to prevent this mutability. And why all trees should + * length-prefix the data before hashing it. + */ +export interface ExistenceProofAmino { + key?: string; + value?: string; + leaf?: LeafOpAmino; + path?: InnerOpAmino[]; +} +export interface ExistenceProofAminoMsg { + type: "cosmos-sdk/ExistenceProof"; + value: ExistenceProofAmino; +} +/** + * 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; + 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; + right?: ExistenceProof; +} +export interface NonExistenceProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.NonExistenceProof"; + value: Uint8Array; +} +/** + * NonExistenceProof takes a proof of two neighbors, one left of the desired key, + * one right of the desired key. If both proofs are valid AND they are neighbors, + * then there is no valid proof for the given key. + */ +export interface NonExistenceProofAmino { + /** TODO: remove this as unnecessary??? we prove a range */ + key?: string; + left?: ExistenceProofAmino; + right?: ExistenceProofAmino; +} +export interface NonExistenceProofAminoMsg { + type: "cosmos-sdk/NonExistenceProof"; + value: NonExistenceProofAmino; +} +/** + * 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 { + key: Uint8Array; + left?: ExistenceProofSDKType; + right?: ExistenceProofSDKType; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProof { + exist?: ExistenceProof; + nonexist?: NonExistenceProof; + batch?: BatchProof; + compressed?: CompressedBatchProof; +} +export interface CommitmentProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.CommitmentProof"; + value: Uint8Array; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProofAmino { + exist?: ExistenceProofAmino; + nonexist?: NonExistenceProofAmino; + batch?: BatchProofAmino; + compressed?: CompressedBatchProofAmino; +} +export interface CommitmentProofAminoMsg { + type: "cosmos-sdk/CommitmentProof"; + value: CommitmentProofAmino; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProofSDKType { + exist?: ExistenceProofSDKType; + nonexist?: NonExistenceProofSDKType; + batch?: BatchProofSDKType; + compressed?: CompressedBatchProofSDKType; +} +/** + * 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; +} +export interface LeafOpProtoMsg { + typeUrl: "/cosmos.ics23.v1.LeafOp"; + value: Uint8Array; +} +/** + * LeafOp represents the raw key-value data we wish to prove, and + * must be flexible to represent the internal transformation from + * the original key-value pairs into the basis hash, for many existing + * merkle trees. + * + * key and value are passed in. So that the signature of this operation is: + * leafOp(key, value) -> output + * + * To process this, first prehash the keys and values if needed (ANY means no hash in this case): + * hkey = prehashKey(key) + * hvalue = prehashValue(value) + * + * Then combine the bytes, and hash it + * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) + */ +export interface LeafOpAmino { + hash?: HashOp; + prehash_key?: HashOp; + prehash_value?: HashOp; + length?: LengthOp; + /** + * prefix is a fixed bytes that may optionally be included at the beginning to differentiate + * a leaf node from an inner node. + */ + prefix?: string; +} +export interface LeafOpAminoMsg { + type: "cosmos-sdk/LeafOp"; + value: LeafOpAmino; +} +/** + * 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: HashOp; + prehash_key: HashOp; + prehash_value: HashOp; + length: LengthOp; + 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; +} +export interface InnerOpProtoMsg { + typeUrl: "/cosmos.ics23.v1.InnerOp"; + value: Uint8Array; +} +/** + * InnerOp represents a merkle-proof step that is not a leaf. + * It represents concatenating two children and hashing them to provide the next result. + * + * The result of the previous step is passed in, so the signature of this op is: + * innerOp(child) -> output + * + * The result of applying InnerOp should be: + * output = op.hash(op.prefix || child || op.suffix) + * + * where the || operator is concatenation of binary data, + * and child is the result of hashing all the tree below this step. + * + * Any special data, like prepending child with the length, or prepending the entire operation with + * some value to differentiate from leaf nodes, should be included in prefix and suffix. + * If either of prefix or suffix is empty, we just treat it as an empty string + */ +export interface InnerOpAmino { + hash?: HashOp; + prefix?: string; + suffix?: string; +} +export interface InnerOpAminoMsg { + type: "cosmos-sdk/InnerOp"; + value: InnerOpAmino; +} +/** + * 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: HashOp; + 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; + innerSpec?: InnerSpec; + /** 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; + /** + * prehash_key_before_comparison is a flag that indicates whether to use the + * prehash_key specified by LeafOp to compare lexical ordering of keys for + * non-existence proofs. + */ + prehashKeyBeforeComparison: boolean; +} +export interface ProofSpecProtoMsg { + typeUrl: "/cosmos.ics23.v1.ProofSpec"; + value: Uint8Array; +} +/** + * ProofSpec defines what the expected parameters are for a given proof type. + * This can be stored in the client and used to validate any incoming proofs. + * + * verify(ProofSpec, Proof) -> Proof | Error + * + * As demonstrated in tests, if we don't fix the algorithm used to calculate the + * LeafHash for a given tree, there are many possible key-value pairs that can + * generate a given hash (by interpretting the preimage differently). + * We need this for proper security, requires client knows a priori what + * tree format server uses. But not in code, rather a configuration object. + */ +export interface ProofSpecAmino { + /** + * any field in the ExistenceProof must be the same as in this spec. + * except Prefix, which is just the first bytes of prefix (spec can be longer) + */ + leaf_spec?: LeafOpAmino; + inner_spec?: InnerSpecAmino; + /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ + max_depth?: number; + /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ + min_depth?: number; + /** + * prehash_key_before_comparison is a flag that indicates whether to use the + * prehash_key specified by LeafOp to compare lexical ordering of keys for + * non-existence proofs. + */ + prehash_key_before_comparison?: boolean; +} +export interface ProofSpecAminoMsg { + type: "cosmos-sdk/ProofSpec"; + value: ProofSpecAmino; +} +/** + * 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 { + leaf_spec?: LeafOpSDKType; + inner_spec?: InnerSpecSDKType; + max_depth: number; + min_depth: number; + prehash_key_before_comparison: boolean; +} +/** + * 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; +} +export interface InnerSpecProtoMsg { + typeUrl: "/cosmos.ics23.v1.InnerSpec"; + value: Uint8Array; +} +/** + * InnerSpec contains all store-specific structure info to determine if two proofs from a + * given store are neighbors. + * + * This enables: + * + * isLeftMost(spec: InnerSpec, op: InnerOp) + * isRightMost(spec: InnerSpec, op: InnerOp) + * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) + */ +export interface InnerSpecAmino { + /** + * Child order is the ordering of the children node, must count from 0 + * iavl tree is [0, 1] (left then right) + * merk is [0, 2, 1] (left, right, here) + */ + child_order?: number[]; + child_size?: number; + min_prefix_length?: number; + max_prefix_length?: number; + /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ + empty_child?: string; + /** hash is the algorithm that must be used for each InnerOp */ + hash?: HashOp; +} +export interface InnerSpecAminoMsg { + type: "cosmos-sdk/InnerSpec"; + value: InnerSpecAmino; +} +/** + * 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: number[]; + child_size: number; + min_prefix_length: number; + max_prefix_length: number; + empty_child: Uint8Array; + hash: HashOp; +} +/** BatchProof is a group of multiple proof types than can be compressed */ +export interface BatchProof { + entries: BatchEntry[]; +} +export interface BatchProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.BatchProof"; + value: Uint8Array; +} +/** BatchProof is a group of multiple proof types than can be compressed */ +export interface BatchProofAmino { + entries?: BatchEntryAmino[]; +} +export interface BatchProofAminoMsg { + type: "cosmos-sdk/BatchProof"; + value: BatchProofAmino; +} +/** 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; + nonexist?: NonExistenceProof; +} +export interface BatchEntryProtoMsg { + typeUrl: "/cosmos.ics23.v1.BatchEntry"; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface BatchEntryAmino { + exist?: ExistenceProofAmino; + nonexist?: NonExistenceProofAmino; +} +export interface BatchEntryAminoMsg { + type: "cosmos-sdk/BatchEntry"; + value: BatchEntryAmino; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface BatchEntrySDKType { + exist?: ExistenceProofSDKType; + nonexist?: NonExistenceProofSDKType; +} +export interface CompressedBatchProof { + entries: CompressedBatchEntry[]; + lookupInners: InnerOp[]; +} +export interface CompressedBatchProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.CompressedBatchProof"; + value: Uint8Array; +} +export interface CompressedBatchProofAmino { + entries?: CompressedBatchEntryAmino[]; + lookup_inners?: InnerOpAmino[]; +} +export interface CompressedBatchProofAminoMsg { + type: "cosmos-sdk/CompressedBatchProof"; + value: CompressedBatchProofAmino; +} +export interface CompressedBatchProofSDKType { + entries: CompressedBatchEntrySDKType[]; + lookup_inners: InnerOpSDKType[]; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntry { + exist?: CompressedExistenceProof; + nonexist?: CompressedNonExistenceProof; +} +export interface CompressedBatchEntryProtoMsg { + typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry"; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntryAmino { + exist?: CompressedExistenceProofAmino; + nonexist?: CompressedNonExistenceProofAmino; +} +export interface CompressedBatchEntryAminoMsg { + type: "cosmos-sdk/CompressedBatchEntry"; + value: CompressedBatchEntryAmino; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntrySDKType { + exist?: CompressedExistenceProofSDKType; + nonexist?: CompressedNonExistenceProofSDKType; +} +export interface CompressedExistenceProof { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOp; + /** these are indexes into the lookup_inners table in CompressedBatchProof */ + path: number[]; +} +export interface CompressedExistenceProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof"; + value: Uint8Array; +} +export interface CompressedExistenceProofAmino { + key?: string; + value?: string; + leaf?: LeafOpAmino; + /** these are indexes into the lookup_inners table in CompressedBatchProof */ + path?: number[]; +} +export interface CompressedExistenceProofAminoMsg { + type: "cosmos-sdk/CompressedExistenceProof"; + value: CompressedExistenceProofAmino; +} +export interface CompressedExistenceProofSDKType { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOpSDKType; + path: number[]; +} +export interface CompressedNonExistenceProof { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: CompressedExistenceProof; + right?: CompressedExistenceProof; +} +export interface CompressedNonExistenceProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof"; + value: Uint8Array; +} +export interface CompressedNonExistenceProofAmino { + /** TODO: remove this as unnecessary??? we prove a range */ + key?: string; + left?: CompressedExistenceProofAmino; + right?: CompressedExistenceProofAmino; +} +export interface CompressedNonExistenceProofAminoMsg { + type: "cosmos-sdk/CompressedNonExistenceProof"; + value: CompressedNonExistenceProofAmino; +} +export interface CompressedNonExistenceProofSDKType { + key: Uint8Array; + left?: CompressedExistenceProofSDKType; + right?: CompressedExistenceProofSDKType; +} +function createBaseExistenceProof(): ExistenceProof { + return { + key: new Uint8Array(), + value: new Uint8Array(), + leaf: undefined, + path: [] + }; +} +export const ExistenceProof = { + typeUrl: "/cosmos.ics23.v1.ExistenceProof", + aminoType: "cosmos-sdk/ExistenceProof", + encode(message: ExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.path) { + InnerOp.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: ExistenceProofAmino): ExistenceProof { + const message = createBaseExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.leaf !== undefined && object.leaf !== null) { + message.leaf = LeafOp.fromAmino(object.leaf); + } + message.path = object.path?.map(e => InnerOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExistenceProof): ExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; + if (message.path) { + obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); + } else { + obj.path = message.path; + } + return obj; + }, + fromAminoMsg(object: ExistenceProofAminoMsg): ExistenceProof { + return ExistenceProof.fromAmino(object.value); + }, + toAminoMsg(message: ExistenceProof): ExistenceProofAminoMsg { + return { + type: "cosmos-sdk/ExistenceProof", + value: ExistenceProof.toAmino(message) + }; + }, + fromProtoMsg(message: ExistenceProofProtoMsg): ExistenceProof { + return ExistenceProof.decode(message.value); + }, + toProto(message: ExistenceProof): Uint8Array { + return ExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: ExistenceProof): ExistenceProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.ExistenceProof", + value: ExistenceProof.encode(message).finish() + }; + } +}; +function createBaseNonExistenceProof(): NonExistenceProof { + return { + key: new Uint8Array(), + left: undefined, + right: undefined + }; +} +export const NonExistenceProof = { + typeUrl: "/cosmos.ics23.v1.NonExistenceProof", + aminoType: "cosmos-sdk/NonExistenceProof", + encode(message: NonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): NonExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: NonExistenceProofAmino): NonExistenceProof { + const message = createBaseNonExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.left !== undefined && object.left !== null) { + message.left = ExistenceProof.fromAmino(object.left); + } + if (object.right !== undefined && object.right !== null) { + message.right = ExistenceProof.fromAmino(object.right); + } + return message; + }, + toAmino(message: NonExistenceProof): NonExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.left = message.left ? ExistenceProof.toAmino(message.left) : undefined; + obj.right = message.right ? ExistenceProof.toAmino(message.right) : undefined; + return obj; + }, + fromAminoMsg(object: NonExistenceProofAminoMsg): NonExistenceProof { + return NonExistenceProof.fromAmino(object.value); + }, + toAminoMsg(message: NonExistenceProof): NonExistenceProofAminoMsg { + return { + type: "cosmos-sdk/NonExistenceProof", + value: NonExistenceProof.toAmino(message) + }; + }, + fromProtoMsg(message: NonExistenceProofProtoMsg): NonExistenceProof { + return NonExistenceProof.decode(message.value); + }, + toProto(message: NonExistenceProof): Uint8Array { + return NonExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: NonExistenceProof): NonExistenceProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.NonExistenceProof", + value: NonExistenceProof.encode(message).finish() + }; + } +}; +function createBaseCommitmentProof(): CommitmentProof { + return { + exist: undefined, + nonexist: undefined, + batch: undefined, + compressed: undefined + }; +} +export const CommitmentProof = { + typeUrl: "/cosmos.ics23.v1.CommitmentProof", + aminoType: "cosmos-sdk/CommitmentProof", + encode(message: CommitmentProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CommitmentProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: CommitmentProofAmino): CommitmentProof { + const message = createBaseCommitmentProof(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = ExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = NonExistenceProof.fromAmino(object.nonexist); + } + if (object.batch !== undefined && object.batch !== null) { + message.batch = BatchProof.fromAmino(object.batch); + } + if (object.compressed !== undefined && object.compressed !== null) { + message.compressed = CompressedBatchProof.fromAmino(object.compressed); + } + return message; + }, + toAmino(message: CommitmentProof): CommitmentProofAmino { + const obj: any = {}; + obj.exist = message.exist ? ExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? NonExistenceProof.toAmino(message.nonexist) : undefined; + obj.batch = message.batch ? BatchProof.toAmino(message.batch) : undefined; + obj.compressed = message.compressed ? CompressedBatchProof.toAmino(message.compressed) : undefined; + return obj; + }, + fromAminoMsg(object: CommitmentProofAminoMsg): CommitmentProof { + return CommitmentProof.fromAmino(object.value); + }, + toAminoMsg(message: CommitmentProof): CommitmentProofAminoMsg { + return { + type: "cosmos-sdk/CommitmentProof", + value: CommitmentProof.toAmino(message) + }; + }, + fromProtoMsg(message: CommitmentProofProtoMsg): CommitmentProof { + return CommitmentProof.decode(message.value); + }, + toProto(message: CommitmentProof): Uint8Array { + return CommitmentProof.encode(message).finish(); + }, + toProtoMsg(message: CommitmentProof): CommitmentProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CommitmentProof", + value: CommitmentProof.encode(message).finish() + }; + } +}; +function createBaseLeafOp(): LeafOp { + return { + hash: 0, + prehashKey: 0, + prehashValue: 0, + length: 0, + prefix: new Uint8Array() + }; +} +export const LeafOp = { + typeUrl: "/cosmos.ics23.v1.LeafOp", + aminoType: "cosmos-sdk/LeafOp", + encode(message: LeafOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): LeafOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: LeafOpAmino): LeafOp { + const message = createBaseLeafOp(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + if (object.prehash_key !== undefined && object.prehash_key !== null) { + message.prehashKey = object.prehash_key; + } + if (object.prehash_value !== undefined && object.prehash_value !== null) { + message.prehashValue = object.prehash_value; + } + if (object.length !== undefined && object.length !== null) { + message.length = object.length; + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = bytesFromBase64(object.prefix); + } + return message; + }, + toAmino(message: LeafOp): LeafOpAmino { + const obj: any = {}; + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; + obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; + return obj; + }, + fromAminoMsg(object: LeafOpAminoMsg): LeafOp { + return LeafOp.fromAmino(object.value); + }, + toAminoMsg(message: LeafOp): LeafOpAminoMsg { + return { + type: "cosmos-sdk/LeafOp", + value: LeafOp.toAmino(message) + }; + }, + fromProtoMsg(message: LeafOpProtoMsg): LeafOp { + return LeafOp.decode(message.value); + }, + toProto(message: LeafOp): Uint8Array { + return LeafOp.encode(message).finish(); + }, + toProtoMsg(message: LeafOp): LeafOpProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.LeafOp", + value: LeafOp.encode(message).finish() + }; + } +}; +function createBaseInnerOp(): InnerOp { + return { + hash: 0, + prefix: new Uint8Array(), + suffix: new Uint8Array() + }; +} +export const InnerOp = { + typeUrl: "/cosmos.ics23.v1.InnerOp", + aminoType: "cosmos-sdk/InnerOp", + encode(message: InnerOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + if (message.suffix.length !== 0) { + writer.uint32(26).bytes(message.suffix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InnerOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + 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: DeepPartial): InnerOp { + const message = createBaseInnerOp(); + message.hash = object.hash ?? 0; + message.prefix = object.prefix ?? new Uint8Array(); + message.suffix = object.suffix ?? new Uint8Array(); + return message; + }, + fromAmino(object: InnerOpAmino): InnerOp { + const message = createBaseInnerOp(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = bytesFromBase64(object.prefix); + } + if (object.suffix !== undefined && object.suffix !== null) { + message.suffix = bytesFromBase64(object.suffix); + } + return message; + }, + toAmino(message: InnerOp): InnerOpAmino { + const obj: any = {}; + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; + obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; + return obj; + }, + fromAminoMsg(object: InnerOpAminoMsg): InnerOp { + return InnerOp.fromAmino(object.value); + }, + toAminoMsg(message: InnerOp): InnerOpAminoMsg { + return { + type: "cosmos-sdk/InnerOp", + value: InnerOp.toAmino(message) + }; + }, + fromProtoMsg(message: InnerOpProtoMsg): InnerOp { + return InnerOp.decode(message.value); + }, + toProto(message: InnerOp): Uint8Array { + return InnerOp.encode(message).finish(); + }, + toProtoMsg(message: InnerOp): InnerOpProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.InnerOp", + value: InnerOp.encode(message).finish() + }; + } +}; +function createBaseProofSpec(): ProofSpec { + return { + leafSpec: undefined, + innerSpec: undefined, + maxDepth: 0, + minDepth: 0, + prehashKeyBeforeComparison: false + }; +} +export const ProofSpec = { + typeUrl: "/cosmos.ics23.v1.ProofSpec", + aminoType: "cosmos-sdk/ProofSpec", + encode(message: ProofSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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); + } + if (message.prehashKeyBeforeComparison === true) { + writer.uint32(40).bool(message.prehashKeyBeforeComparison); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProofSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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; + case 5: + message.prehashKeyBeforeComparison = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): 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; + message.prehashKeyBeforeComparison = object.prehashKeyBeforeComparison ?? false; + return message; + }, + fromAmino(object: ProofSpecAmino): ProofSpec { + const message = createBaseProofSpec(); + if (object.leaf_spec !== undefined && object.leaf_spec !== null) { + message.leafSpec = LeafOp.fromAmino(object.leaf_spec); + } + if (object.inner_spec !== undefined && object.inner_spec !== null) { + message.innerSpec = InnerSpec.fromAmino(object.inner_spec); + } + if (object.max_depth !== undefined && object.max_depth !== null) { + message.maxDepth = object.max_depth; + } + if (object.min_depth !== undefined && object.min_depth !== null) { + message.minDepth = object.min_depth; + } + if (object.prehash_key_before_comparison !== undefined && object.prehash_key_before_comparison !== null) { + message.prehashKeyBeforeComparison = object.prehash_key_before_comparison; + } + return message; + }, + toAmino(message: ProofSpec): ProofSpecAmino { + const obj: any = {}; + obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; + obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; + obj.prehash_key_before_comparison = message.prehashKeyBeforeComparison === false ? undefined : message.prehashKeyBeforeComparison; + return obj; + }, + fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { + return ProofSpec.fromAmino(object.value); + }, + toAminoMsg(message: ProofSpec): ProofSpecAminoMsg { + return { + type: "cosmos-sdk/ProofSpec", + value: ProofSpec.toAmino(message) + }; + }, + fromProtoMsg(message: ProofSpecProtoMsg): ProofSpec { + return ProofSpec.decode(message.value); + }, + toProto(message: ProofSpec): Uint8Array { + return ProofSpec.encode(message).finish(); + }, + toProtoMsg(message: ProofSpec): ProofSpecProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.ProofSpec", + value: ProofSpec.encode(message).finish() + }; + } +}; +function createBaseInnerSpec(): InnerSpec { + return { + childOrder: [], + childSize: 0, + minPrefixLength: 0, + maxPrefixLength: 0, + emptyChild: new Uint8Array(), + hash: 0 + }; +} +export const InnerSpec = { + typeUrl: "/cosmos.ics23.v1.InnerSpec", + aminoType: "cosmos-sdk/InnerSpec", + encode(message: InnerSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): InnerSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: InnerSpecAmino): InnerSpec { + const message = createBaseInnerSpec(); + message.childOrder = object.child_order?.map(e => e) || []; + if (object.child_size !== undefined && object.child_size !== null) { + message.childSize = object.child_size; + } + if (object.min_prefix_length !== undefined && object.min_prefix_length !== null) { + message.minPrefixLength = object.min_prefix_length; + } + if (object.max_prefix_length !== undefined && object.max_prefix_length !== null) { + message.maxPrefixLength = object.max_prefix_length; + } + if (object.empty_child !== undefined && object.empty_child !== null) { + message.emptyChild = bytesFromBase64(object.empty_child); + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + return message; + }, + toAmino(message: InnerSpec): InnerSpecAmino { + const obj: any = {}; + if (message.childOrder) { + obj.child_order = message.childOrder.map(e => e); + } else { + obj.child_order = message.childOrder; + } + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; + obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; + obj.hash = message.hash === 0 ? undefined : message.hash; + return obj; + }, + fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { + return InnerSpec.fromAmino(object.value); + }, + toAminoMsg(message: InnerSpec): InnerSpecAminoMsg { + return { + type: "cosmos-sdk/InnerSpec", + value: InnerSpec.toAmino(message) + }; + }, + fromProtoMsg(message: InnerSpecProtoMsg): InnerSpec { + return InnerSpec.decode(message.value); + }, + toProto(message: InnerSpec): Uint8Array { + return InnerSpec.encode(message).finish(); + }, + toProtoMsg(message: InnerSpec): InnerSpecProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.InnerSpec", + value: InnerSpec.encode(message).finish() + }; + } +}; +function createBaseBatchProof(): BatchProof { + return { + entries: [] + }; +} +export const BatchProof = { + typeUrl: "/cosmos.ics23.v1.BatchProof", + aminoType: "cosmos-sdk/BatchProof", + encode(message: BatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.entries) { + BatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BatchProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): BatchProof { + const message = createBaseBatchProof(); + message.entries = object.entries?.map(e => BatchEntry.fromPartial(e)) || []; + return message; + }, + fromAmino(object: BatchProofAmino): BatchProof { + const message = createBaseBatchProof(); + message.entries = object.entries?.map(e => BatchEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: BatchProof): BatchProofAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + return obj; + }, + fromAminoMsg(object: BatchProofAminoMsg): BatchProof { + return BatchProof.fromAmino(object.value); + }, + toAminoMsg(message: BatchProof): BatchProofAminoMsg { + return { + type: "cosmos-sdk/BatchProof", + value: BatchProof.toAmino(message) + }; + }, + fromProtoMsg(message: BatchProofProtoMsg): BatchProof { + return BatchProof.decode(message.value); + }, + toProto(message: BatchProof): Uint8Array { + return BatchProof.encode(message).finish(); + }, + toProtoMsg(message: BatchProof): BatchProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.BatchProof", + value: BatchProof.encode(message).finish() + }; + } +}; +function createBaseBatchEntry(): BatchEntry { + return { + exist: undefined, + nonexist: undefined + }; +} +export const BatchEntry = { + typeUrl: "/cosmos.ics23.v1.BatchEntry", + aminoType: "cosmos-sdk/BatchEntry", + encode(message: BatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): BatchEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: BatchEntryAmino): BatchEntry { + const message = createBaseBatchEntry(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = ExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = NonExistenceProof.fromAmino(object.nonexist); + } + return message; + }, + toAmino(message: BatchEntry): BatchEntryAmino { + const obj: any = {}; + obj.exist = message.exist ? ExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? NonExistenceProof.toAmino(message.nonexist) : undefined; + return obj; + }, + fromAminoMsg(object: BatchEntryAminoMsg): BatchEntry { + return BatchEntry.fromAmino(object.value); + }, + toAminoMsg(message: BatchEntry): BatchEntryAminoMsg { + return { + type: "cosmos-sdk/BatchEntry", + value: BatchEntry.toAmino(message) + }; + }, + fromProtoMsg(message: BatchEntryProtoMsg): BatchEntry { + return BatchEntry.decode(message.value); + }, + toProto(message: BatchEntry): Uint8Array { + return BatchEntry.encode(message).finish(); + }, + toProtoMsg(message: BatchEntry): BatchEntryProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.BatchEntry", + value: BatchEntry.encode(message).finish() + }; + } +}; +function createBaseCompressedBatchProof(): CompressedBatchProof { + return { + entries: [], + lookupInners: [] + }; +} +export const CompressedBatchProof = { + typeUrl: "/cosmos.ics23.v1.CompressedBatchProof", + aminoType: "cosmos-sdk/CompressedBatchProof", + encode(message: CompressedBatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CompressedBatchProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): CompressedBatchProof { + const message = createBaseCompressedBatchProof(); + message.entries = object.entries?.map(e => CompressedBatchEntry.fromPartial(e)) || []; + message.lookupInners = object.lookupInners?.map(e => InnerOp.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CompressedBatchProofAmino): CompressedBatchProof { + const message = createBaseCompressedBatchProof(); + message.entries = object.entries?.map(e => CompressedBatchEntry.fromAmino(e)) || []; + message.lookupInners = object.lookup_inners?.map(e => InnerOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: CompressedBatchProof): CompressedBatchProofAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + if (message.lookupInners) { + obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); + } else { + obj.lookup_inners = message.lookupInners; + } + return obj; + }, + fromAminoMsg(object: CompressedBatchProofAminoMsg): CompressedBatchProof { + return CompressedBatchProof.fromAmino(object.value); + }, + toAminoMsg(message: CompressedBatchProof): CompressedBatchProofAminoMsg { + return { + type: "cosmos-sdk/CompressedBatchProof", + value: CompressedBatchProof.toAmino(message) + }; + }, + fromProtoMsg(message: CompressedBatchProofProtoMsg): CompressedBatchProof { + return CompressedBatchProof.decode(message.value); + }, + toProto(message: CompressedBatchProof): Uint8Array { + return CompressedBatchProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchProof): CompressedBatchProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CompressedBatchProof", + value: CompressedBatchProof.encode(message).finish() + }; + } +}; +function createBaseCompressedBatchEntry(): CompressedBatchEntry { + return { + exist: undefined, + nonexist: undefined + }; +} +export const CompressedBatchEntry = { + typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry", + aminoType: "cosmos-sdk/CompressedBatchEntry", + encode(message: CompressedBatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CompressedBatchEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: CompressedBatchEntryAmino): CompressedBatchEntry { + const message = createBaseCompressedBatchEntry(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = CompressedExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = CompressedNonExistenceProof.fromAmino(object.nonexist); + } + return message; + }, + toAmino(message: CompressedBatchEntry): CompressedBatchEntryAmino { + const obj: any = {}; + obj.exist = message.exist ? CompressedExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toAmino(message.nonexist) : undefined; + return obj; + }, + fromAminoMsg(object: CompressedBatchEntryAminoMsg): CompressedBatchEntry { + return CompressedBatchEntry.fromAmino(object.value); + }, + toAminoMsg(message: CompressedBatchEntry): CompressedBatchEntryAminoMsg { + return { + type: "cosmos-sdk/CompressedBatchEntry", + value: CompressedBatchEntry.toAmino(message) + }; + }, + fromProtoMsg(message: CompressedBatchEntryProtoMsg): CompressedBatchEntry { + return CompressedBatchEntry.decode(message.value); + }, + toProto(message: CompressedBatchEntry): Uint8Array { + return CompressedBatchEntry.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchEntry): CompressedBatchEntryProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry", + value: CompressedBatchEntry.encode(message).finish() + }; + } +}; +function createBaseCompressedExistenceProof(): CompressedExistenceProof { + return { + key: new Uint8Array(), + value: new Uint8Array(), + leaf: undefined, + path: [] + }; +} +export const CompressedExistenceProof = { + typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof", + aminoType: "cosmos-sdk/CompressedExistenceProof", + encode(message: CompressedExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); + } + writer.uint32(34).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CompressedExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: CompressedExistenceProofAmino): CompressedExistenceProof { + const message = createBaseCompressedExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.leaf !== undefined && object.leaf !== null) { + message.leaf = LeafOp.fromAmino(object.leaf); + } + message.path = object.path?.map(e => e) || []; + return message; + }, + toAmino(message: CompressedExistenceProof): CompressedExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = message.path; + } + return obj; + }, + fromAminoMsg(object: CompressedExistenceProofAminoMsg): CompressedExistenceProof { + return CompressedExistenceProof.fromAmino(object.value); + }, + toAminoMsg(message: CompressedExistenceProof): CompressedExistenceProofAminoMsg { + return { + type: "cosmos-sdk/CompressedExistenceProof", + value: CompressedExistenceProof.toAmino(message) + }; + }, + fromProtoMsg(message: CompressedExistenceProofProtoMsg): CompressedExistenceProof { + return CompressedExistenceProof.decode(message.value); + }, + toProto(message: CompressedExistenceProof): Uint8Array { + return CompressedExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedExistenceProof): CompressedExistenceProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof", + value: CompressedExistenceProof.encode(message).finish() + }; + } +}; +function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { + return { + key: new Uint8Array(), + left: undefined, + right: undefined + }; +} +export const CompressedNonExistenceProof = { + typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof", + aminoType: "cosmos-sdk/CompressedNonExistenceProof", + encode(message: CompressedNonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): CompressedNonExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): 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; + }, + fromAmino(object: CompressedNonExistenceProofAmino): CompressedNonExistenceProof { + const message = createBaseCompressedNonExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.left !== undefined && object.left !== null) { + message.left = CompressedExistenceProof.fromAmino(object.left); + } + if (object.right !== undefined && object.right !== null) { + message.right = CompressedExistenceProof.fromAmino(object.right); + } + return message; + }, + toAmino(message: CompressedNonExistenceProof): CompressedNonExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.left = message.left ? CompressedExistenceProof.toAmino(message.left) : undefined; + obj.right = message.right ? CompressedExistenceProof.toAmino(message.right) : undefined; + return obj; + }, + fromAminoMsg(object: CompressedNonExistenceProofAminoMsg): CompressedNonExistenceProof { + return CompressedNonExistenceProof.fromAmino(object.value); + }, + toAminoMsg(message: CompressedNonExistenceProof): CompressedNonExistenceProofAminoMsg { + return { + type: "cosmos-sdk/CompressedNonExistenceProof", + value: CompressedNonExistenceProof.toAmino(message) + }; + }, + fromProtoMsg(message: CompressedNonExistenceProofProtoMsg): CompressedNonExistenceProof { + return CompressedNonExistenceProof.decode(message.value); + }, + toProto(message: CompressedNonExistenceProof): Uint8Array { + return CompressedNonExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedNonExistenceProof): CompressedNonExistenceProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof", + value: CompressedNonExistenceProof.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/module/v1/module.ts b/util/inj-types/cosmos/mint/module/v1/module.ts new file mode 100644 index 00000000..c7f2da67 --- /dev/null +++ b/util/inj-types/cosmos/mint/module/v1/module.ts @@ -0,0 +1,109 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the mint module. */ +export interface Module { + feeCollectorName: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.mint.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the mint module. */ +export interface ModuleAmino { + fee_collector_name?: string; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the mint module. */ +export interface ModuleSDKType { + fee_collector_name: string; + authority: string; +} +function createBaseModule(): Module { + return { + feeCollectorName: "", + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.mint.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.feeCollectorName !== "") { + writer.uint32(10).string(message.feeCollectorName); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.feeCollectorName = reader.string(); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.feeCollectorName = object.feeCollectorName ?? ""; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.fee_collector_name !== undefined && object.fee_collector_name !== null) { + message.feeCollectorName = object.fee_collector_name; + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.fee_collector_name = message.feeCollectorName === "" ? undefined : message.feeCollectorName; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.mint.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/genesis.ts b/util/inj-types/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 00000000..dbc19a40 --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,112 @@ +import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** GenesisState defines the mint module's genesis state. */ +export interface GenesisState { + /** minter is a space for holding current inflation information. */ + minter: Minter; + /** params defines all the parameters of the module. */ + params: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the mint module's genesis state. */ +export interface GenesisStateAmino { + /** minter is a space for holding current inflation information. */ + minter: MinterAmino; + /** params defines all the parameters of the module. */ + params: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the mint module's genesis state. */ +export interface GenesisStateSDKType { + minter: MinterSDKType; + params: ParamsSDKType; +} +function createBaseGenesisState(): GenesisState { + return { + minter: Minter.fromPartial({}), + params: Params.fromPartial({}) + }; +} +export const GenesisState = { + typeUrl: "/cosmos.mint.v1beta1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.minter = Minter.decode(reader, reader.uint32()); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.minter = object.minter !== undefined && object.minter !== null ? Minter.fromPartial(object.minter) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.minter !== undefined && object.minter !== null) { + message.minter = Minter.fromAmino(object.minter); + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.minter = message.minter ? Minter.toAmino(message.minter) : Minter.toAmino(Minter.fromPartial({})); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/mint.ts b/util/inj-types/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 00000000..ab915538 --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,289 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { Decimal } from "@cosmjs/math"; +import { DeepPartial } from "../../../helpers"; +/** Minter represents the minting state. */ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annualProvisions: string; +} +export interface MinterProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.Minter"; + value: Uint8Array; +} +/** Minter represents the minting state. */ +export interface MinterAmino { + /** current annual inflation rate */ + inflation?: string; + /** current annual expected provisions */ + annual_provisions?: string; +} +export interface MinterAminoMsg { + type: "cosmos-sdk/Minter"; + value: MinterAmino; +} +/** Minter represents the minting state. */ +export interface MinterSDKType { + inflation: string; + annual_provisions: string; +} +/** Params defines the parameters for the x/mint module. */ +export interface Params { + /** type of coin to mint */ + mintDenom: string; + /** maximum annual change in inflation rate */ + inflationRateChange: string; + /** maximum inflation rate */ + inflationMax: string; + /** minimum inflation rate */ + inflationMin: string; + /** goal of percent bonded atoms */ + goalBonded: string; + /** expected blocks per year */ + blocksPerYear: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the x/mint module. */ +export interface ParamsAmino { + /** type of coin to mint */ + mint_denom?: string; + /** maximum annual change in inflation rate */ + inflation_rate_change?: string; + /** maximum inflation rate */ + inflation_max?: string; + /** minimum inflation rate */ + inflation_min?: string; + /** goal of percent bonded atoms */ + goal_bonded?: string; + /** expected blocks per year */ + blocks_per_year?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/mint/Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the x/mint module. */ +export interface ParamsSDKType { + mint_denom: string; + inflation_rate_change: string; + inflation_max: string; + inflation_min: string; + goal_bonded: string; + blocks_per_year: bigint; +} +function createBaseMinter(): Minter { + return { + inflation: "", + annualProvisions: "" + }; +} +export const Minter = { + typeUrl: "/cosmos.mint.v1beta1.Minter", + aminoType: "cosmos-sdk/Minter", + encode(message: Minter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.inflation !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.inflation, 18).atomics); + } + if (message.annualProvisions !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.annualProvisions, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMinter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 2: + message.annualProvisions = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annualProvisions = object.annualProvisions ?? ""; + return message; + }, + fromAmino(object: MinterAmino): Minter { + const message = createBaseMinter(); + if (object.inflation !== undefined && object.inflation !== null) { + message.inflation = object.inflation; + } + if (object.annual_provisions !== undefined && object.annual_provisions !== null) { + message.annualProvisions = object.annual_provisions; + } + return message; + }, + toAmino(message: Minter): MinterAmino { + const obj: any = {}; + obj.inflation = message.inflation === "" ? undefined : message.inflation; + obj.annual_provisions = message.annualProvisions === "" ? undefined : message.annualProvisions; + return obj; + }, + fromAminoMsg(object: MinterAminoMsg): Minter { + return Minter.fromAmino(object.value); + }, + toAminoMsg(message: Minter): MinterAminoMsg { + return { + type: "cosmos-sdk/Minter", + value: Minter.toAmino(message) + }; + }, + fromProtoMsg(message: MinterProtoMsg): Minter { + return Minter.decode(message.value); + }, + toProto(message: Minter): Uint8Array { + return Minter.encode(message).finish(); + }, + toProtoMsg(message: Minter): MinterProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.Minter", + value: Minter.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + mintDenom: "", + inflationRateChange: "", + inflationMax: "", + inflationMin: "", + goalBonded: "", + blocksPerYear: BigInt(0) + }; +} +export const Params = { + typeUrl: "/cosmos.mint.v1beta1.Params", + aminoType: "cosmos-sdk/x/mint/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.mintDenom !== "") { + writer.uint32(10).string(message.mintDenom); + } + if (message.inflationRateChange !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.inflationRateChange, 18).atomics); + } + if (message.inflationMax !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.inflationMax, 18).atomics); + } + if (message.inflationMin !== "") { + writer.uint32(34).string(Decimal.fromUserInput(message.inflationMin, 18).atomics); + } + if (message.goalBonded !== "") { + writer.uint32(42).string(Decimal.fromUserInput(message.goalBonded, 18).atomics); + } + if (message.blocksPerYear !== BigInt(0)) { + writer.uint32(48).uint64(message.blocksPerYear); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.mintDenom = reader.string(); + break; + case 2: + message.inflationRateChange = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.inflationMax = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 4: + message.inflationMin = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 5: + message.goalBonded = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 6: + message.blocksPerYear = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.mintDenom = object.mintDenom ?? ""; + message.inflationRateChange = object.inflationRateChange ?? ""; + message.inflationMax = object.inflationMax ?? ""; + message.inflationMin = object.inflationMin ?? ""; + message.goalBonded = object.goalBonded ?? ""; + message.blocksPerYear = object.blocksPerYear !== undefined && object.blocksPerYear !== null ? BigInt(object.blocksPerYear.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.mint_denom !== undefined && object.mint_denom !== null) { + message.mintDenom = object.mint_denom; + } + if (object.inflation_rate_change !== undefined && object.inflation_rate_change !== null) { + message.inflationRateChange = object.inflation_rate_change; + } + if (object.inflation_max !== undefined && object.inflation_max !== null) { + message.inflationMax = object.inflation_max; + } + if (object.inflation_min !== undefined && object.inflation_min !== null) { + message.inflationMin = object.inflation_min; + } + if (object.goal_bonded !== undefined && object.goal_bonded !== null) { + message.goalBonded = object.goal_bonded; + } + if (object.blocks_per_year !== undefined && object.blocks_per_year !== null) { + message.blocksPerYear = BigInt(object.blocks_per_year); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.inflation_rate_change = message.inflationRateChange === "" ? undefined : message.inflationRateChange; + obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; + obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; + obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; + obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/mint/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/query.lcd.ts b/util/inj-types/cosmos/mint/v1beta1/query.lcd.ts new file mode 100644 index 00000000..3fd6d411 --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/query.lcd.ts @@ -0,0 +1,27 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryParamsRequest, QueryParamsResponseSDKType, QueryInflationRequest, QueryInflationResponseSDKType, QueryAnnualProvisionsRequest, QueryAnnualProvisionsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Params returns the total set of minting parameters. */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `cosmos/mint/v1beta1/params`; + return await this.req.get(endpoint); + }; + /* Inflation returns the current minting inflation value. */ + inflation = async (_params: QueryInflationRequest = {}): Promise => { + const endpoint = `cosmos/mint/v1beta1/inflation`; + return await this.req.get(endpoint); + }; + /* AnnualProvisions current minting annual provisions value. */ + annualProvisions = async (_params: QueryAnnualProvisionsRequest = {}): Promise => { + const endpoint = `cosmos/mint/v1beta1/annual_provisions`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/mint/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..56c32096 --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/query.rpc.Query.ts @@ -0,0 +1,52 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParamsRequest, QueryParamsResponse, QueryInflationRequest, QueryInflationResponse, QueryAnnualProvisionsRequest, QueryAnnualProvisionsResponse } from "./query"; +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** Params returns the total set of minting parameters. */ + params(request?: QueryParamsRequest): Promise; + /** Inflation returns the current minting inflation value. */ + inflation(request?: QueryInflationRequest): Promise; + /** AnnualProvisions current minting annual provisions value. */ + annualProvisions(request?: QueryAnnualProvisionsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Params returns the total set of minting parameters. */ + params = async (request: QueryParamsRequest = {}): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.mint.v1beta1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; + /* Inflation returns the current minting inflation value. */ + inflation = async (request: QueryInflationRequest = {}): Promise => { + const data = QueryInflationRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.mint.v1beta1.Query", "Inflation", data); + return promise.then(data => QueryInflationResponse.decode(new BinaryReader(data))); + }; + /* AnnualProvisions current minting annual provisions value. */ + annualProvisions = async (request: QueryAnnualProvisionsRequest = {}): Promise => { + const data = QueryAnnualProvisionsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.mint.v1beta1.Query", "AnnualProvisions", data); + return promise.then(data => QueryAnnualProvisionsResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + }, + inflation(request?: QueryInflationRequest): Promise { + return queryService.inflation(request); + }, + annualProvisions(request?: QueryAnnualProvisionsRequest): Promise { + return queryService.annualProvisions(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/query.ts b/util/inj-types/cosmos/mint/v1beta1/query.ts new file mode 100644 index 00000000..6d510244 --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,519 @@ +import { Params, ParamsAmino, ParamsSDKType } from "./mint"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +/** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ +export interface QueryInflationRequest {} +export interface QueryInflationRequestProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest"; + value: Uint8Array; +} +/** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ +export interface QueryInflationRequestAmino {} +export interface QueryInflationRequestAminoMsg { + type: "cosmos-sdk/QueryInflationRequest"; + value: QueryInflationRequestAmino; +} +/** QueryInflationRequest is the request type for the Query/Inflation RPC method. */ +export interface QueryInflationRequestSDKType {} +/** + * QueryInflationResponse is the response type for the Query/Inflation RPC + * method. + */ +export interface QueryInflationResponse { + /** inflation is the current minting inflation value. */ + inflation: Uint8Array; +} +export interface QueryInflationResponseProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse"; + value: Uint8Array; +} +/** + * QueryInflationResponse is the response type for the Query/Inflation RPC + * method. + */ +export interface QueryInflationResponseAmino { + /** inflation is the current minting inflation value. */ + inflation: string; +} +export interface QueryInflationResponseAminoMsg { + type: "cosmos-sdk/QueryInflationResponse"; + value: QueryInflationResponseAmino; +} +/** + * QueryInflationResponse is the response type for the Query/Inflation RPC + * method. + */ +export interface QueryInflationResponseSDKType { + inflation: Uint8Array; +} +/** + * QueryAnnualProvisionsRequest is the request type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsRequest {} +export interface QueryAnnualProvisionsRequestProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest"; + value: Uint8Array; +} +/** + * QueryAnnualProvisionsRequest is the request type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsRequestAmino {} +export interface QueryAnnualProvisionsRequestAminoMsg { + type: "cosmos-sdk/QueryAnnualProvisionsRequest"; + value: QueryAnnualProvisionsRequestAmino; +} +/** + * QueryAnnualProvisionsRequest is the request type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsRequestSDKType {} +/** + * QueryAnnualProvisionsResponse is the response type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsResponse { + /** annual_provisions is the current minting annual provisions value. */ + annualProvisions: Uint8Array; +} +export interface QueryAnnualProvisionsResponseProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse"; + value: Uint8Array; +} +/** + * QueryAnnualProvisionsResponse is the response type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsResponseAmino { + /** annual_provisions is the current minting annual provisions value. */ + annual_provisions: string; +} +export interface QueryAnnualProvisionsResponseAminoMsg { + type: "cosmos-sdk/QueryAnnualProvisionsResponse"; + value: QueryAnnualProvisionsResponseAmino; +} +/** + * QueryAnnualProvisionsResponse is the response type for the + * Query/AnnualProvisions RPC method. + */ +export interface QueryAnnualProvisionsResponseSDKType { + annual_provisions: Uint8Array; +} +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} +export const QueryInflationRequest = { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", + aminoType: "cosmos-sdk/QueryInflationRequest", + encode(_: QueryInflationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, + fromAmino(_: QueryInflationRequestAmino): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, + toAmino(_: QueryInflationRequest): QueryInflationRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryInflationRequestAminoMsg): QueryInflationRequest { + return QueryInflationRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryInflationRequest): QueryInflationRequestAminoMsg { + return { + type: "cosmos-sdk/QueryInflationRequest", + value: QueryInflationRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryInflationRequestProtoMsg): QueryInflationRequest { + return QueryInflationRequest.decode(message.value); + }, + toProto(message: QueryInflationRequest): Uint8Array { + return QueryInflationRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryInflationRequest): QueryInflationRequestProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationRequest", + value: QueryInflationRequest.encode(message).finish() + }; + } +}; +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { + inflation: new Uint8Array() + }; +} +export const QueryInflationResponse = { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", + aminoType: "cosmos-sdk/QueryInflationResponse", + encode(message: QueryInflationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryInflationResponseAmino): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + if (object.inflation !== undefined && object.inflation !== null) { + message.inflation = bytesFromBase64(object.inflation); + } + return message; + }, + toAmino(message: QueryInflationResponse): QueryInflationResponseAmino { + const obj: any = {}; + obj.inflation = message.inflation ? base64FromBytes(message.inflation) : ""; + return obj; + }, + fromAminoMsg(object: QueryInflationResponseAminoMsg): QueryInflationResponse { + return QueryInflationResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryInflationResponse): QueryInflationResponseAminoMsg { + return { + type: "cosmos-sdk/QueryInflationResponse", + value: QueryInflationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryInflationResponseProtoMsg): QueryInflationResponse { + return QueryInflationResponse.decode(message.value); + }, + toProto(message: QueryInflationResponse): Uint8Array { + return QueryInflationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryInflationResponse): QueryInflationResponseProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryInflationResponse", + value: QueryInflationResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} +export const QueryAnnualProvisionsRequest = { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", + aminoType: "cosmos-sdk/QueryAnnualProvisionsRequest", + encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, + fromAmino(_: QueryAnnualProvisionsRequestAmino): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, + toAmino(_: QueryAnnualProvisionsRequest): QueryAnnualProvisionsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryAnnualProvisionsRequestAminoMsg): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAnnualProvisionsRequest): QueryAnnualProvisionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAnnualProvisionsRequest", + value: QueryAnnualProvisionsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAnnualProvisionsRequestProtoMsg): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.decode(message.value); + }, + toProto(message: QueryAnnualProvisionsRequest): Uint8Array { + return QueryAnnualProvisionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAnnualProvisionsRequest): QueryAnnualProvisionsRequestProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest", + value: QueryAnnualProvisionsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { + annualProvisions: new Uint8Array() + }; +} +export const QueryAnnualProvisionsResponse = { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", + aminoType: "cosmos-sdk/QueryAnnualProvisionsResponse", + encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.annualProvisions.length !== 0) { + writer.uint32(10).bytes(message.annualProvisions); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annualProvisions = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annualProvisions = object.annualProvisions ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryAnnualProvisionsResponseAmino): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + if (object.annual_provisions !== undefined && object.annual_provisions !== null) { + message.annualProvisions = bytesFromBase64(object.annual_provisions); + } + return message; + }, + toAmino(message: QueryAnnualProvisionsResponse): QueryAnnualProvisionsResponseAmino { + const obj: any = {}; + obj.annual_provisions = message.annualProvisions ? base64FromBytes(message.annualProvisions) : ""; + return obj; + }, + fromAminoMsg(object: QueryAnnualProvisionsResponseAminoMsg): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAnnualProvisionsResponse): QueryAnnualProvisionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAnnualProvisionsResponse", + value: QueryAnnualProvisionsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAnnualProvisionsResponseProtoMsg): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.decode(message.value); + }, + toProto(message: QueryAnnualProvisionsResponse): Uint8Array { + return QueryAnnualProvisionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAnnualProvisionsResponse): QueryAnnualProvisionsResponseProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse", + value: QueryAnnualProvisionsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/tx.amino.ts b/util/inj-types/cosmos/mint/v1beta1/tx.amino.ts new file mode 100644 index 00000000..8298dfa5 --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/tx.amino.ts @@ -0,0 +1,8 @@ +import { MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.mint.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/mint/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/tx.registry.ts b/util/inj-types/cosmos/mint/v1beta1/tx.registry.ts new file mode 100644 index 00000000..d1f7184e --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.mint.v1beta1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/mint/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..567e1946 --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,28 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the x/mint Msg service. */ +export interface Msg { + /** + * UpdateParams defines a governance operation for updating the x/mint module + * parameters. The authority is defaults to the x/gov module account. + * + * Since: cosmos-sdk 0.47 + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* UpdateParams defines a governance operation for updating the x/mint module + parameters. The authority is defaults to the x/gov module account. + + Since: cosmos-sdk 0.47 */ + updateParams = async (request: MsgUpdateParams): Promise => { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.mint.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/mint/v1beta1/tx.ts b/util/inj-types/cosmos/mint/v1beta1/tx.ts new file mode 100644 index 00000000..c56545e3 --- /dev/null +++ b/util/inj-types/cosmos/mint/v1beta1/tx.ts @@ -0,0 +1,218 @@ +import { Params, ParamsAmino, ParamsSDKType } from "./mint"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/mint parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/mint/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + aminoType: "cosmos-sdk/x/mint/MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/mint/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.mint.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/msg/v1/msg.ts b/util/inj-types/cosmos/msg/v1/msg.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/util/inj-types/cosmos/msg/v1/msg.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/util/inj-types/cosmos/nft/module/v1/module.ts b/util/inj-types/cosmos/nft/module/v1/module.ts new file mode 100644 index 00000000..e1122ead --- /dev/null +++ b/util/inj-types/cosmos/nft/module/v1/module.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the nft module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.nft.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the nft module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the nft module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.nft.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.nft.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/orm/module/v1alpha1/module.ts b/util/inj-types/cosmos/orm/module/v1alpha1/module.ts new file mode 100644 index 00000000..b382964b --- /dev/null +++ b/util/inj-types/cosmos/orm/module/v1alpha1/module.ts @@ -0,0 +1,85 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** + * Module defines the ORM module which adds providers to the app container for + * module-scoped DB's. In the future it may provide gRPC services for interacting + * with ORM data. + */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.orm.module.v1alpha1.Module"; + value: Uint8Array; +} +/** + * Module defines the ORM module which adds providers to the app container for + * module-scoped DB's. In the future it may provide gRPC services for interacting + * with ORM data. + */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** + * Module defines the ORM module which adds providers to the app container for + * module-scoped DB's. In the future it may provide gRPC services for interacting + * with ORM data. + */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.orm.module.v1alpha1.Module", + aminoType: "cosmos-sdk/Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.orm.module.v1alpha1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/orm/query/v1alpha1/query.rpc.Query.ts b/util/inj-types/cosmos/orm/query/v1alpha1/query.rpc.Query.ts new file mode 100644 index 00000000..1693d38b --- /dev/null +++ b/util/inj-types/cosmos/orm/query/v1alpha1/query.rpc.Query.ts @@ -0,0 +1,41 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { GetRequest, GetResponse, ListRequest, ListResponse } from "./query"; +/** Query is a generic gRPC service for querying ORM data. */ +export interface Query { + /** Get queries an ORM table against an unique index. */ + get(request: GetRequest): Promise; + /** List queries an ORM table against an index. */ + list(request: ListRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Get queries an ORM table against an unique index. */ + get = async (request: GetRequest): Promise => { + const data = GetRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.orm.query.v1alpha1.Query", "Get", data); + return promise.then(data => GetResponse.decode(new BinaryReader(data))); + }; + /* List queries an ORM table against an index. */ + list = async (request: ListRequest): Promise => { + const data = ListRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.orm.query.v1alpha1.Query", "List", data); + return promise.then(data => ListResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + get(request: GetRequest): Promise { + return queryService.get(request); + }, + list(request: ListRequest): Promise { + return queryService.list(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/orm/query/v1alpha1/query.ts b/util/inj-types/cosmos/orm/query/v1alpha1/query.ts new file mode 100644 index 00000000..70b6e8ef --- /dev/null +++ b/util/inj-types/cosmos/orm/query/v1alpha1/query.ts @@ -0,0 +1,979 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../base/query/v1beta1/pagination"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** GetRequest is the Query/Get request type. */ +export interface GetRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. If it is non-empty, it must + * refer to an unique index. + */ + index: string; + /** + * values are the values of the fields corresponding to the requested index. + * There must be as many values provided as there are fields in the index and + * these values must correspond to the index field types. + */ + values: IndexValue[]; +} +export interface GetRequestProtoMsg { + typeUrl: "/cosmos.orm.query.v1alpha1.GetRequest"; + value: Uint8Array; +} +/** GetRequest is the Query/Get request type. */ +export interface GetRequestAmino { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + message_name?: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. If it is non-empty, it must + * refer to an unique index. + */ + index?: string; + /** + * values are the values of the fields corresponding to the requested index. + * There must be as many values provided as there are fields in the index and + * these values must correspond to the index field types. + */ + values?: IndexValueAmino[]; +} +export interface GetRequestAminoMsg { + type: "cosmos-sdk/GetRequest"; + value: GetRequestAmino; +} +/** GetRequest is the Query/Get request type. */ +export interface GetRequestSDKType { + message_name: string; + index: string; + values: IndexValueSDKType[]; +} +/** GetResponse is the Query/Get response type. */ +export interface GetResponse { + /** + * result is the result of the get query. If no value is found, the gRPC + * status code NOT_FOUND will be returned. + */ + result?: Any; +} +export interface GetResponseProtoMsg { + typeUrl: "/cosmos.orm.query.v1alpha1.GetResponse"; + value: Uint8Array; +} +/** GetResponse is the Query/Get response type. */ +export interface GetResponseAmino { + /** + * result is the result of the get query. If no value is found, the gRPC + * status code NOT_FOUND will be returned. + */ + result?: AnyAmino; +} +export interface GetResponseAminoMsg { + type: "cosmos-sdk/GetResponse"; + value: GetResponseAmino; +} +/** GetResponse is the Query/Get response type. */ +export interface GetResponseSDKType { + result?: AnySDKType; +} +/** ListRequest is the Query/List request type. */ +export interface ListRequest { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + messageName: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. + */ + index: string; + /** prefix defines a prefix query. */ + prefix?: ListRequest_Prefix; + /** range defines a range query. */ + range?: ListRequest_Range; + /** pagination is the pagination request. */ + pagination?: PageRequest; +} +export interface ListRequestProtoMsg { + typeUrl: "/cosmos.orm.query.v1alpha1.ListRequest"; + value: Uint8Array; +} +/** ListRequest is the Query/List request type. */ +export interface ListRequestAmino { + /** message_name is the fully-qualified message name of the ORM table being queried. */ + message_name?: string; + /** + * index is the index fields expression used in orm definitions. If it + * is empty, the table's primary key is assumed. + */ + index?: string; + /** prefix defines a prefix query. */ + prefix?: ListRequest_PrefixAmino; + /** range defines a range query. */ + range?: ListRequest_RangeAmino; + /** pagination is the pagination request. */ + pagination?: PageRequestAmino; +} +export interface ListRequestAminoMsg { + type: "cosmos-sdk/ListRequest"; + value: ListRequestAmino; +} +/** ListRequest is the Query/List request type. */ +export interface ListRequestSDKType { + message_name: string; + index: string; + prefix?: ListRequest_PrefixSDKType; + range?: ListRequest_RangeSDKType; + pagination?: PageRequestSDKType; +} +/** Prefix specifies the arguments to a prefix query. */ +export interface ListRequest_Prefix { + /** + * values specifies the index values for the prefix query. + * It is valid to special a partial prefix with fewer values than + * the number of fields in the index. + */ + values: IndexValue[]; +} +export interface ListRequest_PrefixProtoMsg { + typeUrl: "/cosmos.orm.query.v1alpha1.Prefix"; + value: Uint8Array; +} +/** Prefix specifies the arguments to a prefix query. */ +export interface ListRequest_PrefixAmino { + /** + * values specifies the index values for the prefix query. + * It is valid to special a partial prefix with fewer values than + * the number of fields in the index. + */ + values?: IndexValueAmino[]; +} +export interface ListRequest_PrefixAminoMsg { + type: "cosmos-sdk/Prefix"; + value: ListRequest_PrefixAmino; +} +/** Prefix specifies the arguments to a prefix query. */ +export interface ListRequest_PrefixSDKType { + values: IndexValueSDKType[]; +} +/** Range specifies the arguments to a range query. */ +export interface ListRequest_Range { + /** + * start specifies the starting index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + start: IndexValue[]; + /** + * end specifies the inclusive ending index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + end: IndexValue[]; +} +export interface ListRequest_RangeProtoMsg { + typeUrl: "/cosmos.orm.query.v1alpha1.Range"; + value: Uint8Array; +} +/** Range specifies the arguments to a range query. */ +export interface ListRequest_RangeAmino { + /** + * start specifies the starting index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + start?: IndexValueAmino[]; + /** + * end specifies the inclusive ending index values for the range query. + * It is valid to provide fewer values than the number of fields in the + * index. + */ + end?: IndexValueAmino[]; +} +export interface ListRequest_RangeAminoMsg { + type: "cosmos-sdk/Range"; + value: ListRequest_RangeAmino; +} +/** Range specifies the arguments to a range query. */ +export interface ListRequest_RangeSDKType { + start: IndexValueSDKType[]; + end: IndexValueSDKType[]; +} +/** ListResponse is the Query/List response type. */ +export interface ListResponse { + /** results are the results of the query. */ + results: Any[]; + /** pagination is the pagination response. */ + pagination?: PageResponse; +} +export interface ListResponseProtoMsg { + typeUrl: "/cosmos.orm.query.v1alpha1.ListResponse"; + value: Uint8Array; +} +/** ListResponse is the Query/List response type. */ +export interface ListResponseAmino { + /** results are the results of the query. */ + results?: AnyAmino[]; + /** pagination is the pagination response. */ + pagination?: PageResponseAmino; +} +export interface ListResponseAminoMsg { + type: "cosmos-sdk/ListResponse"; + value: ListResponseAmino; +} +/** ListResponse is the Query/List response type. */ +export interface ListResponseSDKType { + results: AnySDKType[]; + pagination?: PageResponseSDKType; +} +/** IndexValue represents the value of a field in an ORM index expression. */ +export interface IndexValue { + /** + * uint specifies a value for an uint32, fixed32, uint64, or fixed64 + * index field. + */ + uint?: bigint; + /** + * int64 specifies a value for an int32, sfixed32, int64, or sfixed64 + * index field. + */ + int?: bigint; + /** str specifies a value for a string index field. */ + str?: string; + /** bytes specifies a value for a bytes index field. */ + bytes?: Uint8Array; + /** enum specifies a value for an enum index field. */ + enum?: string; + /** bool specifies a value for a bool index field. */ + bool?: boolean; + /** timestamp specifies a value for a timestamp index field. */ + timestamp?: Date; + /** duration specifies a value for a duration index field. */ + duration?: Duration; +} +export interface IndexValueProtoMsg { + typeUrl: "/cosmos.orm.query.v1alpha1.IndexValue"; + value: Uint8Array; +} +/** IndexValue represents the value of a field in an ORM index expression. */ +export interface IndexValueAmino { + /** + * uint specifies a value for an uint32, fixed32, uint64, or fixed64 + * index field. + */ + uint?: string; + /** + * int64 specifies a value for an int32, sfixed32, int64, or sfixed64 + * index field. + */ + int?: string; + /** str specifies a value for a string index field. */ + str?: string; + /** bytes specifies a value for a bytes index field. */ + bytes?: string; + /** enum specifies a value for an enum index field. */ + enum?: string; + /** bool specifies a value for a bool index field. */ + bool?: boolean; + /** timestamp specifies a value for a timestamp index field. */ + timestamp?: string; + /** duration specifies a value for a duration index field. */ + duration?: DurationAmino; +} +export interface IndexValueAminoMsg { + type: "cosmos-sdk/IndexValue"; + value: IndexValueAmino; +} +/** IndexValue represents the value of a field in an ORM index expression. */ +export interface IndexValueSDKType { + uint?: bigint; + int?: bigint; + str?: string; + bytes?: Uint8Array; + enum?: string; + bool?: boolean; + timestamp?: Date; + duration?: DurationSDKType; +} +function createBaseGetRequest(): GetRequest { + return { + messageName: "", + index: "", + values: [] + }; +} +export const GetRequest = { + typeUrl: "/cosmos.orm.query.v1alpha1.GetRequest", + aminoType: "cosmos-sdk/GetRequest", + encode(message: GetRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageName = reader.string(); + break; + case 2: + message.index = reader.string(); + break; + case 3: + message.values.push(IndexValue.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetRequest { + const message = createBaseGetRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.values = object.values?.map(e => IndexValue.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GetRequestAmino): GetRequest { + const message = createBaseGetRequest(); + if (object.message_name !== undefined && object.message_name !== null) { + message.messageName = object.message_name; + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + message.values = object.values?.map(e => IndexValue.fromAmino(e)) || []; + return message; + }, + toAmino(message: GetRequest): GetRequestAmino { + const obj: any = {}; + obj.message_name = message.messageName === "" ? undefined : message.messageName; + obj.index = message.index === "" ? undefined : message.index; + if (message.values) { + obj.values = message.values.map(e => e ? IndexValue.toAmino(e) : undefined); + } else { + obj.values = message.values; + } + return obj; + }, + fromAminoMsg(object: GetRequestAminoMsg): GetRequest { + return GetRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetRequest): GetRequestAminoMsg { + return { + type: "cosmos-sdk/GetRequest", + value: GetRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetRequestProtoMsg): GetRequest { + return GetRequest.decode(message.value); + }, + toProto(message: GetRequest): Uint8Array { + return GetRequest.encode(message).finish(); + }, + toProtoMsg(message: GetRequest): GetRequestProtoMsg { + return { + typeUrl: "/cosmos.orm.query.v1alpha1.GetRequest", + value: GetRequest.encode(message).finish() + }; + } +}; +function createBaseGetResponse(): GetResponse { + return { + result: undefined + }; +} +export const GetResponse = { + typeUrl: "/cosmos.orm.query.v1alpha1.GetResponse", + aminoType: "cosmos-sdk/GetResponse", + encode(message: GetResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== undefined) { + Any.encode(message.result, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetResponse { + const message = createBaseGetResponse(); + message.result = object.result !== undefined && object.result !== null ? Any.fromPartial(object.result) : undefined; + return message; + }, + fromAmino(object: GetResponseAmino): GetResponse { + const message = createBaseGetResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = Any.fromAmino(object.result); + } + return message; + }, + toAmino(message: GetResponse): GetResponseAmino { + const obj: any = {}; + obj.result = message.result ? Any.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: GetResponseAminoMsg): GetResponse { + return GetResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetResponse): GetResponseAminoMsg { + return { + type: "cosmos-sdk/GetResponse", + value: GetResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetResponseProtoMsg): GetResponse { + return GetResponse.decode(message.value); + }, + toProto(message: GetResponse): Uint8Array { + return GetResponse.encode(message).finish(); + }, + toProtoMsg(message: GetResponse): GetResponseProtoMsg { + return { + typeUrl: "/cosmos.orm.query.v1alpha1.GetResponse", + value: GetResponse.encode(message).finish() + }; + } +}; +function createBaseListRequest(): ListRequest { + return { + messageName: "", + index: "", + prefix: undefined, + range: undefined, + pagination: undefined + }; +} +export const ListRequest = { + typeUrl: "/cosmos.orm.query.v1alpha1.ListRequest", + aminoType: "cosmos-sdk/ListRequest", + encode(message: ListRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.messageName !== "") { + writer.uint32(10).string(message.messageName); + } + if (message.index !== "") { + writer.uint32(18).string(message.index); + } + if (message.prefix !== undefined) { + ListRequest_Prefix.encode(message.prefix, writer.uint32(26).fork()).ldelim(); + } + if (message.range !== undefined) { + ListRequest_Range.encode(message.range, writer.uint32(34).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageName = reader.string(); + break; + case 2: + message.index = reader.string(); + break; + case 3: + message.prefix = ListRequest_Prefix.decode(reader, reader.uint32()); + break; + case 4: + message.range = ListRequest_Range.decode(reader, reader.uint32()); + break; + case 5: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ListRequest { + const message = createBaseListRequest(); + message.messageName = object.messageName ?? ""; + message.index = object.index ?? ""; + message.prefix = object.prefix !== undefined && object.prefix !== null ? ListRequest_Prefix.fromPartial(object.prefix) : undefined; + message.range = object.range !== undefined && object.range !== null ? ListRequest_Range.fromPartial(object.range) : undefined; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: ListRequestAmino): ListRequest { + const message = createBaseListRequest(); + if (object.message_name !== undefined && object.message_name !== null) { + message.messageName = object.message_name; + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = ListRequest_Prefix.fromAmino(object.prefix); + } + if (object.range !== undefined && object.range !== null) { + message.range = ListRequest_Range.fromAmino(object.range); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: ListRequest): ListRequestAmino { + const obj: any = {}; + obj.message_name = message.messageName === "" ? undefined : message.messageName; + obj.index = message.index === "" ? undefined : message.index; + obj.prefix = message.prefix ? ListRequest_Prefix.toAmino(message.prefix) : undefined; + obj.range = message.range ? ListRequest_Range.toAmino(message.range) : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: ListRequestAminoMsg): ListRequest { + return ListRequest.fromAmino(object.value); + }, + toAminoMsg(message: ListRequest): ListRequestAminoMsg { + return { + type: "cosmos-sdk/ListRequest", + value: ListRequest.toAmino(message) + }; + }, + fromProtoMsg(message: ListRequestProtoMsg): ListRequest { + return ListRequest.decode(message.value); + }, + toProto(message: ListRequest): Uint8Array { + return ListRequest.encode(message).finish(); + }, + toProtoMsg(message: ListRequest): ListRequestProtoMsg { + return { + typeUrl: "/cosmos.orm.query.v1alpha1.ListRequest", + value: ListRequest.encode(message).finish() + }; + } +}; +function createBaseListRequest_Prefix(): ListRequest_Prefix { + return { + values: [] + }; +} +export const ListRequest_Prefix = { + typeUrl: "/cosmos.orm.query.v1alpha1.Prefix", + aminoType: "cosmos-sdk/Prefix", + encode(message: ListRequest_Prefix, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.values) { + IndexValue.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Prefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Prefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.values.push(IndexValue.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ListRequest_Prefix { + const message = createBaseListRequest_Prefix(); + message.values = object.values?.map(e => IndexValue.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ListRequest_PrefixAmino): ListRequest_Prefix { + const message = createBaseListRequest_Prefix(); + message.values = object.values?.map(e => IndexValue.fromAmino(e)) || []; + return message; + }, + toAmino(message: ListRequest_Prefix): ListRequest_PrefixAmino { + const obj: any = {}; + if (message.values) { + obj.values = message.values.map(e => e ? IndexValue.toAmino(e) : undefined); + } else { + obj.values = message.values; + } + return obj; + }, + fromAminoMsg(object: ListRequest_PrefixAminoMsg): ListRequest_Prefix { + return ListRequest_Prefix.fromAmino(object.value); + }, + toAminoMsg(message: ListRequest_Prefix): ListRequest_PrefixAminoMsg { + return { + type: "cosmos-sdk/Prefix", + value: ListRequest_Prefix.toAmino(message) + }; + }, + fromProtoMsg(message: ListRequest_PrefixProtoMsg): ListRequest_Prefix { + return ListRequest_Prefix.decode(message.value); + }, + toProto(message: ListRequest_Prefix): Uint8Array { + return ListRequest_Prefix.encode(message).finish(); + }, + toProtoMsg(message: ListRequest_Prefix): ListRequest_PrefixProtoMsg { + return { + typeUrl: "/cosmos.orm.query.v1alpha1.Prefix", + value: ListRequest_Prefix.encode(message).finish() + }; + } +}; +function createBaseListRequest_Range(): ListRequest_Range { + return { + start: [], + end: [] + }; +} +export const ListRequest_Range = { + typeUrl: "/cosmos.orm.query.v1alpha1.Range", + aminoType: "cosmos-sdk/Range", + encode(message: ListRequest_Range, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.start) { + IndexValue.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.end) { + IndexValue.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ListRequest_Range { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListRequest_Range(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start.push(IndexValue.decode(reader, reader.uint32())); + break; + case 2: + message.end.push(IndexValue.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ListRequest_Range { + const message = createBaseListRequest_Range(); + message.start = object.start?.map(e => IndexValue.fromPartial(e)) || []; + message.end = object.end?.map(e => IndexValue.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ListRequest_RangeAmino): ListRequest_Range { + const message = createBaseListRequest_Range(); + message.start = object.start?.map(e => IndexValue.fromAmino(e)) || []; + message.end = object.end?.map(e => IndexValue.fromAmino(e)) || []; + return message; + }, + toAmino(message: ListRequest_Range): ListRequest_RangeAmino { + const obj: any = {}; + if (message.start) { + obj.start = message.start.map(e => e ? IndexValue.toAmino(e) : undefined); + } else { + obj.start = message.start; + } + if (message.end) { + obj.end = message.end.map(e => e ? IndexValue.toAmino(e) : undefined); + } else { + obj.end = message.end; + } + return obj; + }, + fromAminoMsg(object: ListRequest_RangeAminoMsg): ListRequest_Range { + return ListRequest_Range.fromAmino(object.value); + }, + toAminoMsg(message: ListRequest_Range): ListRequest_RangeAminoMsg { + return { + type: "cosmos-sdk/Range", + value: ListRequest_Range.toAmino(message) + }; + }, + fromProtoMsg(message: ListRequest_RangeProtoMsg): ListRequest_Range { + return ListRequest_Range.decode(message.value); + }, + toProto(message: ListRequest_Range): Uint8Array { + return ListRequest_Range.encode(message).finish(); + }, + toProtoMsg(message: ListRequest_Range): ListRequest_RangeProtoMsg { + return { + typeUrl: "/cosmos.orm.query.v1alpha1.Range", + value: ListRequest_Range.encode(message).finish() + }; + } +}; +function createBaseListResponse(): ListResponse { + return { + results: [], + pagination: undefined + }; +} +export const ListResponse = { + typeUrl: "/cosmos.orm.query.v1alpha1.ListResponse", + aminoType: "cosmos-sdk/ListResponse", + encode(message: ListResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.results) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.results.push(Any.decode(reader, reader.uint32())); + break; + case 5: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ListResponse { + const message = createBaseListResponse(); + message.results = object.results?.map(e => Any.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: ListResponseAmino): ListResponse { + const message = createBaseListResponse(); + message.results = object.results?.map(e => Any.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: ListResponse): ListResponseAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.results = message.results; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: ListResponseAminoMsg): ListResponse { + return ListResponse.fromAmino(object.value); + }, + toAminoMsg(message: ListResponse): ListResponseAminoMsg { + return { + type: "cosmos-sdk/ListResponse", + value: ListResponse.toAmino(message) + }; + }, + fromProtoMsg(message: ListResponseProtoMsg): ListResponse { + return ListResponse.decode(message.value); + }, + toProto(message: ListResponse): Uint8Array { + return ListResponse.encode(message).finish(); + }, + toProtoMsg(message: ListResponse): ListResponseProtoMsg { + return { + typeUrl: "/cosmos.orm.query.v1alpha1.ListResponse", + value: ListResponse.encode(message).finish() + }; + } +}; +function createBaseIndexValue(): IndexValue { + return { + uint: undefined, + int: undefined, + str: undefined, + bytes: undefined, + enum: undefined, + bool: undefined, + timestamp: undefined, + duration: undefined + }; +} +export const IndexValue = { + typeUrl: "/cosmos.orm.query.v1alpha1.IndexValue", + aminoType: "cosmos-sdk/IndexValue", + encode(message: IndexValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.uint !== undefined) { + writer.uint32(8).uint64(message.uint); + } + if (message.int !== undefined) { + writer.uint32(16).int64(message.int); + } + if (message.str !== undefined) { + writer.uint32(26).string(message.str); + } + if (message.bytes !== undefined) { + writer.uint32(34).bytes(message.bytes); + } + if (message.enum !== undefined) { + writer.uint32(42).string(message.enum); + } + if (message.bool !== undefined) { + writer.uint32(48).bool(message.bool); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(58).fork()).ldelim(); + } + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IndexValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uint = reader.uint64(); + break; + case 2: + message.int = reader.int64(); + break; + case 3: + message.str = reader.string(); + break; + case 4: + message.bytes = reader.bytes(); + break; + case 5: + message.enum = reader.string(); + break; + case 6: + message.bool = reader.bool(); + break; + case 7: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 8: + message.duration = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IndexValue { + const message = createBaseIndexValue(); + message.uint = object.uint !== undefined && object.uint !== null ? BigInt(object.uint.toString()) : undefined; + message.int = object.int !== undefined && object.int !== null ? BigInt(object.int.toString()) : undefined; + message.str = object.str ?? undefined; + message.bytes = object.bytes ?? undefined; + message.enum = object.enum ?? undefined; + message.bool = object.bool ?? undefined; + message.timestamp = object.timestamp ?? undefined; + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; + return message; + }, + fromAmino(object: IndexValueAmino): IndexValue { + const message = createBaseIndexValue(); + if (object.uint !== undefined && object.uint !== null) { + message.uint = BigInt(object.uint); + } + if (object.int !== undefined && object.int !== null) { + message.int = BigInt(object.int); + } + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.bytes !== undefined && object.bytes !== null) { + message.bytes = bytesFromBase64(object.bytes); + } + if (object.enum !== undefined && object.enum !== null) { + message.enum = object.enum; + } + if (object.bool !== undefined && object.bool !== null) { + message.bool = object.bool; + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.duration !== undefined && object.duration !== null) { + message.duration = Duration.fromAmino(object.duration); + } + return message; + }, + toAmino(message: IndexValue): IndexValueAmino { + const obj: any = {}; + obj.uint = message.uint !== BigInt(0) ? message.uint.toString() : undefined; + obj.int = message.int !== BigInt(0) ? message.int.toString() : undefined; + obj.str = message.str === null ? undefined : message.str; + obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; + obj.enum = message.enum === null ? undefined : message.enum; + obj.bool = message.bool === null ? undefined : message.bool; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; + return obj; + }, + fromAminoMsg(object: IndexValueAminoMsg): IndexValue { + return IndexValue.fromAmino(object.value); + }, + toAminoMsg(message: IndexValue): IndexValueAminoMsg { + return { + type: "cosmos-sdk/IndexValue", + value: IndexValue.toAmino(message) + }; + }, + fromProtoMsg(message: IndexValueProtoMsg): IndexValue { + return IndexValue.decode(message.value); + }, + toProto(message: IndexValue): Uint8Array { + return IndexValue.encode(message).finish(); + }, + toProtoMsg(message: IndexValue): IndexValueProtoMsg { + return { + typeUrl: "/cosmos.orm.query.v1alpha1.IndexValue", + value: IndexValue.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/params/module/v1/module.ts b/util/inj-types/cosmos/params/module/v1/module.ts new file mode 100644 index 00000000..76563931 --- /dev/null +++ b/util/inj-types/cosmos/params/module/v1/module.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the params module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.params.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the params module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the params module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.params.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.params.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/params/v1beta1/params.ts b/util/inj-types/cosmos/params/v1beta1/params.ts new file mode 100644 index 00000000..b5471e1a --- /dev/null +++ b/util/inj-types/cosmos/params/v1beta1/params.ts @@ -0,0 +1,256 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** ParameterChangeProposal defines a proposal to change one or more parameters. */ +export interface ParameterChangeProposal { + $typeUrl?: "/cosmos.params.v1beta1.ParameterChangeProposal"; + title: string; + description: string; + changes: ParamChange[]; +} +export interface ParameterChangeProposalProtoMsg { + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal"; + value: Uint8Array; +} +/** ParameterChangeProposal defines a proposal to change one or more parameters. */ +export interface ParameterChangeProposalAmino { + title?: string; + description?: string; + changes: ParamChangeAmino[]; +} +export interface ParameterChangeProposalAminoMsg { + type: "cosmos-sdk/ParameterChangeProposal"; + value: ParameterChangeProposalAmino; +} +/** ParameterChangeProposal defines a proposal to change one or more parameters. */ +export interface ParameterChangeProposalSDKType { + $typeUrl?: "/cosmos.params.v1beta1.ParameterChangeProposal"; + title: string; + description: string; + changes: ParamChangeSDKType[]; +} +/** + * ParamChange defines an individual parameter change, for use in + * ParameterChangeProposal. + */ +export interface ParamChange { + subspace: string; + key: string; + value: string; +} +export interface ParamChangeProtoMsg { + typeUrl: "/cosmos.params.v1beta1.ParamChange"; + value: Uint8Array; +} +/** + * ParamChange defines an individual parameter change, for use in + * ParameterChangeProposal. + */ +export interface ParamChangeAmino { + subspace?: string; + key?: string; + value?: string; +} +export interface ParamChangeAminoMsg { + type: "cosmos-sdk/ParamChange"; + value: ParamChangeAmino; +} +/** + * ParamChange defines an individual parameter change, for use in + * ParameterChangeProposal. + */ +export interface ParamChangeSDKType { + subspace: string; + key: string; + value: string; +} +function createBaseParameterChangeProposal(): ParameterChangeProposal { + return { + $typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + title: "", + description: "", + changes: [] + }; +} +export const ParameterChangeProposal = { + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + aminoType: "cosmos-sdk/ParameterChangeProposal", + encode(message: ParameterChangeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.changes) { + ParamChange.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParameterChangeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.changes.push(ParamChange.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ParameterChangeProposal { + const message = createBaseParameterChangeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.changes = object.changes?.map(e => ParamChange.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ParameterChangeProposalAmino): ParameterChangeProposal { + const message = createBaseParameterChangeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.changes = object.changes?.map(e => ParamChange.fromAmino(e)) || []; + return message; + }, + toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + if (message.changes) { + obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); + } else { + obj.changes = message.changes; + } + return obj; + }, + fromAminoMsg(object: ParameterChangeProposalAminoMsg): ParameterChangeProposal { + return ParameterChangeProposal.fromAmino(object.value); + }, + toAminoMsg(message: ParameterChangeProposal): ParameterChangeProposalAminoMsg { + return { + type: "cosmos-sdk/ParameterChangeProposal", + value: ParameterChangeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: ParameterChangeProposalProtoMsg): ParameterChangeProposal { + return ParameterChangeProposal.decode(message.value); + }, + toProto(message: ParameterChangeProposal): Uint8Array { + return ParameterChangeProposal.encode(message).finish(); + }, + toProtoMsg(message: ParameterChangeProposal): ParameterChangeProposalProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.ParameterChangeProposal", + value: ParameterChangeProposal.encode(message).finish() + }; + } +}; +function createBaseParamChange(): ParamChange { + return { + subspace: "", + key: "", + value: "" + }; +} +export const ParamChange = { + typeUrl: "/cosmos.params.v1beta1.ParamChange", + aminoType: "cosmos-sdk/ParamChange", + encode(message: ParamChange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParamChange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspace = reader.string(); + break; + case 2: + message.key = reader.string(); + break; + case 3: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ParamChange { + const message = createBaseParamChange(); + message.subspace = object.subspace ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, + fromAmino(object: ParamChangeAmino): ParamChange { + const message = createBaseParamChange(); + if (object.subspace !== undefined && object.subspace !== null) { + message.subspace = object.subspace; + } + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: ParamChange): ParamChangeAmino { + const obj: any = {}; + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; + return obj; + }, + fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { + return ParamChange.fromAmino(object.value); + }, + toAminoMsg(message: ParamChange): ParamChangeAminoMsg { + return { + type: "cosmos-sdk/ParamChange", + value: ParamChange.toAmino(message) + }; + }, + fromProtoMsg(message: ParamChangeProtoMsg): ParamChange { + return ParamChange.decode(message.value); + }, + toProto(message: ParamChange): Uint8Array { + return ParamChange.encode(message).finish(); + }, + toProtoMsg(message: ParamChange): ParamChangeProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.ParamChange", + value: ParamChange.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/params/v1beta1/query.lcd.ts b/util/inj-types/cosmos/params/v1beta1/query.lcd.ts new file mode 100644 index 00000000..9f36956e --- /dev/null +++ b/util/inj-types/cosmos/params/v1beta1/query.lcd.ts @@ -0,0 +1,34 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryParamsRequest, QueryParamsResponseSDKType, QuerySubspacesRequest, QuerySubspacesResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Params queries a specific parameter of a module, given its subspace and + key. */ + params = async (params: QueryParamsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.subspace !== "undefined") { + options.params.subspace = params.subspace; + } + if (typeof params?.key !== "undefined") { + options.params.key = params.key; + } + const endpoint = `cosmos/params/v1beta1/params`; + return await this.req.get(endpoint, options); + }; + /* Subspaces queries for all registered subspaces and all keys for a subspace. + + Since: cosmos-sdk 0.46 */ + subspaces = async (_params: QuerySubspacesRequest = {}): Promise => { + const endpoint = `cosmos/params/v1beta1/subspaces`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/params/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/params/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..2b6e42cf --- /dev/null +++ b/util/inj-types/cosmos/params/v1beta1/query.rpc.Query.ts @@ -0,0 +1,51 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParamsRequest, QueryParamsResponse, QuerySubspacesRequest, QuerySubspacesResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Params queries a specific parameter of a module, given its subspace and + * key. + */ + params(request: QueryParamsRequest): Promise; + /** + * Subspaces queries for all registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ + subspaces(request?: QuerySubspacesRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Params queries a specific parameter of a module, given its subspace and + key. */ + params = async (request: QueryParamsRequest): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.params.v1beta1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; + /* Subspaces queries for all registered subspaces and all keys for a subspace. + + Since: cosmos-sdk 0.46 */ + subspaces = async (request: QuerySubspacesRequest = {}): Promise => { + const data = QuerySubspacesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.params.v1beta1.Query", "Subspaces", data); + return promise.then(data => QuerySubspacesResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request: QueryParamsRequest): Promise { + return queryService.params(request); + }, + subspaces(request?: QuerySubspacesRequest): Promise { + return queryService.subspaces(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/params/v1beta1/query.ts b/util/inj-types/cosmos/params/v1beta1/query.ts new file mode 100644 index 00000000..2397a83e --- /dev/null +++ b/util/inj-types/cosmos/params/v1beta1/query.ts @@ -0,0 +1,519 @@ +import { ParamChange, ParamChangeAmino, ParamChangeSDKType } from "./params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** subspace defines the module to query the parameter for. */ + subspace: string; + /** key defines the key of the parameter in the subspace. */ + key: string; +} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino { + /** subspace defines the module to query the parameter for. */ + subspace?: string; + /** key defines the key of the parameter in the subspace. */ + key?: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType { + subspace: string; + key: string; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** param defines the queried parameter. */ + param: ParamChange; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** param defines the queried parameter. */ + param: ParamChangeAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + param: ParamChangeSDKType; +} +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesRequest {} +export interface QuerySubspacesRequestProtoMsg { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest"; + value: Uint8Array; +} +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesRequestAmino {} +export interface QuerySubspacesRequestAminoMsg { + type: "cosmos-sdk/QuerySubspacesRequest"; + value: QuerySubspacesRequestAmino; +} +/** + * QuerySubspacesRequest defines a request type for querying for all registered + * subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesRequestSDKType {} +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesResponse { + subspaces: Subspace[]; +} +export interface QuerySubspacesResponseProtoMsg { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse"; + value: Uint8Array; +} +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesResponseAmino { + subspaces?: SubspaceAmino[]; +} +export interface QuerySubspacesResponseAminoMsg { + type: "cosmos-sdk/QuerySubspacesResponse"; + value: QuerySubspacesResponseAmino; +} +/** + * QuerySubspacesResponse defines the response types for querying for all + * registered subspaces and all keys for a subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySubspacesResponseSDKType { + subspaces: SubspaceSDKType[]; +} +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface Subspace { + subspace: string; + keys: string[]; +} +export interface SubspaceProtoMsg { + typeUrl: "/cosmos.params.v1beta1.Subspace"; + value: Uint8Array; +} +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface SubspaceAmino { + subspace?: string; + keys?: string[]; +} +export interface SubspaceAminoMsg { + type: "cosmos-sdk/Subspace"; + value: SubspaceAmino; +} +/** + * Subspace defines a parameter subspace name and all the keys that exist for + * the subspace. + * + * Since: cosmos-sdk 0.46 + */ +export interface SubspaceSDKType { + subspace: string; + keys: string[]; +} +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { + subspace: "", + key: "" + }; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspace = reader.string(); + break; + case 2: + message.key = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.subspace = object.subspace ?? ""; + message.key = object.key ?? ""; + return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + if (object.subspace !== undefined && object.subspace !== null) { + message.subspace = object.subspace; + } + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + return message; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + param: ParamChange.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.param = ParamChange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.param = object.param !== undefined && object.param !== null ? ParamChange.fromPartial(object.param) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.param !== undefined && object.param !== null) { + message.param = ParamChange.fromAmino(object.param); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.param = message.param ? ParamChange.toAmino(message.param) : ParamChange.toAmino(ParamChange.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { + return {}; +} +export const QuerySubspacesRequest = { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", + aminoType: "cosmos-sdk/QuerySubspacesRequest", + encode(_: QuerySubspacesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, + fromAmino(_: QuerySubspacesRequestAmino): QuerySubspacesRequest { + const message = createBaseQuerySubspacesRequest(); + return message; + }, + toAmino(_: QuerySubspacesRequest): QuerySubspacesRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QuerySubspacesRequestAminoMsg): QuerySubspacesRequest { + return QuerySubspacesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySubspacesRequest): QuerySubspacesRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySubspacesRequest", + value: QuerySubspacesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySubspacesRequestProtoMsg): QuerySubspacesRequest { + return QuerySubspacesRequest.decode(message.value); + }, + toProto(message: QuerySubspacesRequest): Uint8Array { + return QuerySubspacesRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySubspacesRequest): QuerySubspacesRequestProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesRequest", + value: QuerySubspacesRequest.encode(message).finish() + }; + } +}; +function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { + return { + subspaces: [] + }; +} +export const QuerySubspacesResponse = { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", + aminoType: "cosmos-sdk/QuerySubspacesResponse", + encode(message: QuerySubspacesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.subspaces) { + Subspace.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySubspacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySubspacesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspaces.push(Subspace.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySubspacesResponse { + const message = createBaseQuerySubspacesResponse(); + message.subspaces = object.subspaces?.map(e => Subspace.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QuerySubspacesResponseAmino): QuerySubspacesResponse { + const message = createBaseQuerySubspacesResponse(); + message.subspaces = object.subspaces?.map(e => Subspace.fromAmino(e)) || []; + return message; + }, + toAmino(message: QuerySubspacesResponse): QuerySubspacesResponseAmino { + const obj: any = {}; + if (message.subspaces) { + obj.subspaces = message.subspaces.map(e => e ? Subspace.toAmino(e) : undefined); + } else { + obj.subspaces = message.subspaces; + } + return obj; + }, + fromAminoMsg(object: QuerySubspacesResponseAminoMsg): QuerySubspacesResponse { + return QuerySubspacesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySubspacesResponse): QuerySubspacesResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySubspacesResponse", + value: QuerySubspacesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySubspacesResponseProtoMsg): QuerySubspacesResponse { + return QuerySubspacesResponse.decode(message.value); + }, + toProto(message: QuerySubspacesResponse): Uint8Array { + return QuerySubspacesResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySubspacesResponse): QuerySubspacesResponseProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.QuerySubspacesResponse", + value: QuerySubspacesResponse.encode(message).finish() + }; + } +}; +function createBaseSubspace(): Subspace { + return { + subspace: "", + keys: [] + }; +} +export const Subspace = { + typeUrl: "/cosmos.params.v1beta1.Subspace", + aminoType: "cosmos-sdk/Subspace", + encode(message: Subspace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + for (const v of message.keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Subspace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubspace(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subspace = reader.string(); + break; + case 2: + message.keys.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Subspace { + const message = createBaseSubspace(); + message.subspace = object.subspace ?? ""; + message.keys = object.keys?.map(e => e) || []; + return message; + }, + fromAmino(object: SubspaceAmino): Subspace { + const message = createBaseSubspace(); + if (object.subspace !== undefined && object.subspace !== null) { + message.subspace = object.subspace; + } + message.keys = object.keys?.map(e => e) || []; + return message; + }, + toAmino(message: Subspace): SubspaceAmino { + const obj: any = {}; + obj.subspace = message.subspace === "" ? undefined : message.subspace; + if (message.keys) { + obj.keys = message.keys.map(e => e); + } else { + obj.keys = message.keys; + } + return obj; + }, + fromAminoMsg(object: SubspaceAminoMsg): Subspace { + return Subspace.fromAmino(object.value); + }, + toAminoMsg(message: Subspace): SubspaceAminoMsg { + return { + type: "cosmos-sdk/Subspace", + value: Subspace.toAmino(message) + }; + }, + fromProtoMsg(message: SubspaceProtoMsg): Subspace { + return Subspace.decode(message.value); + }, + toProto(message: Subspace): Uint8Array { + return Subspace.encode(message).finish(); + }, + toProtoMsg(message: Subspace): SubspaceProtoMsg { + return { + typeUrl: "/cosmos.params.v1beta1.Subspace", + value: Subspace.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/query/v1/query.ts b/util/inj-types/cosmos/query/v1/query.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/util/inj-types/cosmos/query/v1/query.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/util/inj-types/cosmos/reflection/v1/reflection.ts b/util/inj-types/cosmos/reflection/v1/reflection.ts new file mode 100644 index 00000000..f61f7571 --- /dev/null +++ b/util/inj-types/cosmos/reflection/v1/reflection.ts @@ -0,0 +1,168 @@ +import { FileDescriptorProto, FileDescriptorProtoAmino, FileDescriptorProtoSDKType } from "../../../google/protobuf/descriptor"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequest {} +export interface FileDescriptorsRequestProtoMsg { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsRequest"; + value: Uint8Array; +} +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequestAmino {} +export interface FileDescriptorsRequestAminoMsg { + type: "cosmos-sdk/FileDescriptorsRequest"; + value: FileDescriptorsRequestAmino; +} +/** FileDescriptorsRequest is the Query/FileDescriptors request type. */ +export interface FileDescriptorsRequestSDKType {} +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponse { + /** files is the file descriptors. */ + files: FileDescriptorProto[]; +} +export interface FileDescriptorsResponseProtoMsg { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsResponse"; + value: Uint8Array; +} +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponseAmino { + /** files is the file descriptors. */ + files?: FileDescriptorProtoAmino[]; +} +export interface FileDescriptorsResponseAminoMsg { + type: "cosmos-sdk/FileDescriptorsResponse"; + value: FileDescriptorsResponseAmino; +} +/** FileDescriptorsResponse is the Query/FileDescriptors response type. */ +export interface FileDescriptorsResponseSDKType { + files: FileDescriptorProtoSDKType[]; +} +function createBaseFileDescriptorsRequest(): FileDescriptorsRequest { + return {}; +} +export const FileDescriptorsRequest = { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsRequest", + aminoType: "cosmos-sdk/FileDescriptorsRequest", + encode(_: FileDescriptorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, + fromAmino(_: FileDescriptorsRequestAmino): FileDescriptorsRequest { + const message = createBaseFileDescriptorsRequest(); + return message; + }, + toAmino(_: FileDescriptorsRequest): FileDescriptorsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: FileDescriptorsRequestAminoMsg): FileDescriptorsRequest { + return FileDescriptorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: FileDescriptorsRequest): FileDescriptorsRequestAminoMsg { + return { + type: "cosmos-sdk/FileDescriptorsRequest", + value: FileDescriptorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: FileDescriptorsRequestProtoMsg): FileDescriptorsRequest { + return FileDescriptorsRequest.decode(message.value); + }, + toProto(message: FileDescriptorsRequest): Uint8Array { + return FileDescriptorsRequest.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorsRequest): FileDescriptorsRequestProtoMsg { + return { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsRequest", + value: FileDescriptorsRequest.encode(message).finish() + }; + } +}; +function createBaseFileDescriptorsResponse(): FileDescriptorsResponse { + return { + files: [] + }; +} +export const FileDescriptorsResponse = { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsResponse", + aminoType: "cosmos-sdk/FileDescriptorsResponse", + encode(message: FileDescriptorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.files) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.files.push(FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map(e => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FileDescriptorsResponseAmino): FileDescriptorsResponse { + const message = createBaseFileDescriptorsResponse(); + message.files = object.files?.map(e => FileDescriptorProto.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileDescriptorsResponse): FileDescriptorsResponseAmino { + const obj: any = {}; + if (message.files) { + obj.files = message.files.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); + } else { + obj.files = message.files; + } + return obj; + }, + fromAminoMsg(object: FileDescriptorsResponseAminoMsg): FileDescriptorsResponse { + return FileDescriptorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: FileDescriptorsResponse): FileDescriptorsResponseAminoMsg { + return { + type: "cosmos-sdk/FileDescriptorsResponse", + value: FileDescriptorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: FileDescriptorsResponseProtoMsg): FileDescriptorsResponse { + return FileDescriptorsResponse.decode(message.value); + }, + toProto(message: FileDescriptorsResponse): Uint8Array { + return FileDescriptorsResponse.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorsResponse): FileDescriptorsResponseProtoMsg { + return { + typeUrl: "/cosmos.reflection.v1.FileDescriptorsResponse", + value: FileDescriptorsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/rpc.query.ts b/util/inj-types/cosmos/rpc.query.ts new file mode 100644 index 00000000..296cfc96 --- /dev/null +++ b/util/inj-types/cosmos/rpc.query.ts @@ -0,0 +1,64 @@ +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { QueryClient } from "@cosmjs/stargate"; +export const createRPCQueryClient = async ({ + rpcEndpoint +}: { + rpcEndpoint: string | HttpEndpoint; +}) => { + const tmClient = await connectComet(rpcEndpoint); + const client = new QueryClient(tmClient); + return { + cosmos: { + auth: { + v1beta1: (await import("./auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + authz: { + v1beta1: (await import("./authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + bank: { + v1beta1: (await import("./bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + base: { + node: { + v1beta1: (await import("./base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) + } + }, + consensus: { + v1: (await import("./consensus/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + distribution: { + v1beta1: (await import("./distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + feegrant: { + v1beta1: (await import("./feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + gov: { + v1: (await import("./gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("./gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + group: { + v1: (await import("./group/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + mint: { + v1beta1: (await import("./mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + orm: { + query: { + v1alpha1: (await import("./orm/query/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) + } + }, + params: { + v1beta1: (await import("./params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + staking: { + v1beta1: (await import("./staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + tx: { + v1beta1: (await import("./tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) + }, + upgrade: { + v1beta1: (await import("./upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + } + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/rpc.tx.ts b/util/inj-types/cosmos/rpc.tx.ts new file mode 100644 index 00000000..4a6efb4e --- /dev/null +++ b/util/inj-types/cosmos/rpc.tx.ts @@ -0,0 +1,46 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + cosmos: { + auth: { + v1beta1: new (await import("./auth/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + authz: { + v1beta1: new (await import("./authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + bank: { + v1beta1: new (await import("./bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + consensus: { + v1: new (await import("./consensus/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + distribution: { + v1beta1: new (await import("./distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + feegrant: { + v1beta1: new (await import("./feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + gov: { + v1: new (await import("./gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("./gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + group: { + v1: new (await import("./group/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + mint: { + v1beta1: new (await import("./mint/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + staking: { + v1beta1: new (await import("./staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + upgrade: { + v1beta1: new (await import("./upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + vesting: { + v1beta1: new (await import("./vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + } + } +}); \ No newline at end of file diff --git a/util/inj-types/cosmos/slashing/module/v1/module.ts b/util/inj-types/cosmos/slashing/module/v1/module.ts new file mode 100644 index 00000000..c7561c83 --- /dev/null +++ b/util/inj-types/cosmos/slashing/module/v1/module.ts @@ -0,0 +1,94 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the slashing module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.slashing.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the slashing module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the slashing module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.slashing.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.slashing.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/module/v1/module.ts b/util/inj-types/cosmos/staking/module/v1/module.ts new file mode 100644 index 00000000..2fed74ae --- /dev/null +++ b/util/inj-types/cosmos/staking/module/v1/module.ts @@ -0,0 +1,121 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the staking module. */ +export interface Module { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooksOrder: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.staking.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the staking module. */ +export interface ModuleAmino { + /** + * hooks_order specifies the order of staking hooks and should be a list + * of module names which provide a staking hooks instance. If no order is + * provided, then hooks will be applied in alphabetical order of module names. + */ + hooks_order?: string[]; + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the staking module. */ +export interface ModuleSDKType { + hooks_order: string[]; + authority: string; +} +function createBaseModule(): Module { + return { + hooksOrder: [], + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.staking.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.hooksOrder) { + writer.uint32(10).string(v!); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hooksOrder.push(reader.string()); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooksOrder?.map(e => e) || []; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + message.hooksOrder = object.hooks_order?.map(e => e) || []; + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + if (message.hooksOrder) { + obj.hooks_order = message.hooksOrder.map(e => e); + } else { + obj.hooks_order = message.hooksOrder; + } + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.staking.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/authz.ts b/util/inj-types/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 00000000..05ec4b58 --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,318 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * AuthorizationType defines the type of staking module authorization type + * + * Since: cosmos-sdk 0.43 + */ +export enum AuthorizationType { + /** AUTHORIZATION_TYPE_UNSPECIFIED - AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type */ + AUTHORIZATION_TYPE_UNSPECIFIED = 0, + /** AUTHORIZATION_TYPE_DELEGATE - AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate */ + AUTHORIZATION_TYPE_DELEGATE = 1, + /** AUTHORIZATION_TYPE_UNDELEGATE - AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate */ + AUTHORIZATION_TYPE_UNDELEGATE = 2, + /** AUTHORIZATION_TYPE_REDELEGATE - AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate */ + AUTHORIZATION_TYPE_REDELEGATE = 3, + UNRECOGNIZED = -1, +} +export const AuthorizationTypeSDKType = AuthorizationType; +export const AuthorizationTypeAmino = AuthorizationType; +export function authorizationTypeFromJSON(object: any): AuthorizationType { + switch (object) { + case 0: + case "AUTHORIZATION_TYPE_UNSPECIFIED": + return AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED; + case 1: + case "AUTHORIZATION_TYPE_DELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_DELEGATE; + case 2: + case "AUTHORIZATION_TYPE_UNDELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE; + case 3: + case "AUTHORIZATION_TYPE_REDELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE; + case -1: + case "UNRECOGNIZED": + default: + return AuthorizationType.UNRECOGNIZED; + } +} +export function authorizationTypeToJSON(object: AuthorizationType): string { + switch (object) { + case AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED: + return "AUTHORIZATION_TYPE_UNSPECIFIED"; + case AuthorizationType.AUTHORIZATION_TYPE_DELEGATE: + return "AUTHORIZATION_TYPE_DELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE: + return "AUTHORIZATION_TYPE_UNDELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE: + return "AUTHORIZATION_TYPE_REDELEGATE"; + case AuthorizationType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * StakeAuthorization defines authorization for delegate/undelegate/redelegate. + * + * Since: cosmos-sdk 0.43 + */ +export interface StakeAuthorization { + $typeUrl?: "/cosmos.staking.v1beta1.StakeAuthorization"; + /** + * max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is + * empty, there is no spend limit and any amount of coins can be delegated. + */ + maxTokens?: Coin; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allowList?: StakeAuthorization_Validators; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + denyList?: StakeAuthorization_Validators; + /** authorization_type defines one of AuthorizationType. */ + authorizationType: AuthorizationType; +} +export interface StakeAuthorizationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization"; + value: Uint8Array; +} +/** + * StakeAuthorization defines authorization for delegate/undelegate/redelegate. + * + * Since: cosmos-sdk 0.43 + */ +export interface StakeAuthorizationAmino { + /** + * max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is + * empty, there is no spend limit and any amount of coins can be delegated. + */ + max_tokens?: CoinAmino; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allow_list?: StakeAuthorization_ValidatorsAmino; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + deny_list?: StakeAuthorization_ValidatorsAmino; + /** authorization_type defines one of AuthorizationType. */ + authorization_type?: AuthorizationType; +} +export interface StakeAuthorizationAminoMsg { + type: "cosmos-sdk/StakeAuthorization"; + value: StakeAuthorizationAmino; +} +/** + * StakeAuthorization defines authorization for delegate/undelegate/redelegate. + * + * Since: cosmos-sdk 0.43 + */ +export interface StakeAuthorizationSDKType { + $typeUrl?: "/cosmos.staking.v1beta1.StakeAuthorization"; + max_tokens?: CoinSDKType; + allow_list?: StakeAuthorization_ValidatorsSDKType; + deny_list?: StakeAuthorization_ValidatorsSDKType; + authorization_type: AuthorizationType; +} +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_Validators { + address: string[]; +} +export interface StakeAuthorization_ValidatorsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Validators"; + value: Uint8Array; +} +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_ValidatorsAmino { + address?: string[]; +} +export interface StakeAuthorization_ValidatorsAminoMsg { + type: "cosmos-sdk/Validators"; + value: StakeAuthorization_ValidatorsAmino; +} +/** Validators defines list of validator addresses. */ +export interface StakeAuthorization_ValidatorsSDKType { + address: string[]; +} +function createBaseStakeAuthorization(): StakeAuthorization { + return { + $typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", + maxTokens: undefined, + allowList: undefined, + denyList: undefined, + authorizationType: 0 + }; +} +export const StakeAuthorization = { + typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", + aminoType: "cosmos-sdk/StakeAuthorization", + encode(message: StakeAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxTokens !== undefined) { + Coin.encode(message.maxTokens, writer.uint32(10).fork()).ldelim(); + } + if (message.allowList !== undefined) { + StakeAuthorization_Validators.encode(message.allowList, writer.uint32(18).fork()).ldelim(); + } + if (message.denyList !== undefined) { + StakeAuthorization_Validators.encode(message.denyList, writer.uint32(26).fork()).ldelim(); + } + if (message.authorizationType !== 0) { + writer.uint32(32).int32(message.authorizationType); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxTokens = Coin.decode(reader, reader.uint32()); + break; + case 2: + message.allowList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + break; + case 3: + message.denyList = StakeAuthorization_Validators.decode(reader, reader.uint32()); + break; + case 4: + message.authorizationType = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.maxTokens = object.maxTokens !== undefined && object.maxTokens !== null ? Coin.fromPartial(object.maxTokens) : undefined; + message.allowList = object.allowList !== undefined && object.allowList !== null ? StakeAuthorization_Validators.fromPartial(object.allowList) : undefined; + message.denyList = object.denyList !== undefined && object.denyList !== null ? StakeAuthorization_Validators.fromPartial(object.denyList) : undefined; + message.authorizationType = object.authorizationType ?? 0; + return message; + }, + fromAmino(object: StakeAuthorizationAmino): StakeAuthorization { + const message = createBaseStakeAuthorization(); + if (object.max_tokens !== undefined && object.max_tokens !== null) { + message.maxTokens = Coin.fromAmino(object.max_tokens); + } + if (object.allow_list !== undefined && object.allow_list !== null) { + message.allowList = StakeAuthorization_Validators.fromAmino(object.allow_list); + } + if (object.deny_list !== undefined && object.deny_list !== null) { + message.denyList = StakeAuthorization_Validators.fromAmino(object.deny_list); + } + if (object.authorization_type !== undefined && object.authorization_type !== null) { + message.authorizationType = object.authorization_type; + } + return message; + }, + toAmino(message: StakeAuthorization): StakeAuthorizationAmino { + const obj: any = {}; + obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; + obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; + obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; + obj.authorization_type = message.authorizationType === 0 ? undefined : message.authorizationType; + return obj; + }, + fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { + return StakeAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: StakeAuthorization): StakeAuthorizationAminoMsg { + return { + type: "cosmos-sdk/StakeAuthorization", + value: StakeAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: StakeAuthorizationProtoMsg): StakeAuthorization { + return StakeAuthorization.decode(message.value); + }, + toProto(message: StakeAuthorization): Uint8Array { + return StakeAuthorization.encode(message).finish(); + }, + toProtoMsg(message: StakeAuthorization): StakeAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.StakeAuthorization", + value: StakeAuthorization.encode(message).finish() + }; + } +}; +function createBaseStakeAuthorization_Validators(): StakeAuthorization_Validators { + return { + address: [] + }; +} +export const StakeAuthorization_Validators = { + typeUrl: "/cosmos.staking.v1beta1.Validators", + aminoType: "cosmos-sdk/Validators", + encode(message: StakeAuthorization_Validators, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization_Validators { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeAuthorization_Validators(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): StakeAuthorization_Validators { + const message = createBaseStakeAuthorization_Validators(); + message.address = object.address?.map(e => e) || []; + return message; + }, + fromAmino(object: StakeAuthorization_ValidatorsAmino): StakeAuthorization_Validators { + const message = createBaseStakeAuthorization_Validators(); + message.address = object.address?.map(e => e) || []; + return message; + }, + toAmino(message: StakeAuthorization_Validators): StakeAuthorization_ValidatorsAmino { + const obj: any = {}; + if (message.address) { + obj.address = message.address.map(e => e); + } else { + obj.address = message.address; + } + return obj; + }, + fromAminoMsg(object: StakeAuthorization_ValidatorsAminoMsg): StakeAuthorization_Validators { + return StakeAuthorization_Validators.fromAmino(object.value); + }, + toAminoMsg(message: StakeAuthorization_Validators): StakeAuthorization_ValidatorsAminoMsg { + return { + type: "cosmos-sdk/Validators", + value: StakeAuthorization_Validators.toAmino(message) + }; + }, + fromProtoMsg(message: StakeAuthorization_ValidatorsProtoMsg): StakeAuthorization_Validators { + return StakeAuthorization_Validators.decode(message.value); + }, + toProto(message: StakeAuthorization_Validators): Uint8Array { + return StakeAuthorization_Validators.encode(message).finish(); + }, + toProtoMsg(message: StakeAuthorization_Validators): StakeAuthorization_ValidatorsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Validators", + value: StakeAuthorization_Validators.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/genesis.ts b/util/inj-types/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 00000000..8a18c73e --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,343 @@ +import { Params, ParamsAmino, ParamsSDKType, Validator, ValidatorAmino, ValidatorSDKType, Delegation, DelegationAmino, DelegationSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, Redelegation, RedelegationAmino, RedelegationSDKType } from "./staking"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** GenesisState defines the staking module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of related to deposit. */ + params: Params; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + lastTotalPower: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + lastValidatorPowers: LastValidatorPower[]; + /** delegations defines the validator set at genesis. */ + validators: Validator[]; + /** delegations defines the delegations active at genesis. */ + delegations: Delegation[]; + /** unbonding_delegations defines the unbonding delegations active at genesis. */ + unbondingDelegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + exported: boolean; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the staking module's genesis state. */ +export interface GenesisStateAmino { + /** params defines all the parameters of related to deposit. */ + params: ParamsAmino; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + last_total_power: string; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + last_validator_powers: LastValidatorPowerAmino[]; + /** delegations defines the validator set at genesis. */ + validators: ValidatorAmino[]; + /** delegations defines the delegations active at genesis. */ + delegations: DelegationAmino[]; + /** unbonding_delegations defines the unbonding delegations active at genesis. */ + unbonding_delegations: UnbondingDelegationAmino[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: RedelegationAmino[]; + exported?: boolean; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the staking module's genesis state. */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + last_total_power: Uint8Array; + last_validator_powers: LastValidatorPowerSDKType[]; + validators: ValidatorSDKType[]; + delegations: DelegationSDKType[]; + unbonding_delegations: UnbondingDelegationSDKType[]; + redelegations: RedelegationSDKType[]; + exported: boolean; +} +/** LastValidatorPower required for validator set update logic. */ +export interface LastValidatorPower { + /** address is the address of the validator. */ + address: string; + /** power defines the power of the validator. */ + power: bigint; +} +export interface LastValidatorPowerProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower"; + value: Uint8Array; +} +/** LastValidatorPower required for validator set update logic. */ +export interface LastValidatorPowerAmino { + /** address is the address of the validator. */ + address?: string; + /** power defines the power of the validator. */ + power?: string; +} +export interface LastValidatorPowerAminoMsg { + type: "cosmos-sdk/LastValidatorPower"; + value: LastValidatorPowerAmino; +} +/** LastValidatorPower required for validator set update logic. */ +export interface LastValidatorPowerSDKType { + address: string; + power: bigint; +} +function createBaseGenesisState(): GenesisState { + return { + params: Params.fromPartial({}), + lastTotalPower: new Uint8Array(), + lastValidatorPowers: [], + validators: [], + delegations: [], + unbondingDelegations: [], + redelegations: [], + exported: false + }; +} +export const GenesisState = { + typeUrl: "/cosmos.staking.v1beta1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.lastTotalPower.length !== 0) { + writer.uint32(18).bytes(message.lastTotalPower); + } + for (const v of message.lastValidatorPowers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.unbondingDelegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.exported === true) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.lastTotalPower = reader.bytes(); + break; + case 3: + message.lastValidatorPowers.push(LastValidatorPower.decode(reader, reader.uint32())); + break; + case 4: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 5: + message.delegations.push(Delegation.decode(reader, reader.uint32())); + break; + case 6: + message.unbondingDelegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 7: + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + break; + case 8: + message.exported = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.lastTotalPower = object.lastTotalPower ?? new Uint8Array(); + message.lastValidatorPowers = object.lastValidatorPowers?.map(e => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map(e => Delegation.fromPartial(e)) || []; + message.unbondingDelegations = object.unbondingDelegations?.map(e => UnbondingDelegation.fromPartial(e)) || []; + message.redelegations = object.redelegations?.map(e => Redelegation.fromPartial(e)) || []; + message.exported = object.exported ?? false; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + if (object.last_total_power !== undefined && object.last_total_power !== null) { + message.lastTotalPower = bytesFromBase64(object.last_total_power); + } + message.lastValidatorPowers = object.last_validator_powers?.map(e => LastValidatorPower.fromAmino(e)) || []; + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + message.delegations = object.delegations?.map(e => Delegation.fromAmino(e)) || []; + message.unbondingDelegations = object.unbonding_delegations?.map(e => UnbondingDelegation.fromAmino(e)) || []; + message.redelegations = object.redelegations?.map(e => Redelegation.fromAmino(e)) || []; + if (object.exported !== undefined && object.exported !== null) { + message.exported = object.exported; + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + obj.last_total_power = message.lastTotalPower ? base64FromBytes(message.lastTotalPower) : ""; + if (message.lastValidatorPowers) { + obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e) : undefined); + } else { + obj.last_validator_powers = message.lastValidatorPowers; + } + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + if (message.delegations) { + obj.delegations = message.delegations.map(e => e ? Delegation.toAmino(e) : undefined); + } else { + obj.delegations = message.delegations; + } + if (message.unbondingDelegations) { + obj.unbonding_delegations = message.unbondingDelegations.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); + } else { + obj.unbonding_delegations = message.unbondingDelegations; + } + if (message.redelegations) { + obj.redelegations = message.redelegations.map(e => e ? Redelegation.toAmino(e) : undefined); + } else { + obj.redelegations = message.redelegations; + } + obj.exported = message.exported === false ? undefined : message.exported; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; +function createBaseLastValidatorPower(): LastValidatorPower { + return { + address: "", + power: BigInt(0) + }; +} +export const LastValidatorPower = { + typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", + aminoType: "cosmos-sdk/LastValidatorPower", + encode(message: LastValidatorPower, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== BigInt(0)) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLastValidatorPower(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); + return message; + }, + fromAmino(object: LastValidatorPowerAmino): LastValidatorPower { + const message = createBaseLastValidatorPower(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } + return message; + }, + toAmino(message: LastValidatorPower): LastValidatorPowerAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; + return obj; + }, + fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { + return LastValidatorPower.fromAmino(object.value); + }, + toAminoMsg(message: LastValidatorPower): LastValidatorPowerAminoMsg { + return { + type: "cosmos-sdk/LastValidatorPower", + value: LastValidatorPower.toAmino(message) + }; + }, + fromProtoMsg(message: LastValidatorPowerProtoMsg): LastValidatorPower { + return LastValidatorPower.decode(message.value); + }, + toProto(message: LastValidatorPower): Uint8Array { + return LastValidatorPower.encode(message).finish(); + }, + toProtoMsg(message: LastValidatorPower): LastValidatorPowerProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.LastValidatorPower", + value: LastValidatorPower.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/query.lcd.ts b/util/inj-types/cosmos/staking/v1beta1/query.lcd.ts new file mode 100644 index 00000000..103670ec --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/query.lcd.ts @@ -0,0 +1,159 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryValidatorsRequest, QueryValidatorsResponseSDKType, QueryValidatorRequest, QueryValidatorResponseSDKType, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponseSDKType, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponseSDKType, QueryDelegationRequest, QueryDelegationResponseSDKType, QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponseSDKType, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponseSDKType, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponseSDKType, QueryRedelegationsRequest, QueryRedelegationsResponseSDKType, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponseSDKType, QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponseSDKType, QueryHistoricalInfoRequest, QueryHistoricalInfoResponseSDKType, QueryPoolRequest, QueryPoolResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Validators queries all validators that match the given status. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + validators = async (params: QueryValidatorsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.status !== "undefined") { + options.params.status = params.status; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/staking/v1beta1/validators`; + return await this.req.get(endpoint, options); + }; + /* Validator queries validator info for given validator address. */ + validator = async (params: QueryValidatorRequest): Promise => { + const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}`; + return await this.req.get(endpoint); + }; + /* ValidatorDelegations queries delegate info for given validator. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + validatorDelegations = async (params: QueryValidatorDelegationsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations`; + return await this.req.get(endpoint, options); + }; + /* ValidatorUnbondingDelegations queries unbonding delegations of a validator. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + validatorUnbondingDelegations = async (params: QueryValidatorUnbondingDelegationsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/unbonding_delegations`; + return await this.req.get(endpoint, options); + }; + /* Delegation queries delegate info for given validator delegator pair. */ + delegation = async (params: QueryDelegationRequest): Promise => { + const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations/${params.delegatorAddr}`; + return await this.req.get(endpoint); + }; + /* UnbondingDelegation queries unbonding info for given validator delegator + pair. */ + unbondingDelegation = async (params: QueryUnbondingDelegationRequest): Promise => { + const endpoint = `cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations/${params.delegatorAddr}/unbonding_delegation`; + return await this.req.get(endpoint); + }; + /* DelegatorDelegations queries all delegations of a given delegator address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + delegatorDelegations = async (params: QueryDelegatorDelegationsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/staking/v1beta1/delegations/${params.delegatorAddr}`; + return await this.req.get(endpoint, options); + }; + /* DelegatorUnbondingDelegations queries all unbonding delegations of a given + delegator address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + delegatorUnbondingDelegations = async (params: QueryDelegatorUnbondingDelegationsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/unbonding_delegations`; + return await this.req.get(endpoint, options); + }; + /* Redelegations queries redelegations of given address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + redelegations = async (params: QueryRedelegationsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.srcValidatorAddr !== "undefined") { + options.params.src_validator_addr = params.srcValidatorAddr; + } + if (typeof params?.dstValidatorAddr !== "undefined") { + options.params.dst_validator_addr = params.dstValidatorAddr; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/redelegations`; + return await this.req.get(endpoint, options); + }; + /* DelegatorValidators queries all validators info for given delegator + address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + delegatorValidators = async (params: QueryDelegatorValidatorsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/validators`; + return await this.req.get(endpoint, options); + }; + /* DelegatorValidator queries validator info for given delegator validator + pair. */ + delegatorValidator = async (params: QueryDelegatorValidatorRequest): Promise => { + const endpoint = `cosmos/staking/v1beta1/delegators/${params.delegatorAddr}/validators/${params.validatorAddr}`; + return await this.req.get(endpoint); + }; + /* HistoricalInfo queries the historical info for given height. */ + historicalInfo = async (params: QueryHistoricalInfoRequest): Promise => { + const endpoint = `cosmos/staking/v1beta1/historical_info/${params.height}`; + return await this.req.get(endpoint); + }; + /* Pool queries the pool info. */ + pool = async (_params: QueryPoolRequest = {}): Promise => { + const endpoint = `cosmos/staking/v1beta1/pool`; + return await this.req.get(endpoint); + }; + /* Parameters queries the staking parameters. */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `cosmos/staking/v1beta1/params`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/staking/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..6a0006f0 --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/query.rpc.Query.ts @@ -0,0 +1,241 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryValidatorsRequest, QueryValidatorsResponse, QueryValidatorRequest, QueryValidatorResponse, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponse, QueryDelegationRequest, QueryDelegationResponse, QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponse, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponse, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse, QueryRedelegationsRequest, QueryRedelegationsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponse, QueryHistoricalInfoRequest, QueryHistoricalInfoResponse, QueryPoolRequest, QueryPoolResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; +/** Query defines the gRPC querier service. */ +export interface Query { + /** + * Validators queries all validators that match the given status. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + validators(request: QueryValidatorsRequest): Promise; + /** Validator queries validator info for given validator address. */ + validator(request: QueryValidatorRequest): Promise; + /** + * ValidatorDelegations queries delegate info for given validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + validatorDelegations(request: QueryValidatorDelegationsRequest): Promise; + /** + * ValidatorUnbondingDelegations queries unbonding delegations of a validator. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + validatorUnbondingDelegations(request: QueryValidatorUnbondingDelegationsRequest): Promise; + /** Delegation queries delegate info for given validator delegator pair. */ + delegation(request: QueryDelegationRequest): Promise; + /** + * UnbondingDelegation queries unbonding info for given validator delegator + * pair. + */ + unbondingDelegation(request: QueryUnbondingDelegationRequest): Promise; + /** + * DelegatorDelegations queries all delegations of a given delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + delegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise; + /** + * DelegatorUnbondingDelegations queries all unbonding delegations of a given + * delegator address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + delegatorUnbondingDelegations(request: QueryDelegatorUnbondingDelegationsRequest): Promise; + /** + * Redelegations queries redelegations of given address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + redelegations(request: QueryRedelegationsRequest): Promise; + /** + * DelegatorValidators queries all validators info for given delegator + * address. + * + * When called from another module, this query might consume a high amount of + * gas if the pagination field is incorrectly set. + */ + delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise; + /** + * DelegatorValidator queries validator info for given delegator validator + * pair. + */ + delegatorValidator(request: QueryDelegatorValidatorRequest): Promise; + /** HistoricalInfo queries the historical info for given height. */ + historicalInfo(request: QueryHistoricalInfoRequest): Promise; + /** Pool queries the pool info. */ + pool(request?: QueryPoolRequest): Promise; + /** Parameters queries the staking parameters. */ + params(request?: QueryParamsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Validators queries all validators that match the given status. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + validators = async (request: QueryValidatorsRequest): Promise => { + const data = QueryValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Validators", data); + return promise.then(data => QueryValidatorsResponse.decode(new BinaryReader(data))); + }; + /* Validator queries validator info for given validator address. */ + validator = async (request: QueryValidatorRequest): Promise => { + const data = QueryValidatorRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Validator", data); + return promise.then(data => QueryValidatorResponse.decode(new BinaryReader(data))); + }; + /* ValidatorDelegations queries delegate info for given validator. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + validatorDelegations = async (request: QueryValidatorDelegationsRequest): Promise => { + const data = QueryValidatorDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "ValidatorDelegations", data); + return promise.then(data => QueryValidatorDelegationsResponse.decode(new BinaryReader(data))); + }; + /* ValidatorUnbondingDelegations queries unbonding delegations of a validator. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + validatorUnbondingDelegations = async (request: QueryValidatorUnbondingDelegationsRequest): Promise => { + const data = QueryValidatorUnbondingDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "ValidatorUnbondingDelegations", data); + return promise.then(data => QueryValidatorUnbondingDelegationsResponse.decode(new BinaryReader(data))); + }; + /* Delegation queries delegate info for given validator delegator pair. */ + delegation = async (request: QueryDelegationRequest): Promise => { + const data = QueryDelegationRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Delegation", data); + return promise.then(data => QueryDelegationResponse.decode(new BinaryReader(data))); + }; + /* UnbondingDelegation queries unbonding info for given validator delegator + pair. */ + unbondingDelegation = async (request: QueryUnbondingDelegationRequest): Promise => { + const data = QueryUnbondingDelegationRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "UnbondingDelegation", data); + return promise.then(data => QueryUnbondingDelegationResponse.decode(new BinaryReader(data))); + }; + /* DelegatorDelegations queries all delegations of a given delegator address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + delegatorDelegations = async (request: QueryDelegatorDelegationsRequest): Promise => { + const data = QueryDelegatorDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "DelegatorDelegations", data); + return promise.then(data => QueryDelegatorDelegationsResponse.decode(new BinaryReader(data))); + }; + /* DelegatorUnbondingDelegations queries all unbonding delegations of a given + delegator address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + delegatorUnbondingDelegations = async (request: QueryDelegatorUnbondingDelegationsRequest): Promise => { + const data = QueryDelegatorUnbondingDelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "DelegatorUnbondingDelegations", data); + return promise.then(data => QueryDelegatorUnbondingDelegationsResponse.decode(new BinaryReader(data))); + }; + /* Redelegations queries redelegations of given address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + redelegations = async (request: QueryRedelegationsRequest): Promise => { + const data = QueryRedelegationsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Redelegations", data); + return promise.then(data => QueryRedelegationsResponse.decode(new BinaryReader(data))); + }; + /* DelegatorValidators queries all validators info for given delegator + address. + + When called from another module, this query might consume a high amount of + gas if the pagination field is incorrectly set. */ + delegatorValidators = async (request: QueryDelegatorValidatorsRequest): Promise => { + const data = QueryDelegatorValidatorsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "DelegatorValidators", data); + return promise.then(data => QueryDelegatorValidatorsResponse.decode(new BinaryReader(data))); + }; + /* DelegatorValidator queries validator info for given delegator validator + pair. */ + delegatorValidator = async (request: QueryDelegatorValidatorRequest): Promise => { + const data = QueryDelegatorValidatorRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "DelegatorValidator", data); + return promise.then(data => QueryDelegatorValidatorResponse.decode(new BinaryReader(data))); + }; + /* HistoricalInfo queries the historical info for given height. */ + historicalInfo = async (request: QueryHistoricalInfoRequest): Promise => { + const data = QueryHistoricalInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "HistoricalInfo", data); + return promise.then(data => QueryHistoricalInfoResponse.decode(new BinaryReader(data))); + }; + /* Pool queries the pool info. */ + pool = async (request: QueryPoolRequest = {}): Promise => { + const data = QueryPoolRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Pool", data); + return promise.then(data => QueryPoolResponse.decode(new BinaryReader(data))); + }; + /* Parameters queries the staking parameters. */ + params = async (request: QueryParamsRequest = {}): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + validators(request: QueryValidatorsRequest): Promise { + return queryService.validators(request); + }, + validator(request: QueryValidatorRequest): Promise { + return queryService.validator(request); + }, + validatorDelegations(request: QueryValidatorDelegationsRequest): Promise { + return queryService.validatorDelegations(request); + }, + validatorUnbondingDelegations(request: QueryValidatorUnbondingDelegationsRequest): Promise { + return queryService.validatorUnbondingDelegations(request); + }, + delegation(request: QueryDelegationRequest): Promise { + return queryService.delegation(request); + }, + unbondingDelegation(request: QueryUnbondingDelegationRequest): Promise { + return queryService.unbondingDelegation(request); + }, + delegatorDelegations(request: QueryDelegatorDelegationsRequest): Promise { + return queryService.delegatorDelegations(request); + }, + delegatorUnbondingDelegations(request: QueryDelegatorUnbondingDelegationsRequest): Promise { + return queryService.delegatorUnbondingDelegations(request); + }, + redelegations(request: QueryRedelegationsRequest): Promise { + return queryService.redelegations(request); + }, + delegatorValidators(request: QueryDelegatorValidatorsRequest): Promise { + return queryService.delegatorValidators(request); + }, + delegatorValidator(request: QueryDelegatorValidatorRequest): Promise { + return queryService.delegatorValidator(request); + }, + historicalInfo(request: QueryHistoricalInfoRequest): Promise { + return queryService.historicalInfo(request); + }, + pool(request?: QueryPoolRequest): Promise { + return queryService.pool(request); + }, + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/query.ts b/util/inj-types/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..3bef9806 --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,3029 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { Validator, ValidatorAmino, ValidatorSDKType, DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseAmino, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoAmino, HistoricalInfoSDKType, Pool, PoolAmino, PoolSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** QueryValidatorsRequest is request type for Query/Validators RPC method. */ +export interface QueryValidatorsRequest { + /** status enables to query for validators matching a given status. */ + status?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryValidatorsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest"; + value: Uint8Array; +} +/** QueryValidatorsRequest is request type for Query/Validators RPC method. */ +export interface QueryValidatorsRequestAmino { + /** status enables to query for validators matching a given status. */ + status?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryValidatorsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorsRequest"; + value: QueryValidatorsRequestAmino; +} +/** QueryValidatorsRequest is request type for Query/Validators RPC method. */ +export interface QueryValidatorsRequestSDKType { + status?: string; + pagination?: PageRequestSDKType; +} +/** QueryValidatorsResponse is response type for the Query/Validators RPC method */ +export interface QueryValidatorsResponse { + /** validators contains all the queried validators. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryValidatorsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse"; + value: Uint8Array; +} +/** QueryValidatorsResponse is response type for the Query/Validators RPC method */ +export interface QueryValidatorsResponseAmino { + /** validators contains all the queried validators. */ + validators: ValidatorAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorsResponse"; + value: QueryValidatorsResponseAmino; +} +/** QueryValidatorsResponse is response type for the Query/Validators RPC method */ +export interface QueryValidatorsResponseSDKType { + validators: ValidatorSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} +export interface QueryValidatorRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest"; + value: Uint8Array; +} +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequestAmino { + /** validator_addr defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryValidatorRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorRequest"; + value: QueryValidatorRequestAmino; +} +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequestSDKType { + validator_addr: string; +} +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the validator info. */ + validator: Validator; +} +export interface QueryValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse"; + value: Uint8Array; +} +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponseAmino { + /** validator defines the validator info. */ + validator: ValidatorAmino; +} +export interface QueryValidatorResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorResponse"; + value: QueryValidatorResponseAmino; +} +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponseSDKType { + validator: ValidatorSDKType; +} +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryValidatorDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest"; + value: Uint8Array; +} +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequestAmino { + /** validator_addr defines the validator address to query for. */ + validator_addr?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryValidatorDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorDelegationsRequest"; + value: QueryValidatorDelegationsRequestAmino; +} +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequestSDKType { + validator_addr: string; + pagination?: PageRequestSDKType; +} +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryValidatorDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponseAmino { + delegation_responses: DelegationResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorDelegationsResponse"; + value: QueryValidatorDelegationsResponseAmino; +} +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponseSDKType { + delegation_responses: DelegationResponseSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryValidatorUnbondingDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest"; + value: Uint8Array; +} +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequestAmino { + /** validator_addr defines the validator address to query for. */ + validator_addr?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryValidatorUnbondingDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest"; + value: QueryValidatorUnbondingDelegationsRequestAmino; +} +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequestSDKType { + validator_addr: string; + pagination?: PageRequestSDKType; +} +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryValidatorUnbondingDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponseAmino { + unbonding_responses: UnbondingDelegationAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorUnbondingDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse"; + value: QueryValidatorUnbondingDelegationsResponseAmino; +} +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponseSDKType { + unbonding_responses: UnbondingDelegationSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} +export interface QueryDelegationRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest"; + value: Uint8Array; +} +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr?: string; + /** validator_addr defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryDelegationRequestAminoMsg { + type: "cosmos-sdk/QueryDelegationRequest"; + value: QueryDelegationRequestAmino; +} +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequestSDKType { + delegator_addr: string; + validator_addr: string; +} +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegationResponse?: DelegationResponse; +} +export interface QueryDelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse"; + value: Uint8Array; +} +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponseAmino { + /** delegation_responses defines the delegation info of a delegation. */ + delegation_response?: DelegationResponseAmino; +} +export interface QueryDelegationResponseAminoMsg { + type: "cosmos-sdk/QueryDelegationResponse"; + value: QueryDelegationResponseAmino; +} +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponseSDKType { + delegation_response?: DelegationResponseSDKType; +} +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} +export interface QueryUnbondingDelegationRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest"; + value: Uint8Array; +} +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr?: string; + /** validator_addr defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryUnbondingDelegationRequestAminoMsg { + type: "cosmos-sdk/QueryUnbondingDelegationRequest"; + value: QueryUnbondingDelegationRequestAmino; +} +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequestSDKType { + delegator_addr: string; + validator_addr: string; +} +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegation; +} +export interface QueryUnbondingDelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse"; + value: Uint8Array; +} +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponseAmino { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegationAmino; +} +export interface QueryUnbondingDelegationResponseAminoMsg { + type: "cosmos-sdk/QueryUnbondingDelegationResponse"; + value: QueryUnbondingDelegationResponseAmino; +} +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponseSDKType { + unbond: UnbondingDelegationSDKType; +} +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDelegatorDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDelegatorDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorDelegationsRequest"; + value: QueryDelegatorDelegationsRequestAmino; +} +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequestSDKType { + delegator_addr: string; + pagination?: PageRequestSDKType; +} +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDelegatorDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponseAmino { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegation_responses: DelegationResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDelegatorDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorDelegationsResponse"; + value: QueryDelegatorDelegationsResponseAmino; +} +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponseSDKType { + delegation_responses: DelegationResponseSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDelegatorUnbondingDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDelegatorUnbondingDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest"; + value: QueryDelegatorUnbondingDelegationsRequestAmino; +} +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequestSDKType { + delegator_addr: string; + pagination?: PageRequestSDKType; +} +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDelegatorUnbondingDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponseAmino { + unbonding_responses: UnbondingDelegationAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDelegatorUnbondingDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse"; + value: QueryDelegatorUnbondingDelegationsResponseAmino; +} +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponseSDKType { + unbonding_responses: UnbondingDelegationSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + srcValidatorAddr?: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dstValidatorAddr?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryRedelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest"; + value: Uint8Array; +} +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr?: string; + /** src_validator_addr defines the validator address to redelegate from. */ + src_validator_addr?: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dst_validator_addr?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryRedelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryRedelegationsRequest"; + value: QueryRedelegationsRequestAmino; +} +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequestSDKType { + delegator_addr: string; + src_validator_addr?: string; + dst_validator_addr?: string; + pagination?: PageRequestSDKType; +} +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegationResponses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryRedelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse"; + value: Uint8Array; +} +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponseAmino { + redelegation_responses: RedelegationResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryRedelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryRedelegationsResponse"; + value: QueryRedelegationsResponseAmino; +} +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponseSDKType { + redelegation_responses: RedelegationResponseSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDelegatorValidatorsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDelegatorValidatorsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest"; + value: QueryDelegatorValidatorsRequestAmino; +} +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequestSDKType { + delegator_addr: string; + pagination?: PageRequestSDKType; +} +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDelegatorValidatorsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponseAmino { + /** validators defines the validators' info of a delegator. */ + validators: ValidatorAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDelegatorValidatorsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse"; + value: QueryDelegatorValidatorsResponseAmino; +} +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponseSDKType { + validators: ValidatorSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} +export interface QueryDelegatorValidatorRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr?: string; + /** validator_addr defines the validator address to query for. */ + validator_addr?: string; +} +export interface QueryDelegatorValidatorRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorRequest"; + value: QueryDelegatorValidatorRequestAmino; +} +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequestSDKType { + delegator_addr: string; + validator_addr: string; +} +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the validator info. */ + validator: Validator; +} +export interface QueryDelegatorValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponseAmino { + /** validator defines the validator info. */ + validator: ValidatorAmino; +} +export interface QueryDelegatorValidatorResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorResponse"; + value: QueryDelegatorValidatorResponseAmino; +} +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponseSDKType { + validator: ValidatorSDKType; +} +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: bigint; +} +export interface QueryHistoricalInfoRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest"; + value: Uint8Array; +} +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequestAmino { + /** height defines at which height to query the historical info. */ + height?: string; +} +export interface QueryHistoricalInfoRequestAminoMsg { + type: "cosmos-sdk/QueryHistoricalInfoRequest"; + value: QueryHistoricalInfoRequestAmino; +} +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequestSDKType { + height: bigint; +} +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist?: HistoricalInfo; +} +export interface QueryHistoricalInfoResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse"; + value: Uint8Array; +} +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponseAmino { + /** hist defines the historical info at the given height. */ + hist?: HistoricalInfoAmino; +} +export interface QueryHistoricalInfoResponseAminoMsg { + type: "cosmos-sdk/QueryHistoricalInfoResponse"; + value: QueryHistoricalInfoResponseAmino; +} +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponseSDKType { + hist?: HistoricalInfoSDKType; +} +/** QueryPoolRequest is request type for the Query/Pool RPC method. */ +export interface QueryPoolRequest {} +export interface QueryPoolRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest"; + value: Uint8Array; +} +/** QueryPoolRequest is request type for the Query/Pool RPC method. */ +export interface QueryPoolRequestAmino {} +export interface QueryPoolRequestAminoMsg { + type: "cosmos-sdk/QueryPoolRequest"; + value: QueryPoolRequestAmino; +} +/** QueryPoolRequest is request type for the Query/Pool RPC method. */ +export interface QueryPoolRequestSDKType {} +/** QueryPoolResponse is response type for the Query/Pool RPC method. */ +export interface QueryPoolResponse { + /** pool defines the pool info. */ + pool: Pool; +} +export interface QueryPoolResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse"; + value: Uint8Array; +} +/** QueryPoolResponse is response type for the Query/Pool RPC method. */ +export interface QueryPoolResponseAmino { + /** pool defines the pool info. */ + pool: PoolAmino; +} +export interface QueryPoolResponseAminoMsg { + type: "cosmos-sdk/QueryPoolResponse"; + value: QueryPoolResponseAmino; +} +/** QueryPoolResponse is response type for the Query/Pool RPC method. */ +export interface QueryPoolResponseSDKType { + pool: PoolSDKType; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params holds all the parameters of this module. */ + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { + status: "", + pagination: undefined + }; +} +export const QueryValidatorsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", + aminoType: "cosmos-sdk/QueryValidatorsRequest", + encode(message: QueryValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorsRequest { + const message = createBaseQueryValidatorsRequest(); + message.status = object.status ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorsRequestAmino): QueryValidatorsRequest { + const message = createBaseQueryValidatorsRequest(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { + const obj: any = {}; + obj.status = message.status === "" ? undefined : message.status; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorsRequestAminoMsg): QueryValidatorsRequest { + return QueryValidatorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorsRequest): QueryValidatorsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorsRequest", + value: QueryValidatorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorsRequestProtoMsg): QueryValidatorsRequest { + return QueryValidatorsRequest.decode(message.value); + }, + toProto(message: QueryValidatorsRequest): Uint8Array { + return QueryValidatorsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorsRequest): QueryValidatorsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", + value: QueryValidatorsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { + return { + validators: [], + pagination: undefined + }; +} +export const QueryValidatorsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", + aminoType: "cosmos-sdk/QueryValidatorsResponse", + encode(message: QueryValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(Validator.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: DeepPartial): QueryValidatorsResponse { + const message = createBaseQueryValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorsResponseAmino): QueryValidatorsResponse { + const message = createBaseQueryValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorsResponse): QueryValidatorsResponseAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorsResponseAminoMsg): QueryValidatorsResponse { + return QueryValidatorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorsResponse): QueryValidatorsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorsResponse", + value: QueryValidatorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorsResponseProtoMsg): QueryValidatorsResponse { + return QueryValidatorsResponse.decode(message.value); + }, + toProto(message: QueryValidatorsResponse): Uint8Array { + return QueryValidatorsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorsResponse): QueryValidatorsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", + value: QueryValidatorsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorRequest(): QueryValidatorRequest { + return { + validatorAddr: "" + }; +} +export const QueryValidatorRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", + aminoType: "cosmos-sdk/QueryValidatorRequest", + encode(message: QueryValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, + fromAmino(object: QueryValidatorRequestAmino): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { + return QueryValidatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorRequest): QueryValidatorRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorRequest", + value: QueryValidatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorRequestProtoMsg): QueryValidatorRequest { + return QueryValidatorRequest.decode(message.value); + }, + toProto(message: QueryValidatorRequest): Uint8Array { + return QueryValidatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorRequest): QueryValidatorRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", + value: QueryValidatorRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { + validator: Validator.fromPartial({}) + }; +} +export const QueryValidatorResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", + aminoType: "cosmos-sdk/QueryValidatorResponse", + encode(message: QueryValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorResponse { + const message = createBaseQueryValidatorResponse(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + return message; + }, + fromAmino(object: QueryValidatorResponseAmino): QueryValidatorResponse { + const message = createBaseQueryValidatorResponse(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + return message; + }, + toAmino(message: QueryValidatorResponse): QueryValidatorResponseAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : Validator.toAmino(Validator.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryValidatorResponseAminoMsg): QueryValidatorResponse { + return QueryValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorResponse): QueryValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorResponse", + value: QueryValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorResponseProtoMsg): QueryValidatorResponse { + return QueryValidatorResponse.decode(message.value); + }, + toProto(message: QueryValidatorResponse): Uint8Array { + return QueryValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorResponse): QueryValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", + value: QueryValidatorResponse.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest { + return { + validatorAddr: "", + pagination: undefined + }; +} +export const QueryValidatorDelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", + aminoType: "cosmos-sdk/QueryValidatorDelegationsRequest", + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorDelegationsRequestAmino): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorDelegationsRequestAminoMsg): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDelegationsRequest", + value: QueryValidatorDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDelegationsRequestProtoMsg): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.decode(message.value); + }, + toProto(message: QueryValidatorDelegationsRequest): Uint8Array { + return QueryValidatorDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", + value: QueryValidatorDelegationsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { + delegationResponses: [], + pagination: undefined + }; +} +export const QueryValidatorDelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", + aminoType: "cosmos-sdk/QueryValidatorDelegationsResponse", + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponses.push(DelegationResponse.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: DeepPartial): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorDelegationsResponseAmino): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegation_responses?.map(e => DelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseAmino { + const obj: any = {}; + if (message.delegationResponses) { + obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); + } else { + obj.delegation_responses = message.delegationResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorDelegationsResponseAminoMsg): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDelegationsResponse", + value: QueryValidatorDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDelegationsResponseProtoMsg): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.decode(message.value); + }, + toProto(message: QueryValidatorDelegationsResponse): Uint8Array { + return QueryValidatorDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", + value: QueryValidatorDelegationsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { + validatorAddr: "", + pagination: undefined + }; +} +export const QueryValidatorUnbondingDelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + aminoType: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest", + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorUnbondingDelegationsRequestAmino): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorUnbondingDelegationsRequestAminoMsg): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest", + value: QueryValidatorUnbondingDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorUnbondingDelegationsRequestProtoMsg): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.decode(message.value); + }, + toProto(message: QueryValidatorUnbondingDelegationsRequest): Uint8Array { + return QueryValidatorUnbondingDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + value: QueryValidatorUnbondingDelegationsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { + unbondingResponses: [], + pagination: undefined + }; +} +export const QueryValidatorUnbondingDelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + aminoType: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse", + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondingResponses.push(UnbondingDelegation.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: DeepPartial): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorUnbondingDelegationsResponseAmino): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbonding_responses?.map(e => UnbondingDelegation.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseAmino { + const obj: any = {}; + if (message.unbondingResponses) { + obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); + } else { + obj.unbonding_responses = message.unbondingResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorUnbondingDelegationsResponseAminoMsg): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse", + value: QueryValidatorUnbondingDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorUnbondingDelegationsResponseProtoMsg): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.decode(message.value); + }, + toProto(message: QueryValidatorUnbondingDelegationsResponse): Uint8Array { + return QueryValidatorUnbondingDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + value: QueryValidatorUnbondingDelegationsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { + delegatorAddr: "", + validatorAddr: "" + }; +} +export const QueryDelegationRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", + aminoType: "cosmos-sdk/QueryDelegationRequest", + encode(message: QueryDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, + fromAmino(object: QueryDelegationRequestAmino): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { + return QueryDelegationRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationRequest): QueryDelegationRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationRequest", + value: QueryDelegationRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationRequestProtoMsg): QueryDelegationRequest { + return QueryDelegationRequest.decode(message.value); + }, + toProto(message: QueryDelegationRequest): Uint8Array { + return QueryDelegationRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationRequest): QueryDelegationRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", + value: QueryDelegationRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { + delegationResponse: undefined + }; +} +export const QueryDelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", + aminoType: "cosmos-sdk/QueryDelegationResponse", + encode(message: QueryDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegationResponse !== undefined) { + DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponse = DelegationResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegationResponse = object.delegationResponse !== undefined && object.delegationResponse !== null ? DelegationResponse.fromPartial(object.delegationResponse) : undefined; + return message; + }, + fromAmino(object: QueryDelegationResponseAmino): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + if (object.delegation_response !== undefined && object.delegation_response !== null) { + message.delegationResponse = DelegationResponse.fromAmino(object.delegation_response); + } + return message; + }, + toAmino(message: QueryDelegationResponse): QueryDelegationResponseAmino { + const obj: any = {}; + obj.delegation_response = message.delegationResponse ? DelegationResponse.toAmino(message.delegationResponse) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegationResponseAminoMsg): QueryDelegationResponse { + return QueryDelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationResponse): QueryDelegationResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationResponse", + value: QueryDelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationResponseProtoMsg): QueryDelegationResponse { + return QueryDelegationResponse.decode(message.value); + }, + toProto(message: QueryDelegationResponse): Uint8Array { + return QueryDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationResponse): QueryDelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", + value: QueryDelegationResponse.encode(message).finish() + }; + } +}; +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { + delegatorAddr: "", + validatorAddr: "" + }; +} +export const QueryUnbondingDelegationRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", + aminoType: "cosmos-sdk/QueryUnbondingDelegationRequest", + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, + fromAmino(object: QueryUnbondingDelegationRequestAmino): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUnbondingDelegationRequest", + value: QueryUnbondingDelegationRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnbondingDelegationRequestProtoMsg): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.decode(message.value); + }, + toProto(message: QueryUnbondingDelegationRequest): Uint8Array { + return QueryUnbondingDelegationRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", + value: QueryUnbondingDelegationRequest.encode(message).finish() + }; + } +}; +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { + unbond: UnbondingDelegation.fromPartial({}) + }; +} +export const QueryUnbondingDelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", + aminoType: "cosmos-sdk/QueryUnbondingDelegationResponse", + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUnbondingDelegationResponse { + const message = createBaseQueryUnbondingDelegationResponse(); + message.unbond = object.unbond !== undefined && object.unbond !== null ? UnbondingDelegation.fromPartial(object.unbond) : undefined; + return message; + }, + fromAmino(object: QueryUnbondingDelegationResponseAmino): QueryUnbondingDelegationResponse { + const message = createBaseQueryUnbondingDelegationResponse(); + if (object.unbond !== undefined && object.unbond !== null) { + message.unbond = UnbondingDelegation.fromAmino(object.unbond); + } + return message; + }, + toAmino(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseAmino { + const obj: any = {}; + obj.unbond = message.unbond ? UnbondingDelegation.toAmino(message.unbond) : UnbondingDelegation.toAmino(UnbondingDelegation.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryUnbondingDelegationResponseAminoMsg): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUnbondingDelegationResponse", + value: QueryUnbondingDelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnbondingDelegationResponseProtoMsg): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.decode(message.value); + }, + toProto(message: QueryUnbondingDelegationResponse): Uint8Array { + return QueryUnbondingDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", + value: QueryUnbondingDelegationResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest { + return { + delegatorAddr: "", + pagination: undefined + }; +} +export const QueryDelegatorDelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", + aminoType: "cosmos-sdk/QueryDelegatorDelegationsRequest", + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorDelegationsRequestAmino): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorDelegationsRequestAminoMsg): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorDelegationsRequest", + value: QueryDelegatorDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorDelegationsRequestProtoMsg): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorDelegationsRequest): Uint8Array { + return QueryDelegatorDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", + value: QueryDelegatorDelegationsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { + delegationResponses: [], + pagination: undefined + }; +} +export const QueryDelegatorDelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", + aminoType: "cosmos-sdk/QueryDelegatorDelegationsResponse", + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponses.push(DelegationResponse.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: DeepPartial): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorDelegationsResponseAmino): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegation_responses?.map(e => DelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseAmino { + const obj: any = {}; + if (message.delegationResponses) { + obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); + } else { + obj.delegation_responses = message.delegationResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorDelegationsResponseAminoMsg): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorDelegationsResponse", + value: QueryDelegatorDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorDelegationsResponseProtoMsg): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorDelegationsResponse): Uint8Array { + return QueryDelegatorDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", + value: QueryDelegatorDelegationsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { + delegatorAddr: "", + pagination: undefined + }; +} +export const QueryDelegatorUnbondingDelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + aminoType: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest", + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorUnbondingDelegationsRequestAmino): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorUnbondingDelegationsRequestAminoMsg): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest", + value: QueryDelegatorUnbondingDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorUnbondingDelegationsRequestProtoMsg): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorUnbondingDelegationsRequest): Uint8Array { + return QueryDelegatorUnbondingDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + value: QueryDelegatorUnbondingDelegationsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { + unbondingResponses: [], + pagination: undefined + }; +} +export const QueryDelegatorUnbondingDelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + aminoType: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse", + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondingResponses.push(UnbondingDelegation.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: DeepPartial): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorUnbondingDelegationsResponseAmino): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbonding_responses?.map(e => UnbondingDelegation.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseAmino { + const obj: any = {}; + if (message.unbondingResponses) { + obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); + } else { + obj.unbonding_responses = message.unbondingResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorUnbondingDelegationsResponseAminoMsg): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse", + value: QueryDelegatorUnbondingDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorUnbondingDelegationsResponseProtoMsg): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorUnbondingDelegationsResponse): Uint8Array { + return QueryDelegatorUnbondingDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + value: QueryDelegatorUnbondingDelegationsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { + delegatorAddr: "", + srcValidatorAddr: "", + dstValidatorAddr: "", + pagination: undefined + }; +} +export const QueryRedelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", + aminoType: "cosmos-sdk/QueryRedelegationsRequest", + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.srcValidatorAddr = reader.string(); + break; + case 3: + message.dstValidatorAddr = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.srcValidatorAddr = object.srcValidatorAddr ?? ""; + message.dstValidatorAddr = object.dstValidatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryRedelegationsRequestAmino): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.src_validator_addr !== undefined && object.src_validator_addr !== null) { + message.srcValidatorAddr = object.src_validator_addr; + } + if (object.dst_validator_addr !== undefined && object.dst_validator_addr !== null) { + message.dstValidatorAddr = object.dst_validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr === "" ? undefined : message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr === "" ? undefined : message.dstValidatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRedelegationsRequestAminoMsg): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryRedelegationsRequest): QueryRedelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryRedelegationsRequest", + value: QueryRedelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRedelegationsRequestProtoMsg): QueryRedelegationsRequest { + return QueryRedelegationsRequest.decode(message.value); + }, + toProto(message: QueryRedelegationsRequest): Uint8Array { + return QueryRedelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryRedelegationsRequest): QueryRedelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", + value: QueryRedelegationsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { + redelegationResponses: [], + pagination: undefined + }; +} +export const QueryRedelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", + aminoType: "cosmos-sdk/QueryRedelegationsResponse", + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.redelegationResponses) { + RedelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegationResponses.push(RedelegationResponse.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: DeepPartial): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegationResponses?.map(e => RedelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryRedelegationsResponseAmino): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegation_responses?.map(e => RedelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryRedelegationsResponse): QueryRedelegationsResponseAmino { + const obj: any = {}; + if (message.redelegationResponses) { + obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e) : undefined); + } else { + obj.redelegation_responses = message.redelegationResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRedelegationsResponseAminoMsg): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryRedelegationsResponse): QueryRedelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryRedelegationsResponse", + value: QueryRedelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRedelegationsResponseProtoMsg): QueryRedelegationsResponse { + return QueryRedelegationsResponse.decode(message.value); + }, + toProto(message: QueryRedelegationsResponse): Uint8Array { + return QueryRedelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryRedelegationsResponse): QueryRedelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", + value: QueryRedelegationsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { + delegatorAddr: "", + pagination: undefined + }; +} +export const QueryDelegatorValidatorsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", + aminoType: "cosmos-sdk/QueryDelegatorValidatorsRequest", + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorValidatorsRequestAmino): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsRequestProtoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsRequest): Uint8Array { + return QueryDelegatorValidatorsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { + validators: [], + pagination: undefined + }; +} +export const QueryDelegatorValidatorsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", + aminoType: "cosmos-sdk/QueryDelegatorValidatorsResponse", + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(Validator.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: DeepPartial): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorValidatorsResponseAmino): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsResponseAminoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsResponseProtoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsResponse): Uint8Array { + return QueryDelegatorValidatorsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest { + return { + delegatorAddr: "", + validatorAddr: "" + }; +} +export const QueryDelegatorValidatorRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", + aminoType: "cosmos-sdk/QueryDelegatorValidatorRequest", + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, + fromAmino(object: QueryDelegatorValidatorRequestAmino): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorRequest", + value: QueryDelegatorValidatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorRequestProtoMsg): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorRequest): Uint8Array { + return QueryDelegatorValidatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", + value: QueryDelegatorValidatorRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { + validator: Validator.fromPartial({}) + }; +} +export const QueryDelegatorValidatorResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", + aminoType: "cosmos-sdk/QueryDelegatorValidatorResponse", + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorResponse { + const message = createBaseQueryDelegatorValidatorResponse(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorValidatorResponseAmino): QueryDelegatorValidatorResponse { + const message = createBaseQueryDelegatorValidatorResponse(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : Validator.toAmino(Validator.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorResponseAminoMsg): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorResponse", + value: QueryDelegatorValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorResponseProtoMsg): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorResponse): Uint8Array { + return QueryDelegatorValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", + value: QueryDelegatorValidatorResponse.encode(message).finish() + }; + } +}; +function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { + return { + height: BigInt(0) + }; +} +export const QueryHistoricalInfoRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", + aminoType: "cosmos-sdk/QueryHistoricalInfoRequest", + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryHistoricalInfoRequestAmino): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryHistoricalInfoRequest", + value: QueryHistoricalInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryHistoricalInfoRequestProtoMsg): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.decode(message.value); + }, + toProto(message: QueryHistoricalInfoRequest): Uint8Array { + return QueryHistoricalInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", + value: QueryHistoricalInfoRequest.encode(message).finish() + }; + } +}; +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { + hist: undefined + }; +} +export const QueryHistoricalInfoResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", + aminoType: "cosmos-sdk/QueryHistoricalInfoResponse", + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hist = HistoricalInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryHistoricalInfoResponse { + const message = createBaseQueryHistoricalInfoResponse(); + message.hist = object.hist !== undefined && object.hist !== null ? HistoricalInfo.fromPartial(object.hist) : undefined; + return message; + }, + fromAmino(object: QueryHistoricalInfoResponseAmino): QueryHistoricalInfoResponse { + const message = createBaseQueryHistoricalInfoResponse(); + if (object.hist !== undefined && object.hist !== null) { + message.hist = HistoricalInfo.fromAmino(object.hist); + } + return message; + }, + toAmino(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseAmino { + const obj: any = {}; + obj.hist = message.hist ? HistoricalInfo.toAmino(message.hist) : undefined; + return obj; + }, + fromAminoMsg(object: QueryHistoricalInfoResponseAminoMsg): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryHistoricalInfoResponse", + value: QueryHistoricalInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryHistoricalInfoResponseProtoMsg): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.decode(message.value); + }, + toProto(message: QueryHistoricalInfoResponse): Uint8Array { + return QueryHistoricalInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", + value: QueryHistoricalInfoResponse.encode(message).finish() + }; + } +}; +function createBaseQueryPoolRequest(): QueryPoolRequest { + return {}; +} +export const QueryPoolRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", + aminoType: "cosmos-sdk/QueryPoolRequest", + encode(_: QueryPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, + fromAmino(_: QueryPoolRequestAmino): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, + toAmino(_: QueryPoolRequest): QueryPoolRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { + return QueryPoolRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPoolRequest): QueryPoolRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPoolRequest", + value: QueryPoolRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPoolRequestProtoMsg): QueryPoolRequest { + return QueryPoolRequest.decode(message.value); + }, + toProto(message: QueryPoolRequest): Uint8Array { + return QueryPoolRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPoolRequest): QueryPoolRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", + value: QueryPoolRequest.encode(message).finish() + }; + } +}; +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { + pool: Pool.fromPartial({}) + }; +} +export const QueryPoolResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", + aminoType: "cosmos-sdk/QueryPoolResponse", + encode(message: QueryPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool = Pool.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + message.pool = object.pool !== undefined && object.pool !== null ? Pool.fromPartial(object.pool) : undefined; + return message; + }, + fromAmino(object: QueryPoolResponseAmino): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + if (object.pool !== undefined && object.pool !== null) { + message.pool = Pool.fromAmino(object.pool); + } + return message; + }, + toAmino(message: QueryPoolResponse): QueryPoolResponseAmino { + const obj: any = {}; + obj.pool = message.pool ? Pool.toAmino(message.pool) : Pool.toAmino(Pool.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryPoolResponseAminoMsg): QueryPoolResponse { + return QueryPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPoolResponse): QueryPoolResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPoolResponse", + value: QueryPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPoolResponseProtoMsg): QueryPoolResponse { + return QueryPoolResponse.decode(message.value); + }, + toProto(message: QueryPoolResponse): Uint8Array { + return QueryPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPoolResponse): QueryPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", + value: QueryPoolResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/staking.ts b/util/inj-types/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..caf537a6 --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,3040 @@ +import { Header, HeaderAmino, HeaderSDKType } from "../../../tendermint/types/types"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { ValidatorUpdate, ValidatorUpdateAmino, ValidatorUpdateSDKType } from "../../../tendermint/abci/types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { Decimal } from "@cosmjs/math"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { Pubkey } from "@cosmjs/amino"; +/** BondStatus is the status of a validator. */ +export enum BondStatus { + /** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */ + BOND_STATUS_UNSPECIFIED = 0, + /** BOND_STATUS_UNBONDED - UNBONDED defines a validator that is not bonded. */ + BOND_STATUS_UNBONDED = 1, + /** BOND_STATUS_UNBONDING - UNBONDING defines a validator that is unbonding. */ + BOND_STATUS_UNBONDING = 2, + /** BOND_STATUS_BONDED - BONDED defines a validator that is bonded. */ + BOND_STATUS_BONDED = 3, + UNRECOGNIZED = -1, +} +export const BondStatusSDKType = BondStatus; +export const BondStatusAmino = BondStatus; +export function bondStatusFromJSON(object: any): BondStatus { + switch (object) { + case 0: + case "BOND_STATUS_UNSPECIFIED": + return BondStatus.BOND_STATUS_UNSPECIFIED; + case 1: + case "BOND_STATUS_UNBONDED": + return BondStatus.BOND_STATUS_UNBONDED; + case 2: + case "BOND_STATUS_UNBONDING": + return BondStatus.BOND_STATUS_UNBONDING; + case 3: + case "BOND_STATUS_BONDED": + return BondStatus.BOND_STATUS_BONDED; + case -1: + case "UNRECOGNIZED": + default: + return BondStatus.UNRECOGNIZED; + } +} +export function bondStatusToJSON(object: BondStatus): string { + switch (object) { + case BondStatus.BOND_STATUS_UNSPECIFIED: + return "BOND_STATUS_UNSPECIFIED"; + case BondStatus.BOND_STATUS_UNBONDED: + return "BOND_STATUS_UNBONDED"; + case BondStatus.BOND_STATUS_UNBONDING: + return "BOND_STATUS_UNBONDING"; + case BondStatus.BOND_STATUS_BONDED: + return "BOND_STATUS_BONDED"; + case BondStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Infraction indicates the infraction a validator commited. */ +export enum Infraction { + /** INFRACTION_UNSPECIFIED - UNSPECIFIED defines an empty infraction. */ + INFRACTION_UNSPECIFIED = 0, + /** INFRACTION_DOUBLE_SIGN - DOUBLE_SIGN defines a validator that double-signs a block. */ + INFRACTION_DOUBLE_SIGN = 1, + /** INFRACTION_DOWNTIME - DOWNTIME defines a validator that missed signing too many blocks. */ + INFRACTION_DOWNTIME = 2, + UNRECOGNIZED = -1, +} +export const InfractionSDKType = Infraction; +export const InfractionAmino = Infraction; +export function infractionFromJSON(object: any): Infraction { + switch (object) { + case 0: + case "INFRACTION_UNSPECIFIED": + return Infraction.INFRACTION_UNSPECIFIED; + case 1: + case "INFRACTION_DOUBLE_SIGN": + return Infraction.INFRACTION_DOUBLE_SIGN; + case 2: + case "INFRACTION_DOWNTIME": + return Infraction.INFRACTION_DOWNTIME; + case -1: + case "UNRECOGNIZED": + default: + return Infraction.UNRECOGNIZED; + } +} +export function infractionToJSON(object: Infraction): string { + switch (object) { + case Infraction.INFRACTION_UNSPECIFIED: + return "INFRACTION_UNSPECIFIED"; + case Infraction.INFRACTION_DOUBLE_SIGN: + return "INFRACTION_DOUBLE_SIGN"; + case Infraction.INFRACTION_DOWNTIME: + return "INFRACTION_DOWNTIME"; + case Infraction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfo { + header: Header; + valset: Validator[]; +} +export interface HistoricalInfoProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo"; + value: Uint8Array; +} +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfoAmino { + header: HeaderAmino; + valset: ValidatorAmino[]; +} +export interface HistoricalInfoAminoMsg { + type: "cosmos-sdk/HistoricalInfo"; + value: HistoricalInfoAmino; +} +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfoSDKType { + header: HeaderSDKType; + valset: ValidatorSDKType[]; +} +/** + * CommissionRates defines the initial commission rates to be used for creating + * a validator. + */ +export interface CommissionRates { + /** rate is the commission rate charged to delegators, as a fraction. */ + rate: string; + /** max_rate defines the maximum commission rate which validator can ever charge, as a fraction. */ + maxRate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + maxChangeRate: string; +} +export interface CommissionRatesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates"; + value: Uint8Array; +} +/** + * CommissionRates defines the initial commission rates to be used for creating + * a validator. + */ +export interface CommissionRatesAmino { + /** rate is the commission rate charged to delegators, as a fraction. */ + rate?: string; + /** max_rate defines the maximum commission rate which validator can ever charge, as a fraction. */ + max_rate?: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + max_change_rate?: string; +} +export interface CommissionRatesAminoMsg { + type: "cosmos-sdk/CommissionRates"; + value: CommissionRatesAmino; +} +/** + * CommissionRates defines the initial commission rates to be used for creating + * a validator. + */ +export interface CommissionRatesSDKType { + rate: string; + max_rate: string; + max_change_rate: string; +} +/** Commission defines commission parameters for a given validator. */ +export interface Commission { + /** commission_rates defines the initial commission rates to be used for creating a validator. */ + commissionRates: CommissionRates; + /** update_time is the last time the commission rate was changed. */ + updateTime: Date; +} +export interface CommissionProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Commission"; + value: Uint8Array; +} +/** Commission defines commission parameters for a given validator. */ +export interface CommissionAmino { + /** commission_rates defines the initial commission rates to be used for creating a validator. */ + commission_rates: CommissionRatesAmino; + /** update_time is the last time the commission rate was changed. */ + update_time: string; +} +export interface CommissionAminoMsg { + type: "cosmos-sdk/Commission"; + value: CommissionAmino; +} +/** Commission defines commission parameters for a given validator. */ +export interface CommissionSDKType { + commission_rates: CommissionRatesSDKType; + update_time: Date; +} +/** Description defines a validator description. */ +export interface Description { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + securityContact: string; + /** details define other optional details. */ + details: string; +} +export interface DescriptionProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Description"; + value: Uint8Array; +} +/** Description defines a validator description. */ +export interface DescriptionAmino { + /** moniker defines a human-readable name for the validator. */ + moniker?: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity?: string; + /** website defines an optional website link. */ + website?: string; + /** security_contact defines an optional email for security contact. */ + security_contact?: string; + /** details define other optional details. */ + details?: string; +} +export interface DescriptionAminoMsg { + type: "cosmos-sdk/Description"; + value: DescriptionAmino; +} +/** Description defines a validator description. */ +export interface DescriptionSDKType { + moniker: string; + identity: string; + website: string; + security_contact: string; + details: string; +} +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface Validator { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operatorAddress: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensusPubkey?: Any | undefined; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegatorShares: string; + /** description defines the description terms for the validator. */ + description: Description; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbondingHeight: bigint; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbondingTime: Date; + /** commission defines the commission parameters. */ + commission: Commission; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + minSelfDelegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbondingIds: bigint[]; +} +export interface ValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Validator"; + value: Uint8Array; +} +export type ValidatorEncoded = Omit & { + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */consensusPubkey?: AnyProtoMsg | undefined; +}; +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface ValidatorAmino { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operator_address?: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensus_pubkey?: AnyAmino; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed?: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status?: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens?: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegator_shares?: string; + /** description defines the description terms for the validator. */ + description: DescriptionAmino; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbonding_height?: string; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbonding_time: string; + /** commission defines the commission parameters. */ + commission: CommissionAmino; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + min_self_delegation?: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count?: string; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbonding_ids?: string[]; +} +export interface ValidatorAminoMsg { + type: "cosmos-sdk/Validator"; + value: ValidatorAmino; +} +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface ValidatorSDKType { + operator_address: string; + consensus_pubkey?: AnySDKType | undefined; + jailed: boolean; + status: BondStatus; + tokens: string; + delegator_shares: string; + description: DescriptionSDKType; + unbonding_height: bigint; + unbonding_time: Date; + commission: CommissionSDKType; + min_self_delegation: string; + unbonding_on_hold_ref_count: bigint; + unbonding_ids: bigint[]; +} +/** ValAddresses defines a repeated set of validator addresses. */ +export interface ValAddresses { + addresses: string[]; +} +export interface ValAddressesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses"; + value: Uint8Array; +} +/** ValAddresses defines a repeated set of validator addresses. */ +export interface ValAddressesAmino { + addresses?: string[]; +} +export interface ValAddressesAminoMsg { + type: "cosmos-sdk/ValAddresses"; + value: ValAddressesAmino; +} +/** ValAddresses defines a repeated set of validator addresses. */ +export interface ValAddressesSDKType { + addresses: string[]; +} +/** + * DVPair is struct that just has a delegator-validator pair with no other data. + * It is intended to be used as a marshalable pointer. For example, a DVPair can + * be used to construct the key to getting an UnbondingDelegation from state. + */ +export interface DVPair { + delegatorAddress: string; + validatorAddress: string; +} +export interface DVPairProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVPair"; + value: Uint8Array; +} +/** + * DVPair is struct that just has a delegator-validator pair with no other data. + * It is intended to be used as a marshalable pointer. For example, a DVPair can + * be used to construct the key to getting an UnbondingDelegation from state. + */ +export interface DVPairAmino { + delegator_address?: string; + validator_address?: string; +} +export interface DVPairAminoMsg { + type: "cosmos-sdk/DVPair"; + value: DVPairAmino; +} +/** + * DVPair is struct that just has a delegator-validator pair with no other data. + * It is intended to be used as a marshalable pointer. For example, a DVPair can + * be used to construct the key to getting an UnbondingDelegation from state. + */ +export interface DVPairSDKType { + delegator_address: string; + validator_address: string; +} +/** DVPairs defines an array of DVPair objects. */ +export interface DVPairs { + pairs: DVPair[]; +} +export interface DVPairsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVPairs"; + value: Uint8Array; +} +/** DVPairs defines an array of DVPair objects. */ +export interface DVPairsAmino { + pairs: DVPairAmino[]; +} +export interface DVPairsAminoMsg { + type: "cosmos-sdk/DVPairs"; + value: DVPairsAmino; +} +/** DVPairs defines an array of DVPair objects. */ +export interface DVPairsSDKType { + pairs: DVPairSDKType[]; +} +/** + * DVVTriplet is struct that just has a delegator-validator-validator triplet + * with no other data. It is intended to be used as a marshalable pointer. For + * example, a DVVTriplet can be used to construct the key to getting a + * Redelegation from state. + */ +export interface DVVTriplet { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; +} +export interface DVVTripletProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet"; + value: Uint8Array; +} +/** + * DVVTriplet is struct that just has a delegator-validator-validator triplet + * with no other data. It is intended to be used as a marshalable pointer. For + * example, a DVVTriplet can be used to construct the key to getting a + * Redelegation from state. + */ +export interface DVVTripletAmino { + delegator_address?: string; + validator_src_address?: string; + validator_dst_address?: string; +} +export interface DVVTripletAminoMsg { + type: "cosmos-sdk/DVVTriplet"; + value: DVVTripletAmino; +} +/** + * DVVTriplet is struct that just has a delegator-validator-validator triplet + * with no other data. It is intended to be used as a marshalable pointer. For + * example, a DVVTriplet can be used to construct the key to getting a + * Redelegation from state. + */ +export interface DVVTripletSDKType { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; +} +/** DVVTriplets defines an array of DVVTriplet objects. */ +export interface DVVTriplets { + triplets: DVVTriplet[]; +} +export interface DVVTripletsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets"; + value: Uint8Array; +} +/** DVVTriplets defines an array of DVVTriplet objects. */ +export interface DVVTripletsAmino { + triplets: DVVTripletAmino[]; +} +export interface DVVTripletsAminoMsg { + type: "cosmos-sdk/DVVTriplets"; + value: DVVTripletsAmino; +} +/** DVVTriplets defines an array of DVVTriplet objects. */ +export interface DVVTripletsSDKType { + triplets: DVVTripletSDKType[]; +} +/** + * Delegation represents the bond with tokens held by an account. It is + * owned by one delegator, and is associated with the voting power of one + * validator. + */ +export interface Delegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the bech32-encoded address of the validator. */ + validatorAddress: string; + /** shares define the delegation shares received. */ + shares: string; +} +export interface DelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Delegation"; + value: Uint8Array; +} +/** + * Delegation represents the bond with tokens held by an account. It is + * owned by one delegator, and is associated with the voting power of one + * validator. + */ +export interface DelegationAmino { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegator_address?: string; + /** validator_address is the bech32-encoded address of the validator. */ + validator_address?: string; + /** shares define the delegation shares received. */ + shares?: string; +} +export interface DelegationAminoMsg { + type: "cosmos-sdk/Delegation"; + value: DelegationAmino; +} +/** + * Delegation represents the bond with tokens held by an account. It is + * owned by one delegator, and is associated with the voting power of one + * validator. + */ +export interface DelegationSDKType { + delegator_address: string; + validator_address: string; + shares: string; +} +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the bech32-encoded address of the validator. */ + validatorAddress: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} +export interface UnbondingDelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation"; + value: Uint8Array; +} +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegationAmino { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegator_address?: string; + /** validator_address is the bech32-encoded address of the validator. */ + validator_address?: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntryAmino[]; +} +export interface UnbondingDelegationAminoMsg { + type: "cosmos-sdk/UnbondingDelegation"; + value: UnbondingDelegationAmino; +} +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegationSDKType { + delegator_address: string; + validator_address: string; + entries: UnbondingDelegationEntrySDKType[]; +} +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creationHeight: bigint; + /** completion_time is the unix time for unbonding completion. */ + completionTime: Date; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initialBalance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: bigint; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; +} +export interface UnbondingDelegationEntryProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry"; + value: Uint8Array; +} +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntryAmino { + /** creation_height is the height which the unbonding took place. */ + creation_height?: string; + /** completion_time is the unix time for unbonding completion. */ + completion_time: string; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initial_balance?: string; + /** balance defines the tokens to receive at completion. */ + balance?: string; + /** Incrementing id that uniquely identifies this entry */ + unbonding_id?: string; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count?: string; +} +export interface UnbondingDelegationEntryAminoMsg { + type: "cosmos-sdk/UnbondingDelegationEntry"; + value: UnbondingDelegationEntryAmino; +} +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntrySDKType { + creation_height: bigint; + completion_time: Date; + initial_balance: string; + balance: string; + unbonding_id: bigint; + unbonding_on_hold_ref_count: bigint; +} +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creationHeight: bigint; + /** completion_time defines the unix time for redelegation completion. */ + completionTime: Date; + /** initial_balance defines the initial balance when redelegation started. */ + initialBalance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + sharesDst: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: bigint; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; +} +export interface RedelegationEntryProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry"; + value: Uint8Array; +} +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntryAmino { + /** creation_height defines the height which the redelegation took place. */ + creation_height?: string; + /** completion_time defines the unix time for redelegation completion. */ + completion_time: string; + /** initial_balance defines the initial balance when redelegation started. */ + initial_balance?: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + shares_dst?: string; + /** Incrementing id that uniquely identifies this entry */ + unbonding_id?: string; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count?: string; +} +export interface RedelegationEntryAminoMsg { + type: "cosmos-sdk/RedelegationEntry"; + value: RedelegationEntryAmino; +} +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntrySDKType { + creation_height: bigint; + completion_time: Date; + initial_balance: string; + shares_dst: string; + unbonding_id: bigint; + unbonding_on_hold_ref_count: bigint; +} +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface Redelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_src_address is the validator redelegation source operator address. */ + validatorSrcAddress: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validatorDstAddress: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntry[]; +} +export interface RedelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Redelegation"; + value: Uint8Array; +} +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface RedelegationAmino { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegator_address?: string; + /** validator_src_address is the validator redelegation source operator address. */ + validator_src_address?: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validator_dst_address?: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntryAmino[]; +} +export interface RedelegationAminoMsg { + type: "cosmos-sdk/Redelegation"; + value: RedelegationAmino; +} +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface RedelegationSDKType { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; + entries: RedelegationEntrySDKType[]; +} +/** Params defines the parameters for the x/staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbondingTime: Duration; + /** max_validators is the maximum number of validators. */ + maxValidators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + maxEntries: number; + /** historical_entries is the number of historical entries to persist. */ + historicalEntries: number; + /** bond_denom defines the bondable coin denomination. */ + bondDenom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + minCommissionRate: string; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the x/staking module. */ +export interface ParamsAmino { + /** unbonding_time is the time duration of unbonding. */ + unbonding_time: DurationAmino; + /** max_validators is the maximum number of validators. */ + max_validators?: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + max_entries?: number; + /** historical_entries is the number of historical entries to persist. */ + historical_entries?: number; + /** bond_denom defines the bondable coin denomination. */ + bond_denom?: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + min_commission_rate?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/staking/Params"; + value: ParamsAmino; +} +/** Params defines the parameters for the x/staking module. */ +export interface ParamsSDKType { + unbonding_time: DurationSDKType; + max_validators: number; + max_entries: number; + historical_entries: number; + bond_denom: string; + min_commission_rate: string; +} +/** + * DelegationResponse is equivalent to Delegation except that it contains a + * balance in addition to shares which is more suitable for client responses. + */ +export interface DelegationResponse { + delegation: Delegation; + balance: Coin; +} +export interface DelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse"; + value: Uint8Array; +} +/** + * DelegationResponse is equivalent to Delegation except that it contains a + * balance in addition to shares which is more suitable for client responses. + */ +export interface DelegationResponseAmino { + delegation: DelegationAmino; + balance: CoinAmino; +} +export interface DelegationResponseAminoMsg { + type: "cosmos-sdk/DelegationResponse"; + value: DelegationResponseAmino; +} +/** + * DelegationResponse is equivalent to Delegation except that it contains a + * balance in addition to shares which is more suitable for client responses. + */ +export interface DelegationResponseSDKType { + delegation: DelegationSDKType; + balance: CoinSDKType; +} +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponse { + redelegationEntry: RedelegationEntry; + balance: string; +} +export interface RedelegationEntryResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse"; + value: Uint8Array; +} +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponseAmino { + redelegation_entry: RedelegationEntryAmino; + balance?: string; +} +export interface RedelegationEntryResponseAminoMsg { + type: "cosmos-sdk/RedelegationEntryResponse"; + value: RedelegationEntryResponseAmino; +} +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponseSDKType { + redelegation_entry: RedelegationEntrySDKType; + balance: string; +} +/** + * RedelegationResponse is equivalent to a Redelegation except that its entries + * contain a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationResponse { + redelegation: Redelegation; + entries: RedelegationEntryResponse[]; +} +export interface RedelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse"; + value: Uint8Array; +} +/** + * RedelegationResponse is equivalent to a Redelegation except that its entries + * contain a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationResponseAmino { + redelegation: RedelegationAmino; + entries: RedelegationEntryResponseAmino[]; +} +export interface RedelegationResponseAminoMsg { + type: "cosmos-sdk/RedelegationResponse"; + value: RedelegationResponseAmino; +} +/** + * RedelegationResponse is equivalent to a Redelegation except that its entries + * contain a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationResponseSDKType { + redelegation: RedelegationSDKType; + entries: RedelegationEntryResponseSDKType[]; +} +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + notBondedTokens: string; + bondedTokens: string; +} +export interface PoolProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Pool"; + value: Uint8Array; +} +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface PoolAmino { + not_bonded_tokens: string; + bonded_tokens: string; +} +export interface PoolAminoMsg { + type: "cosmos-sdk/Pool"; + value: PoolAmino; +} +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface PoolSDKType { + not_bonded_tokens: string; + bonded_tokens: string; +} +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdates { + updates: ValidatorUpdate[]; +} +export interface ValidatorUpdatesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates"; + value: Uint8Array; +} +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdatesAmino { + updates: ValidatorUpdateAmino[]; +} +export interface ValidatorUpdatesAminoMsg { + type: "cosmos-sdk/ValidatorUpdates"; + value: ValidatorUpdatesAmino; +} +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdatesSDKType { + updates: ValidatorUpdateSDKType[]; +} +function createBaseHistoricalInfo(): HistoricalInfo { + return { + header: Header.fromPartial({}), + valset: [] + }; +} +export const HistoricalInfo = { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", + aminoType: "cosmos-sdk/HistoricalInfo", + encode(message: HistoricalInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.valset) { + Validator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = Header.decode(reader, reader.uint32()); + break; + case 2: + message.valset.push(Validator.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HistoricalInfo { + const message = createBaseHistoricalInfo(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.valset = object.valset?.map(e => Validator.fromPartial(e)) || []; + return message; + }, + fromAmino(object: HistoricalInfoAmino): HistoricalInfo { + const message = createBaseHistoricalInfo(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + message.valset = object.valset?.map(e => Validator.fromAmino(e)) || []; + return message; + }, + toAmino(message: HistoricalInfo): HistoricalInfoAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : Header.toAmino(Header.fromPartial({})); + if (message.valset) { + obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.valset = message.valset; + } + return obj; + }, + fromAminoMsg(object: HistoricalInfoAminoMsg): HistoricalInfo { + return HistoricalInfo.fromAmino(object.value); + }, + toAminoMsg(message: HistoricalInfo): HistoricalInfoAminoMsg { + return { + type: "cosmos-sdk/HistoricalInfo", + value: HistoricalInfo.toAmino(message) + }; + }, + fromProtoMsg(message: HistoricalInfoProtoMsg): HistoricalInfo { + return HistoricalInfo.decode(message.value); + }, + toProto(message: HistoricalInfo): Uint8Array { + return HistoricalInfo.encode(message).finish(); + }, + toProtoMsg(message: HistoricalInfo): HistoricalInfoProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", + value: HistoricalInfo.encode(message).finish() + }; + } +}; +function createBaseCommissionRates(): CommissionRates { + return { + rate: "", + maxRate: "", + maxChangeRate: "" + }; +} +export const CommissionRates = { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates", + aminoType: "cosmos-sdk/CommissionRates", + encode(message: CommissionRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.rate !== "") { + writer.uint32(10).string(Decimal.fromUserInput(message.rate, 18).atomics); + } + if (message.maxRate !== "") { + writer.uint32(18).string(Decimal.fromUserInput(message.maxRate, 18).atomics); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.maxChangeRate, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 2: + message.maxRate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 3: + message.maxChangeRate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.maxRate = object.maxRate ?? ""; + message.maxChangeRate = object.maxChangeRate ?? ""; + return message; + }, + fromAmino(object: CommissionRatesAmino): CommissionRates { + const message = createBaseCommissionRates(); + if (object.rate !== undefined && object.rate !== null) { + message.rate = object.rate; + } + if (object.max_rate !== undefined && object.max_rate !== null) { + message.maxRate = object.max_rate; + } + if (object.max_change_rate !== undefined && object.max_change_rate !== null) { + message.maxChangeRate = object.max_change_rate; + } + return message; + }, + toAmino(message: CommissionRates): CommissionRatesAmino { + const obj: any = {}; + obj.rate = message.rate === "" ? undefined : message.rate; + obj.max_rate = message.maxRate === "" ? undefined : message.maxRate; + obj.max_change_rate = message.maxChangeRate === "" ? undefined : message.maxChangeRate; + return obj; + }, + fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { + return CommissionRates.fromAmino(object.value); + }, + toAminoMsg(message: CommissionRates): CommissionRatesAminoMsg { + return { + type: "cosmos-sdk/CommissionRates", + value: CommissionRates.toAmino(message) + }; + }, + fromProtoMsg(message: CommissionRatesProtoMsg): CommissionRates { + return CommissionRates.decode(message.value); + }, + toProto(message: CommissionRates): Uint8Array { + return CommissionRates.encode(message).finish(); + }, + toProtoMsg(message: CommissionRates): CommissionRatesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates", + value: CommissionRates.encode(message).finish() + }; + } +}; +function createBaseCommission(): Commission { + return { + commissionRates: CommissionRates.fromPartial({}), + updateTime: new Date() + }; +} +export const Commission = { + typeUrl: "/cosmos.staking.v1beta1.Commission", + aminoType: "cosmos-sdk/Commission", + encode(message: Commission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.commissionRates !== undefined) { + CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).ldelim(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commissionRates = CommissionRates.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Commission { + const message = createBaseCommission(); + message.commissionRates = object.commissionRates !== undefined && object.commissionRates !== null ? CommissionRates.fromPartial(object.commissionRates) : undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, + fromAmino(object: CommissionAmino): Commission { + const message = createBaseCommission(); + if (object.commission_rates !== undefined && object.commission_rates !== null) { + message.commissionRates = CommissionRates.fromAmino(object.commission_rates); + } + if (object.update_time !== undefined && object.update_time !== null) { + message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); + } + return message; + }, + toAmino(message: Commission): CommissionAmino { + const obj: any = {}; + obj.commission_rates = message.commissionRates ? CommissionRates.toAmino(message.commissionRates) : CommissionRates.toAmino(CommissionRates.fromPartial({})); + obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: CommissionAminoMsg): Commission { + return Commission.fromAmino(object.value); + }, + toAminoMsg(message: Commission): CommissionAminoMsg { + return { + type: "cosmos-sdk/Commission", + value: Commission.toAmino(message) + }; + }, + fromProtoMsg(message: CommissionProtoMsg): Commission { + return Commission.decode(message.value); + }, + toProto(message: Commission): Uint8Array { + return Commission.encode(message).finish(); + }, + toProtoMsg(message: Commission): CommissionProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Commission", + value: Commission.encode(message).finish() + }; + } +}; +function createBaseDescription(): Description { + return { + moniker: "", + identity: "", + website: "", + securityContact: "", + details: "" + }; +} +export const Description = { + typeUrl: "/cosmos.staking.v1beta1.Description", + aminoType: "cosmos-sdk/Description", + encode(message: Description, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moniker = reader.string(); + break; + case 2: + message.identity = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.securityContact = reader.string(); + break; + case 5: + message.details = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.securityContact = object.securityContact ?? ""; + message.details = object.details ?? ""; + return message; + }, + fromAmino(object: DescriptionAmino): Description { + const message = createBaseDescription(); + if (object.moniker !== undefined && object.moniker !== null) { + message.moniker = object.moniker; + } + if (object.identity !== undefined && object.identity !== null) { + message.identity = object.identity; + } + if (object.website !== undefined && object.website !== null) { + message.website = object.website; + } + if (object.security_contact !== undefined && object.security_contact !== null) { + message.securityContact = object.security_contact; + } + if (object.details !== undefined && object.details !== null) { + message.details = object.details; + } + return message; + }, + toAmino(message: Description): DescriptionAmino { + const obj: any = {}; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.identity = message.identity === "" ? undefined : message.identity; + obj.website = message.website === "" ? undefined : message.website; + obj.security_contact = message.securityContact === "" ? undefined : message.securityContact; + obj.details = message.details === "" ? undefined : message.details; + return obj; + }, + fromAminoMsg(object: DescriptionAminoMsg): Description { + return Description.fromAmino(object.value); + }, + toAminoMsg(message: Description): DescriptionAminoMsg { + return { + type: "cosmos-sdk/Description", + value: Description.toAmino(message) + }; + }, + fromProtoMsg(message: DescriptionProtoMsg): Description { + return Description.decode(message.value); + }, + toProto(message: Description): Uint8Array { + return Description.encode(message).finish(); + }, + toProtoMsg(message: Description): DescriptionProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Description", + value: Description.encode(message).finish() + }; + } +}; +function createBaseValidator(): Validator { + return { + operatorAddress: "", + consensusPubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegatorShares: "", + description: Description.fromPartial({}), + unbondingHeight: BigInt(0), + unbondingTime: new Date(), + commission: Commission.fromPartial({}), + minSelfDelegation: "", + unbondingOnHoldRefCount: BigInt(0), + unbondingIds: [] + }; +} +export const Validator = { + typeUrl: "/cosmos.staking.v1beta1.Validator", + aminoType: "cosmos-sdk/Validator", + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + if (message.consensusPubkey !== undefined) { + Any.encode((message.consensusPubkey as Any), writer.uint32(18).fork()).ldelim(); + } + if (message.jailed === true) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(Decimal.fromUserInput(message.delegatorShares, 18).atomics); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).ldelim(); + } + if (message.unbondingHeight !== BigInt(0)) { + writer.uint32(64).int64(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).ldelim(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(96).int64(message.unbondingOnHoldRefCount); + } + writer.uint32(106).fork(); + for (const v of message.unbondingIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operatorAddress = reader.string(); + break; + case 2: + message.consensusPubkey = (Cosmos_cryptoPubKey_InterfaceDecoder(reader) as Any); + break; + case 3: + message.jailed = reader.bool(); + break; + case 4: + message.status = (reader.int32() as any); + break; + case 5: + message.tokens = reader.string(); + break; + case 6: + message.delegatorShares = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 7: + message.description = Description.decode(reader, reader.uint32()); + break; + case 8: + message.unbondingHeight = reader.int64(); + break; + case 9: + message.unbondingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 10: + message.commission = Commission.decode(reader, reader.uint32()); + break; + case 11: + message.minSelfDelegation = reader.string(); + break; + case 12: + message.unbondingOnHoldRefCount = reader.int64(); + break; + case 13: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unbondingIds.push(reader.uint64()); + } + } else { + message.unbondingIds.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Validator { + const message = createBaseValidator(); + message.operatorAddress = object.operatorAddress ?? ""; + message.consensusPubkey = object.consensusPubkey !== undefined && object.consensusPubkey !== null ? Any.fromPartial(object.consensusPubkey) : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegatorShares = object.delegatorShares ?? ""; + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.unbondingHeight = object.unbondingHeight !== undefined && object.unbondingHeight !== null ? BigInt(object.unbondingHeight.toString()) : BigInt(0); + message.unbondingTime = object.unbondingTime ?? undefined; + message.commission = object.commission !== undefined && object.commission !== null ? Commission.fromPartial(object.commission) : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); + message.unbondingIds = object.unbondingIds?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.operator_address !== undefined && object.operator_address !== null) { + message.operatorAddress = object.operator_address; + } + if (object.consensus_pubkey !== undefined && object.consensus_pubkey !== null) { + message.consensusPubkey = encodePubkey(object.consensus_pubkey); + } + if (object.jailed !== undefined && object.jailed !== null) { + message.jailed = object.jailed; + } + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.tokens !== undefined && object.tokens !== null) { + message.tokens = object.tokens; + } + if (object.delegator_shares !== undefined && object.delegator_shares !== null) { + message.delegatorShares = object.delegator_shares; + } + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.unbonding_height !== undefined && object.unbonding_height !== null) { + message.unbondingHeight = BigInt(object.unbonding_height); + } + if (object.unbonding_time !== undefined && object.unbonding_time !== null) { + message.unbondingTime = fromTimestamp(Timestamp.fromAmino(object.unbonding_time)); + } + if (object.commission !== undefined && object.commission !== null) { + message.commission = Commission.fromAmino(object.commission); + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } + message.unbondingIds = object.unbonding_ids?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; + obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; + obj.jailed = message.jailed === false ? undefined : message.jailed; + obj.status = message.status === 0 ? undefined : message.status; + obj.tokens = message.tokens === "" ? undefined : message.tokens; + obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); + obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight.toString() : undefined; + obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : new Date(); + obj.commission = message.commission ? Commission.toAmino(message.commission) : Commission.toAmino(Commission.fromPartial({})); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount.toString() : undefined; + if (message.unbondingIds) { + obj.unbonding_ids = message.unbondingIds.map(e => e.toString()); + } else { + obj.unbonding_ids = message.unbondingIds; + } + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + toAminoMsg(message: Validator): ValidatorAminoMsg { + return { + type: "cosmos-sdk/Validator", + value: Validator.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Validator", + value: Validator.encode(message).finish() + }; + } +}; +function createBaseValAddresses(): ValAddresses { + return { + addresses: [] + }; +} +export const ValAddresses = { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses", + aminoType: "cosmos-sdk/ValAddresses", + encode(message: ValAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: ValAddressesAmino): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + toAmino(message: ValAddresses): ValAddressesAmino { + const obj: any = {}; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = message.addresses; + } + return obj; + }, + fromAminoMsg(object: ValAddressesAminoMsg): ValAddresses { + return ValAddresses.fromAmino(object.value); + }, + toAminoMsg(message: ValAddresses): ValAddressesAminoMsg { + return { + type: "cosmos-sdk/ValAddresses", + value: ValAddresses.toAmino(message) + }; + }, + fromProtoMsg(message: ValAddressesProtoMsg): ValAddresses { + return ValAddresses.decode(message.value); + }, + toProto(message: ValAddresses): Uint8Array { + return ValAddresses.encode(message).finish(); + }, + toProtoMsg(message: ValAddresses): ValAddressesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses", + value: ValAddresses.encode(message).finish() + }; + } +}; +function createBaseDVPair(): DVPair { + return { + delegatorAddress: "", + validatorAddress: "" + }; +} +export const DVPair = { + typeUrl: "/cosmos.staking.v1beta1.DVPair", + aminoType: "cosmos-sdk/DVPair", + encode(message: DVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DVPair { + const message = createBaseDVPair(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: DVPairAmino): DVPair { + const message = createBaseDVPair(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: DVPair): DVPairAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: DVPairAminoMsg): DVPair { + return DVPair.fromAmino(object.value); + }, + toAminoMsg(message: DVPair): DVPairAminoMsg { + return { + type: "cosmos-sdk/DVPair", + value: DVPair.toAmino(message) + }; + }, + fromProtoMsg(message: DVPairProtoMsg): DVPair { + return DVPair.decode(message.value); + }, + toProto(message: DVPair): Uint8Array { + return DVPair.encode(message).finish(); + }, + toProtoMsg(message: DVPair): DVPairProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVPair", + value: DVPair.encode(message).finish() + }; + } +}; +function createBaseDVPairs(): DVPairs { + return { + pairs: [] + }; +} +export const DVPairs = { + typeUrl: "/cosmos.staking.v1beta1.DVPairs", + aminoType: "cosmos-sdk/DVPairs", + encode(message: DVPairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pairs.push(DVPair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map(e => DVPair.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DVPairsAmino): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map(e => DVPair.fromAmino(e)) || []; + return message; + }, + toAmino(message: DVPairs): DVPairsAmino { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e) : undefined); + } else { + obj.pairs = message.pairs; + } + return obj; + }, + fromAminoMsg(object: DVPairsAminoMsg): DVPairs { + return DVPairs.fromAmino(object.value); + }, + toAminoMsg(message: DVPairs): DVPairsAminoMsg { + return { + type: "cosmos-sdk/DVPairs", + value: DVPairs.toAmino(message) + }; + }, + fromProtoMsg(message: DVPairsProtoMsg): DVPairs { + return DVPairs.decode(message.value); + }, + toProto(message: DVPairs): Uint8Array { + return DVPairs.encode(message).finish(); + }, + toProtoMsg(message: DVPairs): DVPairsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVPairs", + value: DVPairs.encode(message).finish() + }; + } +}; +function createBaseDVVTriplet(): DVVTriplet { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "" + }; +} +export const DVVTriplet = { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", + aminoType: "cosmos-sdk/DVVTriplet", + encode(message: DVVTriplet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + return message; + }, + fromAmino(object: DVVTripletAmino): DVVTriplet { + const message = createBaseDVVTriplet(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + return message; + }, + toAmino(message: DVVTriplet): DVVTripletAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; + return obj; + }, + fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { + return DVVTriplet.fromAmino(object.value); + }, + toAminoMsg(message: DVVTriplet): DVVTripletAminoMsg { + return { + type: "cosmos-sdk/DVVTriplet", + value: DVVTriplet.toAmino(message) + }; + }, + fromProtoMsg(message: DVVTripletProtoMsg): DVVTriplet { + return DVVTriplet.decode(message.value); + }, + toProto(message: DVVTriplet): Uint8Array { + return DVVTriplet.encode(message).finish(); + }, + toProtoMsg(message: DVVTriplet): DVVTripletProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", + value: DVVTriplet.encode(message).finish() + }; + } +}; +function createBaseDVVTriplets(): DVVTriplets { + return { + triplets: [] + }; +} +export const DVVTriplets = { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", + aminoType: "cosmos-sdk/DVVTriplets", + encode(message: DVVTriplets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map(e => DVVTriplet.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DVVTripletsAmino): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map(e => DVVTriplet.fromAmino(e)) || []; + return message; + }, + toAmino(message: DVVTriplets): DVVTripletsAmino { + const obj: any = {}; + if (message.triplets) { + obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e) : undefined); + } else { + obj.triplets = message.triplets; + } + return obj; + }, + fromAminoMsg(object: DVVTripletsAminoMsg): DVVTriplets { + return DVVTriplets.fromAmino(object.value); + }, + toAminoMsg(message: DVVTriplets): DVVTripletsAminoMsg { + return { + type: "cosmos-sdk/DVVTriplets", + value: DVVTriplets.toAmino(message) + }; + }, + fromProtoMsg(message: DVVTripletsProtoMsg): DVVTriplets { + return DVVTriplets.decode(message.value); + }, + toProto(message: DVVTriplets): Uint8Array { + return DVVTriplets.encode(message).finish(); + }, + toProtoMsg(message: DVVTriplets): DVVTripletsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", + value: DVVTriplets.encode(message).finish() + }; + } +}; +function createBaseDelegation(): Delegation { + return { + delegatorAddress: "", + validatorAddress: "", + shares: "" + }; +} +export const Delegation = { + typeUrl: "/cosmos.staking.v1beta1.Delegation", + aminoType: "cosmos-sdk/Delegation", + encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.shares, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.shares = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Delegation { + const message = createBaseDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.shares = object.shares ?? ""; + return message; + }, + fromAmino(object: DelegationAmino): Delegation { + const message = createBaseDelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.shares !== undefined && object.shares !== null) { + message.shares = object.shares; + } + return message; + }, + toAmino(message: Delegation): DelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = message.shares === "" ? undefined : message.shares; + return obj; + }, + fromAminoMsg(object: DelegationAminoMsg): Delegation { + return Delegation.fromAmino(object.value); + }, + toAminoMsg(message: Delegation): DelegationAminoMsg { + return { + type: "cosmos-sdk/Delegation", + value: Delegation.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationProtoMsg): Delegation { + return Delegation.decode(message.value); + }, + toProto(message: Delegation): Uint8Array { + return Delegation.encode(message).finish(); + }, + toProtoMsg(message: Delegation): DelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Delegation", + value: Delegation.encode(message).finish() + }; + } +}; +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { + delegatorAddress: "", + validatorAddress: "", + entries: [] + }; +} +export const UnbondingDelegation = { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", + aminoType: "cosmos-sdk/UnbondingDelegation", + encode(message: UnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.entries = object.entries?.map(e => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, + fromAmino(object: UnbondingDelegationAmino): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.entries = object.entries?.map(e => UnbondingDelegationEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + if (message.entries) { + obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + return obj; + }, + fromAminoMsg(object: UnbondingDelegationAminoMsg): UnbondingDelegation { + return UnbondingDelegation.fromAmino(object.value); + }, + toAminoMsg(message: UnbondingDelegation): UnbondingDelegationAminoMsg { + return { + type: "cosmos-sdk/UnbondingDelegation", + value: UnbondingDelegation.toAmino(message) + }; + }, + fromProtoMsg(message: UnbondingDelegationProtoMsg): UnbondingDelegation { + return UnbondingDelegation.decode(message.value); + }, + toProto(message: UnbondingDelegation): Uint8Array { + return UnbondingDelegation.encode(message).finish(); + }, + toProtoMsg(message: UnbondingDelegation): UnbondingDelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", + value: UnbondingDelegation.encode(message).finish() + }; + } +}; +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { + creationHeight: BigInt(0), + completionTime: new Date(), + initialBalance: "", + balance: "", + unbondingId: BigInt(0), + unbondingOnHoldRefCount: BigInt(0) + }; +} +export const UnbondingDelegationEntry = { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", + aminoType: "cosmos-sdk/UnbondingDelegationEntry", + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creationHeight !== BigInt(0)) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + if (message.unbondingId !== BigInt(0)) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creationHeight = reader.int64(); + break; + case 2: + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.initialBalance = reader.string(); + break; + case 4: + message.balance = reader.string(); + break; + case 5: + message.unbondingId = reader.uint64(); + break; + case 6: + message.unbondingOnHoldRefCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.balance = object.balance ?? ""; + message.unbondingId = object.unbondingId !== undefined && object.unbondingId !== null ? BigInt(object.unbondingId.toString()) : BigInt(0); + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); + return message; + }, + fromAmino(object: UnbondingDelegationEntryAmino): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + if (object.creation_height !== undefined && object.creation_height !== null) { + message.creationHeight = BigInt(object.creation_height); + } + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + if (object.initial_balance !== undefined && object.initial_balance !== null) { + message.initialBalance = object.initial_balance; + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = object.balance; + } + if (object.unbonding_id !== undefined && object.unbonding_id !== null) { + message.unbondingId = BigInt(object.unbonding_id); + } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } + return message; + }, + toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { + const obj: any = {}; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.balance = message.balance === "" ? undefined : message.balance; + obj.unbonding_id = message.unbondingId !== BigInt(0) ? message.unbondingId.toString() : undefined; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount.toString() : undefined; + return obj; + }, + fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromAmino(object.value); + }, + toAminoMsg(message: UnbondingDelegationEntry): UnbondingDelegationEntryAminoMsg { + return { + type: "cosmos-sdk/UnbondingDelegationEntry", + value: UnbondingDelegationEntry.toAmino(message) + }; + }, + fromProtoMsg(message: UnbondingDelegationEntryProtoMsg): UnbondingDelegationEntry { + return UnbondingDelegationEntry.decode(message.value); + }, + toProto(message: UnbondingDelegationEntry): Uint8Array { + return UnbondingDelegationEntry.encode(message).finish(); + }, + toProtoMsg(message: UnbondingDelegationEntry): UnbondingDelegationEntryProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", + value: UnbondingDelegationEntry.encode(message).finish() + }; + } +}; +function createBaseRedelegationEntry(): RedelegationEntry { + return { + creationHeight: BigInt(0), + completionTime: new Date(), + initialBalance: "", + sharesDst: "", + unbondingId: BigInt(0), + unbondingOnHoldRefCount: BigInt(0) + }; +} +export const RedelegationEntry = { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", + aminoType: "cosmos-sdk/RedelegationEntry", + encode(message: RedelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creationHeight !== BigInt(0)) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(Decimal.fromUserInput(message.sharesDst, 18).atomics); + } + if (message.unbondingId !== BigInt(0)) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creationHeight = reader.int64(); + break; + case 2: + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.initialBalance = reader.string(); + break; + case 4: + message.sharesDst = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 5: + message.unbondingId = reader.uint64(); + break; + case 6: + message.unbondingOnHoldRefCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.sharesDst = object.sharesDst ?? ""; + message.unbondingId = object.unbondingId !== undefined && object.unbondingId !== null ? BigInt(object.unbondingId.toString()) : BigInt(0); + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); + return message; + }, + fromAmino(object: RedelegationEntryAmino): RedelegationEntry { + const message = createBaseRedelegationEntry(); + if (object.creation_height !== undefined && object.creation_height !== null) { + message.creationHeight = BigInt(object.creation_height); + } + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + if (object.initial_balance !== undefined && object.initial_balance !== null) { + message.initialBalance = object.initial_balance; + } + if (object.shares_dst !== undefined && object.shares_dst !== null) { + message.sharesDst = object.shares_dst; + } + if (object.unbonding_id !== undefined && object.unbonding_id !== null) { + message.unbondingId = BigInt(object.unbonding_id); + } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } + return message; + }, + toAmino(message: RedelegationEntry): RedelegationEntryAmino { + const obj: any = {}; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.unbonding_id = message.unbondingId !== BigInt(0) ? message.unbondingId.toString() : undefined; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { + return RedelegationEntry.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationEntry): RedelegationEntryAminoMsg { + return { + type: "cosmos-sdk/RedelegationEntry", + value: RedelegationEntry.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationEntryProtoMsg): RedelegationEntry { + return RedelegationEntry.decode(message.value); + }, + toProto(message: RedelegationEntry): Uint8Array { + return RedelegationEntry.encode(message).finish(); + }, + toProtoMsg(message: RedelegationEntry): RedelegationEntryProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", + value: RedelegationEntry.encode(message).finish() + }; + } +}; +function createBaseRedelegation(): Redelegation { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "", + entries: [] + }; +} +export const Redelegation = { + typeUrl: "/cosmos.staking.v1beta1.Redelegation", + aminoType: "cosmos-sdk/Redelegation", + encode(message: Redelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + case 4: + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Redelegation { + const message = createBaseRedelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.entries = object.entries?.map(e => RedelegationEntry.fromPartial(e)) || []; + return message; + }, + fromAmino(object: RedelegationAmino): Redelegation { + const message = createBaseRedelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + message.entries = object.entries?.map(e => RedelegationEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: Redelegation): RedelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; + if (message.entries) { + obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + return obj; + }, + fromAminoMsg(object: RedelegationAminoMsg): Redelegation { + return Redelegation.fromAmino(object.value); + }, + toAminoMsg(message: Redelegation): RedelegationAminoMsg { + return { + type: "cosmos-sdk/Redelegation", + value: Redelegation.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationProtoMsg): Redelegation { + return Redelegation.decode(message.value); + }, + toProto(message: Redelegation): Uint8Array { + return Redelegation.encode(message).finish(); + }, + toProtoMsg(message: Redelegation): RedelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Redelegation", + value: Redelegation.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + unbondingTime: Duration.fromPartial({}), + maxValidators: 0, + maxEntries: 0, + historicalEntries: 0, + bondDenom: "", + minCommissionRate: "" + }; +} +export const Params = { + typeUrl: "/cosmos.staking.v1beta1.Params", + aminoType: "cosmos-sdk/x/staking/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.unbondingTime !== undefined) { + Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); + } + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } + if (message.minCommissionRate !== "") { + writer.uint32(50).string(Decimal.fromUserInput(message.minCommissionRate, 18).atomics); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.unbondingTime = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.maxValidators = reader.uint32(); + break; + case 3: + message.maxEntries = reader.uint32(); + break; + case 4: + message.historicalEntries = reader.uint32(); + break; + case 5: + message.bondDenom = reader.string(); + break; + case 6: + message.minCommissionRate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.unbondingTime = object.unbondingTime !== undefined && object.unbondingTime !== null ? Duration.fromPartial(object.unbondingTime) : undefined; + message.maxValidators = object.maxValidators ?? 0; + message.maxEntries = object.maxEntries ?? 0; + message.historicalEntries = object.historicalEntries ?? 0; + message.bondDenom = object.bondDenom ?? ""; + message.minCommissionRate = object.minCommissionRate ?? ""; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.unbonding_time !== undefined && object.unbonding_time !== null) { + message.unbondingTime = Duration.fromAmino(object.unbonding_time); + } + if (object.max_validators !== undefined && object.max_validators !== null) { + message.maxValidators = object.max_validators; + } + if (object.max_entries !== undefined && object.max_entries !== null) { + message.maxEntries = object.max_entries; + } + if (object.historical_entries !== undefined && object.historical_entries !== null) { + message.historicalEntries = object.historical_entries; + } + if (object.bond_denom !== undefined && object.bond_denom !== null) { + message.bondDenom = object.bond_denom; + } + if (object.min_commission_rate !== undefined && object.min_commission_rate !== null) { + message.minCommissionRate = object.min_commission_rate; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : Duration.toAmino(Duration.fromPartial({})); + obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; + obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; + obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; + obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; + obj.min_commission_rate = message.minCommissionRate === "" ? undefined : message.minCommissionRate; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/staking/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; +function createBaseDelegationResponse(): DelegationResponse { + return { + delegation: Delegation.fromPartial({}), + balance: Coin.fromPartial({}) + }; +} +export const DelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", + aminoType: "cosmos-sdk/DelegationResponse", + encode(message: DelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegation !== undefined) { + Delegation.encode(message.delegation, writer.uint32(10).fork()).ldelim(); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegation = Delegation.decode(reader, reader.uint32()); + break; + case 2: + message.balance = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelegationResponse { + const message = createBaseDelegationResponse(); + message.delegation = object.delegation !== undefined && object.delegation !== null ? Delegation.fromPartial(object.delegation) : undefined; + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, + fromAmino(object: DelegationResponseAmino): DelegationResponse { + const message = createBaseDelegationResponse(); + if (object.delegation !== undefined && object.delegation !== null) { + message.delegation = Delegation.fromAmino(object.delegation); + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: DelegationResponse): DelegationResponseAmino { + const obj: any = {}; + obj.delegation = message.delegation ? Delegation.toAmino(message.delegation) : Delegation.toAmino(Delegation.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: DelegationResponseAminoMsg): DelegationResponse { + return DelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: DelegationResponse): DelegationResponseAminoMsg { + return { + type: "cosmos-sdk/DelegationResponse", + value: DelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationResponseProtoMsg): DelegationResponse { + return DelegationResponse.decode(message.value); + }, + toProto(message: DelegationResponse): Uint8Array { + return DelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: DelegationResponse): DelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", + value: DelegationResponse.encode(message).finish() + }; + } +}; +function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { + return { + redelegationEntry: RedelegationEntry.fromPartial({}), + balance: "" + }; +} +export const RedelegationEntryResponse = { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", + aminoType: "cosmos-sdk/RedelegationEntryResponse", + encode(message: RedelegationEntryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.redelegationEntry !== undefined) { + RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegationEntry = RedelegationEntry.decode(reader, reader.uint32()); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegationEntry = object.redelegationEntry !== undefined && object.redelegationEntry !== null ? RedelegationEntry.fromPartial(object.redelegationEntry) : undefined; + message.balance = object.balance ?? ""; + return message; + }, + fromAmino(object: RedelegationEntryResponseAmino): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + if (object.redelegation_entry !== undefined && object.redelegation_entry !== null) { + message.redelegationEntry = RedelegationEntry.fromAmino(object.redelegation_entry); + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = object.balance; + } + return message; + }, + toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { + const obj: any = {}; + obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : RedelegationEntry.toAmino(RedelegationEntry.fromPartial({})); + obj.balance = message.balance === "" ? undefined : message.balance; + return obj; + }, + fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { + return RedelegationEntryResponse.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationEntryResponse): RedelegationEntryResponseAminoMsg { + return { + type: "cosmos-sdk/RedelegationEntryResponse", + value: RedelegationEntryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationEntryResponseProtoMsg): RedelegationEntryResponse { + return RedelegationEntryResponse.decode(message.value); + }, + toProto(message: RedelegationEntryResponse): Uint8Array { + return RedelegationEntryResponse.encode(message).finish(); + }, + toProtoMsg(message: RedelegationEntryResponse): RedelegationEntryResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", + value: RedelegationEntryResponse.encode(message).finish() + }; + } +}; +function createBaseRedelegationResponse(): RedelegationResponse { + return { + redelegation: Redelegation.fromPartial({}), + entries: [] + }; +} +export const RedelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", + aminoType: "cosmos-sdk/RedelegationResponse", + encode(message: RedelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.redelegation !== undefined) { + Redelegation.encode(message.redelegation, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.entries) { + RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegation = Redelegation.decode(reader, reader.uint32()); + break; + case 2: + message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RedelegationResponse { + const message = createBaseRedelegationResponse(); + message.redelegation = object.redelegation !== undefined && object.redelegation !== null ? Redelegation.fromPartial(object.redelegation) : undefined; + message.entries = object.entries?.map(e => RedelegationEntryResponse.fromPartial(e)) || []; + return message; + }, + fromAmino(object: RedelegationResponseAmino): RedelegationResponse { + const message = createBaseRedelegationResponse(); + if (object.redelegation !== undefined && object.redelegation !== null) { + message.redelegation = Redelegation.fromAmino(object.redelegation); + } + message.entries = object.entries?.map(e => RedelegationEntryResponse.fromAmino(e)) || []; + return message; + }, + toAmino(message: RedelegationResponse): RedelegationResponseAmino { + const obj: any = {}; + obj.redelegation = message.redelegation ? Redelegation.toAmino(message.redelegation) : Redelegation.toAmino(Redelegation.fromPartial({})); + if (message.entries) { + obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + return obj; + }, + fromAminoMsg(object: RedelegationResponseAminoMsg): RedelegationResponse { + return RedelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationResponse): RedelegationResponseAminoMsg { + return { + type: "cosmos-sdk/RedelegationResponse", + value: RedelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationResponseProtoMsg): RedelegationResponse { + return RedelegationResponse.decode(message.value); + }, + toProto(message: RedelegationResponse): Uint8Array { + return RedelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: RedelegationResponse): RedelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", + value: RedelegationResponse.encode(message).finish() + }; + } +}; +function createBasePool(): Pool { + return { + notBondedTokens: "", + bondedTokens: "" + }; +} +export const Pool = { + typeUrl: "/cosmos.staking.v1beta1.Pool", + aminoType: "cosmos-sdk/Pool", + encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.notBondedTokens = reader.string(); + break; + case 2: + message.bondedTokens = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Pool { + const message = createBasePool(); + message.notBondedTokens = object.notBondedTokens ?? ""; + message.bondedTokens = object.bondedTokens ?? ""; + return message; + }, + fromAmino(object: PoolAmino): Pool { + const message = createBasePool(); + if (object.not_bonded_tokens !== undefined && object.not_bonded_tokens !== null) { + message.notBondedTokens = object.not_bonded_tokens; + } + if (object.bonded_tokens !== undefined && object.bonded_tokens !== null) { + message.bondedTokens = object.bonded_tokens; + } + return message; + }, + toAmino(message: Pool): PoolAmino { + const obj: any = {}; + obj.not_bonded_tokens = message.notBondedTokens ?? ""; + obj.bonded_tokens = message.bondedTokens ?? ""; + return obj; + }, + fromAminoMsg(object: PoolAminoMsg): Pool { + return Pool.fromAmino(object.value); + }, + toAminoMsg(message: Pool): PoolAminoMsg { + return { + type: "cosmos-sdk/Pool", + value: Pool.toAmino(message) + }; + }, + fromProtoMsg(message: PoolProtoMsg): Pool { + return Pool.decode(message.value); + }, + toProto(message: Pool): Uint8Array { + return Pool.encode(message).finish(); + }, + toProtoMsg(message: Pool): PoolProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Pool", + value: Pool.encode(message).finish() + }; + } +}; +function createBaseValidatorUpdates(): ValidatorUpdates { + return { + updates: [] + }; +} +export const ValidatorUpdates = { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates", + aminoType: "cosmos-sdk/ValidatorUpdates", + encode(message: ValidatorUpdates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map(e => ValidatorUpdate.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorUpdatesAmino): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map(e => ValidatorUpdate.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorUpdates): ValidatorUpdatesAmino { + const obj: any = {}; + if (message.updates) { + obj.updates = message.updates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.updates = message.updates; + } + return obj; + }, + fromAminoMsg(object: ValidatorUpdatesAminoMsg): ValidatorUpdates { + return ValidatorUpdates.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorUpdates): ValidatorUpdatesAminoMsg { + return { + type: "cosmos-sdk/ValidatorUpdates", + value: ValidatorUpdates.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorUpdatesProtoMsg): ValidatorUpdates { + return ValidatorUpdates.decode(message.value); + }, + toProto(message: ValidatorUpdates): Uint8Array { + return ValidatorUpdates.encode(message).finish(); + }, + toProtoMsg(message: ValidatorUpdates): ValidatorUpdatesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates", + value: ValidatorUpdates.encode(message).finish() + }; + } +}; +export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + default: + return data; + } +}; +export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { + return encodePubkey(content); +}; +export const Cosmos_cryptoPubKey_ToAmino = (content: Any): Pubkey | null => { + return decodePubkey(content); +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/tx.amino.ts b/util/inj-types/cosmos/staking/v1beta1/tx.amino.ts new file mode 100644 index 00000000..ab2985b9 --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/tx.amino.ts @@ -0,0 +1,38 @@ +import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate, MsgCancelUnbondingDelegation, MsgUpdateParams } from "./tx"; +export const AminoConverter = { + "/cosmos.staking.v1beta1.MsgCreateValidator": { + aminoType: "cosmos-sdk/MsgCreateValidator", + toAmino: MsgCreateValidator.toAmino, + fromAmino: MsgCreateValidator.fromAmino + }, + "/cosmos.staking.v1beta1.MsgEditValidator": { + aminoType: "cosmos-sdk/MsgEditValidator", + toAmino: MsgEditValidator.toAmino, + fromAmino: MsgEditValidator.fromAmino + }, + "/cosmos.staking.v1beta1.MsgDelegate": { + aminoType: "cosmos-sdk/MsgDelegate", + toAmino: MsgDelegate.toAmino, + fromAmino: MsgDelegate.fromAmino + }, + "/cosmos.staking.v1beta1.MsgBeginRedelegate": { + aminoType: "cosmos-sdk/MsgBeginRedelegate", + toAmino: MsgBeginRedelegate.toAmino, + fromAmino: MsgBeginRedelegate.fromAmino + }, + "/cosmos.staking.v1beta1.MsgUndelegate": { + aminoType: "cosmos-sdk/MsgUndelegate", + toAmino: MsgUndelegate.toAmino, + fromAmino: MsgUndelegate.fromAmino + }, + "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation": { + aminoType: "cosmos-sdk/MsgCancelUnbondingDelegation", + toAmino: MsgCancelUnbondingDelegation.toAmino, + fromAmino: MsgCancelUnbondingDelegation.fromAmino + }, + "/cosmos.staking.v1beta1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/staking/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/tx.registry.ts b/util/inj-types/cosmos/staking/v1beta1/tx.registry.ts new file mode 100644 index 00000000..813c4faf --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/tx.registry.ts @@ -0,0 +1,143 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate, MsgCancelUnbondingDelegation, MsgUpdateParams } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], ["/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", MsgCancelUnbondingDelegation], ["/cosmos.staking.v1beta1.MsgUpdateParams", MsgUpdateParams]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + createValidator(value: MsgCreateValidator) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + value: MsgCreateValidator.encode(value).finish() + }; + }, + editValidator(value: MsgEditValidator) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + value: MsgEditValidator.encode(value).finish() + }; + }, + delegate(value: MsgDelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + value: MsgDelegate.encode(value).finish() + }; + }, + beginRedelegate(value: MsgBeginRedelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + value: MsgBeginRedelegate.encode(value).finish() + }; + }, + undelegate(value: MsgUndelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + value: MsgUndelegate.encode(value).finish() + }; + }, + cancelUnbondingDelegation(value: MsgCancelUnbondingDelegation) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + value: MsgCancelUnbondingDelegation.encode(value).finish() + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + } + }, + withTypeUrl: { + createValidator(value: MsgCreateValidator) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + value + }; + }, + editValidator(value: MsgEditValidator) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + value + }; + }, + delegate(value: MsgDelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + value + }; + }, + beginRedelegate(value: MsgBeginRedelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + value + }; + }, + undelegate(value: MsgUndelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + value + }; + }, + cancelUnbondingDelegation(value: MsgCancelUnbondingDelegation) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + value + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value + }; + } + }, + fromPartial: { + createValidator(value: MsgCreateValidator) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + value: MsgCreateValidator.fromPartial(value) + }; + }, + editValidator(value: MsgEditValidator) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + value: MsgEditValidator.fromPartial(value) + }; + }, + delegate(value: MsgDelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + value: MsgDelegate.fromPartial(value) + }; + }, + beginRedelegate(value: MsgBeginRedelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + value: MsgBeginRedelegate.fromPartial(value) + }; + }, + undelegate(value: MsgUndelegate) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + value: MsgUndelegate.fromPartial(value) + }; + }, + cancelUnbondingDelegation(value: MsgCancelUnbondingDelegation) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + value: MsgCancelUnbondingDelegation.fromPartial(value) + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/staking/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..fbb10d4c --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,94 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgCreateValidator, MsgCreateValidatorResponse, MsgEditValidator, MsgEditValidatorResponse, MsgDelegate, MsgDelegateResponse, MsgBeginRedelegate, MsgBeginRedelegateResponse, MsgUndelegate, MsgUndelegateResponse, MsgCancelUnbondingDelegation, MsgCancelUnbondingDelegationResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx"; +/** Msg defines the staking Msg service. */ +export interface Msg { + /** CreateValidator defines a method for creating a new validator. */ + createValidator(request: MsgCreateValidator): Promise; + /** EditValidator defines a method for editing an existing validator. */ + editValidator(request: MsgEditValidator): Promise; + /** + * Delegate defines a method for performing a delegation of coins + * from a delegator to a validator. + */ + delegate(request: MsgDelegate): Promise; + /** + * BeginRedelegate defines a method for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ + beginRedelegate(request: MsgBeginRedelegate): Promise; + /** + * Undelegate defines a method for performing an undelegation from a + * delegate and a validator. + */ + undelegate(request: MsgUndelegate): Promise; + /** + * CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + * and delegate back to previous validator. + * + * Since: cosmos-sdk 0.46 + */ + cancelUnbondingDelegation(request: MsgCancelUnbondingDelegation): Promise; + /** + * UpdateParams defines an operation for updating the x/staking module + * parameters. + * Since: cosmos-sdk 0.47 + */ + updateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* CreateValidator defines a method for creating a new validator. */ + createValidator = async (request: MsgCreateValidator): Promise => { + const data = MsgCreateValidator.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "CreateValidator", data); + return promise.then(data => MsgCreateValidatorResponse.decode(new BinaryReader(data))); + }; + /* EditValidator defines a method for editing an existing validator. */ + editValidator = async (request: MsgEditValidator): Promise => { + const data = MsgEditValidator.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "EditValidator", data); + return promise.then(data => MsgEditValidatorResponse.decode(new BinaryReader(data))); + }; + /* Delegate defines a method for performing a delegation of coins + from a delegator to a validator. */ + delegate = async (request: MsgDelegate): Promise => { + const data = MsgDelegate.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "Delegate", data); + return promise.then(data => MsgDelegateResponse.decode(new BinaryReader(data))); + }; + /* BeginRedelegate defines a method for performing a redelegation + of coins from a delegator and source validator to a destination validator. */ + beginRedelegate = async (request: MsgBeginRedelegate): Promise => { + const data = MsgBeginRedelegate.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "BeginRedelegate", data); + return promise.then(data => MsgBeginRedelegateResponse.decode(new BinaryReader(data))); + }; + /* Undelegate defines a method for performing an undelegation from a + delegate and a validator. */ + undelegate = async (request: MsgUndelegate): Promise => { + const data = MsgUndelegate.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "Undelegate", data); + return promise.then(data => MsgUndelegateResponse.decode(new BinaryReader(data))); + }; + /* CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation + and delegate back to previous validator. + + Since: cosmos-sdk 0.46 */ + cancelUnbondingDelegation = async (request: MsgCancelUnbondingDelegation): Promise => { + const data = MsgCancelUnbondingDelegation.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "CancelUnbondingDelegation", data); + return promise.then(data => MsgCancelUnbondingDelegationResponse.decode(new BinaryReader(data))); + }; + /* UpdateParams defines an operation for updating the x/staking module + parameters. + Since: cosmos-sdk 0.47 */ + updateParams = async (request: MsgUpdateParams): Promise => { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/staking/v1beta1/tx.ts b/util/inj-types/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..90fcc024 --- /dev/null +++ b/util/inj-types/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,1597 @@ +import { Description, DescriptionAmino, DescriptionSDKType, CommissionRates, CommissionRatesAmino, CommissionRatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { Decimal } from "@cosmjs/math"; +import { Pubkey } from "@cosmjs/amino"; +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description: Description; + commission: CommissionRates; + minSelfDelegation: string; + delegatorAddress: string; + validatorAddress: string; + pubkey?: Any | undefined; + value: Coin; +} +export interface MsgCreateValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator"; + value: Uint8Array; +} +export type MsgCreateValidatorEncoded = Omit & { + pubkey?: AnyProtoMsg | undefined; +}; +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidatorAmino { + description: DescriptionAmino; + commission: CommissionRatesAmino; + min_self_delegation?: string; + delegator_address?: string; + validator_address?: string; + pubkey?: AnyAmino; + value: CoinAmino; +} +export interface MsgCreateValidatorAminoMsg { + type: "cosmos-sdk/MsgCreateValidator"; + value: MsgCreateValidatorAmino; +} +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidatorSDKType { + description: DescriptionSDKType; + commission: CommissionRatesSDKType; + min_self_delegation: string; + delegator_address: string; + validator_address: string; + pubkey?: AnySDKType | undefined; + value: CoinSDKType; +} +/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ +export interface MsgCreateValidatorResponse {} +export interface MsgCreateValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse"; + value: Uint8Array; +} +/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ +export interface MsgCreateValidatorResponseAmino {} +export interface MsgCreateValidatorResponseAminoMsg { + type: "cosmos-sdk/MsgCreateValidatorResponse"; + value: MsgCreateValidatorResponseAmino; +} +/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ +export interface MsgCreateValidatorResponseSDKType {} +/** MsgEditValidator defines a SDK message for editing an existing validator. */ +export interface MsgEditValidator { + description: Description; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; +} +export interface MsgEditValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator"; + value: Uint8Array; +} +/** MsgEditValidator defines a SDK message for editing an existing validator. */ +export interface MsgEditValidatorAmino { + description: DescriptionAmino; + validator_address?: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commission_rate?: string; + min_self_delegation?: string; +} +export interface MsgEditValidatorAminoMsg { + type: "cosmos-sdk/MsgEditValidator"; + value: MsgEditValidatorAmino; +} +/** MsgEditValidator defines a SDK message for editing an existing validator. */ +export interface MsgEditValidatorSDKType { + description: DescriptionSDKType; + validator_address: string; + commission_rate: string; + min_self_delegation: string; +} +/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ +export interface MsgEditValidatorResponse {} +export interface MsgEditValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse"; + value: Uint8Array; +} +/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ +export interface MsgEditValidatorResponseAmino {} +export interface MsgEditValidatorResponseAminoMsg { + type: "cosmos-sdk/MsgEditValidatorResponse"; + value: MsgEditValidatorResponseAmino; +} +/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ +export interface MsgEditValidatorResponseSDKType {} +/** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ +export interface MsgDelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin; +} +export interface MsgDelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate"; + value: Uint8Array; +} +/** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ +export interface MsgDelegateAmino { + delegator_address?: string; + validator_address?: string; + amount: CoinAmino; +} +export interface MsgDelegateAminoMsg { + type: "cosmos-sdk/MsgDelegate"; + value: MsgDelegateAmino; +} +/** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ +export interface MsgDelegateSDKType { + delegator_address: string; + validator_address: string; + amount: CoinSDKType; +} +/** MsgDelegateResponse defines the Msg/Delegate response type. */ +export interface MsgDelegateResponse {} +export interface MsgDelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse"; + value: Uint8Array; +} +/** MsgDelegateResponse defines the Msg/Delegate response type. */ +export interface MsgDelegateResponseAmino {} +export interface MsgDelegateResponseAminoMsg { + type: "cosmos-sdk/MsgDelegateResponse"; + value: MsgDelegateResponseAmino; +} +/** MsgDelegateResponse defines the Msg/Delegate response type. */ +export interface MsgDelegateResponseSDKType {} +/** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ +export interface MsgBeginRedelegate { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin; +} +export interface MsgBeginRedelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate"; + value: Uint8Array; +} +/** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ +export interface MsgBeginRedelegateAmino { + delegator_address?: string; + validator_src_address?: string; + validator_dst_address?: string; + amount: CoinAmino; +} +export interface MsgBeginRedelegateAminoMsg { + type: "cosmos-sdk/MsgBeginRedelegate"; + value: MsgBeginRedelegateAmino; +} +/** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ +export interface MsgBeginRedelegateSDKType { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; + amount: CoinSDKType; +} +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completionTime: Date; +} +export interface MsgBeginRedelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse"; + value: Uint8Array; +} +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponseAmino { + completion_time: string; +} +export interface MsgBeginRedelegateResponseAminoMsg { + type: "cosmos-sdk/MsgBeginRedelegateResponse"; + value: MsgBeginRedelegateResponseAmino; +} +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponseSDKType { + completion_time: Date; +} +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin; +} +export interface MsgUndelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate"; + value: Uint8Array; +} +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegateAmino { + delegator_address?: string; + validator_address?: string; + amount: CoinAmino; +} +export interface MsgUndelegateAminoMsg { + type: "cosmos-sdk/MsgUndelegate"; + value: MsgUndelegateAmino; +} +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegateSDKType { + delegator_address: string; + validator_address: string; + amount: CoinSDKType; +} +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completionTime: Date; +} +export interface MsgUndelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse"; + value: Uint8Array; +} +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponseAmino { + completion_time: string; +} +export interface MsgUndelegateResponseAminoMsg { + type: "cosmos-sdk/MsgUndelegateResponse"; + value: MsgUndelegateResponseAmino; +} +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponseSDKType { + completion_time: Date; +} +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: Coin; + /** creation_height is the height which the unbonding took place. */ + creationHeight: bigint; +} +export interface MsgCancelUnbondingDelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation"; + value: Uint8Array; +} +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationAmino { + delegator_address?: string; + validator_address?: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: CoinAmino; + /** creation_height is the height which the unbonding took place. */ + creation_height?: string; +} +export interface MsgCancelUnbondingDelegationAminoMsg { + type: "cosmos-sdk/MsgCancelUnbondingDelegation"; + value: MsgCancelUnbondingDelegationAmino; +} +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationSDKType { + delegator_address: string; + validator_address: string; + amount: CoinSDKType; + creation_height: bigint; +} +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponse {} +export interface MsgCancelUnbondingDelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse"; + value: Uint8Array; +} +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponseAmino {} +export interface MsgCancelUnbondingDelegationResponseAminoMsg { + type: "cosmos-sdk/MsgCancelUnbondingDelegationResponse"; + value: MsgCancelUnbondingDelegationResponseAmino; +} +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponseSDKType {} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/staking/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseSDKType {} +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: Description.fromPartial({}), + commission: CommissionRates.fromPartial({}), + minSelfDelegation: "", + delegatorAddress: "", + validatorAddress: "", + pubkey: undefined, + value: Coin.fromPartial({}) + }; +} +export const MsgCreateValidator = { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + aminoType: "cosmos-sdk/MsgCreateValidator", + encode(message: MsgCreateValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).ldelim(); + } + if (message.commission !== undefined) { + CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } + if (message.pubkey !== undefined) { + Any.encode((message.pubkey as Any), writer.uint32(50).fork()).ldelim(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = Description.decode(reader, reader.uint32()); + break; + case 2: + message.commission = CommissionRates.decode(reader, reader.uint32()); + break; + case 3: + message.minSelfDelegation = reader.string(); + break; + case 4: + message.delegatorAddress = reader.string(); + break; + case 5: + message.validatorAddress = reader.string(); + break; + case 6: + message.pubkey = (Cosmos_cryptoPubKey_InterfaceDecoder(reader) as Any); + break; + case 7: + message.value = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateValidator { + const message = createBaseMsgCreateValidator(); + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.commission = object.commission !== undefined && object.commission !== null ? CommissionRates.fromPartial(object.commission) : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.pubkey = object.pubkey !== undefined && object.pubkey !== null ? Any.fromPartial(object.pubkey) : undefined; + message.value = object.value !== undefined && object.value !== null ? Coin.fromPartial(object.value) : undefined; + return message; + }, + fromAmino(object: MsgCreateValidatorAmino): MsgCreateValidator { + const message = createBaseMsgCreateValidator(); + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.commission !== undefined && object.commission !== null) { + message.commission = CommissionRates.fromAmino(object.commission); + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.value !== undefined && object.value !== null) { + message.value = Coin.fromAmino(object.value); + } + return message; + }, + toAmino(message: MsgCreateValidator): MsgCreateValidatorAmino { + const obj: any = {}; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); + obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : CommissionRates.toAmino(CommissionRates.fromPartial({})); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.value = message.value ? Coin.toAmino(message.value) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgCreateValidatorAminoMsg): MsgCreateValidator { + return MsgCreateValidator.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateValidator): MsgCreateValidatorAminoMsg { + return { + type: "cosmos-sdk/MsgCreateValidator", + value: MsgCreateValidator.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateValidatorProtoMsg): MsgCreateValidator { + return MsgCreateValidator.decode(message.value); + }, + toProto(message: MsgCreateValidator): Uint8Array { + return MsgCreateValidator.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateValidator): MsgCreateValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + value: MsgCreateValidator.encode(message).finish() + }; + } +}; +function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { + return {}; +} +export const MsgCreateValidatorResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", + aminoType: "cosmos-sdk/MsgCreateValidatorResponse", + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, + fromAmino(_: MsgCreateValidatorResponseAmino): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, + toAmino(_: MsgCreateValidatorResponse): MsgCreateValidatorResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateValidatorResponseAminoMsg): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateValidatorResponse): MsgCreateValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateValidatorResponse", + value: MsgCreateValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateValidatorResponseProtoMsg): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.decode(message.value); + }, + toProto(message: MsgCreateValidatorResponse): Uint8Array { + return MsgCreateValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateValidatorResponse): MsgCreateValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", + value: MsgCreateValidatorResponse.encode(message).finish() + }; + } +}; +function createBaseMsgEditValidator(): MsgEditValidator { + return { + description: Description.fromPartial({}), + validatorAddress: "", + commissionRate: "", + minSelfDelegation: "" + }; +} +export const MsgEditValidator = { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + aminoType: "cosmos-sdk/MsgEditValidator", + encode(message: MsgEditValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(Decimal.fromUserInput(message.commissionRate, 18).atomics); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = Description.decode(reader, reader.uint32()); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.commissionRate = Decimal.fromAtomics(reader.string(), 18).toString(); + break; + case 4: + message.minSelfDelegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.validatorAddress = object.validatorAddress ?? ""; + message.commissionRate = object.commissionRate ?? ""; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, + fromAmino(object: MsgEditValidatorAmino): MsgEditValidator { + const message = createBaseMsgEditValidator(); + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.commission_rate !== undefined && object.commission_rate !== null) { + message.commissionRate = object.commission_rate; + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + return message; + }, + toAmino(message: MsgEditValidator): MsgEditValidatorAmino { + const obj: any = {}; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + return obj; + }, + fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { + return MsgEditValidator.fromAmino(object.value); + }, + toAminoMsg(message: MsgEditValidator): MsgEditValidatorAminoMsg { + return { + type: "cosmos-sdk/MsgEditValidator", + value: MsgEditValidator.toAmino(message) + }; + }, + fromProtoMsg(message: MsgEditValidatorProtoMsg): MsgEditValidator { + return MsgEditValidator.decode(message.value); + }, + toProto(message: MsgEditValidator): Uint8Array { + return MsgEditValidator.encode(message).finish(); + }, + toProtoMsg(message: MsgEditValidator): MsgEditValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + value: MsgEditValidator.encode(message).finish() + }; + } +}; +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} +export const MsgEditValidatorResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", + aminoType: "cosmos-sdk/MsgEditValidatorResponse", + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, + fromAmino(_: MsgEditValidatorResponseAmino): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, + toAmino(_: MsgEditValidatorResponse): MsgEditValidatorResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgEditValidatorResponseAminoMsg): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgEditValidatorResponse): MsgEditValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/MsgEditValidatorResponse", + value: MsgEditValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgEditValidatorResponseProtoMsg): MsgEditValidatorResponse { + return MsgEditValidatorResponse.decode(message.value); + }, + toProto(message: MsgEditValidatorResponse): Uint8Array { + return MsgEditValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgEditValidatorResponse): MsgEditValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", + value: MsgEditValidatorResponse.encode(message).finish() + }; + } +}; +function createBaseMsgDelegate(): MsgDelegate { + return { + delegatorAddress: "", + validatorAddress: "", + amount: Coin.fromPartial({}) + }; +} +export const MsgDelegate = { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + aminoType: "cosmos-sdk/MsgDelegate", + encode(message: MsgDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: MsgDelegateAmino): MsgDelegate { + const message = createBaseMsgDelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgDelegate): MsgDelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgDelegateAminoMsg): MsgDelegate { + return MsgDelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgDelegate): MsgDelegateAminoMsg { + return { + type: "cosmos-sdk/MsgDelegate", + value: MsgDelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDelegateProtoMsg): MsgDelegate { + return MsgDelegate.decode(message.value); + }, + toProto(message: MsgDelegate): Uint8Array { + return MsgDelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgDelegate): MsgDelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + value: MsgDelegate.encode(message).finish() + }; + } +}; +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} +export const MsgDelegateResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", + aminoType: "cosmos-sdk/MsgDelegateResponse", + encode(_: MsgDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, + fromAmino(_: MsgDelegateResponseAmino): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, + toAmino(_: MsgDelegateResponse): MsgDelegateResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDelegateResponseAminoMsg): MsgDelegateResponse { + return MsgDelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDelegateResponse): MsgDelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDelegateResponse", + value: MsgDelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDelegateResponseProtoMsg): MsgDelegateResponse { + return MsgDelegateResponse.decode(message.value); + }, + toProto(message: MsgDelegateResponse): Uint8Array { + return MsgDelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDelegateResponse): MsgDelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", + value: MsgDelegateResponse.encode(message).finish() + }; + } +}; +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "", + amount: Coin.fromPartial({}) + }; +} +export const MsgBeginRedelegate = { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + aminoType: "cosmos-sdk/MsgBeginRedelegate", + encode(message: MsgBeginRedelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + case 4: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: MsgBeginRedelegateAmino): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgBeginRedelegateAminoMsg): MsgBeginRedelegate { + return MsgBeginRedelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgBeginRedelegate): MsgBeginRedelegateAminoMsg { + return { + type: "cosmos-sdk/MsgBeginRedelegate", + value: MsgBeginRedelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgBeginRedelegateProtoMsg): MsgBeginRedelegate { + return MsgBeginRedelegate.decode(message.value); + }, + toProto(message: MsgBeginRedelegate): Uint8Array { + return MsgBeginRedelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgBeginRedelegate): MsgBeginRedelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + value: MsgBeginRedelegate.encode(message).finish() + }; + } +}; +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { + completionTime: new Date() + }; +} +export const MsgBeginRedelegateResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", + aminoType: "cosmos-sdk/MsgBeginRedelegateResponse", + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + return message; + }, + fromAmino(object: MsgBeginRedelegateResponseAmino): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + return message; + }, + toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino { + const obj: any = {}; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: MsgBeginRedelegateResponseAminoMsg): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgBeginRedelegateResponse", + value: MsgBeginRedelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgBeginRedelegateResponseProtoMsg): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.decode(message.value); + }, + toProto(message: MsgBeginRedelegateResponse): Uint8Array { + return MsgBeginRedelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", + value: MsgBeginRedelegateResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUndelegate(): MsgUndelegate { + return { + delegatorAddress: "", + validatorAddress: "", + amount: Coin.fromPartial({}) + }; +} +export const MsgUndelegate = { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + aminoType: "cosmos-sdk/MsgUndelegate", + encode(message: MsgUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: MsgUndelegateAmino): MsgUndelegate { + const message = createBaseMsgUndelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgUndelegate): MsgUndelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUndelegateAminoMsg): MsgUndelegate { + return MsgUndelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgUndelegate): MsgUndelegateAminoMsg { + return { + type: "cosmos-sdk/MsgUndelegate", + value: MsgUndelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUndelegateProtoMsg): MsgUndelegate { + return MsgUndelegate.decode(message.value); + }, + toProto(message: MsgUndelegate): Uint8Array { + return MsgUndelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgUndelegate): MsgUndelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + value: MsgUndelegate.encode(message).finish() + }; + } +}; +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { + completionTime: new Date() + }; +} +export const MsgUndelegateResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", + aminoType: "cosmos-sdk/MsgUndelegateResponse", + encode(message: MsgUndelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + return message; + }, + fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + return message; + }, + toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino { + const obj: any = {}; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: MsgUndelegateResponseAminoMsg): MsgUndelegateResponse { + return MsgUndelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUndelegateResponse): MsgUndelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUndelegateResponse", + value: MsgUndelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUndelegateResponseProtoMsg): MsgUndelegateResponse { + return MsgUndelegateResponse.decode(message.value); + }, + toProto(message: MsgUndelegateResponse): Uint8Array { + return MsgUndelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUndelegateResponse): MsgUndelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", + value: MsgUndelegateResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCancelUnbondingDelegation(): MsgCancelUnbondingDelegation { + return { + delegatorAddress: "", + validatorAddress: "", + amount: Coin.fromPartial({}), + creationHeight: BigInt(0) + }; +} +export const MsgCancelUnbondingDelegation = { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + aminoType: "cosmos-sdk/MsgCancelUnbondingDelegation", + encode(message: MsgCancelUnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + if (message.creationHeight !== BigInt(0)) { + writer.uint32(32).int64(message.creationHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.creationHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgCancelUnbondingDelegationAmino): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + if (object.creation_height !== undefined && object.creation_height !== null) { + message.creationHeight = BigInt(object.creation_height); + } + return message; + }, + toAmino(message: MsgCancelUnbondingDelegation): MsgCancelUnbondingDelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgCancelUnbondingDelegationAminoMsg): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUnbondingDelegation): MsgCancelUnbondingDelegationAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUnbondingDelegation", + value: MsgCancelUnbondingDelegation.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelUnbondingDelegationProtoMsg): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.decode(message.value); + }, + toProto(message: MsgCancelUnbondingDelegation): Uint8Array { + return MsgCancelUnbondingDelegation.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUnbondingDelegation): MsgCancelUnbondingDelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + value: MsgCancelUnbondingDelegation.encode(message).finish() + }; + } +}; +function createBaseMsgCancelUnbondingDelegationResponse(): MsgCancelUnbondingDelegationResponse { + return {}; +} +export const MsgCancelUnbondingDelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", + aminoType: "cosmos-sdk/MsgCancelUnbondingDelegationResponse", + encode(_: MsgCancelUnbondingDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, + fromAmino(_: MsgCancelUnbondingDelegationResponseAmino): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, + toAmino(_: MsgCancelUnbondingDelegationResponse): MsgCancelUnbondingDelegationResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCancelUnbondingDelegationResponseAminoMsg): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUnbondingDelegationResponse): MsgCancelUnbondingDelegationResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUnbondingDelegationResponse", + value: MsgCancelUnbondingDelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelUnbondingDelegationResponseProtoMsg): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.decode(message.value); + }, + toProto(message: MsgCancelUnbondingDelegationResponse): Uint8Array { + return MsgCancelUnbondingDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUnbondingDelegationResponse): MsgCancelUnbondingDelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", + value: MsgCancelUnbondingDelegationResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + aminoType: "cosmos-sdk/x/staking/MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/staking/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + default: + return data; + } +}; +export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { + return encodePubkey(content); +}; +export const Cosmos_cryptoPubKey_ToAmino = (content: Any): Pubkey | null => { + return decodePubkey(content); +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/tx/config/v1/config.ts b/util/inj-types/cosmos/tx/config/v1/config.ts new file mode 100644 index 00000000..0a18fb05 --- /dev/null +++ b/util/inj-types/cosmos/tx/config/v1/config.ts @@ -0,0 +1,123 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Config is the config object of the x/auth/tx package. */ +export interface Config { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipAnteHandler: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skipPostHandler: boolean; +} +export interface ConfigProtoMsg { + typeUrl: "/cosmos.tx.config.v1.Config"; + value: Uint8Array; +} +/** Config is the config object of the x/auth/tx package. */ +export interface ConfigAmino { + /** + * skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override + * this functionality. + */ + skip_ante_handler?: boolean; + /** + * skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override + * this functionality. + */ + skip_post_handler?: boolean; +} +export interface ConfigAminoMsg { + type: "cosmos-sdk/Config"; + value: ConfigAmino; +} +/** Config is the config object of the x/auth/tx package. */ +export interface ConfigSDKType { + skip_ante_handler: boolean; + skip_post_handler: boolean; +} +function createBaseConfig(): Config { + return { + skipAnteHandler: false, + skipPostHandler: false + }; +} +export const Config = { + typeUrl: "/cosmos.tx.config.v1.Config", + aminoType: "cosmos-sdk/Config", + encode(message: Config, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.skipAnteHandler === true) { + writer.uint32(8).bool(message.skipAnteHandler); + } + if (message.skipPostHandler === true) { + writer.uint32(16).bool(message.skipPostHandler); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skipAnteHandler = reader.bool(); + break; + case 2: + message.skipPostHandler = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Config { + const message = createBaseConfig(); + message.skipAnteHandler = object.skipAnteHandler ?? false; + message.skipPostHandler = object.skipPostHandler ?? false; + return message; + }, + fromAmino(object: ConfigAmino): Config { + const message = createBaseConfig(); + if (object.skip_ante_handler !== undefined && object.skip_ante_handler !== null) { + message.skipAnteHandler = object.skip_ante_handler; + } + if (object.skip_post_handler !== undefined && object.skip_post_handler !== null) { + message.skipPostHandler = object.skip_post_handler; + } + return message; + }, + toAmino(message: Config): ConfigAmino { + const obj: any = {}; + obj.skip_ante_handler = message.skipAnteHandler === false ? undefined : message.skipAnteHandler; + obj.skip_post_handler = message.skipPostHandler === false ? undefined : message.skipPostHandler; + return obj; + }, + fromAminoMsg(object: ConfigAminoMsg): Config { + return Config.fromAmino(object.value); + }, + toAminoMsg(message: Config): ConfigAminoMsg { + return { + type: "cosmos-sdk/Config", + value: Config.toAmino(message) + }; + }, + fromProtoMsg(message: ConfigProtoMsg): Config { + return Config.decode(message.value); + }, + toProto(message: Config): Uint8Array { + return Config.encode(message).finish(); + }, + toProtoMsg(message: Config): ConfigProtoMsg { + return { + typeUrl: "/cosmos.tx.config.v1.Config", + value: Config.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/tx/signing/v1beta1/signing.ts b/util/inj-types/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..8a97587a --- /dev/null +++ b/util/inj-types/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,687 @@ +import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * SignMode represents a signing mode with its own security guarantees. + * + * This enum should be considered a registry of all known sign modes + * in the Cosmos ecosystem. Apps are not expected to support all known + * sign modes. Apps that would like to support custom sign modes are + * encouraged to open a small PR against this file to add a new case + * to this SignMode enum describing their sign mode so that different + * apps have a consistent version of this enum. + */ +export enum SignMode { + /** + * SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be + * rejected. + */ + SIGN_MODE_UNSPECIFIED = 0, + /** + * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + * verified with raw bytes from Tx. + */ + SIGN_MODE_DIRECT = 1, + /** + * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some + * human-readable textual representation on top of the binary representation + * from SIGN_MODE_DIRECT. It is currently not supported. + */ + SIGN_MODE_TEXTUAL = 2, + /** + * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses + * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not + * require signers signing over other signers' `signer_info`. It also allows + * for adding Tips in transactions. + * + * Since: cosmos-sdk 0.46 + */ + SIGN_MODE_DIRECT_AUX = 3, + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future. + */ + SIGN_MODE_LEGACY_AMINO_JSON = 127, + /** + * SIGN_MODE_EIP712_V2 - Injective EIP712 support for any cosmos messages which uses proto-json encoded string for messages + * Signature verification is implemented in injective core + */ + SIGN_MODE_EIP712_V2 = 128, + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SIGN_MODE_EIP_191 = 191, + UNRECOGNIZED = -1, +} +export const SignModeSDKType = SignMode; +export const SignModeAmino = SignMode; +export function signModeFromJSON(object: any): SignMode { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + case 3: + case "SIGN_MODE_DIRECT_AUX": + return SignMode.SIGN_MODE_DIRECT_AUX; + case 127: + case "SIGN_MODE_LEGACY_AMINO_JSON": + return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 128: + case "SIGN_MODE_EIP712_V2": + return SignMode.SIGN_MODE_EIP712_V2; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; + case -1: + case "UNRECOGNIZED": + default: + return SignMode.UNRECOGNIZED; + } +} +export function signModeToJSON(object: SignMode): string { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + case SignMode.SIGN_MODE_DIRECT_AUX: + return "SIGN_MODE_DIRECT_AUX"; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP712_V2: + return "SIGN_MODE_EIP712_V2"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; + case SignMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} +export interface SignatureDescriptorsProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors"; + value: Uint8Array; +} +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptorsAmino { + /** signatures are the signature descriptors */ + signatures?: SignatureDescriptorAmino[]; +} +export interface SignatureDescriptorsAminoMsg { + type: "cosmos-sdk/SignatureDescriptors"; + value: SignatureDescriptorsAmino; +} +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptorsSDKType { + signatures: SignatureDescriptorSDKType[]; +} +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey?: Any; + data?: SignatureDescriptor_Data; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to prevent + * replay attacks. + */ + sequence: bigint; +} +export interface SignatureDescriptorProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor"; + value: Uint8Array; +} +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptorAmino { + /** public_key is the public key of the signer */ + public_key?: AnyAmino; + data?: SignatureDescriptor_DataAmino; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to prevent + * replay attacks. + */ + sequence?: string; +} +export interface SignatureDescriptorAminoMsg { + type: "cosmos-sdk/SignatureDescriptor"; + value: SignatureDescriptorAmino; +} +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptorSDKType { + public_key?: AnySDKType; + data?: SignatureDescriptor_DataSDKType; + sequence: bigint; +} +/** Data represents signature data */ +export interface SignatureDescriptor_Data { + /** single represents a single signer */ + single?: SignatureDescriptor_Data_Single; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_Multi; +} +export interface SignatureDescriptor_DataProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Data"; + value: Uint8Array; +} +/** Data represents signature data */ +export interface SignatureDescriptor_DataAmino { + /** single represents a single signer */ + single?: SignatureDescriptor_Data_SingleAmino; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_MultiAmino; +} +export interface SignatureDescriptor_DataAminoMsg { + type: "cosmos-sdk/Data"; + value: SignatureDescriptor_DataAmino; +} +/** Data represents signature data */ +export interface SignatureDescriptor_DataSDKType { + single?: SignatureDescriptor_Data_SingleSDKType; + multi?: SignatureDescriptor_Data_MultiSDKType; +} +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_Single { + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** signature is the raw signature bytes */ + signature: Uint8Array; +} +export interface SignatureDescriptor_Data_SingleProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Single"; + value: Uint8Array; +} +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_SingleAmino { + /** mode is the signing mode of the single signer */ + mode?: SignMode; + /** signature is the raw signature bytes */ + signature?: string; +} +export interface SignatureDescriptor_Data_SingleAminoMsg { + type: "cosmos-sdk/Single"; + value: SignatureDescriptor_Data_SingleAmino; +} +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_SingleSDKType { + mode: SignMode; + signature: Uint8Array; +} +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_Multi { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArray; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} +export interface SignatureDescriptor_Data_MultiProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi"; + value: Uint8Array; +} +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_MultiAmino { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArrayAmino; + /** signatures is the signatures of the multi-signature */ + signatures?: SignatureDescriptor_DataAmino[]; +} +export interface SignatureDescriptor_Data_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: SignatureDescriptor_Data_MultiAmino; +} +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_MultiSDKType { + bitarray?: CompactBitArraySDKType; + signatures: SignatureDescriptor_DataSDKType[]; +} +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { + signatures: [] + }; +} +export const SignatureDescriptors = { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", + aminoType: "cosmos-sdk/SignatureDescriptors", + encode(message: SignatureDescriptors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map(e => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SignatureDescriptorsAmino): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map(e => SignatureDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: SignatureDescriptors): SignatureDescriptorsAmino { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: SignatureDescriptorsAminoMsg): SignatureDescriptors { + return SignatureDescriptors.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptors): SignatureDescriptorsAminoMsg { + return { + type: "cosmos-sdk/SignatureDescriptors", + value: SignatureDescriptors.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptorsProtoMsg): SignatureDescriptors { + return SignatureDescriptors.decode(message.value); + }, + toProto(message: SignatureDescriptors): Uint8Array { + return SignatureDescriptors.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptors): SignatureDescriptorsProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", + value: SignatureDescriptors.encode(message).finish() + }; + } +}; +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { + publicKey: undefined, + data: undefined, + sequence: BigInt(0) + }; +} +export const SignatureDescriptor = { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", + aminoType: "cosmos-sdk/SignatureDescriptor", + encode(message: SignatureDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + message.data = object.data !== undefined && object.data !== null ? SignatureDescriptor_Data.fromPartial(object.data) : undefined; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignatureDescriptorAmino): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.data !== undefined && object.data !== null) { + message.data = SignatureDescriptor_Data.fromAmino(object.data); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: SignatureDescriptor): SignatureDescriptorAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { + return SignatureDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor): SignatureDescriptorAminoMsg { + return { + type: "cosmos-sdk/SignatureDescriptor", + value: SignatureDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptorProtoMsg): SignatureDescriptor { + return SignatureDescriptor.decode(message.value); + }, + toProto(message: SignatureDescriptor): Uint8Array { + return SignatureDescriptor.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor): SignatureDescriptorProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", + value: SignatureDescriptor.encode(message).finish() + }; + } +}; +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { + single: undefined, + multi: undefined + }; +} +export const SignatureDescriptor_Data = { + typeUrl: "/cosmos.tx.signing.v1beta1.Data", + aminoType: "cosmos-sdk/Data", + encode(message: SignatureDescriptor_Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.single !== undefined) { + SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); + } + if (message.multi !== undefined) { + SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); + break; + case 2: + message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data { + const message = createBaseSignatureDescriptor_Data(); + message.single = object.single !== undefined && object.single !== null ? SignatureDescriptor_Data_Single.fromPartial(object.single) : undefined; + message.multi = object.multi !== undefined && object.multi !== null ? SignatureDescriptor_Data_Multi.fromPartial(object.multi) : undefined; + return message; + }, + fromAmino(object: SignatureDescriptor_DataAmino): SignatureDescriptor_Data { + const message = createBaseSignatureDescriptor_Data(); + if (object.single !== undefined && object.single !== null) { + message.single = SignatureDescriptor_Data_Single.fromAmino(object.single); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = SignatureDescriptor_Data_Multi.fromAmino(object.multi); + } + return message; + }, + toAmino(message: SignatureDescriptor_Data): SignatureDescriptor_DataAmino { + const obj: any = {}; + obj.single = message.single ? SignatureDescriptor_Data_Single.toAmino(message.single) : undefined; + obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toAmino(message.multi) : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_DataAminoMsg): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data): SignatureDescriptor_DataAminoMsg { + return { + type: "cosmos-sdk/Data", + value: SignatureDescriptor_Data.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_DataProtoMsg): SignatureDescriptor_Data { + return SignatureDescriptor_Data.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data): Uint8Array { + return SignatureDescriptor_Data.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data): SignatureDescriptor_DataProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Data", + value: SignatureDescriptor_Data.encode(message).finish() + }; + } +}; +function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_Single { + return { + mode: 0, + signature: new Uint8Array() + }; +} +export const SignatureDescriptor_Data_Single = { + typeUrl: "/cosmos.tx.signing.v1beta1.Single", + aminoType: "cosmos-sdk/Single", + encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = (reader.int32() as any); + break; + case 2: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, + fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { + const obj: any = {}; + obj.mode = message.mode === 0 ? undefined : message.mode; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_Data_SingleAminoMsg): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAminoMsg { + return { + type: "cosmos-sdk/Single", + value: SignatureDescriptor_Data_Single.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_Data_SingleProtoMsg): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data_Single): Uint8Array { + return SignatureDescriptor_Data_Single.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Single", + value: SignatureDescriptor_Data_Single.encode(message).finish() + }; + } +}; +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { + bitarray: undefined, + signatures: [] + }; +} +export const SignatureDescriptor_Data_Multi = { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi", + aminoType: "cosmos-sdk/Multi", + encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.signatures) { + SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + break; + case 2: + message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Multi { + const message = createBaseSignatureDescriptor_Data_Multi(); + message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; + message.signatures = object.signatures?.map(e => SignatureDescriptor_Data.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SignatureDescriptor_Data_MultiAmino): SignatureDescriptor_Data_Multi { + const message = createBaseSignatureDescriptor_Data_Multi(); + if (object.bitarray !== undefined && object.bitarray !== null) { + message.bitarray = CompactBitArray.fromAmino(object.bitarray); + } + message.signatures = object.signatures?.map(e => SignatureDescriptor_Data.fromAmino(e)) || []; + return message; + }, + toAmino(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiAmino { + const obj: any = {}; + obj.bitarray = message.bitarray ? CompactBitArray.toAmino(message.bitarray) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e) : undefined); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_Data_MultiAminoMsg): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: SignatureDescriptor_Data_Multi.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_Data_MultiProtoMsg): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data_Multi): Uint8Array { + return SignatureDescriptor_Data_Multi.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi", + value: SignatureDescriptor_Data_Multi.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/tx/v1beta1/service.lcd.ts b/util/inj-types/cosmos/tx/v1beta1/service.lcd.ts new file mode 100644 index 00000000..51c85865 --- /dev/null +++ b/util/inj-types/cosmos/tx/v1beta1/service.lcd.ts @@ -0,0 +1,54 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { GetTxRequest, GetTxResponseSDKType, GetTxsEventRequest, GetTxsEventResponseSDKType, GetBlockWithTxsRequest, GetBlockWithTxsResponseSDKType } from "./service"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* GetTx fetches a tx by hash. */ + getTx = async (params: GetTxRequest): Promise => { + const endpoint = `cosmos/tx/v1beta1/txs/${params.hash}`; + return await this.req.get(endpoint); + }; + /* GetTxsEvent fetches txs by event. */ + getTxsEvent = async (params: GetTxsEventRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.events !== "undefined") { + options.params.events = params.events; + } + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + if (typeof params?.orderBy !== "undefined") { + options.params.order_by = params.orderBy; + } + if (typeof params?.page !== "undefined") { + options.params.page = params.page; + } + if (typeof params?.limit !== "undefined") { + options.params.limit = params.limit; + } + const endpoint = `cosmos/tx/v1beta1/txs`; + return await this.req.get(endpoint, options); + }; + /* GetBlockWithTxs fetches a block with decoded txs. + + Since: cosmos-sdk 0.45.2 */ + getBlockWithTxs = async (params: GetBlockWithTxsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmos/tx/v1beta1/txs/block/${params.height}`; + return await this.req.get(endpoint, options); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/tx/v1beta1/service.rpc.Service.ts b/util/inj-types/cosmos/tx/v1beta1/service.rpc.Service.ts new file mode 100644 index 00000000..4bfcccce --- /dev/null +++ b/util/inj-types/cosmos/tx/v1beta1/service.rpc.Service.ts @@ -0,0 +1,148 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { SimulateRequest, SimulateResponse, GetTxRequest, GetTxResponse, BroadcastTxRequest, BroadcastTxResponse, GetTxsEventRequest, GetTxsEventResponse, GetBlockWithTxsRequest, GetBlockWithTxsResponse, TxDecodeRequest, TxDecodeResponse, TxEncodeRequest, TxEncodeResponse, TxEncodeAminoRequest, TxEncodeAminoResponse, TxDecodeAminoRequest, TxDecodeAminoResponse } from "./service"; +/** Service defines a gRPC service for interacting with transactions. */ +export interface Service { + /** Simulate simulates executing a transaction for estimating gas usage. */ + simulate(request: SimulateRequest): Promise; + /** GetTx fetches a tx by hash. */ + getTx(request: GetTxRequest): Promise; + /** BroadcastTx broadcast transaction. */ + broadcastTx(request: BroadcastTxRequest): Promise; + /** GetTxsEvent fetches txs by event. */ + getTxsEvent(request: GetTxsEventRequest): Promise; + /** + * GetBlockWithTxs fetches a block with decoded txs. + * + * Since: cosmos-sdk 0.45.2 + */ + getBlockWithTxs(request: GetBlockWithTxsRequest): Promise; + /** + * TxDecode decodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + txDecode(request: TxDecodeRequest): Promise; + /** + * TxEncode encodes the transaction. + * + * Since: cosmos-sdk 0.47 + */ + txEncode(request: TxEncodeRequest): Promise; + /** + * TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. + * + * Since: cosmos-sdk 0.47 + */ + txEncodeAmino(request: TxEncodeAminoRequest): Promise; + /** + * TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. + * + * Since: cosmos-sdk 0.47 + */ + txDecodeAmino(request: TxDecodeAminoRequest): Promise; +} +export class ServiceClientImpl implements Service { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Simulate simulates executing a transaction for estimating gas usage. */ + simulate = async (request: SimulateRequest): Promise => { + const data = SimulateRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "Simulate", data); + return promise.then(data => SimulateResponse.decode(new BinaryReader(data))); + }; + /* GetTx fetches a tx by hash. */ + getTx = async (request: GetTxRequest): Promise => { + const data = GetTxRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "GetTx", data); + return promise.then(data => GetTxResponse.decode(new BinaryReader(data))); + }; + /* BroadcastTx broadcast transaction. */ + broadcastTx = async (request: BroadcastTxRequest): Promise => { + const data = BroadcastTxRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "BroadcastTx", data); + return promise.then(data => BroadcastTxResponse.decode(new BinaryReader(data))); + }; + /* GetTxsEvent fetches txs by event. */ + getTxsEvent = async (request: GetTxsEventRequest): Promise => { + const data = GetTxsEventRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "GetTxsEvent", data); + return promise.then(data => GetTxsEventResponse.decode(new BinaryReader(data))); + }; + /* GetBlockWithTxs fetches a block with decoded txs. + + Since: cosmos-sdk 0.45.2 */ + getBlockWithTxs = async (request: GetBlockWithTxsRequest): Promise => { + const data = GetBlockWithTxsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "GetBlockWithTxs", data); + return promise.then(data => GetBlockWithTxsResponse.decode(new BinaryReader(data))); + }; + /* TxDecode decodes the transaction. + + Since: cosmos-sdk 0.47 */ + txDecode = async (request: TxDecodeRequest): Promise => { + const data = TxDecodeRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "TxDecode", data); + return promise.then(data => TxDecodeResponse.decode(new BinaryReader(data))); + }; + /* TxEncode encodes the transaction. + + Since: cosmos-sdk 0.47 */ + txEncode = async (request: TxEncodeRequest): Promise => { + const data = TxEncodeRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "TxEncode", data); + return promise.then(data => TxEncodeResponse.decode(new BinaryReader(data))); + }; + /* TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. + + Since: cosmos-sdk 0.47 */ + txEncodeAmino = async (request: TxEncodeAminoRequest): Promise => { + const data = TxEncodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "TxEncodeAmino", data); + return promise.then(data => TxEncodeAminoResponse.decode(new BinaryReader(data))); + }; + /* TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. + + Since: cosmos-sdk 0.47 */ + txDecodeAmino = async (request: TxDecodeAminoRequest): Promise => { + const data = TxDecodeAminoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.tx.v1beta1.Service", "TxDecodeAmino", data); + return promise.then(data => TxDecodeAminoResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new ServiceClientImpl(rpc); + return { + simulate(request: SimulateRequest): Promise { + return queryService.simulate(request); + }, + getTx(request: GetTxRequest): Promise { + return queryService.getTx(request); + }, + broadcastTx(request: BroadcastTxRequest): Promise { + return queryService.broadcastTx(request); + }, + getTxsEvent(request: GetTxsEventRequest): Promise { + return queryService.getTxsEvent(request); + }, + getBlockWithTxs(request: GetBlockWithTxsRequest): Promise { + return queryService.getBlockWithTxs(request); + }, + txDecode(request: TxDecodeRequest): Promise { + return queryService.txDecode(request); + }, + txEncode(request: TxEncodeRequest): Promise { + return queryService.txEncode(request); + }, + txEncodeAmino(request: TxEncodeAminoRequest): Promise { + return queryService.txEncodeAmino(request); + }, + txDecodeAmino(request: TxDecodeAminoRequest): Promise { + return queryService.txDecodeAmino(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/tx/v1beta1/service.ts b/util/inj-types/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..d085dee9 --- /dev/null +++ b/util/inj-types/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,2261 @@ +import { Tx, TxAmino, TxSDKType } from "./tx"; +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; +import { TxResponse, TxResponseAmino, TxResponseSDKType, GasInfo, GasInfoAmino, GasInfoSDKType, Result, ResultAmino, ResultSDKType } from "../../base/abci/v1beta1/abci"; +import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../tendermint/types/types"; +import { Block, BlockAmino, BlockSDKType } from "../../../tendermint/types/block"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** OrderBy defines the sorting order */ +export enum OrderBy { + /** ORDER_BY_UNSPECIFIED - ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. */ + ORDER_BY_UNSPECIFIED = 0, + /** ORDER_BY_ASC - ORDER_BY_ASC defines ascending order */ + ORDER_BY_ASC = 1, + /** ORDER_BY_DESC - ORDER_BY_DESC defines descending order */ + ORDER_BY_DESC = 2, + UNRECOGNIZED = -1, +} +export const OrderBySDKType = OrderBy; +export const OrderByAmino = OrderBy; +export function orderByFromJSON(object: any): OrderBy { + switch (object) { + case 0: + case "ORDER_BY_UNSPECIFIED": + return OrderBy.ORDER_BY_UNSPECIFIED; + case 1: + case "ORDER_BY_ASC": + return OrderBy.ORDER_BY_ASC; + case 2: + case "ORDER_BY_DESC": + return OrderBy.ORDER_BY_DESC; + case -1: + case "UNRECOGNIZED": + default: + return OrderBy.UNRECOGNIZED; + } +} +export function orderByToJSON(object: OrderBy): string { + switch (object) { + case OrderBy.ORDER_BY_UNSPECIFIED: + return "ORDER_BY_UNSPECIFIED"; + case OrderBy.ORDER_BY_ASC: + return "ORDER_BY_ASC"; + case OrderBy.ORDER_BY_DESC: + return "ORDER_BY_DESC"; + case OrderBy.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. */ +export enum BroadcastMode { + /** BROADCAST_MODE_UNSPECIFIED - zero-value for mode ordering */ + BROADCAST_MODE_UNSPECIFIED = 0, + /** + * BROADCAST_MODE_BLOCK - DEPRECATED: use BROADCAST_MODE_SYNC instead, + * BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + */ + BROADCAST_MODE_BLOCK = 1, + /** + * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for + * a CheckTx execution response only. + */ + BROADCAST_MODE_SYNC = 2, + /** + * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns + * immediately. + */ + BROADCAST_MODE_ASYNC = 3, + UNRECOGNIZED = -1, +} +export const BroadcastModeSDKType = BroadcastMode; +export const BroadcastModeAmino = BroadcastMode; +export function broadcastModeFromJSON(object: any): BroadcastMode { + switch (object) { + case 0: + case "BROADCAST_MODE_UNSPECIFIED": + return BroadcastMode.BROADCAST_MODE_UNSPECIFIED; + case 1: + case "BROADCAST_MODE_BLOCK": + return BroadcastMode.BROADCAST_MODE_BLOCK; + case 2: + case "BROADCAST_MODE_SYNC": + return BroadcastMode.BROADCAST_MODE_SYNC; + case 3: + case "BROADCAST_MODE_ASYNC": + return BroadcastMode.BROADCAST_MODE_ASYNC; + case -1: + case "UNRECOGNIZED": + default: + return BroadcastMode.UNRECOGNIZED; + } +} +export function broadcastModeToJSON(object: BroadcastMode): string { + switch (object) { + case BroadcastMode.BROADCAST_MODE_UNSPECIFIED: + return "BROADCAST_MODE_UNSPECIFIED"; + case BroadcastMode.BROADCAST_MODE_BLOCK: + return "BROADCAST_MODE_BLOCK"; + case BroadcastMode.BROADCAST_MODE_SYNC: + return "BROADCAST_MODE_SYNC"; + case BroadcastMode.BROADCAST_MODE_ASYNC: + return "BROADCAST_MODE_ASYNC"; + case BroadcastMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * GetTxsEventRequest is the request type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventRequest { + /** events is the list of transaction event type. */ + events?: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + */ + /** @deprecated */ + pagination?: PageRequest; + orderBy?: OrderBy; + /** page is the page number to query, starts at 1. If not provided, will default to first page. */ + page?: bigint; + /** + * 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?: bigint; +} +export interface GetTxsEventRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest"; + value: Uint8Array; +} +/** + * GetTxsEventRequest is the request type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventRequestAmino { + /** events is the list of transaction event type. */ + events?: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + */ + /** @deprecated */ + pagination?: PageRequestAmino; + order_by?: OrderBy; + /** page is the page number to query, starts at 1. If not provided, will default to first page. */ + page?: string; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit?: string; +} +export interface GetTxsEventRequestAminoMsg { + type: "cosmos-sdk/GetTxsEventRequest"; + value: GetTxsEventRequestAmino; +} +/** + * GetTxsEventRequest is the request type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventRequestSDKType { + events?: string[]; + /** @deprecated */ + pagination?: PageRequestSDKType; + order_by?: OrderBy; + page?: bigint; + limit?: bigint; +} +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponse { + /** txs is the list of queried transactions. */ + txs: Tx[]; + /** tx_responses is the list of queried TxResponses. */ + txResponses: TxResponse[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + */ + /** @deprecated */ + pagination?: PageResponse; + /** total is total number of results available */ + total: bigint; +} +export interface GetTxsEventResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse"; + value: Uint8Array; +} +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponseAmino { + /** txs is the list of queried transactions. */ + txs?: TxAmino[]; + /** tx_responses is the list of queried TxResponses. */ + tx_responses?: TxResponseAmino[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + */ + /** @deprecated */ + pagination?: PageResponseAmino; + /** total is total number of results available */ + total?: string; +} +export interface GetTxsEventResponseAminoMsg { + type: "cosmos-sdk/GetTxsEventResponse"; + value: GetTxsEventResponseAmino; +} +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponseSDKType { + txs: TxSDKType[]; + tx_responses: TxResponseSDKType[]; + /** @deprecated */ + pagination?: PageResponseSDKType; + total: bigint; +} +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; + mode: BroadcastMode; +} +export interface BroadcastTxRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest"; + value: Uint8Array; +} +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequestAmino { + /** tx_bytes is the raw transaction. */ + tx_bytes?: string; + mode?: BroadcastMode; +} +export interface BroadcastTxRequestAminoMsg { + type: "cosmos-sdk/BroadcastTxRequest"; + value: BroadcastTxRequestAmino; +} +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequestSDKType { + tx_bytes: Uint8Array; + mode: BroadcastMode; +} +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + txResponse?: TxResponse; +} +export interface BroadcastTxResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse"; + value: Uint8Array; +} +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponseAmino { + /** tx_response is the queried TxResponses. */ + tx_response?: TxResponseAmino; +} +export interface BroadcastTxResponseAminoMsg { + type: "cosmos-sdk/BroadcastTxResponse"; + value: BroadcastTxResponseAmino; +} +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponseSDKType { + tx_response?: TxResponseSDKType; +} +/** + * SimulateRequest is the request type for the Service.Simulate + * RPC method. + */ +export interface SimulateRequest { + /** + * tx is the transaction to simulate. + * Deprecated. Send raw tx bytes instead. + */ + /** @deprecated */ + tx?: Tx; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + txBytes: Uint8Array; +} +export interface SimulateRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest"; + value: Uint8Array; +} +/** + * SimulateRequest is the request type for the Service.Simulate + * RPC method. + */ +export interface SimulateRequestAmino { + /** + * tx is the transaction to simulate. + * Deprecated. Send raw tx bytes instead. + */ + /** @deprecated */ + tx?: TxAmino; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + tx_bytes?: string; +} +export interface SimulateRequestAminoMsg { + type: "cosmos-sdk/SimulateRequest"; + value: SimulateRequestAmino; +} +/** + * SimulateRequest is the request type for the Service.Simulate + * RPC method. + */ +export interface SimulateRequestSDKType { + /** @deprecated */ + tx?: TxSDKType; + tx_bytes: Uint8Array; +} +/** + * SimulateResponse is the response type for the + * Service.SimulateRPC method. + */ +export interface SimulateResponse { + /** gas_info is the information about gas used in the simulation. */ + gasInfo?: GasInfo; + /** result is the result of the simulation. */ + result?: Result; +} +export interface SimulateResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse"; + value: Uint8Array; +} +/** + * SimulateResponse is the response type for the + * Service.SimulateRPC method. + */ +export interface SimulateResponseAmino { + /** gas_info is the information about gas used in the simulation. */ + gas_info?: GasInfoAmino; + /** result is the result of the simulation. */ + result?: ResultAmino; +} +export interface SimulateResponseAminoMsg { + type: "cosmos-sdk/SimulateResponse"; + value: SimulateResponseAmino; +} +/** + * SimulateResponse is the response type for the + * Service.SimulateRPC method. + */ +export interface SimulateResponseSDKType { + gas_info?: GasInfoSDKType; + result?: ResultSDKType; +} +/** + * GetTxRequest is the request type for the Service.GetTx + * RPC method. + */ +export interface GetTxRequest { + /** hash is the tx hash to query, encoded as a hex string. */ + hash: string; +} +export interface GetTxRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest"; + value: Uint8Array; +} +/** + * GetTxRequest is the request type for the Service.GetTx + * RPC method. + */ +export interface GetTxRequestAmino { + /** hash is the tx hash to query, encoded as a hex string. */ + hash?: string; +} +export interface GetTxRequestAminoMsg { + type: "cosmos-sdk/GetTxRequest"; + value: GetTxRequestAmino; +} +/** + * GetTxRequest is the request type for the Service.GetTx + * RPC method. + */ +export interface GetTxRequestSDKType { + hash: string; +} +/** GetTxResponse is the response type for the Service.GetTx method. */ +export interface GetTxResponse { + /** tx is the queried transaction. */ + tx?: Tx; + /** tx_response is the queried TxResponses. */ + txResponse?: TxResponse; +} +export interface GetTxResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse"; + value: Uint8Array; +} +/** GetTxResponse is the response type for the Service.GetTx method. */ +export interface GetTxResponseAmino { + /** tx is the queried transaction. */ + tx?: TxAmino; + /** tx_response is the queried TxResponses. */ + tx_response?: TxResponseAmino; +} +export interface GetTxResponseAminoMsg { + type: "cosmos-sdk/GetTxResponse"; + value: GetTxResponseAmino; +} +/** GetTxResponse is the response type for the Service.GetTx method. */ +export interface GetTxResponseSDKType { + tx?: TxSDKType; + tx_response?: TxResponseSDKType; +} +/** + * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs + * RPC method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsRequest { + /** height is the height of the block to query. */ + height: bigint; + /** pagination defines a pagination for the request. */ + pagination?: PageRequest; +} +export interface GetBlockWithTxsRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest"; + value: Uint8Array; +} +/** + * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs + * RPC method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsRequestAmino { + /** height is the height of the block to query. */ + height?: string; + /** pagination defines a pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface GetBlockWithTxsRequestAminoMsg { + type: "cosmos-sdk/GetBlockWithTxsRequest"; + value: GetBlockWithTxsRequestAmino; +} +/** + * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs + * RPC method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsRequestSDKType { + height: bigint; + pagination?: PageRequestSDKType; +} +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponse { + /** txs are the transactions in the block. */ + txs: Tx[]; + blockId?: BlockID; + block?: Block; + /** pagination defines a pagination for the response. */ + pagination?: PageResponse; +} +export interface GetBlockWithTxsResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse"; + value: Uint8Array; +} +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponseAmino { + /** txs are the transactions in the block. */ + txs?: TxAmino[]; + block_id?: BlockIDAmino; + block?: BlockAmino; + /** pagination defines a pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface GetBlockWithTxsResponseAminoMsg { + type: "cosmos-sdk/GetBlockWithTxsResponse"; + value: GetBlockWithTxsResponseAmino; +} +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponseSDKType { + txs: TxSDKType[]; + block_id?: BlockIDSDKType; + block?: BlockSDKType; + pagination?: PageResponseSDKType; +} +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; +} +export interface TxDecodeRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest"; + value: Uint8Array; +} +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequestAmino { + /** tx_bytes is the raw transaction. */ + tx_bytes?: string; +} +export interface TxDecodeRequestAminoMsg { + type: "cosmos-sdk/TxDecodeRequest"; + value: TxDecodeRequestAmino; +} +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequestSDKType { + tx_bytes: Uint8Array; +} +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponse { + /** tx is the decoded transaction. */ + tx?: Tx; +} +export interface TxDecodeResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse"; + value: Uint8Array; +} +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponseAmino { + /** tx is the decoded transaction. */ + tx?: TxAmino; +} +export interface TxDecodeResponseAminoMsg { + type: "cosmos-sdk/TxDecodeResponse"; + value: TxDecodeResponseAmino; +} +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponseSDKType { + tx?: TxSDKType; +} +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequest { + /** tx is the transaction to encode. */ + tx?: Tx; +} +export interface TxEncodeRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest"; + value: Uint8Array; +} +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequestAmino { + /** tx is the transaction to encode. */ + tx?: TxAmino; +} +export interface TxEncodeRequestAminoMsg { + type: "cosmos-sdk/TxEncodeRequest"; + value: TxEncodeRequestAmino; +} +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequestSDKType { + tx?: TxSDKType; +} +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponse { + /** tx_bytes is the encoded transaction bytes. */ + txBytes: Uint8Array; +} +export interface TxEncodeResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse"; + value: Uint8Array; +} +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponseAmino { + /** tx_bytes is the encoded transaction bytes. */ + tx_bytes?: string; +} +export interface TxEncodeResponseAminoMsg { + type: "cosmos-sdk/TxEncodeResponse"; + value: TxEncodeResponseAmino; +} +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponseSDKType { + tx_bytes: Uint8Array; +} +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequest { + aminoJson: string; +} +export interface TxEncodeAminoRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest"; + value: Uint8Array; +} +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequestAmino { + amino_json?: string; +} +export interface TxEncodeAminoRequestAminoMsg { + type: "cosmos-sdk/TxEncodeAminoRequest"; + value: TxEncodeAminoRequestAmino; +} +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequestSDKType { + amino_json: string; +} +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponse { + aminoBinary: Uint8Array; +} +export interface TxEncodeAminoResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse"; + value: Uint8Array; +} +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponseAmino { + amino_binary?: string; +} +export interface TxEncodeAminoResponseAminoMsg { + type: "cosmos-sdk/TxEncodeAminoResponse"; + value: TxEncodeAminoResponseAmino; +} +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponseSDKType { + amino_binary: Uint8Array; +} +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequest { + aminoBinary: Uint8Array; +} +export interface TxDecodeAminoRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest"; + value: Uint8Array; +} +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequestAmino { + amino_binary?: string; +} +export interface TxDecodeAminoRequestAminoMsg { + type: "cosmos-sdk/TxDecodeAminoRequest"; + value: TxDecodeAminoRequestAmino; +} +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequestSDKType { + amino_binary: Uint8Array; +} +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponse { + aminoJson: string; +} +export interface TxDecodeAminoResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse"; + value: Uint8Array; +} +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponseAmino { + amino_json?: string; +} +export interface TxDecodeAminoResponseAminoMsg { + type: "cosmos-sdk/TxDecodeAminoResponse"; + value: TxDecodeAminoResponseAmino; +} +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponseSDKType { + amino_json: string; +} +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { + events: [], + pagination: undefined, + orderBy: 0, + page: BigInt(0), + limit: BigInt(0) + }; +} +export const GetTxsEventRequest = { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", + aminoType: "cosmos-sdk/GetTxsEventRequest", + encode(message: GetTxsEventRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.events) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.orderBy !== 0) { + writer.uint32(24).int32(message.orderBy); + } + if (message.page !== BigInt(0)) { + writer.uint32(32).uint64(message.page); + } + if (message.limit !== BigInt(0)) { + writer.uint32(40).uint64(message.limit); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.events.push(reader.string()); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 3: + message.orderBy = (reader.int32() as any); + break; + case 4: + message.page = reader.uint64(); + break; + case 5: + message.limit = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxsEventRequest { + const message = createBaseGetTxsEventRequest(); + message.events = object.events?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + message.orderBy = object.orderBy ?? 0; + message.page = object.page !== undefined && object.page !== null ? BigInt(object.page.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GetTxsEventRequestAmino): GetTxsEventRequest { + const message = createBaseGetTxsEventRequest(); + message.events = object.events?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + if (object.order_by !== undefined && object.order_by !== null) { + message.orderBy = object.order_by; + } + if (object.page !== undefined && object.page !== null) { + message.page = BigInt(object.page); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + return message; + }, + toAmino(message: GetTxsEventRequest): GetTxsEventRequestAmino { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map(e => e); + } else { + obj.events = message.events; + } + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; + obj.page = message.page !== BigInt(0) ? message.page.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { + return GetTxsEventRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetTxsEventRequest): GetTxsEventRequestAminoMsg { + return { + type: "cosmos-sdk/GetTxsEventRequest", + value: GetTxsEventRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxsEventRequestProtoMsg): GetTxsEventRequest { + return GetTxsEventRequest.decode(message.value); + }, + toProto(message: GetTxsEventRequest): Uint8Array { + return GetTxsEventRequest.encode(message).finish(); + }, + toProtoMsg(message: GetTxsEventRequest): GetTxsEventRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", + value: GetTxsEventRequest.encode(message).finish() + }; + } +}; +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { + txs: [], + txResponses: [], + pagination: undefined, + total: BigInt(0) + }; +} +export const GetTxsEventResponse = { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", + aminoType: "cosmos-sdk/GetTxsEventResponse", + encode(message: GetTxsEventResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.txResponses) { + TxResponse.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + if (message.total !== BigInt(0)) { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(Tx.decode(reader, reader.uint32())); + break; + case 2: + message.txResponses.push(TxResponse.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 4: + message.total = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; + message.txResponses = object.txResponses?.map(e => TxResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GetTxsEventResponseAmino): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map(e => Tx.fromAmino(e)) || []; + message.txResponses = object.tx_responses?.map(e => TxResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.total !== undefined && object.total !== null) { + message.total = BigInt(object.total); + } + return message; + }, + toAmino(message: GetTxsEventResponse): GetTxsEventResponseAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); + } else { + obj.txs = message.txs; + } + if (message.txResponses) { + obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e) : undefined); + } else { + obj.tx_responses = message.txResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GetTxsEventResponseAminoMsg): GetTxsEventResponse { + return GetTxsEventResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetTxsEventResponse): GetTxsEventResponseAminoMsg { + return { + type: "cosmos-sdk/GetTxsEventResponse", + value: GetTxsEventResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxsEventResponseProtoMsg): GetTxsEventResponse { + return GetTxsEventResponse.decode(message.value); + }, + toProto(message: GetTxsEventResponse): Uint8Array { + return GetTxsEventResponse.encode(message).finish(); + }, + toProtoMsg(message: GetTxsEventResponse): GetTxsEventResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", + value: GetTxsEventResponse.encode(message).finish() + }; + } +}; +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { + txBytes: new Uint8Array(), + mode: 0 + }; +} +export const BroadcastTxRequest = { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", + aminoType: "cosmos-sdk/BroadcastTxRequest", + encode(message: BroadcastTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + case 2: + message.mode = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(); + message.mode = object.mode ?? 0; + return message; + }, + fromAmino(object: BroadcastTxRequestAmino): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } + return message; + }, + toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + obj.mode = message.mode === 0 ? undefined : message.mode; + return obj; + }, + fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { + return BroadcastTxRequest.fromAmino(object.value); + }, + toAminoMsg(message: BroadcastTxRequest): BroadcastTxRequestAminoMsg { + return { + type: "cosmos-sdk/BroadcastTxRequest", + value: BroadcastTxRequest.toAmino(message) + }; + }, + fromProtoMsg(message: BroadcastTxRequestProtoMsg): BroadcastTxRequest { + return BroadcastTxRequest.decode(message.value); + }, + toProto(message: BroadcastTxRequest): Uint8Array { + return BroadcastTxRequest.encode(message).finish(); + }, + toProtoMsg(message: BroadcastTxRequest): BroadcastTxRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", + value: BroadcastTxRequest.encode(message).finish() + }; + } +}; +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { + txResponse: undefined + }; +} +export const BroadcastTxResponse = { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", + aminoType: "cosmos-sdk/BroadcastTxResponse", + encode(message: BroadcastTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txResponse = TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; + return message; + }, + fromAmino(object: BroadcastTxResponseAmino): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + if (object.tx_response !== undefined && object.tx_response !== null) { + message.txResponse = TxResponse.fromAmino(object.tx_response); + } + return message; + }, + toAmino(message: BroadcastTxResponse): BroadcastTxResponseAmino { + const obj: any = {}; + obj.tx_response = message.txResponse ? TxResponse.toAmino(message.txResponse) : undefined; + return obj; + }, + fromAminoMsg(object: BroadcastTxResponseAminoMsg): BroadcastTxResponse { + return BroadcastTxResponse.fromAmino(object.value); + }, + toAminoMsg(message: BroadcastTxResponse): BroadcastTxResponseAminoMsg { + return { + type: "cosmos-sdk/BroadcastTxResponse", + value: BroadcastTxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: BroadcastTxResponseProtoMsg): BroadcastTxResponse { + return BroadcastTxResponse.decode(message.value); + }, + toProto(message: BroadcastTxResponse): Uint8Array { + return BroadcastTxResponse.encode(message).finish(); + }, + toProtoMsg(message: BroadcastTxResponse): BroadcastTxResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", + value: BroadcastTxResponse.encode(message).finish() + }; + } +}; +function createBaseSimulateRequest(): SimulateRequest { + return { + tx: undefined, + txBytes: new Uint8Array() + }; +} +export const SimulateRequest = { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", + aminoType: "cosmos-sdk/SimulateRequest", + encode(message: SimulateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.txBytes.length !== 0) { + writer.uint32(18).bytes(message.txBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + case 2: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: SimulateRequestAmino): SimulateRequest { + const message = createBaseSimulateRequest(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: SimulateRequest): SimulateRequestAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: SimulateRequestAminoMsg): SimulateRequest { + return SimulateRequest.fromAmino(object.value); + }, + toAminoMsg(message: SimulateRequest): SimulateRequestAminoMsg { + return { + type: "cosmos-sdk/SimulateRequest", + value: SimulateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: SimulateRequestProtoMsg): SimulateRequest { + return SimulateRequest.decode(message.value); + }, + toProto(message: SimulateRequest): Uint8Array { + return SimulateRequest.encode(message).finish(); + }, + toProtoMsg(message: SimulateRequest): SimulateRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", + value: SimulateRequest.encode(message).finish() + }; + } +}; +function createBaseSimulateResponse(): SimulateResponse { + return { + gasInfo: undefined, + result: undefined + }; +} +export const SimulateResponse = { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", + aminoType: "cosmos-sdk/SimulateResponse", + encode(message: SimulateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + 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: DeepPartial): SimulateResponse { + const message = createBaseSimulateResponse(); + 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; + }, + fromAmino(object: SimulateResponseAmino): SimulateResponse { + const message = createBaseSimulateResponse(); + if (object.gas_info !== undefined && object.gas_info !== null) { + message.gasInfo = GasInfo.fromAmino(object.gas_info); + } + if (object.result !== undefined && object.result !== null) { + message.result = Result.fromAmino(object.result); + } + return message; + }, + toAmino(message: SimulateResponse): SimulateResponseAmino { + const obj: any = {}; + obj.gas_info = message.gasInfo ? GasInfo.toAmino(message.gasInfo) : undefined; + obj.result = message.result ? Result.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: SimulateResponseAminoMsg): SimulateResponse { + return SimulateResponse.fromAmino(object.value); + }, + toAminoMsg(message: SimulateResponse): SimulateResponseAminoMsg { + return { + type: "cosmos-sdk/SimulateResponse", + value: SimulateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: SimulateResponseProtoMsg): SimulateResponse { + return SimulateResponse.decode(message.value); + }, + toProto(message: SimulateResponse): Uint8Array { + return SimulateResponse.encode(message).finish(); + }, + toProtoMsg(message: SimulateResponse): SimulateResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", + value: SimulateResponse.encode(message).finish() + }; + } +}; +function createBaseGetTxRequest(): GetTxRequest { + return { + hash: "" + }; +} +export const GetTxRequest = { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", + aminoType: "cosmos-sdk/GetTxRequest", + encode(message: GetTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, + fromAmino(object: GetTxRequestAmino): GetTxRequest { + const message = createBaseGetTxRequest(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + return message; + }, + toAmino(message: GetTxRequest): GetTxRequestAmino { + const obj: any = {}; + obj.hash = message.hash === "" ? undefined : message.hash; + return obj; + }, + fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { + return GetTxRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetTxRequest): GetTxRequestAminoMsg { + return { + type: "cosmos-sdk/GetTxRequest", + value: GetTxRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxRequestProtoMsg): GetTxRequest { + return GetTxRequest.decode(message.value); + }, + toProto(message: GetTxRequest): Uint8Array { + return GetTxRequest.encode(message).finish(); + }, + toProtoMsg(message: GetTxRequest): GetTxRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", + value: GetTxRequest.encode(message).finish() + }; + } +}; +function createBaseGetTxResponse(): GetTxResponse { + return { + tx: undefined, + txResponse: undefined + }; +} +export const GetTxResponse = { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", + aminoType: "cosmos-sdk/GetTxResponse", + encode(message: GetTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + case 2: + message.txResponse = TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; + return message; + }, + fromAmino(object: GetTxResponseAmino): GetTxResponse { + const message = createBaseGetTxResponse(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + if (object.tx_response !== undefined && object.tx_response !== null) { + message.txResponse = TxResponse.fromAmino(object.tx_response); + } + return message; + }, + toAmino(message: GetTxResponse): GetTxResponseAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + obj.tx_response = message.txResponse ? TxResponse.toAmino(message.txResponse) : undefined; + return obj; + }, + fromAminoMsg(object: GetTxResponseAminoMsg): GetTxResponse { + return GetTxResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetTxResponse): GetTxResponseAminoMsg { + return { + type: "cosmos-sdk/GetTxResponse", + value: GetTxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxResponseProtoMsg): GetTxResponse { + return GetTxResponse.decode(message.value); + }, + toProto(message: GetTxResponse): Uint8Array { + return GetTxResponse.encode(message).finish(); + }, + toProtoMsg(message: GetTxResponse): GetTxResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", + value: GetTxResponse.encode(message).finish() + }; + } +}; +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { + height: BigInt(0), + pagination: undefined + }; +} +export const GetBlockWithTxsRequest = { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", + aminoType: "cosmos-sdk/GetBlockWithTxsRequest", + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetBlockWithTxsRequest { + const message = createBaseGetBlockWithTxsRequest(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: GetBlockWithTxsRequestAmino): GetBlockWithTxsRequest { + const message = createBaseGetBlockWithTxsRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetBlockWithTxsRequestAminoMsg): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAminoMsg { + return { + type: "cosmos-sdk/GetBlockWithTxsRequest", + value: GetBlockWithTxsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetBlockWithTxsRequestProtoMsg): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.decode(message.value); + }, + toProto(message: GetBlockWithTxsRequest): Uint8Array { + return GetBlockWithTxsRequest.encode(message).finish(); + }, + toProtoMsg(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", + value: GetBlockWithTxsRequest.encode(message).finish() + }; + } +}; +function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { + return { + txs: [], + blockId: undefined, + block: undefined, + pagination: undefined + }; +} +export const GetBlockWithTxsResponse = { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", + aminoType: "cosmos-sdk/GetBlockWithTxsResponse", + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(18).fork()).ldelim(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(26).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(Tx.decode(reader, reader.uint32())); + break; + case 2: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 3: + message.block = Block.decode(reader, reader.uint32()); + break; + case 4: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: GetBlockWithTxsResponseAmino): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map(e => Tx.fromAmino(e)) || []; + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.block !== undefined && object.block !== null) { + message.block = Block.fromAmino(object.block); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); + } else { + obj.txs = message.txs; + } + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.block = message.block ? Block.toAmino(message.block) : undefined; + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetBlockWithTxsResponseAminoMsg): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseAminoMsg { + return { + type: "cosmos-sdk/GetBlockWithTxsResponse", + value: GetBlockWithTxsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetBlockWithTxsResponseProtoMsg): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.decode(message.value); + }, + toProto(message: GetBlockWithTxsResponse): Uint8Array { + return GetBlockWithTxsResponse.encode(message).finish(); + }, + toProtoMsg(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", + value: GetBlockWithTxsResponse.encode(message).finish() + }; + } +}; +function createBaseTxDecodeRequest(): TxDecodeRequest { + return { + txBytes: new Uint8Array() + }; +} +export const TxDecodeRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest", + aminoType: "cosmos-sdk/TxDecodeRequest", + encode(message: TxDecodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxDecodeRequestAmino): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: TxDecodeRequest): TxDecodeRequestAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeRequestAminoMsg): TxDecodeRequest { + return TxDecodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeRequest): TxDecodeRequestAminoMsg { + return { + type: "cosmos-sdk/TxDecodeRequest", + value: TxDecodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeRequestProtoMsg): TxDecodeRequest { + return TxDecodeRequest.decode(message.value); + }, + toProto(message: TxDecodeRequest): Uint8Array { + return TxDecodeRequest.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeRequest): TxDecodeRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest", + value: TxDecodeRequest.encode(message).finish() + }; + } +}; +function createBaseTxDecodeResponse(): TxDecodeResponse { + return { + tx: undefined + }; +} +export const TxDecodeResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse", + aminoType: "cosmos-sdk/TxDecodeResponse", + encode(message: TxDecodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + return message; + }, + fromAmino(object: TxDecodeResponseAmino): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + return message; + }, + toAmino(message: TxDecodeResponse): TxDecodeResponseAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeResponseAminoMsg): TxDecodeResponse { + return TxDecodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeResponse): TxDecodeResponseAminoMsg { + return { + type: "cosmos-sdk/TxDecodeResponse", + value: TxDecodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeResponseProtoMsg): TxDecodeResponse { + return TxDecodeResponse.decode(message.value); + }, + toProto(message: TxDecodeResponse): Uint8Array { + return TxDecodeResponse.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeResponse): TxDecodeResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse", + value: TxDecodeResponse.encode(message).finish() + }; + } +}; +function createBaseTxEncodeRequest(): TxEncodeRequest { + return { + tx: undefined + }; +} +export const TxEncodeRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest", + aminoType: "cosmos-sdk/TxEncodeRequest", + encode(message: TxEncodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + return message; + }, + fromAmino(object: TxEncodeRequestAmino): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + return message; + }, + toAmino(message: TxEncodeRequest): TxEncodeRequestAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeRequestAminoMsg): TxEncodeRequest { + return TxEncodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeRequest): TxEncodeRequestAminoMsg { + return { + type: "cosmos-sdk/TxEncodeRequest", + value: TxEncodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeRequestProtoMsg): TxEncodeRequest { + return TxEncodeRequest.decode(message.value); + }, + toProto(message: TxEncodeRequest): Uint8Array { + return TxEncodeRequest.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeRequest): TxEncodeRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest", + value: TxEncodeRequest.encode(message).finish() + }; + } +}; +function createBaseTxEncodeResponse(): TxEncodeResponse { + return { + txBytes: new Uint8Array() + }; +} +export const TxEncodeResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse", + aminoType: "cosmos-sdk/TxEncodeResponse", + encode(message: TxEncodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxEncodeResponseAmino): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: TxEncodeResponse): TxEncodeResponseAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeResponseAminoMsg): TxEncodeResponse { + return TxEncodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeResponse): TxEncodeResponseAminoMsg { + return { + type: "cosmos-sdk/TxEncodeResponse", + value: TxEncodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeResponseProtoMsg): TxEncodeResponse { + return TxEncodeResponse.decode(message.value); + }, + toProto(message: TxEncodeResponse): Uint8Array { + return TxEncodeResponse.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeResponse): TxEncodeResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse", + value: TxEncodeResponse.encode(message).finish() + }; + } +}; +function createBaseTxEncodeAminoRequest(): TxEncodeAminoRequest { + return { + aminoJson: "" + }; +} +export const TxEncodeAminoRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest", + aminoType: "cosmos-sdk/TxEncodeAminoRequest", + encode(message: TxEncodeAminoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoJson = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, + fromAmino(object: TxEncodeAminoRequestAmino): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + if (object.amino_json !== undefined && object.amino_json !== null) { + message.aminoJson = object.amino_json; + } + return message; + }, + toAmino(message: TxEncodeAminoRequest): TxEncodeAminoRequestAmino { + const obj: any = {}; + obj.amino_json = message.aminoJson === "" ? undefined : message.aminoJson; + return obj; + }, + fromAminoMsg(object: TxEncodeAminoRequestAminoMsg): TxEncodeAminoRequest { + return TxEncodeAminoRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeAminoRequest): TxEncodeAminoRequestAminoMsg { + return { + type: "cosmos-sdk/TxEncodeAminoRequest", + value: TxEncodeAminoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeAminoRequestProtoMsg): TxEncodeAminoRequest { + return TxEncodeAminoRequest.decode(message.value); + }, + toProto(message: TxEncodeAminoRequest): Uint8Array { + return TxEncodeAminoRequest.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeAminoRequest): TxEncodeAminoRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest", + value: TxEncodeAminoRequest.encode(message).finish() + }; + } +}; +function createBaseTxEncodeAminoResponse(): TxEncodeAminoResponse { + return { + aminoBinary: new Uint8Array() + }; +} +export const TxEncodeAminoResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse", + aminoType: "cosmos-sdk/TxEncodeAminoResponse", + encode(message: TxEncodeAminoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoBinary = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxEncodeAminoResponseAmino): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + if (object.amino_binary !== undefined && object.amino_binary !== null) { + message.aminoBinary = bytesFromBase64(object.amino_binary); + } + return message; + }, + toAmino(message: TxEncodeAminoResponse): TxEncodeAminoResponseAmino { + const obj: any = {}; + obj.amino_binary = message.aminoBinary ? base64FromBytes(message.aminoBinary) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeAminoResponseAminoMsg): TxEncodeAminoResponse { + return TxEncodeAminoResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeAminoResponse): TxEncodeAminoResponseAminoMsg { + return { + type: "cosmos-sdk/TxEncodeAminoResponse", + value: TxEncodeAminoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeAminoResponseProtoMsg): TxEncodeAminoResponse { + return TxEncodeAminoResponse.decode(message.value); + }, + toProto(message: TxEncodeAminoResponse): Uint8Array { + return TxEncodeAminoResponse.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeAminoResponse): TxEncodeAminoResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse", + value: TxEncodeAminoResponse.encode(message).finish() + }; + } +}; +function createBaseTxDecodeAminoRequest(): TxDecodeAminoRequest { + return { + aminoBinary: new Uint8Array() + }; +} +export const TxDecodeAminoRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest", + aminoType: "cosmos-sdk/TxDecodeAminoRequest", + encode(message: TxDecodeAminoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoBinary = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxDecodeAminoRequestAmino): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + if (object.amino_binary !== undefined && object.amino_binary !== null) { + message.aminoBinary = bytesFromBase64(object.amino_binary); + } + return message; + }, + toAmino(message: TxDecodeAminoRequest): TxDecodeAminoRequestAmino { + const obj: any = {}; + obj.amino_binary = message.aminoBinary ? base64FromBytes(message.aminoBinary) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeAminoRequestAminoMsg): TxDecodeAminoRequest { + return TxDecodeAminoRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeAminoRequest): TxDecodeAminoRequestAminoMsg { + return { + type: "cosmos-sdk/TxDecodeAminoRequest", + value: TxDecodeAminoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeAminoRequestProtoMsg): TxDecodeAminoRequest { + return TxDecodeAminoRequest.decode(message.value); + }, + toProto(message: TxDecodeAminoRequest): Uint8Array { + return TxDecodeAminoRequest.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeAminoRequest): TxDecodeAminoRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest", + value: TxDecodeAminoRequest.encode(message).finish() + }; + } +}; +function createBaseTxDecodeAminoResponse(): TxDecodeAminoResponse { + return { + aminoJson: "" + }; +} +export const TxDecodeAminoResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse", + aminoType: "cosmos-sdk/TxDecodeAminoResponse", + encode(message: TxDecodeAminoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoJson = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, + fromAmino(object: TxDecodeAminoResponseAmino): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + if (object.amino_json !== undefined && object.amino_json !== null) { + message.aminoJson = object.amino_json; + } + return message; + }, + toAmino(message: TxDecodeAminoResponse): TxDecodeAminoResponseAmino { + const obj: any = {}; + obj.amino_json = message.aminoJson === "" ? undefined : message.aminoJson; + return obj; + }, + fromAminoMsg(object: TxDecodeAminoResponseAminoMsg): TxDecodeAminoResponse { + return TxDecodeAminoResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeAminoResponse): TxDecodeAminoResponseAminoMsg { + return { + type: "cosmos-sdk/TxDecodeAminoResponse", + value: TxDecodeAminoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeAminoResponseProtoMsg): TxDecodeAminoResponse { + return TxDecodeAminoResponse.decode(message.value); + }, + toProto(message: TxDecodeAminoResponse): Uint8Array { + return TxDecodeAminoResponse.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeAminoResponse): TxDecodeAminoResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse", + value: TxDecodeAminoResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/tx/v1beta1/tx.ts b/util/inj-types/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..2ef54406 --- /dev/null +++ b/util/inj-types/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,2049 @@ +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { SignMode } from "../signing/v1beta1/signing"; +import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** Tx is the standard type used for broadcasting transactions. */ +export interface Tx { + /** body is the processable content of the transaction */ + body?: TxBody; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + authInfo?: AuthInfo; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} +export interface TxProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Tx"; + value: Uint8Array; +} +/** Tx is the standard type used for broadcasting transactions. */ +export interface TxAmino { + /** body is the processable content of the transaction */ + body?: TxBodyAmino; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + auth_info?: AuthInfoAmino; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures?: string[]; +} +export interface TxAminoMsg { + type: "cosmos-sdk/Tx"; + value: TxAmino; +} +/** Tx is the standard type used for broadcasting transactions. */ +export interface TxSDKType { + body?: TxBodySDKType; + auth_info?: AuthInfoSDKType; + signatures: Uint8Array[]; +} +/** + * TxRaw is a variant of Tx that pins the signer's exact binary representation + * of body and auth_info. This is used for signing, broadcasting and + * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and + * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used + * as the transaction ID. + */ +export interface TxRaw { + /** + * body_bytes is a protobuf serialization of a TxBody that matches the + * representation in SignDoc. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + authInfoBytes: Uint8Array; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} +export interface TxRawProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxRaw"; + value: Uint8Array; +} +/** + * TxRaw is a variant of Tx that pins the signer's exact binary representation + * of body and auth_info. This is used for signing, broadcasting and + * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and + * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used + * as the transaction ID. + */ +export interface TxRawAmino { + /** + * body_bytes is a protobuf serialization of a TxBody that matches the + * representation in SignDoc. + */ + body_bytes?: string; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + auth_info_bytes?: string; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures?: string[]; +} +export interface TxRawAminoMsg { + type: "cosmos-sdk/TxRaw"; + value: TxRawAmino; +} +/** + * TxRaw is a variant of Tx that pins the signer's exact binary representation + * of body and auth_info. This is used for signing, broadcasting and + * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and + * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used + * as the transaction ID. + */ +export interface TxRawSDKType { + body_bytes: Uint8Array; + auth_info_bytes: Uint8Array; + signatures: Uint8Array[]; +} +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDoc { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + authInfoBytes: Uint8Array; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chainId: string; + /** account_number is the account number of the account in state */ + accountNumber: bigint; +} +export interface SignDocProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignDoc"; + value: Uint8Array; +} +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDocAmino { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + body_bytes?: string; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + auth_info_bytes?: string; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chain_id?: string; + /** account_number is the account number of the account in state */ + account_number?: string; +} +export interface SignDocAminoMsg { + type: "cosmos-sdk/SignDoc"; + value: SignDocAmino; +} +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDocSDKType { + body_bytes: Uint8Array; + auth_info_bytes: Uint8Array; + chain_id: string; + account_number: bigint; +} +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAux { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** public_key is the public key of the signing account. */ + publicKey?: Any; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chainId: string; + /** account_number is the account number of the account in state. */ + accountNumber: bigint; + /** sequence is the sequence number of the signing account. */ + sequence: bigint; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * It should be left empty if the signer is not the tipper for this + * transaction. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + */ + tip?: Tip; +} +export interface SignDocDirectAuxProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux"; + value: Uint8Array; +} +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAuxAmino { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + body_bytes?: string; + /** public_key is the public key of the signing account. */ + public_key?: AnyAmino; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chain_id?: string; + /** account_number is the account number of the account in state. */ + account_number?: string; + /** sequence is the sequence number of the signing account. */ + sequence?: string; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * It should be left empty if the signer is not the tipper for this + * transaction. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + */ + tip?: TipAmino; +} +export interface SignDocDirectAuxAminoMsg { + type: "cosmos-sdk/SignDocDirectAux"; + value: SignDocDirectAuxAmino; +} +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAuxSDKType { + body_bytes: Uint8Array; + public_key?: AnySDKType; + chain_id: string; + account_number: bigint; + sequence: bigint; + tip?: TipSDKType; +} +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBody { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: Any[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeoutHeight: bigint; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extensionOptions: Any[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + nonCriticalExtensionOptions: Any[]; +} +export interface TxBodyProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxBody"; + value: Uint8Array; +} +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBodyAmino { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages?: AnyAmino[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo?: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeout_height?: string; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extension_options?: AnyAmino[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + non_critical_extension_options?: AnyAmino[]; +} +export interface TxBodyAminoMsg { + type: "cosmos-sdk/TxBody"; + value: TxBodyAmino; +} +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBodySDKType { + messages: AnySDKType[]; + memo: string; + timeout_height: bigint; + extension_options: AnySDKType[]; + non_critical_extension_options: AnySDKType[]; +} +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfo { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signerInfos: SignerInfo[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee?: Fee; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + */ + tip?: Tip; +} +export interface AuthInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo"; + value: Uint8Array; +} +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfoAmino { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signer_infos?: SignerInfoAmino[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee?: FeeAmino; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + */ + tip?: TipAmino; +} +export interface AuthInfoAminoMsg { + type: "cosmos-sdk/AuthInfo"; + value: AuthInfoAmino; +} +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfoSDKType { + signer_infos: SignerInfoSDKType[]; + fee?: FeeSDKType; + tip?: TipSDKType; +} +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfo { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + publicKey?: Any; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + modeInfo?: ModeInfo; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to + * prevent replay attacks. + */ + sequence: bigint; +} +export interface SignerInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo"; + value: Uint8Array; +} +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfoAmino { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + public_key?: AnyAmino; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + mode_info?: ModeInfoAmino; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to + * prevent replay attacks. + */ + sequence?: string; +} +export interface SignerInfoAminoMsg { + type: "cosmos-sdk/SignerInfo"; + value: SignerInfoAmino; +} +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfoSDKType { + public_key?: AnySDKType; + mode_info?: ModeInfoSDKType; + sequence: bigint; +} +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ +export interface ModeInfo { + /** single represents a single signer */ + single?: ModeInfo_Single; + /** multi represents a nested multisig signer */ + multi?: ModeInfo_Multi; +} +export interface ModeInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo"; + value: Uint8Array; +} +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ +export interface ModeInfoAmino { + /** single represents a single signer */ + single?: ModeInfo_SingleAmino; + /** multi represents a nested multisig signer */ + multi?: ModeInfo_MultiAmino; +} +export interface ModeInfoAminoMsg { + type: "cosmos-sdk/ModeInfo"; + value: ModeInfoAmino; +} +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ +export interface ModeInfoSDKType { + single?: ModeInfo_SingleSDKType; + multi?: ModeInfo_MultiSDKType; +} +/** + * Single is the mode info for a single signer. It is structured as a message + * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + * future + */ +export interface ModeInfo_Single { + /** mode is the signing mode of the single signer */ + mode: SignMode; +} +export interface ModeInfo_SingleProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Single"; + value: Uint8Array; +} +/** + * Single is the mode info for a single signer. It is structured as a message + * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + * future + */ +export interface ModeInfo_SingleAmino { + /** mode is the signing mode of the single signer */ + mode?: SignMode; +} +export interface ModeInfo_SingleAminoMsg { + type: "cosmos-sdk/Single"; + value: ModeInfo_SingleAmino; +} +/** + * Single is the mode info for a single signer. It is structured as a message + * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + * future + */ +export interface ModeInfo_SingleSDKType { + mode: SignMode; +} +/** Multi is the mode info for a multisig public key */ +export interface ModeInfo_Multi { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArray; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + modeInfos: ModeInfo[]; +} +export interface ModeInfo_MultiProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Multi"; + value: Uint8Array; +} +/** Multi is the mode info for a multisig public key */ +export interface ModeInfo_MultiAmino { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArrayAmino; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + mode_infos?: ModeInfoAmino[]; +} +export interface ModeInfo_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: ModeInfo_MultiAmino; +} +/** Multi is the mode info for a multisig public key */ +export interface ModeInfo_MultiSDKType { + bitarray?: CompactBitArraySDKType; + mode_infos: ModeInfoSDKType[]; +} +/** + * Fee includes the amount of coins paid in fees and the maximum + * gas to be used by the transaction. The ratio yields an effective "gasprice", + * which must be above some miminum to be accepted into the mempool. + */ +export interface Fee { + /** amount is the amount of coins to be paid as a fee */ + amount: Coin[]; + /** + * gas_limit is the maximum gas that can be used in transaction processing + * before an out of gas error occurs + */ + gasLimit: bigint; + /** + * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + * the payer must be a tx signer (and thus have signed this field in AuthInfo). + * setting this field does *not* change the ordering of required signers for the transaction. + */ + payer: string; + /** + * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + * not support fee grants, this will fail + */ + granter: string; +} +export interface FeeProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Fee"; + value: Uint8Array; +} +/** + * Fee includes the amount of coins paid in fees and the maximum + * gas to be used by the transaction. The ratio yields an effective "gasprice", + * which must be above some miminum to be accepted into the mempool. + */ +export interface FeeAmino { + /** amount is the amount of coins to be paid as a fee */ + amount?: CoinAmino[]; + /** + * gas_limit is the maximum gas that can be used in transaction processing + * before an out of gas error occurs + */ + gas_limit?: string; + /** + * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + * the payer must be a tx signer (and thus have signed this field in AuthInfo). + * setting this field does *not* change the ordering of required signers for the transaction. + */ + payer?: string; + /** + * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + * not support fee grants, this will fail + */ + granter?: string; +} +export interface FeeAminoMsg { + type: "cosmos-sdk/Fee"; + value: FeeAmino; +} +/** + * Fee includes the amount of coins paid in fees and the maximum + * gas to be used by the transaction. The ratio yields an effective "gasprice", + * which must be above some miminum to be accepted into the mempool. + */ +export interface FeeSDKType { + amount: CoinSDKType[]; + gas_limit: bigint; + payer: string; + granter: string; +} +/** + * Tip is the tip used for meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ +export interface Tip { + /** amount is the amount of the tip */ + amount: Coin[]; + /** tipper is the address of the account paying for the tip */ + tipper: string; +} +export interface TipProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Tip"; + value: Uint8Array; +} +/** + * Tip is the tip used for meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ +export interface TipAmino { + /** amount is the amount of the tip */ + amount?: CoinAmino[]; + /** tipper is the address of the account paying for the tip */ + tipper?: string; +} +export interface TipAminoMsg { + type: "cosmos-sdk/Tip"; + value: TipAmino; +} +/** + * Tip is the tip used for meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ +export interface TipSDKType { + amount: CoinSDKType[]; + tipper: string; +} +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerData { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + signDoc?: SignDocDirectAux; + /** mode is the signing mode of the single signer. */ + mode: SignMode; + /** sig is the signature of the sign doc. */ + sig: Uint8Array; +} +export interface AuxSignerDataProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData"; + value: Uint8Array; +} +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerDataAmino { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address?: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + sign_doc?: SignDocDirectAuxAmino; + /** mode is the signing mode of the single signer. */ + mode?: SignMode; + /** sig is the signature of the sign doc. */ + sig?: string; +} +export interface AuxSignerDataAminoMsg { + type: "cosmos-sdk/AuxSignerData"; + value: AuxSignerDataAmino; +} +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerDataSDKType { + address: string; + sign_doc?: SignDocDirectAuxSDKType; + mode: SignMode; + sig: Uint8Array; +} +function createBaseTx(): Tx { + return { + body: undefined, + authInfo: undefined, + signatures: [] + }; +} +export const Tx = { + typeUrl: "/cosmos.tx.v1beta1.Tx", + aminoType: "cosmos-sdk/Tx", + encode(message: Tx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).ldelim(); + } + if (message.authInfo !== undefined) { + AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.body = TxBody.decode(reader, reader.uint32()); + break; + case 2: + message.authInfo = AuthInfo.decode(reader, reader.uint32()); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Tx { + const message = createBaseTx(); + message.body = object.body !== undefined && object.body !== null ? TxBody.fromPartial(object.body) : undefined; + message.authInfo = object.authInfo !== undefined && object.authInfo !== null ? AuthInfo.fromPartial(object.authInfo) : undefined; + message.signatures = object.signatures?.map(e => e) || []; + return message; + }, + fromAmino(object: TxAmino): Tx { + const message = createBaseTx(); + if (object.body !== undefined && object.body !== null) { + message.body = TxBody.fromAmino(object.body); + } + if (object.auth_info !== undefined && object.auth_info !== null) { + message.authInfo = AuthInfo.fromAmino(object.auth_info); + } + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Tx): TxAmino { + const obj: any = {}; + obj.body = message.body ? TxBody.toAmino(message.body) : undefined; + obj.auth_info = message.authInfo ? AuthInfo.toAmino(message.authInfo) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: TxAminoMsg): Tx { + return Tx.fromAmino(object.value); + }, + toAminoMsg(message: Tx): TxAminoMsg { + return { + type: "cosmos-sdk/Tx", + value: Tx.toAmino(message) + }; + }, + fromProtoMsg(message: TxProtoMsg): Tx { + return Tx.decode(message.value); + }, + toProto(message: Tx): Uint8Array { + return Tx.encode(message).finish(); + }, + toProtoMsg(message: Tx): TxProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Tx", + value: Tx.encode(message).finish() + }; + } +}; +function createBaseTxRaw(): TxRaw { + return { + bodyBytes: new Uint8Array(), + authInfoBytes: new Uint8Array(), + signatures: [] + }; +} +export const TxRaw = { + typeUrl: "/cosmos.tx.v1beta1.TxRaw", + aminoType: "cosmos-sdk/TxRaw", + encode(message: TxRaw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bodyBytes = reader.bytes(); + break; + case 2: + message.authInfoBytes = reader.bytes(); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxRaw { + const message = createBaseTxRaw(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); + message.signatures = object.signatures?.map(e => e) || []; + return message; + }, + fromAmino(object: TxRawAmino): TxRaw { + const message = createBaseTxRaw(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.auth_info_bytes !== undefined && object.auth_info_bytes !== null) { + message.authInfoBytes = bytesFromBase64(object.auth_info_bytes); + } + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: TxRaw): TxRawAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: TxRawAminoMsg): TxRaw { + return TxRaw.fromAmino(object.value); + }, + toAminoMsg(message: TxRaw): TxRawAminoMsg { + return { + type: "cosmos-sdk/TxRaw", + value: TxRaw.toAmino(message) + }; + }, + fromProtoMsg(message: TxRawProtoMsg): TxRaw { + return TxRaw.decode(message.value); + }, + toProto(message: TxRaw): Uint8Array { + return TxRaw.encode(message).finish(); + }, + toProtoMsg(message: TxRaw): TxRawProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxRaw", + value: TxRaw.encode(message).finish() + }; + } +}; +function createBaseSignDoc(): SignDoc { + return { + bodyBytes: new Uint8Array(), + authInfoBytes: new Uint8Array(), + chainId: "", + accountNumber: BigInt(0) + }; +} +export const SignDoc = { + typeUrl: "/cosmos.tx.v1beta1.SignDoc", + aminoType: "cosmos-sdk/SignDoc", + encode(message: SignDoc, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== BigInt(0)) { + writer.uint32(32).uint64(message.accountNumber); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bodyBytes = reader.bytes(); + break; + case 2: + message.authInfoBytes = reader.bytes(); + break; + case 3: + message.chainId = reader.string(); + break; + case 4: + message.accountNumber = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignDoc { + const message = createBaseSignDoc(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignDocAmino): SignDoc { + const message = createBaseSignDoc(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.auth_info_bytes !== undefined && object.auth_info_bytes !== null) { + message.authInfoBytes = bytesFromBase64(object.auth_info_bytes); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } + return message; + }, + toAmino(message: SignDoc): SignDocAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignDocAminoMsg): SignDoc { + return SignDoc.fromAmino(object.value); + }, + toAminoMsg(message: SignDoc): SignDocAminoMsg { + return { + type: "cosmos-sdk/SignDoc", + value: SignDoc.toAmino(message) + }; + }, + fromProtoMsg(message: SignDocProtoMsg): SignDoc { + return SignDoc.decode(message.value); + }, + toProto(message: SignDoc): Uint8Array { + return SignDoc.encode(message).finish(); + }, + toProtoMsg(message: SignDoc): SignDocProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignDoc", + value: SignDoc.encode(message).finish() + }; + } +}; +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + bodyBytes: new Uint8Array(), + publicKey: undefined, + chainId: "", + accountNumber: BigInt(0), + sequence: BigInt(0), + tip: undefined + }; +} +export const SignDocDirectAux = { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", + aminoType: "cosmos-sdk/SignDocDirectAux", + encode(message: SignDocDirectAux, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(18).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== BigInt(0)) { + writer.uint32(32).uint64(message.accountNumber); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDocDirectAux(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bodyBytes = reader.bytes(); + break; + case 2: + message.publicKey = Any.decode(reader, reader.uint32()); + break; + case 3: + message.chainId = reader.string(); + break; + case 4: + message.accountNumber = reader.uint64(); + break; + case 5: + message.sequence = reader.uint64(); + break; + case 6: + message.tip = Tip.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(); + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.tip = object.tip !== undefined && object.tip !== null ? Tip.fromPartial(object.tip) : undefined; + return message; + }, + fromAmino(object: SignDocDirectAuxAmino): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.tip !== undefined && object.tip !== null) { + message.tip = Tip.fromAmino(object.tip); + } + return message; + }, + toAmino(message: SignDocDirectAux): SignDocDirectAuxAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; + return obj; + }, + fromAminoMsg(object: SignDocDirectAuxAminoMsg): SignDocDirectAux { + return SignDocDirectAux.fromAmino(object.value); + }, + toAminoMsg(message: SignDocDirectAux): SignDocDirectAuxAminoMsg { + return { + type: "cosmos-sdk/SignDocDirectAux", + value: SignDocDirectAux.toAmino(message) + }; + }, + fromProtoMsg(message: SignDocDirectAuxProtoMsg): SignDocDirectAux { + return SignDocDirectAux.decode(message.value); + }, + toProto(message: SignDocDirectAux): Uint8Array { + return SignDocDirectAux.encode(message).finish(); + }, + toProtoMsg(message: SignDocDirectAux): SignDocDirectAuxProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", + value: SignDocDirectAux.encode(message).finish() + }; + } +}; +function createBaseTxBody(): TxBody { + return { + messages: [], + memo: "", + timeoutHeight: BigInt(0), + extensionOptions: [], + nonCriticalExtensionOptions: [] + }; +} +export const TxBody = { + typeUrl: "/cosmos.tx.v1beta1.TxBody", + aminoType: "cosmos-sdk/TxBody", + encode(message: TxBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (message.timeoutHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.timeoutHeight); + } + for (const v of message.extensionOptions) { + Any.encode(v!, writer.uint32(8186).fork()).ldelim(); + } + for (const v of message.nonCriticalExtensionOptions) { + Any.encode(v!, writer.uint32(16378).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 2: + message.memo = reader.string(); + break; + case 3: + message.timeoutHeight = reader.uint64(); + break; + case 1023: + message.extensionOptions.push(Any.decode(reader, reader.uint32())); + break; + case 2047: + message.nonCriticalExtensionOptions.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0); + message.extensionOptions = object.extensionOptions?.map(e => Any.fromPartial(e)) || []; + message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TxBodyAmino): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = BigInt(object.timeout_height); + } + message.extensionOptions = object.extension_options?.map(e => Any.fromAmino(e)) || []; + message.nonCriticalExtensionOptions = object.non_critical_extension_options?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxBody): TxBodyAmino { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + obj.memo = message.memo === "" ? undefined : message.memo; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; + if (message.extensionOptions) { + obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.extension_options = message.extensionOptions; + } + if (message.nonCriticalExtensionOptions) { + obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.non_critical_extension_options = message.nonCriticalExtensionOptions; + } + return obj; + }, + fromAminoMsg(object: TxBodyAminoMsg): TxBody { + return TxBody.fromAmino(object.value); + }, + toAminoMsg(message: TxBody): TxBodyAminoMsg { + return { + type: "cosmos-sdk/TxBody", + value: TxBody.toAmino(message) + }; + }, + fromProtoMsg(message: TxBodyProtoMsg): TxBody { + return TxBody.decode(message.value); + }, + toProto(message: TxBody): Uint8Array { + return TxBody.encode(message).finish(); + }, + toProtoMsg(message: TxBody): TxBodyProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxBody", + value: TxBody.encode(message).finish() + }; + } +}; +function createBaseAuthInfo(): AuthInfo { + return { + signerInfos: [], + fee: undefined, + tip: undefined + }; +} +export const AuthInfo = { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo", + aminoType: "cosmos-sdk/AuthInfo", + encode(message: AuthInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.signerInfos) { + SignerInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(18).fork()).ldelim(); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signerInfos.push(SignerInfo.decode(reader, reader.uint32())); + break; + case 2: + message.fee = Fee.decode(reader, reader.uint32()); + break; + case 3: + message.tip = Tip.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signerInfos?.map(e => SignerInfo.fromPartial(e)) || []; + message.fee = object.fee !== undefined && object.fee !== null ? Fee.fromPartial(object.fee) : undefined; + message.tip = object.tip !== undefined && object.tip !== null ? Tip.fromPartial(object.tip) : undefined; + return message; + }, + fromAmino(object: AuthInfoAmino): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signer_infos?.map(e => SignerInfo.fromAmino(e)) || []; + if (object.fee !== undefined && object.fee !== null) { + message.fee = Fee.fromAmino(object.fee); + } + if (object.tip !== undefined && object.tip !== null) { + message.tip = Tip.fromAmino(object.tip); + } + return message; + }, + toAmino(message: AuthInfo): AuthInfoAmino { + const obj: any = {}; + if (message.signerInfos) { + obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e) : undefined); + } else { + obj.signer_infos = message.signerInfos; + } + obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; + obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; + return obj; + }, + fromAminoMsg(object: AuthInfoAminoMsg): AuthInfo { + return AuthInfo.fromAmino(object.value); + }, + toAminoMsg(message: AuthInfo): AuthInfoAminoMsg { + return { + type: "cosmos-sdk/AuthInfo", + value: AuthInfo.toAmino(message) + }; + }, + fromProtoMsg(message: AuthInfoProtoMsg): AuthInfo { + return AuthInfo.decode(message.value); + }, + toProto(message: AuthInfo): Uint8Array { + return AuthInfo.encode(message).finish(); + }, + toProtoMsg(message: AuthInfo): AuthInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo", + value: AuthInfo.encode(message).finish() + }; + } +}; +function createBaseSignerInfo(): SignerInfo { + return { + publicKey: undefined, + modeInfo: undefined, + sequence: BigInt(0) + }; +} +export const SignerInfo = { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo", + aminoType: "cosmos-sdk/SignerInfo", + encode(message: SignerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.modeInfo !== undefined) { + ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).ldelim(); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.modeInfo = ModeInfo.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignerInfo { + const message = createBaseSignerInfo(); + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + message.modeInfo = object.modeInfo !== undefined && object.modeInfo !== null ? ModeInfo.fromPartial(object.modeInfo) : undefined; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignerInfoAmino): SignerInfo { + const message = createBaseSignerInfo(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.mode_info !== undefined && object.mode_info !== null) { + message.modeInfo = ModeInfo.fromAmino(object.mode_info); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: SignerInfo): SignerInfoAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { + return SignerInfo.fromAmino(object.value); + }, + toAminoMsg(message: SignerInfo): SignerInfoAminoMsg { + return { + type: "cosmos-sdk/SignerInfo", + value: SignerInfo.toAmino(message) + }; + }, + fromProtoMsg(message: SignerInfoProtoMsg): SignerInfo { + return SignerInfo.decode(message.value); + }, + toProto(message: SignerInfo): Uint8Array { + return SignerInfo.encode(message).finish(); + }, + toProtoMsg(message: SignerInfo): SignerInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo", + value: SignerInfo.encode(message).finish() + }; + } +}; +function createBaseModeInfo(): ModeInfo { + return { + single: undefined, + multi: undefined + }; +} +export const ModeInfo = { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo", + aminoType: "cosmos-sdk/ModeInfo", + encode(message: ModeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.single !== undefined) { + ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); + } + if (message.multi !== undefined) { + ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.single = ModeInfo_Single.decode(reader, reader.uint32()); + break; + case 2: + message.multi = ModeInfo_Multi.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModeInfo { + const message = createBaseModeInfo(); + message.single = object.single !== undefined && object.single !== null ? ModeInfo_Single.fromPartial(object.single) : undefined; + message.multi = object.multi !== undefined && object.multi !== null ? ModeInfo_Multi.fromPartial(object.multi) : undefined; + return message; + }, + fromAmino(object: ModeInfoAmino): ModeInfo { + const message = createBaseModeInfo(); + if (object.single !== undefined && object.single !== null) { + message.single = ModeInfo_Single.fromAmino(object.single); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = ModeInfo_Multi.fromAmino(object.multi); + } + return message; + }, + toAmino(message: ModeInfo): ModeInfoAmino { + const obj: any = {}; + obj.single = message.single ? ModeInfo_Single.toAmino(message.single) : undefined; + obj.multi = message.multi ? ModeInfo_Multi.toAmino(message.multi) : undefined; + return obj; + }, + fromAminoMsg(object: ModeInfoAminoMsg): ModeInfo { + return ModeInfo.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo): ModeInfoAminoMsg { + return { + type: "cosmos-sdk/ModeInfo", + value: ModeInfo.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfoProtoMsg): ModeInfo { + return ModeInfo.decode(message.value); + }, + toProto(message: ModeInfo): Uint8Array { + return ModeInfo.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo): ModeInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo", + value: ModeInfo.encode(message).finish() + }; + } +}; +function createBaseModeInfo_Single(): ModeInfo_Single { + return { + mode: 0 + }; +} +export const ModeInfo_Single = { + typeUrl: "/cosmos.tx.v1beta1.Single", + aminoType: "cosmos-sdk/Single", + encode(message: ModeInfo_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModeInfo_Single { + const message = createBaseModeInfo_Single(); + message.mode = object.mode ?? 0; + return message; + }, + fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { + const message = createBaseModeInfo_Single(); + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } + return message; + }, + toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { + const obj: any = {}; + obj.mode = message.mode === 0 ? undefined : message.mode; + return obj; + }, + fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { + return ModeInfo_Single.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo_Single): ModeInfo_SingleAminoMsg { + return { + type: "cosmos-sdk/Single", + value: ModeInfo_Single.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfo_SingleProtoMsg): ModeInfo_Single { + return ModeInfo_Single.decode(message.value); + }, + toProto(message: ModeInfo_Single): Uint8Array { + return ModeInfo_Single.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo_Single): ModeInfo_SingleProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Single", + value: ModeInfo_Single.encode(message).finish() + }; + } +}; +function createBaseModeInfo_Multi(): ModeInfo_Multi { + return { + bitarray: undefined, + modeInfos: [] + }; +} +export const ModeInfo_Multi = { + typeUrl: "/cosmos.tx.v1beta1.Multi", + aminoType: "cosmos-sdk/Multi", + encode(message: ModeInfo_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.modeInfos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + break; + case 2: + message.modeInfos.push(ModeInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; + message.modeInfos = object.modeInfos?.map(e => ModeInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ModeInfo_MultiAmino): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + if (object.bitarray !== undefined && object.bitarray !== null) { + message.bitarray = CompactBitArray.fromAmino(object.bitarray); + } + message.modeInfos = object.mode_infos?.map(e => ModeInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: ModeInfo_Multi): ModeInfo_MultiAmino { + const obj: any = {}; + obj.bitarray = message.bitarray ? CompactBitArray.toAmino(message.bitarray) : undefined; + if (message.modeInfos) { + obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e) : undefined); + } else { + obj.mode_infos = message.modeInfos; + } + return obj; + }, + fromAminoMsg(object: ModeInfo_MultiAminoMsg): ModeInfo_Multi { + return ModeInfo_Multi.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo_Multi): ModeInfo_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: ModeInfo_Multi.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfo_MultiProtoMsg): ModeInfo_Multi { + return ModeInfo_Multi.decode(message.value); + }, + toProto(message: ModeInfo_Multi): Uint8Array { + return ModeInfo_Multi.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo_Multi): ModeInfo_MultiProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Multi", + value: ModeInfo_Multi.encode(message).finish() + }; + } +}; +function createBaseFee(): Fee { + return { + amount: [], + gasLimit: BigInt(0), + payer: "", + granter: "" + }; +} +export const Fee = { + typeUrl: "/cosmos.tx.v1beta1.Fee", + aminoType: "cosmos-sdk/Fee", + encode(message: Fee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.gasLimit !== BigInt(0)) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.gasLimit = reader.uint64(); + break; + case 3: + message.payer = reader.string(); + break; + case 4: + message.granter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + message.gasLimit = object.gasLimit !== undefined && object.gasLimit !== null ? BigInt(object.gasLimit.toString()) : BigInt(0); + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, + fromAmino(object: FeeAmino): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.gas_limit !== undefined && object.gas_limit !== null) { + message.gasLimit = BigInt(object.gas_limit); + } + if (object.payer !== undefined && object.payer !== null) { + message.payer = object.payer; + } + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + return message; + }, + toAmino(message: Fee): FeeAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + obj.gas_limit = message.gasLimit !== BigInt(0) ? message.gasLimit.toString() : undefined; + obj.payer = message.payer === "" ? undefined : message.payer; + obj.granter = message.granter === "" ? undefined : message.granter; + return obj; + }, + fromAminoMsg(object: FeeAminoMsg): Fee { + return Fee.fromAmino(object.value); + }, + toAminoMsg(message: Fee): FeeAminoMsg { + return { + type: "cosmos-sdk/Fee", + value: Fee.toAmino(message) + }; + }, + fromProtoMsg(message: FeeProtoMsg): Fee { + return Fee.decode(message.value); + }, + toProto(message: Fee): Uint8Array { + return Fee.encode(message).finish(); + }, + toProtoMsg(message: Fee): FeeProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Fee", + value: Fee.encode(message).finish() + }; + } +}; +function createBaseTip(): Tip { + return { + amount: [], + tipper: "" + }; +} +export const Tip = { + typeUrl: "/cosmos.tx.v1beta1.Tip", + aminoType: "cosmos-sdk/Tip", + encode(message: Tip, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.tipper !== "") { + writer.uint32(18).string(message.tipper); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Tip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTip(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.tipper = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Tip { + const message = createBaseTip(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + message.tipper = object.tipper ?? ""; + return message; + }, + fromAmino(object: TipAmino): Tip { + const message = createBaseTip(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.tipper !== undefined && object.tipper !== null) { + message.tipper = object.tipper; + } + return message; + }, + toAmino(message: Tip): TipAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + obj.tipper = message.tipper === "" ? undefined : message.tipper; + return obj; + }, + fromAminoMsg(object: TipAminoMsg): Tip { + return Tip.fromAmino(object.value); + }, + toAminoMsg(message: Tip): TipAminoMsg { + return { + type: "cosmos-sdk/Tip", + value: Tip.toAmino(message) + }; + }, + fromProtoMsg(message: TipProtoMsg): Tip { + return Tip.decode(message.value); + }, + toProto(message: Tip): Uint8Array { + return Tip.encode(message).finish(); + }, + toProtoMsg(message: Tip): TipProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Tip", + value: Tip.encode(message).finish() + }; + } +}; +function createBaseAuxSignerData(): AuxSignerData { + return { + address: "", + signDoc: undefined, + mode: 0, + sig: new Uint8Array() + }; +} +export const AuxSignerData = { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", + aminoType: "cosmos-sdk/AuxSignerData", + encode(message: AuxSignerData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.signDoc !== undefined) { + SignDocDirectAux.encode(message.signDoc, writer.uint32(18).fork()).ldelim(); + } + if (message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.sig.length !== 0) { + writer.uint32(34).bytes(message.sig); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuxSignerData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.signDoc = SignDocDirectAux.decode(reader, reader.uint32()); + break; + case 3: + message.mode = (reader.int32() as any); + break; + case 4: + message.sig = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.signDoc = object.signDoc !== undefined && object.signDoc !== null ? SignDocDirectAux.fromPartial(object.signDoc) : undefined; + message.mode = object.mode ?? 0; + message.sig = object.sig ?? new Uint8Array(); + return message; + }, + fromAmino(object: AuxSignerDataAmino): AuxSignerData { + const message = createBaseAuxSignerData(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.sign_doc !== undefined && object.sign_doc !== null) { + message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); + } + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } + if (object.sig !== undefined && object.sig !== null) { + message.sig = bytesFromBase64(object.sig); + } + return message; + }, + toAmino(message: AuxSignerData): AuxSignerDataAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; + obj.mode = message.mode === 0 ? undefined : message.mode; + obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; + return obj; + }, + fromAminoMsg(object: AuxSignerDataAminoMsg): AuxSignerData { + return AuxSignerData.fromAmino(object.value); + }, + toAminoMsg(message: AuxSignerData): AuxSignerDataAminoMsg { + return { + type: "cosmos-sdk/AuxSignerData", + value: AuxSignerData.toAmino(message) + }; + }, + fromProtoMsg(message: AuxSignerDataProtoMsg): AuxSignerData { + return AuxSignerData.decode(message.value); + }, + toProto(message: AuxSignerData): Uint8Array { + return AuxSignerData.encode(message).finish(); + }, + toProtoMsg(message: AuxSignerData): AuxSignerDataProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", + value: AuxSignerData.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/module/v1/module.ts b/util/inj-types/cosmos/upgrade/module/v1/module.ts new file mode 100644 index 00000000..fab75334 --- /dev/null +++ b/util/inj-types/cosmos/upgrade/module/v1/module.ts @@ -0,0 +1,94 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the upgrade module. */ +export interface Module { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority: string; +} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.upgrade.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the upgrade module. */ +export interface ModuleAmino { + /** authority defines the custom module authority. If not set, defaults to the governance module. */ + authority?: string; +} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the upgrade module. */ +export interface ModuleSDKType { + authority: string; +} +function createBaseModule(): Module { + return { + authority: "" + }; +} +export const Module = { + typeUrl: "/cosmos.upgrade.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Module { + const message = createBaseModule(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: ModuleAmino): Module { + const message = createBaseModule(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: Module): ModuleAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.upgrade.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/v1beta1/query.lcd.ts b/util/inj-types/cosmos/upgrade/v1beta1/query.lcd.ts new file mode 100644 index 00000000..3b8af5da --- /dev/null +++ b/util/inj-types/cosmos/upgrade/v1beta1/query.lcd.ts @@ -0,0 +1,52 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryCurrentPlanRequest, QueryCurrentPlanResponseSDKType, QueryAppliedPlanRequest, QueryAppliedPlanResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponseSDKType, QueryModuleVersionsRequest, QueryModuleVersionsResponseSDKType, QueryAuthorityRequest, QueryAuthorityResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* CurrentPlan queries the current upgrade plan. */ + currentPlan = async (_params: QueryCurrentPlanRequest = {}): Promise => { + const endpoint = `cosmos/upgrade/v1beta1/current_plan`; + return await this.req.get(endpoint); + }; + /* AppliedPlan queries a previously applied upgrade plan by its name. */ + appliedPlan = async (params: QueryAppliedPlanRequest): Promise => { + const endpoint = `cosmos/upgrade/v1beta1/applied_plan/${params.name}`; + return await this.req.get(endpoint); + }; + /* UpgradedConsensusState queries the consensus state that will serve + as a trusted kernel for the next version of this chain. It will only be + stored at the last height of this chain. + UpgradedConsensusState RPC not supported with legacy querier + This rpc is deprecated now that IBC has its own replacement + (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) */ + upgradedConsensusState = async (params: QueryUpgradedConsensusStateRequest): Promise => { + const endpoint = `cosmos/upgrade/v1beta1/upgraded_consensus_state/${params.lastHeight}`; + return await this.req.get(endpoint); + }; + /* ModuleVersions queries the list of module versions from state. + + Since: cosmos-sdk 0.43 */ + moduleVersions = async (params: QueryModuleVersionsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.moduleName !== "undefined") { + options.params.module_name = params.moduleName; + } + const endpoint = `cosmos/upgrade/v1beta1/module_versions`; + return await this.req.get(endpoint, options); + }; + /* Returns the account with authority to conduct upgrades + + Since: cosmos-sdk 0.46 */ + authority = async (_params: QueryAuthorityRequest = {}): Promise => { + const endpoint = `cosmos/upgrade/v1beta1/authority`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/v1beta1/query.rpc.Query.ts b/util/inj-types/cosmos/upgrade/v1beta1/query.rpc.Query.ts new file mode 100644 index 00000000..90b7f67d --- /dev/null +++ b/util/inj-types/cosmos/upgrade/v1beta1/query.rpc.Query.ts @@ -0,0 +1,98 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryCurrentPlanRequest, QueryCurrentPlanResponse, QueryAppliedPlanRequest, QueryAppliedPlanResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse, QueryModuleVersionsRequest, QueryModuleVersionsResponse, QueryAuthorityRequest, QueryAuthorityResponse } from "./query"; +/** Query defines the gRPC upgrade querier service. */ +export interface Query { + /** CurrentPlan queries the current upgrade plan. */ + currentPlan(request?: QueryCurrentPlanRequest): Promise; + /** AppliedPlan queries a previously applied upgrade plan by its name. */ + appliedPlan(request: QueryAppliedPlanRequest): Promise; + /** + * UpgradedConsensusState queries the consensus state that will serve + * as a trusted kernel for the next version of this chain. It will only be + * stored at the last height of this chain. + * UpgradedConsensusState RPC not supported with legacy querier + * This rpc is deprecated now that IBC has its own replacement + * (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) + */ + upgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise; + /** + * ModuleVersions queries the list of module versions from state. + * + * Since: cosmos-sdk 0.43 + */ + moduleVersions(request: QueryModuleVersionsRequest): Promise; + /** + * Returns the account with authority to conduct upgrades + * + * Since: cosmos-sdk 0.46 + */ + authority(request?: QueryAuthorityRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* CurrentPlan queries the current upgrade plan. */ + currentPlan = async (request: QueryCurrentPlanRequest = {}): Promise => { + const data = QueryCurrentPlanRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.upgrade.v1beta1.Query", "CurrentPlan", data); + return promise.then(data => QueryCurrentPlanResponse.decode(new BinaryReader(data))); + }; + /* AppliedPlan queries a previously applied upgrade plan by its name. */ + appliedPlan = async (request: QueryAppliedPlanRequest): Promise => { + const data = QueryAppliedPlanRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.upgrade.v1beta1.Query", "AppliedPlan", data); + return promise.then(data => QueryAppliedPlanResponse.decode(new BinaryReader(data))); + }; + /* UpgradedConsensusState queries the consensus state that will serve + as a trusted kernel for the next version of this chain. It will only be + stored at the last height of this chain. + UpgradedConsensusState RPC not supported with legacy querier + This rpc is deprecated now that IBC has its own replacement + (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) */ + upgradedConsensusState = async (request: QueryUpgradedConsensusStateRequest): Promise => { + const data = QueryUpgradedConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.upgrade.v1beta1.Query", "UpgradedConsensusState", data); + return promise.then(data => QueryUpgradedConsensusStateResponse.decode(new BinaryReader(data))); + }; + /* ModuleVersions queries the list of module versions from state. + + Since: cosmos-sdk 0.43 */ + moduleVersions = async (request: QueryModuleVersionsRequest): Promise => { + const data = QueryModuleVersionsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.upgrade.v1beta1.Query", "ModuleVersions", data); + return promise.then(data => QueryModuleVersionsResponse.decode(new BinaryReader(data))); + }; + /* Returns the account with authority to conduct upgrades + + Since: cosmos-sdk 0.46 */ + authority = async (request: QueryAuthorityRequest = {}): Promise => { + const data = QueryAuthorityRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.upgrade.v1beta1.Query", "Authority", data); + return promise.then(data => QueryAuthorityResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + currentPlan(request?: QueryCurrentPlanRequest): Promise { + return queryService.currentPlan(request); + }, + appliedPlan(request: QueryAppliedPlanRequest): Promise { + return queryService.appliedPlan(request); + }, + upgradedConsensusState(request: QueryUpgradedConsensusStateRequest): Promise { + return queryService.upgradedConsensusState(request); + }, + moduleVersions(request: QueryModuleVersionsRequest): Promise { + return queryService.moduleVersions(request); + }, + authority(request?: QueryAuthorityRequest): Promise { + return queryService.authority(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/v1beta1/query.ts b/util/inj-types/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 00000000..977cfdbc --- /dev/null +++ b/util/inj-types/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,1009 @@ +import { Plan, PlanAmino, PlanSDKType, ModuleVersion, ModuleVersionAmino, ModuleVersionSDKType } from "./upgrade"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** + * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanRequest {} +export interface QueryCurrentPlanRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest"; + value: Uint8Array; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanRequestAmino {} +export interface QueryCurrentPlanRequestAminoMsg { + type: "cosmos-sdk/QueryCurrentPlanRequest"; + value: QueryCurrentPlanRequestAmino; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanRequestSDKType {} +/** + * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanResponse { + /** plan is the current upgrade plan. */ + plan?: Plan; +} +export interface QueryCurrentPlanResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse"; + value: Uint8Array; +} +/** + * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanResponseAmino { + /** plan is the current upgrade plan. */ + plan?: PlanAmino; +} +export interface QueryCurrentPlanResponseAminoMsg { + type: "cosmos-sdk/QueryCurrentPlanResponse"; + value: QueryCurrentPlanResponseAmino; +} +/** + * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanResponseSDKType { + plan?: PlanSDKType; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanRequest { + /** name is the name of the applied plan to query for. */ + name: string; +} +export interface QueryAppliedPlanRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest"; + value: Uint8Array; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanRequestAmino { + /** name is the name of the applied plan to query for. */ + name?: string; +} +export interface QueryAppliedPlanRequestAminoMsg { + type: "cosmos-sdk/QueryAppliedPlanRequest"; + value: QueryAppliedPlanRequestAmino; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanRequestSDKType { + name: string; +} +/** + * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanResponse { + /** height is the block height at which the plan was applied. */ + height: bigint; +} +export interface QueryAppliedPlanResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse"; + value: Uint8Array; +} +/** + * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanResponseAmino { + /** height is the block height at which the plan was applied. */ + height?: string; +} +export interface QueryAppliedPlanResponseAminoMsg { + type: "cosmos-sdk/QueryAppliedPlanResponse"; + value: QueryAppliedPlanResponseAmino; +} +/** + * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanResponseSDKType { + height: bigint; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateRequest { + /** + * last height of the current chain must be sent in request + * as this is the height under which next consensus state is stored + */ + lastHeight: bigint; +} +export interface QueryUpgradedConsensusStateRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateRequestAmino { + /** + * last height of the current chain must be sent in request + * as this is the height under which next consensus state is stored + */ + last_height?: string; +} +export interface QueryUpgradedConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest"; + value: QueryUpgradedConsensusStateRequestAmino; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateRequestSDKType { + last_height: bigint; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateResponse { + /** Since: cosmos-sdk 0.43 */ + upgradedConsensusState: Uint8Array; +} +export interface QueryUpgradedConsensusStateResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateResponseAmino { + /** Since: cosmos-sdk 0.43 */ + upgraded_consensus_state?: string; +} +export interface QueryUpgradedConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse"; + value: QueryUpgradedConsensusStateResponseAmino; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateResponseSDKType { + upgraded_consensus_state: Uint8Array; +} +/** + * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsRequest { + /** + * module_name is a field to query a specific module + * consensus version from state. Leaving this empty will + * fetch the full list of module versions from state + */ + moduleName?: string; +} +export interface QueryModuleVersionsRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest"; + value: Uint8Array; +} +/** + * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsRequestAmino { + /** + * module_name is a field to query a specific module + * consensus version from state. Leaving this empty will + * fetch the full list of module versions from state + */ + module_name?: string; +} +export interface QueryModuleVersionsRequestAminoMsg { + type: "cosmos-sdk/QueryModuleVersionsRequest"; + value: QueryModuleVersionsRequestAmino; +} +/** + * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsRequestSDKType { + module_name?: string; +} +/** + * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsResponse { + /** module_versions is a list of module names with their consensus versions. */ + moduleVersions: ModuleVersion[]; +} +export interface QueryModuleVersionsResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse"; + value: Uint8Array; +} +/** + * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsResponseAmino { + /** module_versions is a list of module names with their consensus versions. */ + module_versions?: ModuleVersionAmino[]; +} +export interface QueryModuleVersionsResponseAminoMsg { + type: "cosmos-sdk/QueryModuleVersionsResponse"; + value: QueryModuleVersionsResponseAmino; +} +/** + * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsResponseSDKType { + module_versions: ModuleVersionSDKType[]; +} +/** + * QueryAuthorityRequest is the request type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityRequest {} +export interface QueryAuthorityRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest"; + value: Uint8Array; +} +/** + * QueryAuthorityRequest is the request type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityRequestAmino {} +export interface QueryAuthorityRequestAminoMsg { + type: "cosmos-sdk/QueryAuthorityRequest"; + value: QueryAuthorityRequestAmino; +} +/** + * QueryAuthorityRequest is the request type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityRequestSDKType {} +/** + * QueryAuthorityResponse is the response type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityResponse { + address: string; +} +export interface QueryAuthorityResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse"; + value: Uint8Array; +} +/** + * QueryAuthorityResponse is the response type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityResponseAmino { + address?: string; +} +export interface QueryAuthorityResponseAminoMsg { + type: "cosmos-sdk/QueryAuthorityResponse"; + value: QueryAuthorityResponseAmino; +} +/** + * QueryAuthorityResponse is the response type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityResponseSDKType { + address: string; +} +function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { + return {}; +} +export const QueryCurrentPlanRequest = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", + aminoType: "cosmos-sdk/QueryCurrentPlanRequest", + encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, + fromAmino(_: QueryCurrentPlanRequestAmino): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, + toAmino(_: QueryCurrentPlanRequest): QueryCurrentPlanRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryCurrentPlanRequestAminoMsg): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCurrentPlanRequest): QueryCurrentPlanRequestAminoMsg { + return { + type: "cosmos-sdk/QueryCurrentPlanRequest", + value: QueryCurrentPlanRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCurrentPlanRequestProtoMsg): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.decode(message.value); + }, + toProto(message: QueryCurrentPlanRequest): Uint8Array { + return QueryCurrentPlanRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCurrentPlanRequest): QueryCurrentPlanRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", + value: QueryCurrentPlanRequest.encode(message).finish() + }; + } +}; +function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { + return { + plan: undefined + }; +} +export const QueryCurrentPlanResponse = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", + aminoType: "cosmos-sdk/QueryCurrentPlanResponse", + encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.plan = Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryCurrentPlanResponse { + const message = createBaseQueryCurrentPlanResponse(); + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + return message; + }, + fromAmino(object: QueryCurrentPlanResponseAmino): QueryCurrentPlanResponse { + const message = createBaseQueryCurrentPlanResponse(); + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + return message; + }, + toAmino(message: QueryCurrentPlanResponse): QueryCurrentPlanResponseAmino { + const obj: any = {}; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + return obj; + }, + fromAminoMsg(object: QueryCurrentPlanResponseAminoMsg): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCurrentPlanResponse): QueryCurrentPlanResponseAminoMsg { + return { + type: "cosmos-sdk/QueryCurrentPlanResponse", + value: QueryCurrentPlanResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCurrentPlanResponseProtoMsg): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.decode(message.value); + }, + toProto(message: QueryCurrentPlanResponse): Uint8Array { + return QueryCurrentPlanResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCurrentPlanResponse): QueryCurrentPlanResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", + value: QueryCurrentPlanResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { + return { + name: "" + }; +} +export const QueryAppliedPlanRequest = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", + aminoType: "cosmos-sdk/QueryAppliedPlanRequest", + encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAppliedPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + message.name = object.name ?? ""; + return message; + }, + fromAmino(object: QueryAppliedPlanRequestAmino): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + return message; + }, + toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + return obj; + }, + fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAppliedPlanRequest", + value: QueryAppliedPlanRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAppliedPlanRequestProtoMsg): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.decode(message.value); + }, + toProto(message: QueryAppliedPlanRequest): Uint8Array { + return QueryAppliedPlanRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", + value: QueryAppliedPlanRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { + return { + height: BigInt(0) + }; +} +export const QueryAppliedPlanResponse = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", + aminoType: "cosmos-sdk/QueryAppliedPlanResponse", + encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAppliedPlanResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryAppliedPlanResponseAmino): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAppliedPlanResponse", + value: QueryAppliedPlanResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAppliedPlanResponseProtoMsg): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.decode(message.value); + }, + toProto(message: QueryAppliedPlanResponse): Uint8Array { + return QueryAppliedPlanResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", + value: QueryAppliedPlanResponse.encode(message).finish() + }; + } +}; +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return { + lastHeight: BigInt(0) + }; +} +export const QueryUpgradedConsensusStateRequest = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", + aminoType: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.lastHeight !== BigInt(0)) { + writer.uint32(8).int64(message.lastHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lastHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + message.lastHeight = object.lastHeight !== undefined && object.lastHeight !== null ? BigInt(object.lastHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryUpgradedConsensusStateRequestAmino): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + if (object.last_height !== undefined && object.last_height !== null) { + message.lastHeight = BigInt(object.last_height); + } + return message; + }, + toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { + const obj: any = {}; + obj.last_height = message.lastHeight !== BigInt(0) ? message.lastHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedConsensusStateRequestProtoMsg): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateRequest): Uint8Array { + return QueryUpgradedConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: new Uint8Array() + }; +} +export const QueryUpgradedConsensusStateResponse = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", + aminoType: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.upgradedConsensusState.length !== 0) { + writer.uint32(18).bytes(message.upgradedConsensusState); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.upgradedConsensusState = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgradedConsensusState = object.upgradedConsensusState ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryUpgradedConsensusStateResponseAmino): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + if (object.upgraded_consensus_state !== undefined && object.upgraded_consensus_state !== null) { + message.upgradedConsensusState = bytesFromBase64(object.upgraded_consensus_state); + } + return message; + }, + toAmino(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseAmino { + const obj: any = {}; + obj.upgraded_consensus_state = message.upgradedConsensusState ? base64FromBytes(message.upgradedConsensusState) : undefined; + return obj; + }, + fromAminoMsg(object: QueryUpgradedConsensusStateResponseAminoMsg): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedConsensusStateResponseProtoMsg): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateResponse): Uint8Array { + return QueryUpgradedConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { + return { + moduleName: "" + }; +} +export const QueryModuleVersionsRequest = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", + aminoType: "cosmos-sdk/QueryModuleVersionsRequest", + encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleVersionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moduleName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + message.moduleName = object.moduleName ?? ""; + return message; + }, + fromAmino(object: QueryModuleVersionsRequestAmino): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + if (object.module_name !== undefined && object.module_name !== null) { + message.moduleName = object.module_name; + } + return message; + }, + toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { + const obj: any = {}; + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; + return obj; + }, + fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryModuleVersionsRequest", + value: QueryModuleVersionsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleVersionsRequestProtoMsg): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.decode(message.value); + }, + toProto(message: QueryModuleVersionsRequest): Uint8Array { + return QueryModuleVersionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", + value: QueryModuleVersionsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { + return { + moduleVersions: [] + }; +} +export const QueryModuleVersionsResponse = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", + aminoType: "cosmos-sdk/QueryModuleVersionsResponse", + encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.moduleVersions) { + ModuleVersion.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleVersionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moduleVersions.push(ModuleVersion.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.moduleVersions = object.moduleVersions?.map(e => ModuleVersion.fromPartial(e)) || []; + return message; + }, + fromAmino(object: QueryModuleVersionsResponseAmino): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.moduleVersions = object.module_versions?.map(e => ModuleVersion.fromAmino(e)) || []; + return message; + }, + toAmino(message: QueryModuleVersionsResponse): QueryModuleVersionsResponseAmino { + const obj: any = {}; + if (message.moduleVersions) { + obj.module_versions = message.moduleVersions.map(e => e ? ModuleVersion.toAmino(e) : undefined); + } else { + obj.module_versions = message.moduleVersions; + } + return obj; + }, + fromAminoMsg(object: QueryModuleVersionsResponseAminoMsg): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleVersionsResponse): QueryModuleVersionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryModuleVersionsResponse", + value: QueryModuleVersionsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleVersionsResponseProtoMsg): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.decode(message.value); + }, + toProto(message: QueryModuleVersionsResponse): Uint8Array { + return QueryModuleVersionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleVersionsResponse): QueryModuleVersionsResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", + value: QueryModuleVersionsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { + return {}; +} +export const QueryAuthorityRequest = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", + aminoType: "cosmos-sdk/QueryAuthorityRequest", + encode(_: QueryAuthorityRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, + fromAmino(_: QueryAuthorityRequestAmino): QueryAuthorityRequest { + const message = createBaseQueryAuthorityRequest(); + return message; + }, + toAmino(_: QueryAuthorityRequest): QueryAuthorityRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryAuthorityRequestAminoMsg): QueryAuthorityRequest { + return QueryAuthorityRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAuthorityRequest): QueryAuthorityRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAuthorityRequest", + value: QueryAuthorityRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAuthorityRequestProtoMsg): QueryAuthorityRequest { + return QueryAuthorityRequest.decode(message.value); + }, + toProto(message: QueryAuthorityRequest): Uint8Array { + return QueryAuthorityRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAuthorityRequest): QueryAuthorityRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", + value: QueryAuthorityRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { + return { + address: "" + }; +} +export const QueryAuthorityResponse = { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", + aminoType: "cosmos-sdk/QueryAuthorityResponse", + encode(message: QueryAuthorityResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAuthorityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAuthorityResponse(); + 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: DeepPartial): QueryAuthorityResponse { + const message = createBaseQueryAuthorityResponse(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryAuthorityResponseAmino): QueryAuthorityResponse { + const message = createBaseQueryAuthorityResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { + return QueryAuthorityResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAuthorityResponse): QueryAuthorityResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAuthorityResponse", + value: QueryAuthorityResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAuthorityResponseProtoMsg): QueryAuthorityResponse { + return QueryAuthorityResponse.decode(message.value); + }, + toProto(message: QueryAuthorityResponse): Uint8Array { + return QueryAuthorityResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAuthorityResponse): QueryAuthorityResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", + value: QueryAuthorityResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/v1beta1/tx.amino.ts b/util/inj-types/cosmos/upgrade/v1beta1/tx.amino.ts new file mode 100644 index 00000000..1734b0fa --- /dev/null +++ b/util/inj-types/cosmos/upgrade/v1beta1/tx.amino.ts @@ -0,0 +1,13 @@ +import { MsgSoftwareUpgrade, MsgCancelUpgrade } from "./tx"; +export const AminoConverter = { + "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade": { + aminoType: "cosmos-sdk/MsgSoftwareUpgrade", + toAmino: MsgSoftwareUpgrade.toAmino, + fromAmino: MsgSoftwareUpgrade.fromAmino + }, + "/cosmos.upgrade.v1beta1.MsgCancelUpgrade": { + aminoType: "cosmos-sdk/MsgCancelUpgrade", + toAmino: MsgCancelUpgrade.toAmino, + fromAmino: MsgCancelUpgrade.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/v1beta1/tx.registry.ts b/util/inj-types/cosmos/upgrade/v1beta1/tx.registry.ts new file mode 100644 index 00000000..019dde52 --- /dev/null +++ b/util/inj-types/cosmos/upgrade/v1beta1/tx.registry.ts @@ -0,0 +1,53 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgSoftwareUpgrade, MsgCancelUpgrade } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", MsgSoftwareUpgrade], ["/cosmos.upgrade.v1beta1.MsgCancelUpgrade", MsgCancelUpgrade]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + softwareUpgrade(value: MsgSoftwareUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.encode(value).finish() + }; + }, + cancelUpgrade(value: MsgCancelUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.encode(value).finish() + }; + } + }, + withTypeUrl: { + softwareUpgrade(value: MsgSoftwareUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value + }; + }, + cancelUpgrade(value: MsgCancelUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value + }; + } + }, + fromPartial: { + softwareUpgrade(value: MsgSoftwareUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.fromPartial(value) + }; + }, + cancelUpgrade(value: MsgCancelUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/upgrade/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..f371c5e7 --- /dev/null +++ b/util/inj-types/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,42 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgSoftwareUpgrade, MsgSoftwareUpgradeResponse, MsgCancelUpgrade, MsgCancelUpgradeResponse } from "./tx"; +/** Msg defines the upgrade Msg service. */ +export interface Msg { + /** + * SoftwareUpgrade is a governance operation for initiating a software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + softwareUpgrade(request: MsgSoftwareUpgrade): Promise; + /** + * CancelUpgrade is a governance operation for cancelling a previously + * approved software upgrade. + * + * Since: cosmos-sdk 0.46 + */ + cancelUpgrade(request: MsgCancelUpgrade): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* SoftwareUpgrade is a governance operation for initiating a software upgrade. + + Since: cosmos-sdk 0.46 */ + softwareUpgrade = async (request: MsgSoftwareUpgrade): Promise => { + const data = MsgSoftwareUpgrade.encode(request).finish(); + const promise = this.rpc.request("cosmos.upgrade.v1beta1.Msg", "SoftwareUpgrade", data); + return promise.then(data => MsgSoftwareUpgradeResponse.decode(new BinaryReader(data))); + }; + /* CancelUpgrade is a governance operation for cancelling a previously + approved software upgrade. + + Since: cosmos-sdk 0.46 */ + cancelUpgrade = async (request: MsgCancelUpgrade): Promise => { + const data = MsgCancelUpgrade.encode(request).finish(); + const promise = this.rpc.request("cosmos.upgrade.v1beta1.Msg", "CancelUpgrade", data); + return promise.then(data => MsgCancelUpgradeResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/v1beta1/tx.ts b/util/inj-types/cosmos/upgrade/v1beta1/tx.ts new file mode 100644 index 00000000..b3892b45 --- /dev/null +++ b/util/inj-types/cosmos/upgrade/v1beta1/tx.ts @@ -0,0 +1,394 @@ +import { Plan, PlanAmino, PlanSDKType } from "./upgrade"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgrade { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** plan is the upgrade plan. */ + plan: Plan; +} +export interface MsgSoftwareUpgradeProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"; + value: Uint8Array; +} +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; + /** plan is the upgrade plan. */ + plan: PlanAmino; +} +export interface MsgSoftwareUpgradeAminoMsg { + type: "cosmos-sdk/MsgSoftwareUpgrade"; + value: MsgSoftwareUpgradeAmino; +} +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeSDKType { + authority: string; + plan: PlanSDKType; +} +/** + * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeResponse {} +export interface MsgSoftwareUpgradeResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse"; + value: Uint8Array; +} +/** + * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeResponseAmino {} +export interface MsgSoftwareUpgradeResponseAminoMsg { + type: "cosmos-sdk/MsgSoftwareUpgradeResponse"; + value: MsgSoftwareUpgradeResponseAmino; +} +/** + * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeResponseSDKType {} +/** + * MsgCancelUpgrade is the Msg/CancelUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgrade { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; +} +export interface MsgCancelUpgradeProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade"; + value: Uint8Array; +} +/** + * MsgCancelUpgrade is the Msg/CancelUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority?: string; +} +export interface MsgCancelUpgradeAminoMsg { + type: "cosmos-sdk/MsgCancelUpgrade"; + value: MsgCancelUpgradeAmino; +} +/** + * MsgCancelUpgrade is the Msg/CancelUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeSDKType { + authority: string; +} +/** + * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeResponse {} +export interface MsgCancelUpgradeResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse"; + value: Uint8Array; +} +/** + * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeResponseAmino {} +export interface MsgCancelUpgradeResponseAminoMsg { + type: "cosmos-sdk/MsgCancelUpgradeResponse"; + value: MsgCancelUpgradeResponseAmino; +} +/** + * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeResponseSDKType {} +function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { + return { + authority: "", + plan: Plan.fromPartial({}) + }; +} +export const MsgSoftwareUpgrade = { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + aminoType: "cosmos-sdk/MsgSoftwareUpgrade", + encode(message: MsgSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.plan = Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSoftwareUpgrade { + const message = createBaseMsgSoftwareUpgrade(); + message.authority = object.authority ?? ""; + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + return message; + }, + fromAmino(object: MsgSoftwareUpgradeAmino): MsgSoftwareUpgrade { + const message = createBaseMsgSoftwareUpgrade(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + return message; + }, + toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.plan = message.plan ? Plan.toAmino(message.plan) : Plan.toAmino(Plan.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgSoftwareUpgradeAminoMsg): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.fromAmino(object.value); + }, + toAminoMsg(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoMsg { + return { + type: "cosmos-sdk/MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSoftwareUpgradeProtoMsg): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.decode(message.value); + }, + toProto(message: MsgSoftwareUpgrade): Uint8Array { + return MsgSoftwareUpgrade.encode(message).finish(); + }, + toProtoMsg(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.encode(message).finish() + }; + } +}; +function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { + return {}; +} +export const MsgSoftwareUpgradeResponse = { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", + aminoType: "cosmos-sdk/MsgSoftwareUpgradeResponse", + encode(_: MsgSoftwareUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, + fromAmino(_: MsgSoftwareUpgradeResponseAmino): MsgSoftwareUpgradeResponse { + const message = createBaseMsgSoftwareUpgradeResponse(); + return message; + }, + toAmino(_: MsgSoftwareUpgradeResponse): MsgSoftwareUpgradeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSoftwareUpgradeResponseAminoMsg): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSoftwareUpgradeResponse): MsgSoftwareUpgradeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSoftwareUpgradeResponse", + value: MsgSoftwareUpgradeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSoftwareUpgradeResponseProtoMsg): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.decode(message.value); + }, + toProto(message: MsgSoftwareUpgradeResponse): Uint8Array { + return MsgSoftwareUpgradeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSoftwareUpgradeResponse): MsgSoftwareUpgradeResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", + value: MsgSoftwareUpgradeResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { + return { + authority: "" + }; +} +export const MsgCancelUpgrade = { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + aminoType: "cosmos-sdk/MsgCancelUpgrade", + encode(message: MsgCancelUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: MsgCancelUpgradeAmino): MsgCancelUpgrade { + const message = createBaseMsgCancelUpgrade(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { + return MsgCancelUpgrade.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUpgrade): MsgCancelUpgradeAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUpgrade", + value: MsgCancelUpgrade.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelUpgradeProtoMsg): MsgCancelUpgrade { + return MsgCancelUpgrade.decode(message.value); + }, + toProto(message: MsgCancelUpgrade): Uint8Array { + return MsgCancelUpgrade.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUpgrade): MsgCancelUpgradeProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.encode(message).finish() + }; + } +}; +function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { + return {}; +} +export const MsgCancelUpgradeResponse = { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", + aminoType: "cosmos-sdk/MsgCancelUpgradeResponse", + encode(_: MsgCancelUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCancelUpgradeResponse { + const message = createBaseMsgCancelUpgradeResponse(); + return message; + }, + fromAmino(_: MsgCancelUpgradeResponseAmino): MsgCancelUpgradeResponse { + const message = createBaseMsgCancelUpgradeResponse(); + return message; + }, + toAmino(_: MsgCancelUpgradeResponse): MsgCancelUpgradeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCancelUpgradeResponseAminoMsg): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUpgradeResponse): MsgCancelUpgradeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUpgradeResponse", + value: MsgCancelUpgradeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelUpgradeResponseProtoMsg): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.decode(message.value); + }, + toProto(message: MsgCancelUpgradeResponse): Uint8Array { + return MsgCancelUpgradeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUpgradeResponse): MsgCancelUpgradeResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", + value: MsgCancelUpgradeResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/upgrade/v1beta1/upgrade.ts b/util/inj-types/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 00000000..fa05d525 --- /dev/null +++ b/util/inj-types/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,606 @@ +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; +/** Plan specifies information about a planned upgrade and when it should occur. */ +export interface Plan { + /** + * Sets the name for the upgrade. This name will be used by the upgraded + * version of the software to apply any special "on-upgrade" commands during + * the first BeginBlock method after the upgrade is applied. It is also used + * to detect whether a software version can handle a given upgrade. If no + * upgrade handler with this name has been set in the software, it will be + * assumed that the software is out-of-date when the upgrade Time or Height is + * reached and the software will exit. + */ + name: string; + /** + * Deprecated: Time based upgrades have been deprecated. Time based upgrade logic + * has been removed from the SDK. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + time: Date; + /** The height at which the upgrade must be performed. */ + height: bigint; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + upgradedClientState?: Any; +} +export interface PlanProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.Plan"; + value: Uint8Array; +} +/** Plan specifies information about a planned upgrade and when it should occur. */ +export interface PlanAmino { + /** + * Sets the name for the upgrade. This name will be used by the upgraded + * version of the software to apply any special "on-upgrade" commands during + * the first BeginBlock method after the upgrade is applied. It is also used + * to detect whether a software version can handle a given upgrade. If no + * upgrade handler with this name has been set in the software, it will be + * assumed that the software is out-of-date when the upgrade Time or Height is + * reached and the software will exit. + */ + name?: string; + /** + * Deprecated: Time based upgrades have been deprecated. Time based upgrade logic + * has been removed from the SDK. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + time: string; + /** The height at which the upgrade must be performed. */ + height?: string; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info?: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + upgraded_client_state?: AnyAmino; +} +export interface PlanAminoMsg { + type: "cosmos-sdk/Plan"; + value: PlanAmino; +} +/** Plan specifies information about a planned upgrade and when it should occur. */ +export interface PlanSDKType { + name: string; + /** @deprecated */ + time: Date; + height: bigint; + info: string; + /** @deprecated */ + upgraded_client_state?: AnySDKType; +} +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + */ +/** @deprecated */ +export interface SoftwareUpgradeProposal { + $typeUrl?: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; + /** plan of the proposal */ + plan: Plan; +} +export interface SoftwareUpgradeProposalProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; + value: Uint8Array; +} +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + */ +/** @deprecated */ +export interface SoftwareUpgradeProposalAmino { + /** title of the proposal */ + title?: string; + /** description of the proposal */ + description?: string; + /** plan of the proposal */ + plan: PlanAmino; +} +export interface SoftwareUpgradeProposalAminoMsg { + type: "cosmos-sdk/SoftwareUpgradeProposal"; + value: SoftwareUpgradeProposalAmino; +} +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + */ +/** @deprecated */ +export interface SoftwareUpgradeProposalSDKType { + $typeUrl?: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; + title: string; + description: string; + plan: PlanSDKType; +} +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + */ +/** @deprecated */ +export interface CancelSoftwareUpgradeProposal { + $typeUrl?: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; +} +export interface CancelSoftwareUpgradeProposalProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; + value: Uint8Array; +} +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + */ +/** @deprecated */ +export interface CancelSoftwareUpgradeProposalAmino { + /** title of the proposal */ + title?: string; + /** description of the proposal */ + description?: string; +} +export interface CancelSoftwareUpgradeProposalAminoMsg { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal"; + value: CancelSoftwareUpgradeProposalAmino; +} +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + */ +/** @deprecated */ +export interface CancelSoftwareUpgradeProposalSDKType { + $typeUrl?: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; + title: string; + description: string; +} +/** + * ModuleVersion specifies a module and its consensus version. + * + * Since: cosmos-sdk 0.43 + */ +export interface ModuleVersion { + /** name of the app module */ + name: string; + /** consensus version of the app module */ + version: bigint; +} +export interface ModuleVersionProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion"; + value: Uint8Array; +} +/** + * ModuleVersion specifies a module and its consensus version. + * + * Since: cosmos-sdk 0.43 + */ +export interface ModuleVersionAmino { + /** name of the app module */ + name?: string; + /** consensus version of the app module */ + version?: string; +} +export interface ModuleVersionAminoMsg { + type: "cosmos-sdk/ModuleVersion"; + value: ModuleVersionAmino; +} +/** + * ModuleVersion specifies a module and its consensus version. + * + * Since: cosmos-sdk 0.43 + */ +export interface ModuleVersionSDKType { + name: string; + version: bigint; +} +function createBasePlan(): Plan { + return { + name: "", + time: new Date(), + height: BigInt(0), + info: "", + upgradedClientState: undefined + }; +} +export const Plan = { + typeUrl: "/cosmos.upgrade.v1beta1.Plan", + aminoType: "cosmos-sdk/Plan", + encode(message: Plan, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Plan { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.upgradedClientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Plan { + const message = createBasePlan(); + message.name = object.name ?? ""; + message.time = object.time ?? undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.info = object.info ?? ""; + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; + return message; + }, + fromAmino(object: PlanAmino): Plan { + const message = createBasePlan(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + return message; + }, + toAmino(message: Plan): PlanAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : new Date(); + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.info = message.info === "" ? undefined : message.info; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + return obj; + }, + fromAminoMsg(object: PlanAminoMsg): Plan { + return Plan.fromAmino(object.value); + }, + toAminoMsg(message: Plan): PlanAminoMsg { + return { + type: "cosmos-sdk/Plan", + value: Plan.toAmino(message) + }; + }, + fromProtoMsg(message: PlanProtoMsg): Plan { + return Plan.decode(message.value); + }, + toProto(message: Plan): Uint8Array { + return Plan.encode(message).finish(); + }, + toProtoMsg(message: Plan): PlanProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.Plan", + value: Plan.encode(message).finish() + }; + } +}; +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { + $typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + title: "", + description: "", + plan: Plan.fromPartial({}) + }; +} +export const SoftwareUpgradeProposal = { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + aminoType: "cosmos-sdk/SoftwareUpgradeProposal", + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.plan = Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SoftwareUpgradeProposal { + const message = createBaseSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + return message; + }, + fromAmino(object: SoftwareUpgradeProposalAmino): SoftwareUpgradeProposal { + const message = createBaseSoftwareUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + return message; + }, + toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.plan = message.plan ? Plan.toAmino(message.plan) : Plan.toAmino(Plan.fromPartial({})); + return obj; + }, + fromAminoMsg(object: SoftwareUpgradeProposalAminoMsg): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: SoftwareUpgradeProposalProtoMsg): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.decode(message.value); + }, + toProto(message: SoftwareUpgradeProposal): Uint8Array { + return SoftwareUpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(message).finish() + }; + } +}; +function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { + return { + $typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + title: "", + description: "" + }; +} +export const CancelSoftwareUpgradeProposal = { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + aminoType: "cosmos-sdk/CancelSoftwareUpgradeProposal", + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CancelSoftwareUpgradeProposal { + const message = createBaseCancelSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, + fromAmino(object: CancelSoftwareUpgradeProposalAmino): CancelSoftwareUpgradeProposal { + const message = createBaseCancelSoftwareUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + return obj; + }, + fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: CancelSoftwareUpgradeProposalProtoMsg): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.decode(message.value); + }, + toProto(message: CancelSoftwareUpgradeProposal): Uint8Array { + return CancelSoftwareUpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(message).finish() + }; + } +}; +function createBaseModuleVersion(): ModuleVersion { + return { + name: "", + version: BigInt(0) + }; +} +export const ModuleVersion = { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", + aminoType: "cosmos-sdk/ModuleVersion", + encode(message: ModuleVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== BigInt(0)) { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.version = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModuleVersion { + const message = createBaseModuleVersion(); + message.name = object.name ?? ""; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ModuleVersionAmino): ModuleVersion { + const message = createBaseModuleVersion(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + return message; + }, + toAmino(message: ModuleVersion): ModuleVersionAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { + return ModuleVersion.fromAmino(object.value); + }, + toAminoMsg(message: ModuleVersion): ModuleVersionAminoMsg { + return { + type: "cosmos-sdk/ModuleVersion", + value: ModuleVersion.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleVersionProtoMsg): ModuleVersion { + return ModuleVersion.decode(message.value); + }, + toProto(message: ModuleVersion): Uint8Array { + return ModuleVersion.encode(message).finish(); + }, + toProtoMsg(message: ModuleVersion): ModuleVersionProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", + value: ModuleVersion.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/vesting/module/v1/module.ts b/util/inj-types/cosmos/vesting/module/v1/module.ts new file mode 100644 index 00000000..5bfdcd7e --- /dev/null +++ b/util/inj-types/cosmos/vesting/module/v1/module.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Module is the config object of the vesting module. */ +export interface Module {} +export interface ModuleProtoMsg { + typeUrl: "/cosmos.vesting.module.v1.Module"; + value: Uint8Array; +} +/** Module is the config object of the vesting module. */ +export interface ModuleAmino {} +export interface ModuleAminoMsg { + type: "cosmos-sdk/Module"; + value: ModuleAmino; +} +/** Module is the config object of the vesting module. */ +export interface ModuleSDKType {} +function createBaseModule(): Module { + return {}; +} +export const Module = { + typeUrl: "/cosmos.vesting.module.v1.Module", + aminoType: "cosmos-sdk/Module", + encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Module { + const message = createBaseModule(); + return message; + }, + fromAmino(_: ModuleAmino): Module { + const message = createBaseModule(); + return message; + }, + toAmino(_: Module): ModuleAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ModuleAminoMsg): Module { + return Module.fromAmino(object.value); + }, + toAminoMsg(message: Module): ModuleAminoMsg { + return { + type: "cosmos-sdk/Module", + value: Module.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleProtoMsg): Module { + return Module.decode(message.value); + }, + toProto(message: Module): Uint8Array { + return Module.encode(message).finish(); + }, + toProtoMsg(message: Module): ModuleProtoMsg { + return { + typeUrl: "/cosmos.vesting.module.v1.Module", + value: Module.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/vesting/v1beta1/tx.amino.ts b/util/inj-types/cosmos/vesting/v1beta1/tx.amino.ts new file mode 100644 index 00000000..61931efd --- /dev/null +++ b/util/inj-types/cosmos/vesting/v1beta1/tx.amino.ts @@ -0,0 +1,18 @@ +import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; +export const AminoConverter = { + "/cosmos.vesting.v1beta1.MsgCreateVestingAccount": { + aminoType: "cosmos-sdk/MsgCreateVestingAccount", + toAmino: MsgCreateVestingAccount.toAmino, + fromAmino: MsgCreateVestingAccount.fromAmino + }, + "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount": { + aminoType: "cosmos-sdk/MsgCreatePermLockedAccount", + toAmino: MsgCreatePermanentLockedAccount.toAmino, + fromAmino: MsgCreatePermanentLockedAccount.fromAmino + }, + "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount": { + aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccount", + toAmino: MsgCreatePeriodicVestingAccount.toAmino, + fromAmino: MsgCreatePeriodicVestingAccount.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/vesting/v1beta1/tx.registry.ts b/util/inj-types/cosmos/vesting/v1beta1/tx.registry.ts new file mode 100644 index 00000000..9942916a --- /dev/null +++ b/util/inj-types/cosmos/vesting/v1beta1/tx.registry.ts @@ -0,0 +1,71 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.vesting.v1beta1.MsgCreateVestingAccount", MsgCreateVestingAccount], ["/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", MsgCreatePermanentLockedAccount], ["/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", MsgCreatePeriodicVestingAccount]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + createVestingAccount(value: MsgCreateVestingAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + value: MsgCreateVestingAccount.encode(value).finish() + }; + }, + createPermanentLockedAccount(value: MsgCreatePermanentLockedAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + value: MsgCreatePermanentLockedAccount.encode(value).finish() + }; + }, + createPeriodicVestingAccount(value: MsgCreatePeriodicVestingAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + value: MsgCreatePeriodicVestingAccount.encode(value).finish() + }; + } + }, + withTypeUrl: { + createVestingAccount(value: MsgCreateVestingAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + value + }; + }, + createPermanentLockedAccount(value: MsgCreatePermanentLockedAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + value + }; + }, + createPeriodicVestingAccount(value: MsgCreatePeriodicVestingAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + value + }; + } + }, + fromPartial: { + createVestingAccount(value: MsgCreateVestingAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + value: MsgCreateVestingAccount.fromPartial(value) + }; + }, + createPermanentLockedAccount(value: MsgCreatePermanentLockedAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + value: MsgCreatePermanentLockedAccount.fromPartial(value) + }; + }, + createPeriodicVestingAccount(value: MsgCreatePeriodicVestingAccount) { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + value: MsgCreatePeriodicVestingAccount.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/util/inj-types/cosmos/vesting/v1beta1/tx.rpc.msg.ts new file mode 100644 index 00000000..29f1dd8d --- /dev/null +++ b/util/inj-types/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,56 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgCreateVestingAccount, MsgCreateVestingAccountResponse, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountResponse, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountResponse } from "./tx"; +/** Msg defines the bank Msg service. */ +export interface Msg { + /** + * CreateVestingAccount defines a method that enables creating a vesting + * account. + */ + createVestingAccount(request: MsgCreateVestingAccount): Promise; + /** + * CreatePermanentLockedAccount defines a method that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ + createPermanentLockedAccount(request: MsgCreatePermanentLockedAccount): Promise; + /** + * CreatePeriodicVestingAccount defines a method that enables creating a + * periodic vesting account. + * + * Since: cosmos-sdk 0.46 + */ + createPeriodicVestingAccount(request: MsgCreatePeriodicVestingAccount): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* CreateVestingAccount defines a method that enables creating a vesting + account. */ + createVestingAccount = async (request: MsgCreateVestingAccount): Promise => { + const data = MsgCreateVestingAccount.encode(request).finish(); + const promise = this.rpc.request("cosmos.vesting.v1beta1.Msg", "CreateVestingAccount", data); + return promise.then(data => MsgCreateVestingAccountResponse.decode(new BinaryReader(data))); + }; + /* CreatePermanentLockedAccount defines a method that enables creating a permanent + locked account. + + Since: cosmos-sdk 0.46 */ + createPermanentLockedAccount = async (request: MsgCreatePermanentLockedAccount): Promise => { + const data = MsgCreatePermanentLockedAccount.encode(request).finish(); + const promise = this.rpc.request("cosmos.vesting.v1beta1.Msg", "CreatePermanentLockedAccount", data); + return promise.then(data => MsgCreatePermanentLockedAccountResponse.decode(new BinaryReader(data))); + }; + /* CreatePeriodicVestingAccount defines a method that enables creating a + periodic vesting account. + + Since: cosmos-sdk 0.46 */ + createPeriodicVestingAccount = async (request: MsgCreatePeriodicVestingAccount): Promise => { + const data = MsgCreatePeriodicVestingAccount.encode(request).finish(); + const promise = this.rpc.request("cosmos.vesting.v1beta1.Msg", "CreatePeriodicVestingAccount", data); + return promise.then(data => MsgCreatePeriodicVestingAccountResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmos/vesting/v1beta1/tx.ts b/util/inj-types/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..baab680c --- /dev/null +++ b/util/inj-types/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,698 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { Period, PeriodAmino, PeriodSDKType } from "./vesting"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreateVestingAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: bigint; + delayed: boolean; +} +export interface MsgCreateVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreateVestingAccountAmino { + from_address?: string; + to_address?: string; + amount: CoinAmino[]; + /** end of vesting as unix time (in seconds). */ + end_time?: string; + delayed?: boolean; +} +export interface MsgCreateVestingAccountAminoMsg { + type: "cosmos-sdk/MsgCreateVestingAccount"; + value: MsgCreateVestingAccountAmino; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreateVestingAccountSDKType { + from_address: string; + to_address: string; + amount: CoinSDKType[]; + end_time: bigint; + delayed: boolean; +} +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse {} +export interface MsgCreateVestingAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse"; + value: Uint8Array; +} +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponseAmino {} +export interface MsgCreateVestingAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreateVestingAccountResponse"; + value: MsgCreateVestingAccountResponseAmino; +} +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponseSDKType {} +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} +export interface MsgCreatePermanentLockedAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount"; + value: Uint8Array; +} +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountAmino { + from_address?: string; + to_address?: string; + amount: CoinAmino[]; +} +export interface MsgCreatePermanentLockedAccountAminoMsg { + type: "cosmos-sdk/MsgCreatePermLockedAccount"; + value: MsgCreatePermanentLockedAccountAmino; +} +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountSDKType { + from_address: string; + to_address: string; + amount: CoinSDKType[]; +} +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponse {} +export interface MsgCreatePermanentLockedAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse"; + value: Uint8Array; +} +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponseAmino {} +export interface MsgCreatePermanentLockedAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse"; + value: MsgCreatePermanentLockedAccountResponseAmino; +} +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponseSDKType {} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: bigint; + vestingPeriods: Period[]; +} +export interface MsgCreatePeriodicVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountAmino { + from_address?: string; + to_address?: string; + /** start of vesting as unix time (in seconds). */ + start_time?: string; + vesting_periods: PeriodAmino[]; +} +export interface MsgCreatePeriodicVestingAccountAminoMsg { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccount"; + value: MsgCreatePeriodicVestingAccountAmino; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountSDKType { + from_address: string; + to_address: string; + start_time: bigint; + vesting_periods: PeriodSDKType[]; +} +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponse {} +export interface MsgCreatePeriodicVestingAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponseAmino {} +export interface MsgCreatePeriodicVestingAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse"; + value: MsgCreatePeriodicVestingAccountResponseAmino; +} +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponseSDKType {} +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { + fromAddress: "", + toAddress: "", + amount: [], + endTime: BigInt(0), + delayed: false + }; +} +export const MsgCreateVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + aminoType: "cosmos-sdk/MsgCreateVestingAccount", + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + if (message.endTime !== BigInt(0)) { + writer.uint32(32).int64(message.endTime); + } + if (message.delayed === true) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + 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; + case 4: + message.endTime = reader.int64(); + break; + case 5: + message.delayed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); + message.delayed = object.delayed ?? false; + return message; + }, + fromAmino(object: MsgCreateVestingAccountAmino): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.end_time !== undefined && object.end_time !== null) { + message.endTime = BigInt(object.end_time); + } + if (object.delayed !== undefined && object.delayed !== null) { + message.delayed = object.delayed; + } + return message; + }, + toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; + obj.delayed = message.delayed === false ? undefined : message.delayed; + return obj; + }, + fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateVestingAccount): MsgCreateVestingAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreateVestingAccount", + value: MsgCreateVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateVestingAccountProtoMsg): MsgCreateVestingAccount { + return MsgCreateVestingAccount.decode(message.value); + }, + toProto(message: MsgCreateVestingAccount): Uint8Array { + return MsgCreateVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateVestingAccount): MsgCreateVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + value: MsgCreateVestingAccount.encode(message).finish() + }; + } +}; +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} +export const MsgCreateVestingAccountResponse = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", + aminoType: "cosmos-sdk/MsgCreateVestingAccountResponse", + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, + fromAmino(_: MsgCreateVestingAccountResponseAmino): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, + toAmino(_: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateVestingAccountResponseAminoMsg): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateVestingAccountResponse", + value: MsgCreateVestingAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateVestingAccountResponseProtoMsg): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.decode(message.value); + }, + toProto(message: MsgCreateVestingAccountResponse): Uint8Array { + return MsgCreateVestingAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", + value: MsgCreateVestingAccountResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { + fromAddress: "", + toAddress: "", + amount: [] + }; +} +export const MsgCreatePermanentLockedAccount = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + aminoType: "cosmos-sdk/MsgCreatePermLockedAccount", + encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccount(); + 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: DeepPartial): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgCreatePermanentLockedAccountAmino): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgCreatePermanentLockedAccountAminoMsg): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePermLockedAccount", + value: MsgCreatePermanentLockedAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePermanentLockedAccountProtoMsg): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.decode(message.value); + }, + toProto(message: MsgCreatePermanentLockedAccount): Uint8Array { + return MsgCreatePermanentLockedAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + value: MsgCreatePermanentLockedAccount.encode(message).finish() + }; + } +}; +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} +export const MsgCreatePermanentLockedAccountResponse = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + aminoType: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse", + encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, + fromAmino(_: MsgCreatePermanentLockedAccountResponseAmino): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, + toAmino(_: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreatePermanentLockedAccountResponseAminoMsg): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse", + value: MsgCreatePermanentLockedAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePermanentLockedAccountResponseProtoMsg): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.decode(message.value); + }, + toProto(message: MsgCreatePermanentLockedAccountResponse): Uint8Array { + return MsgCreatePermanentLockedAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + value: MsgCreatePermanentLockedAccountResponse.encode(message).finish() + }; + } +}; +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { + fromAddress: "", + toAddress: "", + startTime: BigInt(0), + vestingPeriods: [] + }; +} +export const MsgCreatePeriodicVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccount", + encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + if (message.startTime !== BigInt(0)) { + writer.uint32(24).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccount(); + 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.startTime = reader.int64(); + break; + case 4: + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgCreatePeriodicVestingAccountAmino): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + message.vestingPeriods = object.vesting_periods?.map(e => Period.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; + if (message.vestingPeriods) { + obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); + } else { + obj.vesting_periods = message.vestingPeriods; + } + return obj; + }, + fromAminoMsg(object: MsgCreatePeriodicVestingAccountAminoMsg): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccount", + value: MsgCreatePeriodicVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePeriodicVestingAccountProtoMsg): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.decode(message.value); + }, + toProto(message: MsgCreatePeriodicVestingAccount): Uint8Array { + return MsgCreatePeriodicVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + value: MsgCreatePeriodicVestingAccount.encode(message).finish() + }; + } +}; +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} +export const MsgCreatePeriodicVestingAccountResponse = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse", + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreatePeriodicVestingAccountResponse { + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + return message; + }, + fromAmino(_: MsgCreatePeriodicVestingAccountResponseAmino): MsgCreatePeriodicVestingAccountResponse { + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + return message; + }, + toAmino(_: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreatePeriodicVestingAccountResponseAminoMsg): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse", + value: MsgCreatePeriodicVestingAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePeriodicVestingAccountResponseProtoMsg): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.decode(message.value); + }, + toProto(message: MsgCreatePeriodicVestingAccountResponse): Uint8Array { + return MsgCreatePeriodicVestingAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + value: MsgCreatePeriodicVestingAccountResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos/vesting/v1beta1/vesting.ts b/util/inj-types/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..bfe74945 --- /dev/null +++ b/util/inj-types/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,737 @@ +import { BaseAccount, BaseAccountAmino, BaseAccountSDKType } from "../../auth/v1beta1/auth"; +import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +/** + * BaseVestingAccount implements the VestingAccount interface. It contains all + * the necessary fields needed for any vesting account implementation. + */ +export interface BaseVestingAccount { + baseAccount?: BaseAccount; + originalVesting: Coin[]; + delegatedFree: Coin[]; + delegatedVesting: Coin[]; + /** Vesting end time, as unix timestamp (in seconds). */ + endTime: bigint; +} +export interface BaseVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount"; + value: Uint8Array; +} +/** + * BaseVestingAccount implements the VestingAccount interface. It contains all + * the necessary fields needed for any vesting account implementation. + */ +export interface BaseVestingAccountAmino { + base_account?: BaseAccountAmino; + original_vesting: CoinAmino[]; + delegated_free: CoinAmino[]; + delegated_vesting: CoinAmino[]; + /** Vesting end time, as unix timestamp (in seconds). */ + end_time?: string; +} +export interface BaseVestingAccountAminoMsg { + type: "cosmos-sdk/BaseVestingAccount"; + value: BaseVestingAccountAmino; +} +/** + * BaseVestingAccount implements the VestingAccount interface. It contains all + * the necessary fields needed for any vesting account implementation. + */ +export interface BaseVestingAccountSDKType { + base_account?: BaseAccountSDKType; + original_vesting: CoinSDKType[]; + delegated_free: CoinSDKType[]; + delegated_vesting: CoinSDKType[]; + end_time: bigint; +} +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + baseVestingAccount?: BaseVestingAccount; + /** Vesting start time, as unix timestamp (in seconds). */ + startTime: bigint; +} +export interface ContinuousVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount"; + value: Uint8Array; +} +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; + /** Vesting start time, as unix timestamp (in seconds). */ + start_time?: string; +} +export interface ContinuousVestingAccountAminoMsg { + type: "cosmos-sdk/ContinuousVestingAccount"; + value: ContinuousVestingAccountAmino; +} +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccountSDKType { + base_vesting_account?: BaseVestingAccountSDKType; + start_time: bigint; +} +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccount { + baseVestingAccount?: BaseVestingAccount; +} +export interface DelayedVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount"; + value: Uint8Array; +} +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; +} +export interface DelayedVestingAccountAminoMsg { + type: "cosmos-sdk/DelayedVestingAccount"; + value: DelayedVestingAccountAmino; +} +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccountSDKType { + base_vesting_account?: BaseVestingAccountSDKType; +} +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + /** Period duration in seconds. */ + length: bigint; + amount: Coin[]; +} +export interface PeriodProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.Period"; + value: Uint8Array; +} +/** Period defines a length of time and amount of coins that will vest. */ +export interface PeriodAmino { + /** Period duration in seconds. */ + length?: string; + amount: CoinAmino[]; +} +export interface PeriodAminoMsg { + type: "cosmos-sdk/Period"; + value: PeriodAmino; +} +/** Period defines a length of time and amount of coins that will vest. */ +export interface PeriodSDKType { + length: bigint; + amount: CoinSDKType[]; +} +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + baseVestingAccount?: BaseVestingAccount; + startTime: bigint; + vestingPeriods: Period[]; +} +export interface PeriodicVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount"; + value: Uint8Array; +} +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; + start_time?: string; + vesting_periods: PeriodAmino[]; +} +export interface PeriodicVestingAccountAminoMsg { + type: "cosmos-sdk/PeriodicVestingAccount"; + value: PeriodicVestingAccountAmino; +} +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccountSDKType { + base_vesting_account?: BaseVestingAccountSDKType; + start_time: bigint; + vesting_periods: PeriodSDKType[]; +} +/** + * PermanentLockedAccount implements the VestingAccount interface. It does + * not ever release coins, locking them indefinitely. Coins in this account can + * still be used for delegating and for governance votes even while locked. + * + * Since: cosmos-sdk 0.43 + */ +export interface PermanentLockedAccount { + baseVestingAccount?: BaseVestingAccount; +} +export interface PermanentLockedAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount"; + value: Uint8Array; +} +/** + * PermanentLockedAccount implements the VestingAccount interface. It does + * not ever release coins, locking them indefinitely. Coins in this account can + * still be used for delegating and for governance votes even while locked. + * + * Since: cosmos-sdk 0.43 + */ +export interface PermanentLockedAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; +} +export interface PermanentLockedAccountAminoMsg { + type: "cosmos-sdk/PermanentLockedAccount"; + value: PermanentLockedAccountAmino; +} +/** + * PermanentLockedAccount implements the VestingAccount interface. It does + * not ever release coins, locking them indefinitely. Coins in this account can + * still be used for delegating and for governance votes even while locked. + * + * Since: cosmos-sdk 0.43 + */ +export interface PermanentLockedAccountSDKType { + base_vesting_account?: BaseVestingAccountSDKType; +} +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { + baseAccount: undefined, + originalVesting: [], + delegatedFree: [], + delegatedVesting: [], + endTime: BigInt(0) + }; +} +export const BaseVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", + aminoType: "cosmos-sdk/BaseVestingAccount", + encode(message: BaseVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.originalVesting) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatedFree) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.delegatedVesting) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.endTime !== BigInt(0)) { + writer.uint32(40).int64(message.endTime); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.originalVesting.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.delegatedFree.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.delegatedVesting.push(Coin.decode(reader, reader.uint32())); + break; + case 5: + message.endTime = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; + message.originalVesting = object.originalVesting?.map(e => Coin.fromPartial(e)) || []; + message.delegatedFree = object.delegatedFree?.map(e => Coin.fromPartial(e)) || []; + message.delegatedVesting = object.delegatedVesting?.map(e => Coin.fromPartial(e)) || []; + message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BaseVestingAccountAmino): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + if (object.base_account !== undefined && object.base_account !== null) { + message.baseAccount = BaseAccount.fromAmino(object.base_account); + } + message.originalVesting = object.original_vesting?.map(e => Coin.fromAmino(e)) || []; + message.delegatedFree = object.delegated_free?.map(e => Coin.fromAmino(e)) || []; + message.delegatedVesting = object.delegated_vesting?.map(e => Coin.fromAmino(e)) || []; + if (object.end_time !== undefined && object.end_time !== null) { + message.endTime = BigInt(object.end_time); + } + return message; + }, + toAmino(message: BaseVestingAccount): BaseVestingAccountAmino { + const obj: any = {}; + obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; + if (message.originalVesting) { + obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.original_vesting = message.originalVesting; + } + if (message.delegatedFree) { + obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.delegated_free = message.delegatedFree; + } + if (message.delegatedVesting) { + obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.delegated_vesting = message.delegatedVesting; + } + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { + return BaseVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: BaseVestingAccount): BaseVestingAccountAminoMsg { + return { + type: "cosmos-sdk/BaseVestingAccount", + value: BaseVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: BaseVestingAccountProtoMsg): BaseVestingAccount { + return BaseVestingAccount.decode(message.value); + }, + toProto(message: BaseVestingAccount): Uint8Array { + return BaseVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: BaseVestingAccount): BaseVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", + value: BaseVestingAccount.encode(message).finish() + }; + } +}; +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { + baseVestingAccount: undefined, + startTime: BigInt(0) + }; +} +export const ContinuousVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", + aminoType: "cosmos-sdk/ContinuousVestingAccount", + encode(message: ContinuousVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.startTime !== BigInt(0)) { + writer.uint32(16).int64(message.startTime); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.startTime = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ContinuousVestingAccountAmino): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + return message; + }, + toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { + return ContinuousVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: ContinuousVestingAccount): ContinuousVestingAccountAminoMsg { + return { + type: "cosmos-sdk/ContinuousVestingAccount", + value: ContinuousVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: ContinuousVestingAccountProtoMsg): ContinuousVestingAccount { + return ContinuousVestingAccount.decode(message.value); + }, + toProto(message: ContinuousVestingAccount): Uint8Array { + return ContinuousVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: ContinuousVestingAccount): ContinuousVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", + value: ContinuousVestingAccount.encode(message).finish() + }; + } +}; +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { + baseVestingAccount: undefined + }; +} +export const DelayedVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", + aminoType: "cosmos-sdk/DelayedVestingAccount", + encode(message: DelayedVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + return message; + }, + fromAmino(object: DelayedVestingAccountAmino): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + return message; + }, + toAmino(message: DelayedVestingAccount): DelayedVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + return obj; + }, + fromAminoMsg(object: DelayedVestingAccountAminoMsg): DelayedVestingAccount { + return DelayedVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: DelayedVestingAccount): DelayedVestingAccountAminoMsg { + return { + type: "cosmos-sdk/DelayedVestingAccount", + value: DelayedVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: DelayedVestingAccountProtoMsg): DelayedVestingAccount { + return DelayedVestingAccount.decode(message.value); + }, + toProto(message: DelayedVestingAccount): Uint8Array { + return DelayedVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: DelayedVestingAccount): DelayedVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", + value: DelayedVestingAccount.encode(message).finish() + }; + } +}; +function createBasePeriod(): Period { + return { + length: BigInt(0), + amount: [] + }; +} +export const Period = { + typeUrl: "/cosmos.vesting.v1beta1.Period", + aminoType: "cosmos-sdk/Period", + encode(message: Period, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.length !== BigInt(0)) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.length = reader.int64(); + break; + case 2: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Period { + const message = createBasePeriod(); + message.length = object.length !== undefined && object.length !== null ? BigInt(object.length.toString()) : BigInt(0); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: PeriodAmino): Period { + const message = createBasePeriod(); + if (object.length !== undefined && object.length !== null) { + message.length = BigInt(object.length); + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Period): PeriodAmino { + const obj: any = {}; + obj.length = message.length !== BigInt(0) ? message.length.toString() : undefined; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: PeriodAminoMsg): Period { + return Period.fromAmino(object.value); + }, + toAminoMsg(message: Period): PeriodAminoMsg { + return { + type: "cosmos-sdk/Period", + value: Period.toAmino(message) + }; + }, + fromProtoMsg(message: PeriodProtoMsg): Period { + return Period.decode(message.value); + }, + toProto(message: Period): Uint8Array { + return Period.encode(message).finish(); + }, + toProtoMsg(message: Period): PeriodProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.Period", + value: Period.encode(message).finish() + }; + } +}; +function createBasePeriodicVestingAccount(): PeriodicVestingAccount { + return { + baseVestingAccount: undefined, + startTime: BigInt(0), + vestingPeriods: [] + }; +} +export const PeriodicVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", + aminoType: "cosmos-sdk/PeriodicVestingAccount", + encode(message: PeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.startTime !== BigInt(0)) { + writer.uint32(16).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.startTime = reader.int64(); + break; + case 3: + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; + return message; + }, + fromAmino(object: PeriodicVestingAccountAmino): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + message.vestingPeriods = object.vesting_periods?.map(e => Period.fromAmino(e)) || []; + return message; + }, + toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; + if (message.vestingPeriods) { + obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); + } else { + obj.vesting_periods = message.vestingPeriods; + } + return obj; + }, + fromAminoMsg(object: PeriodicVestingAccountAminoMsg): PeriodicVestingAccount { + return PeriodicVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: PeriodicVestingAccount): PeriodicVestingAccountAminoMsg { + return { + type: "cosmos-sdk/PeriodicVestingAccount", + value: PeriodicVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: PeriodicVestingAccountProtoMsg): PeriodicVestingAccount { + return PeriodicVestingAccount.decode(message.value); + }, + toProto(message: PeriodicVestingAccount): Uint8Array { + return PeriodicVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: PeriodicVestingAccount): PeriodicVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", + value: PeriodicVestingAccount.encode(message).finish() + }; + } +}; +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { + baseVestingAccount: undefined + }; +} +export const PermanentLockedAccount = { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", + aminoType: "cosmos-sdk/PermanentLockedAccount", + encode(message: PermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + return message; + }, + fromAmino(object: PermanentLockedAccountAmino): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + return message; + }, + toAmino(message: PermanentLockedAccount): PermanentLockedAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + return obj; + }, + fromAminoMsg(object: PermanentLockedAccountAminoMsg): PermanentLockedAccount { + return PermanentLockedAccount.fromAmino(object.value); + }, + toAminoMsg(message: PermanentLockedAccount): PermanentLockedAccountAminoMsg { + return { + type: "cosmos-sdk/PermanentLockedAccount", + value: PermanentLockedAccount.toAmino(message) + }; + }, + fromProtoMsg(message: PermanentLockedAccountProtoMsg): PermanentLockedAccount { + return PermanentLockedAccount.decode(message.value); + }, + toProto(message: PermanentLockedAccount): Uint8Array { + return PermanentLockedAccount.encode(message).finish(); + }, + toProtoMsg(message: PermanentLockedAccount): PermanentLockedAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", + value: PermanentLockedAccount.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmos_proto/bundle.ts b/util/inj-types/cosmos_proto/bundle.ts new file mode 100644 index 00000000..fd490026 --- /dev/null +++ b/util/inj-types/cosmos_proto/bundle.ts @@ -0,0 +1,4 @@ +import * as _1 from "./cosmos"; +export const cosmos_proto = { + ..._1 +}; \ No newline at end of file diff --git a/util/inj-types/cosmos_proto/cosmos.ts b/util/inj-types/cosmos_proto/cosmos.ts new file mode 100644 index 00000000..b0b2af4d --- /dev/null +++ b/util/inj-types/cosmos_proto/cosmos.ts @@ -0,0 +1,349 @@ +import { BinaryReader, BinaryWriter } from "../binary"; +import { DeepPartial } from "../helpers"; +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1, +} +export const ScalarTypeSDKType = ScalarType; +export const ScalarTypeAmino = ScalarType; +export function scalarTypeFromJSON(object: any): ScalarType { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} +export function scalarTypeToJSON(object: ScalarType): string { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} +export interface InterfaceDescriptorProtoMsg { + typeUrl: "/cosmos_proto.InterfaceDescriptor"; + value: Uint8Array; +} +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptorAmino { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name?: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description?: string; +} +export interface InterfaceDescriptorAminoMsg { + type: "/cosmos_proto.InterfaceDescriptor"; + value: InterfaceDescriptorAmino; +} +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptorSDKType { + name: string; + description: string; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} +export interface ScalarDescriptorProtoMsg { + typeUrl: "/cosmos_proto.ScalarDescriptor"; + value: Uint8Array; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptorAmino { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name?: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description?: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + field_type?: ScalarType[]; +} +export interface ScalarDescriptorAminoMsg { + type: "/cosmos_proto.ScalarDescriptor"; + value: ScalarDescriptorAmino; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptorSDKType { + name: string; + description: string; + field_type: ScalarType[]; +} +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { + name: "", + description: "" + }; +} +export const InterfaceDescriptor = { + typeUrl: "/cosmos_proto.InterfaceDescriptor", + encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, + fromAmino(object: InterfaceDescriptorAmino): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + return obj; + }, + fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { + return InterfaceDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: InterfaceDescriptorProtoMsg): InterfaceDescriptor { + return InterfaceDescriptor.decode(message.value); + }, + toProto(message: InterfaceDescriptor): Uint8Array { + return InterfaceDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceDescriptor): InterfaceDescriptorProtoMsg { + return { + typeUrl: "/cosmos_proto.InterfaceDescriptor", + value: InterfaceDescriptor.encode(message).finish() + }; + } +}; +function createBaseScalarDescriptor(): ScalarDescriptor { + return { + name: "", + description: "", + fieldType: [] + }; +} +export const ScalarDescriptor = { + typeUrl: "/cosmos_proto.ScalarDescriptor", + encode(message: ScalarDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push((reader.int32() as any)); + } + } else { + message.fieldType.push((reader.int32() as any)); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map(e => e) || []; + return message; + }, + fromAmino(object: ScalarDescriptorAmino): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.fieldType = object.field_type?.map(e => e) || []; + return message; + }, + toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + if (message.fieldType) { + obj.field_type = message.fieldType.map(e => e); + } else { + obj.field_type = message.fieldType; + } + return obj; + }, + fromAminoMsg(object: ScalarDescriptorAminoMsg): ScalarDescriptor { + return ScalarDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: ScalarDescriptorProtoMsg): ScalarDescriptor { + return ScalarDescriptor.decode(message.value); + }, + toProto(message: ScalarDescriptor): Uint8Array { + return ScalarDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ScalarDescriptor): ScalarDescriptorProtoMsg { + return { + typeUrl: "/cosmos_proto.ScalarDescriptor", + value: ScalarDescriptor.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/bundle.ts b/util/inj-types/cosmwasm/bundle.ts new file mode 100644 index 00000000..f5d64006 --- /dev/null +++ b/util/inj-types/cosmwasm/bundle.ts @@ -0,0 +1,36 @@ +import * as _96 from "./wasm/v1/authz"; +import * as _97 from "./wasm/v1/genesis"; +import * as _98 from "./wasm/v1/ibc"; +import * as _99 from "./wasm/v1/proposal_legacy"; +import * as _100 from "./wasm/v1/query"; +import * as _101 from "./wasm/v1/tx"; +import * as _102 from "./wasm/v1/types"; +import * as _232 from "./wasm/v1/tx.amino"; +import * as _233 from "./wasm/v1/tx.registry"; +import * as _234 from "./wasm/v1/query.lcd"; +import * as _235 from "./wasm/v1/query.rpc.Query"; +import * as _236 from "./wasm/v1/tx.rpc.msg"; +import * as _268 from "./rpc.query"; +import * as _269 from "./rpc.tx"; +export namespace cosmwasm { + export namespace wasm { + export const v1 = { + ..._96, + ..._97, + ..._98, + ..._99, + ..._100, + ..._101, + ..._102, + ..._232, + ..._233, + ..._234, + ..._235, + ..._236 + }; + } + export const ClientFactory = { + ..._268, + ..._269 + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmwasm/client.ts b/util/inj-types/cosmwasm/client.ts new file mode 100644 index 00000000..1b6196fc --- /dev/null +++ b/util/inj-types/cosmwasm/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as cosmwasmWasmV1TxRegistry from "./wasm/v1/tx.registry"; +import * as cosmwasmWasmV1TxAmino from "./wasm/v1/tx.amino"; +export const cosmwasmAminoConverters = { + ...cosmwasmWasmV1TxAmino.AminoConverter +}; +export const cosmwasmProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...cosmwasmWasmV1TxRegistry.registry]; +export const getSigningCosmwasmClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...cosmwasmProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...cosmwasmAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningCosmwasmClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningCosmwasmClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/rpc.query.ts b/util/inj-types/cosmwasm/rpc.query.ts new file mode 100644 index 00000000..f188721f --- /dev/null +++ b/util/inj-types/cosmwasm/rpc.query.ts @@ -0,0 +1,69 @@ +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { QueryClient } from "@cosmjs/stargate"; +export const createRPCQueryClient = async ({ + rpcEndpoint +}: { + rpcEndpoint: string | HttpEndpoint; +}) => { + const tmClient = await connectComet(rpcEndpoint); + const client = new QueryClient(tmClient); + return { + cosmos: { + auth: { + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + authz: { + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + bank: { + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + base: { + node: { + v1beta1: (await import("../cosmos/base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) + } + }, + consensus: { + v1: (await import("../cosmos/consensus/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + distribution: { + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + feegrant: { + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + gov: { + v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + group: { + v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + mint: { + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + orm: { + query: { + v1alpha1: (await import("../cosmos/orm/query/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) + } + }, + params: { + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + staking: { + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + tx: { + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) + }, + upgrade: { + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + } + }, + cosmwasm: { + wasm: { + v1: (await import("./wasm/v1/query.rpc.Query")).createRpcQueryExtension(client) + } + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/rpc.tx.ts b/util/inj-types/cosmwasm/rpc.tx.ts new file mode 100644 index 00000000..744f6ef8 --- /dev/null +++ b/util/inj-types/cosmwasm/rpc.tx.ts @@ -0,0 +1,51 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + cosmos: { + auth: { + v1beta1: new (await import("../cosmos/auth/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + authz: { + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + bank: { + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + consensus: { + v1: new (await import("../cosmos/consensus/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + distribution: { + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + feegrant: { + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + gov: { + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + group: { + v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + mint: { + v1beta1: new (await import("../cosmos/mint/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + staking: { + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + upgrade: { + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + vesting: { + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + } + }, + cosmwasm: { + wasm: { + v1: new (await import("./wasm/v1/tx.rpc.msg")).MsgClientImpl(rpc) + } + } +}); \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/authz.ts b/util/inj-types/cosmwasm/wasm/v1/authz.ts new file mode 100644 index 00000000..56a49103 --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/authz.ts @@ -0,0 +1,1364 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +/** + * StoreCodeAuthorization defines authorization for wasm code upload. + * Since: wasmd 0.42 + */ +export interface StoreCodeAuthorization { + $typeUrl?: "/cosmwasm.wasm.v1.StoreCodeAuthorization"; + /** Grants for code upload */ + grants: CodeGrant[]; +} +export interface StoreCodeAuthorizationProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.StoreCodeAuthorization"; + value: Uint8Array; +} +/** + * StoreCodeAuthorization defines authorization for wasm code upload. + * Since: wasmd 0.42 + */ +export interface StoreCodeAuthorizationAmino { + /** Grants for code upload */ + grants: CodeGrantAmino[]; +} +export interface StoreCodeAuthorizationAminoMsg { + type: "wasm/StoreCodeAuthorization"; + value: StoreCodeAuthorizationAmino; +} +/** + * StoreCodeAuthorization defines authorization for wasm code upload. + * Since: wasmd 0.42 + */ +export interface StoreCodeAuthorizationSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.StoreCodeAuthorization"; + grants: CodeGrantSDKType[]; +} +/** + * ContractExecutionAuthorization defines authorization for wasm execute. + * Since: wasmd 0.30 + */ +export interface ContractExecutionAuthorization { + $typeUrl?: "/cosmwasm.wasm.v1.ContractExecutionAuthorization"; + /** Grants for contract executions */ + grants: ContractGrant[]; +} +export interface ContractExecutionAuthorizationProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization"; + value: Uint8Array; +} +/** + * ContractExecutionAuthorization defines authorization for wasm execute. + * Since: wasmd 0.30 + */ +export interface ContractExecutionAuthorizationAmino { + /** Grants for contract executions */ + grants: ContractGrantAmino[]; +} +export interface ContractExecutionAuthorizationAminoMsg { + type: "wasm/ContractExecutionAuthorization"; + value: ContractExecutionAuthorizationAmino; +} +/** + * ContractExecutionAuthorization defines authorization for wasm execute. + * Since: wasmd 0.30 + */ +export interface ContractExecutionAuthorizationSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.ContractExecutionAuthorization"; + grants: ContractGrantSDKType[]; +} +/** + * ContractMigrationAuthorization defines authorization for wasm contract + * migration. Since: wasmd 0.30 + */ +export interface ContractMigrationAuthorization { + $typeUrl?: "/cosmwasm.wasm.v1.ContractMigrationAuthorization"; + /** Grants for contract migrations */ + grants: ContractGrant[]; +} +export interface ContractMigrationAuthorizationProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization"; + value: Uint8Array; +} +/** + * ContractMigrationAuthorization defines authorization for wasm contract + * migration. Since: wasmd 0.30 + */ +export interface ContractMigrationAuthorizationAmino { + /** Grants for contract migrations */ + grants: ContractGrantAmino[]; +} +export interface ContractMigrationAuthorizationAminoMsg { + type: "wasm/ContractMigrationAuthorization"; + value: ContractMigrationAuthorizationAmino; +} +/** + * ContractMigrationAuthorization defines authorization for wasm contract + * migration. Since: wasmd 0.30 + */ +export interface ContractMigrationAuthorizationSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.ContractMigrationAuthorization"; + grants: ContractGrantSDKType[]; +} +/** CodeGrant a granted permission for a single code */ +export interface CodeGrant { + /** + * CodeHash is the unique identifier created by wasmvm + * Wildcard "*" is used to specify any kind of grant. + */ + codeHash: Uint8Array; + /** + * InstantiatePermission is the superset access control to apply + * on contract creation. + * Optional + */ + instantiatePermission?: AccessConfig; +} +export interface CodeGrantProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.CodeGrant"; + value: Uint8Array; +} +/** CodeGrant a granted permission for a single code */ +export interface CodeGrantAmino { + /** + * CodeHash is the unique identifier created by wasmvm + * Wildcard "*" is used to specify any kind of grant. + */ + code_hash?: string; + /** + * InstantiatePermission is the superset access control to apply + * on contract creation. + * Optional + */ + instantiate_permission?: AccessConfigAmino; +} +export interface CodeGrantAminoMsg { + type: "wasm/CodeGrant"; + value: CodeGrantAmino; +} +/** CodeGrant a granted permission for a single code */ +export interface CodeGrantSDKType { + code_hash: Uint8Array; + instantiate_permission?: AccessConfigSDKType; +} +/** + * ContractGrant a granted permission for a single contract + * Since: wasmd 0.30 + */ +export interface ContractGrant { + /** Contract is the bech32 address of the smart contract */ + contract: string; + /** + * Limit defines execution limits that are enforced and updated when the grant + * is applied. When the limit lapsed the grant is removed. + */ + limit?: MaxCallsLimit | MaxFundsLimit | CombinedLimit | Any | undefined; + /** + * Filter define more fine-grained control on the message payload passed + * to the contract in the operation. When no filter applies on execution, the + * operation is prohibited. + */ + filter?: AllowAllMessagesFilter | AcceptedMessageKeysFilter | AcceptedMessagesFilter | Any | undefined; +} +export interface ContractGrantProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ContractGrant"; + value: Uint8Array; +} +export type ContractGrantEncoded = Omit & { + /** + * Limit defines execution limits that are enforced and updated when the grant + * is applied. When the limit lapsed the grant is removed. + */ + limit?: MaxCallsLimitProtoMsg | MaxFundsLimitProtoMsg | CombinedLimitProtoMsg | AnyProtoMsg | undefined; + /** + * Filter define more fine-grained control on the message payload passed + * to the contract in the operation. When no filter applies on execution, the + * operation is prohibited. + */ + filter?: AllowAllMessagesFilterProtoMsg | AcceptedMessageKeysFilterProtoMsg | AcceptedMessagesFilterProtoMsg | AnyProtoMsg | undefined; +}; +/** + * ContractGrant a granted permission for a single contract + * Since: wasmd 0.30 + */ +export interface ContractGrantAmino { + /** Contract is the bech32 address of the smart contract */ + contract?: string; + /** + * Limit defines execution limits that are enforced and updated when the grant + * is applied. When the limit lapsed the grant is removed. + */ + limit?: AnyAmino; + /** + * Filter define more fine-grained control on the message payload passed + * to the contract in the operation. When no filter applies on execution, the + * operation is prohibited. + */ + filter?: AnyAmino; +} +export interface ContractGrantAminoMsg { + type: "wasm/ContractGrant"; + value: ContractGrantAmino; +} +/** + * ContractGrant a granted permission for a single contract + * Since: wasmd 0.30 + */ +export interface ContractGrantSDKType { + contract: string; + limit?: MaxCallsLimitSDKType | MaxFundsLimitSDKType | CombinedLimitSDKType | AnySDKType | undefined; + filter?: AllowAllMessagesFilterSDKType | AcceptedMessageKeysFilterSDKType | AcceptedMessagesFilterSDKType | AnySDKType | undefined; +} +/** + * MaxCallsLimit limited number of calls to the contract. No funds transferable. + * Since: wasmd 0.30 + */ +export interface MaxCallsLimit { + $typeUrl?: "/cosmwasm.wasm.v1.MaxCallsLimit"; + /** Remaining number that is decremented on each execution */ + remaining: bigint; +} +export interface MaxCallsLimitProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit"; + value: Uint8Array; +} +/** + * MaxCallsLimit limited number of calls to the contract. No funds transferable. + * Since: wasmd 0.30 + */ +export interface MaxCallsLimitAmino { + /** Remaining number that is decremented on each execution */ + remaining?: string; +} +export interface MaxCallsLimitAminoMsg { + type: "wasm/MaxCallsLimit"; + value: MaxCallsLimitAmino; +} +/** + * MaxCallsLimit limited number of calls to the contract. No funds transferable. + * Since: wasmd 0.30 + */ +export interface MaxCallsLimitSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.MaxCallsLimit"; + remaining: bigint; +} +/** + * MaxFundsLimit defines the maximal amounts that can be sent to the contract. + * Since: wasmd 0.30 + */ +export interface MaxFundsLimit { + $typeUrl?: "/cosmwasm.wasm.v1.MaxFundsLimit"; + /** Amounts is the maximal amount of tokens transferable to the contract. */ + amounts: Coin[]; +} +export interface MaxFundsLimitProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit"; + value: Uint8Array; +} +/** + * MaxFundsLimit defines the maximal amounts that can be sent to the contract. + * Since: wasmd 0.30 + */ +export interface MaxFundsLimitAmino { + /** Amounts is the maximal amount of tokens transferable to the contract. */ + amounts: CoinAmino[]; +} +export interface MaxFundsLimitAminoMsg { + type: "wasm/MaxFundsLimit"; + value: MaxFundsLimitAmino; +} +/** + * MaxFundsLimit defines the maximal amounts that can be sent to the contract. + * Since: wasmd 0.30 + */ +export interface MaxFundsLimitSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.MaxFundsLimit"; + amounts: CoinSDKType[]; +} +/** + * CombinedLimit defines the maximal amounts that can be sent to a contract and + * the maximal number of calls executable. Both need to remain >0 to be valid. + * Since: wasmd 0.30 + */ +export interface CombinedLimit { + $typeUrl?: "/cosmwasm.wasm.v1.CombinedLimit"; + /** Remaining number that is decremented on each execution */ + callsRemaining: bigint; + /** Amounts is the maximal amount of tokens transferable to the contract. */ + amounts: Coin[]; +} +export interface CombinedLimitProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.CombinedLimit"; + value: Uint8Array; +} +/** + * CombinedLimit defines the maximal amounts that can be sent to a contract and + * the maximal number of calls executable. Both need to remain >0 to be valid. + * Since: wasmd 0.30 + */ +export interface CombinedLimitAmino { + /** Remaining number that is decremented on each execution */ + calls_remaining?: string; + /** Amounts is the maximal amount of tokens transferable to the contract. */ + amounts: CoinAmino[]; +} +export interface CombinedLimitAminoMsg { + type: "wasm/CombinedLimit"; + value: CombinedLimitAmino; +} +/** + * CombinedLimit defines the maximal amounts that can be sent to a contract and + * the maximal number of calls executable. Both need to remain >0 to be valid. + * Since: wasmd 0.30 + */ +export interface CombinedLimitSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.CombinedLimit"; + calls_remaining: bigint; + amounts: CoinSDKType[]; +} +/** + * AllowAllMessagesFilter is a wildcard to allow any type of contract payload + * message. + * Since: wasmd 0.30 + */ +export interface AllowAllMessagesFilter { + $typeUrl?: "/cosmwasm.wasm.v1.AllowAllMessagesFilter"; +} +export interface AllowAllMessagesFilterProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter"; + value: Uint8Array; +} +/** + * AllowAllMessagesFilter is a wildcard to allow any type of contract payload + * message. + * Since: wasmd 0.30 + */ +export interface AllowAllMessagesFilterAmino {} +export interface AllowAllMessagesFilterAminoMsg { + type: "wasm/AllowAllMessagesFilter"; + value: AllowAllMessagesFilterAmino; +} +/** + * AllowAllMessagesFilter is a wildcard to allow any type of contract payload + * message. + * Since: wasmd 0.30 + */ +export interface AllowAllMessagesFilterSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.AllowAllMessagesFilter"; +} +/** + * AcceptedMessageKeysFilter accept only the specific contract message keys in + * the json object to be executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessageKeysFilter { + $typeUrl?: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter"; + /** Messages is the list of unique keys */ + keys: string[]; +} +export interface AcceptedMessageKeysFilterProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter"; + value: Uint8Array; +} +/** + * AcceptedMessageKeysFilter accept only the specific contract message keys in + * the json object to be executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessageKeysFilterAmino { + /** Messages is the list of unique keys */ + keys?: string[]; +} +export interface AcceptedMessageKeysFilterAminoMsg { + type: "wasm/AcceptedMessageKeysFilter"; + value: AcceptedMessageKeysFilterAmino; +} +/** + * AcceptedMessageKeysFilter accept only the specific contract message keys in + * the json object to be executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessageKeysFilterSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter"; + keys: string[]; +} +/** + * AcceptedMessagesFilter accept only the specific raw contract messages to be + * executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessagesFilter { + $typeUrl?: "/cosmwasm.wasm.v1.AcceptedMessagesFilter"; + /** Messages is the list of raw contract messages */ + messages: Uint8Array[]; +} +export interface AcceptedMessagesFilterProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter"; + value: Uint8Array; +} +/** + * AcceptedMessagesFilter accept only the specific raw contract messages to be + * executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessagesFilterAmino { + /** Messages is the list of raw contract messages */ + messages?: any[]; +} +export interface AcceptedMessagesFilterAminoMsg { + type: "wasm/AcceptedMessagesFilter"; + value: AcceptedMessagesFilterAmino; +} +/** + * AcceptedMessagesFilter accept only the specific raw contract messages to be + * executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessagesFilterSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.AcceptedMessagesFilter"; + messages: Uint8Array[]; +} +function createBaseStoreCodeAuthorization(): StoreCodeAuthorization { + return { + $typeUrl: "/cosmwasm.wasm.v1.StoreCodeAuthorization", + grants: [] + }; +} +export const StoreCodeAuthorization = { + typeUrl: "/cosmwasm.wasm.v1.StoreCodeAuthorization", + aminoType: "wasm/StoreCodeAuthorization", + encode(message: StoreCodeAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.grants) { + CodeGrant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StoreCodeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreCodeAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(CodeGrant.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): StoreCodeAuthorization { + const message = createBaseStoreCodeAuthorization(); + message.grants = object.grants?.map(e => CodeGrant.fromPartial(e)) || []; + return message; + }, + fromAmino(object: StoreCodeAuthorizationAmino): StoreCodeAuthorization { + const message = createBaseStoreCodeAuthorization(); + message.grants = object.grants?.map(e => CodeGrant.fromAmino(e)) || []; + return message; + }, + toAmino(message: StoreCodeAuthorization): StoreCodeAuthorizationAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? CodeGrant.toAmino(e) : undefined); + } else { + obj.grants = message.grants; + } + return obj; + }, + fromAminoMsg(object: StoreCodeAuthorizationAminoMsg): StoreCodeAuthorization { + return StoreCodeAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: StoreCodeAuthorization): StoreCodeAuthorizationAminoMsg { + return { + type: "wasm/StoreCodeAuthorization", + value: StoreCodeAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: StoreCodeAuthorizationProtoMsg): StoreCodeAuthorization { + return StoreCodeAuthorization.decode(message.value); + }, + toProto(message: StoreCodeAuthorization): Uint8Array { + return StoreCodeAuthorization.encode(message).finish(); + }, + toProtoMsg(message: StoreCodeAuthorization): StoreCodeAuthorizationProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.StoreCodeAuthorization", + value: StoreCodeAuthorization.encode(message).finish() + }; + } +}; +function createBaseContractExecutionAuthorization(): ContractExecutionAuthorization { + return { + $typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", + grants: [] + }; +} +export const ContractExecutionAuthorization = { + typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", + aminoType: "wasm/ContractExecutionAuthorization", + encode(message: ContractExecutionAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.grants) { + ContractGrant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContractExecutionAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractExecutionAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(ContractGrant.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContractExecutionAuthorization { + const message = createBaseContractExecutionAuthorization(); + message.grants = object.grants?.map(e => ContractGrant.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ContractExecutionAuthorizationAmino): ContractExecutionAuthorization { + const message = createBaseContractExecutionAuthorization(); + message.grants = object.grants?.map(e => ContractGrant.fromAmino(e)) || []; + return message; + }, + toAmino(message: ContractExecutionAuthorization): ContractExecutionAuthorizationAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? ContractGrant.toAmino(e) : undefined); + } else { + obj.grants = message.grants; + } + return obj; + }, + fromAminoMsg(object: ContractExecutionAuthorizationAminoMsg): ContractExecutionAuthorization { + return ContractExecutionAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: ContractExecutionAuthorization): ContractExecutionAuthorizationAminoMsg { + return { + type: "wasm/ContractExecutionAuthorization", + value: ContractExecutionAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: ContractExecutionAuthorizationProtoMsg): ContractExecutionAuthorization { + return ContractExecutionAuthorization.decode(message.value); + }, + toProto(message: ContractExecutionAuthorization): Uint8Array { + return ContractExecutionAuthorization.encode(message).finish(); + }, + toProtoMsg(message: ContractExecutionAuthorization): ContractExecutionAuthorizationProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", + value: ContractExecutionAuthorization.encode(message).finish() + }; + } +}; +function createBaseContractMigrationAuthorization(): ContractMigrationAuthorization { + return { + $typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization", + grants: [] + }; +} +export const ContractMigrationAuthorization = { + typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization", + aminoType: "wasm/ContractMigrationAuthorization", + encode(message: ContractMigrationAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.grants) { + ContractGrant.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContractMigrationAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractMigrationAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grants.push(ContractGrant.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContractMigrationAuthorization { + const message = createBaseContractMigrationAuthorization(); + message.grants = object.grants?.map(e => ContractGrant.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ContractMigrationAuthorizationAmino): ContractMigrationAuthorization { + const message = createBaseContractMigrationAuthorization(); + message.grants = object.grants?.map(e => ContractGrant.fromAmino(e)) || []; + return message; + }, + toAmino(message: ContractMigrationAuthorization): ContractMigrationAuthorizationAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map(e => e ? ContractGrant.toAmino(e) : undefined); + } else { + obj.grants = message.grants; + } + return obj; + }, + fromAminoMsg(object: ContractMigrationAuthorizationAminoMsg): ContractMigrationAuthorization { + return ContractMigrationAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: ContractMigrationAuthorization): ContractMigrationAuthorizationAminoMsg { + return { + type: "wasm/ContractMigrationAuthorization", + value: ContractMigrationAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: ContractMigrationAuthorizationProtoMsg): ContractMigrationAuthorization { + return ContractMigrationAuthorization.decode(message.value); + }, + toProto(message: ContractMigrationAuthorization): Uint8Array { + return ContractMigrationAuthorization.encode(message).finish(); + }, + toProtoMsg(message: ContractMigrationAuthorization): ContractMigrationAuthorizationProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ContractMigrationAuthorization", + value: ContractMigrationAuthorization.encode(message).finish() + }; + } +}; +function createBaseCodeGrant(): CodeGrant { + return { + codeHash: new Uint8Array(), + instantiatePermission: undefined + }; +} +export const CodeGrant = { + typeUrl: "/cosmwasm.wasm.v1.CodeGrant", + aminoType: "wasm/CodeGrant", + encode(message: CodeGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeHash.length !== 0) { + writer.uint32(10).bytes(message.codeHash); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CodeGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeHash = reader.bytes(); + break; + case 2: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CodeGrant { + const message = createBaseCodeGrant(); + message.codeHash = object.codeHash ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + return message; + }, + fromAmino(object: CodeGrantAmino): CodeGrant { + const message = createBaseCodeGrant(); + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = bytesFromBase64(object.code_hash); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + return message; + }, + toAmino(message: CodeGrant): CodeGrantAmino { + const obj: any = {}; + obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + return obj; + }, + fromAminoMsg(object: CodeGrantAminoMsg): CodeGrant { + return CodeGrant.fromAmino(object.value); + }, + toAminoMsg(message: CodeGrant): CodeGrantAminoMsg { + return { + type: "wasm/CodeGrant", + value: CodeGrant.toAmino(message) + }; + }, + fromProtoMsg(message: CodeGrantProtoMsg): CodeGrant { + return CodeGrant.decode(message.value); + }, + toProto(message: CodeGrant): Uint8Array { + return CodeGrant.encode(message).finish(); + }, + toProtoMsg(message: CodeGrant): CodeGrantProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.CodeGrant", + value: CodeGrant.encode(message).finish() + }; + } +}; +function createBaseContractGrant(): ContractGrant { + return { + contract: "", + limit: undefined, + filter: undefined + }; +} +export const ContractGrant = { + typeUrl: "/cosmwasm.wasm.v1.ContractGrant", + aminoType: "wasm/ContractGrant", + encode(message: ContractGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.contract !== "") { + writer.uint32(10).string(message.contract); + } + if (message.limit !== undefined) { + Any.encode((message.limit as Any), writer.uint32(18).fork()).ldelim(); + } + if (message.filter !== undefined) { + Any.encode((message.filter as Any), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContractGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contract = reader.string(); + break; + case 2: + message.limit = (Cosmwasm_wasmv1ContractAuthzLimitX_InterfaceDecoder(reader) as Any); + break; + case 3: + message.filter = (Cosmwasm_wasmv1ContractAuthzFilterX_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContractGrant { + const message = createBaseContractGrant(); + message.contract = object.contract ?? ""; + message.limit = object.limit !== undefined && object.limit !== null ? Any.fromPartial(object.limit) : undefined; + message.filter = object.filter !== undefined && object.filter !== null ? Any.fromPartial(object.filter) : undefined; + return message; + }, + fromAmino(object: ContractGrantAmino): ContractGrant { + const message = createBaseContractGrant(); + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = Cosmwasm_wasmv1ContractAuthzLimitX_FromAmino(object.limit); + } + if (object.filter !== undefined && object.filter !== null) { + message.filter = Cosmwasm_wasmv1ContractAuthzFilterX_FromAmino(object.filter); + } + return message; + }, + toAmino(message: ContractGrant): ContractGrantAmino { + const obj: any = {}; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.limit = message.limit ? Cosmwasm_wasmv1ContractAuthzLimitX_ToAmino((message.limit as Any)) : undefined; + obj.filter = message.filter ? Cosmwasm_wasmv1ContractAuthzFilterX_ToAmino((message.filter as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: ContractGrantAminoMsg): ContractGrant { + return ContractGrant.fromAmino(object.value); + }, + toAminoMsg(message: ContractGrant): ContractGrantAminoMsg { + return { + type: "wasm/ContractGrant", + value: ContractGrant.toAmino(message) + }; + }, + fromProtoMsg(message: ContractGrantProtoMsg): ContractGrant { + return ContractGrant.decode(message.value); + }, + toProto(message: ContractGrant): Uint8Array { + return ContractGrant.encode(message).finish(); + }, + toProtoMsg(message: ContractGrant): ContractGrantProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ContractGrant", + value: ContractGrant.encode(message).finish() + }; + } +}; +function createBaseMaxCallsLimit(): MaxCallsLimit { + return { + $typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit", + remaining: BigInt(0) + }; +} +export const MaxCallsLimit = { + typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit", + aminoType: "wasm/MaxCallsLimit", + encode(message: MaxCallsLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.remaining !== BigInt(0)) { + writer.uint32(8).uint64(message.remaining); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MaxCallsLimit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMaxCallsLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.remaining = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MaxCallsLimit { + const message = createBaseMaxCallsLimit(); + message.remaining = object.remaining !== undefined && object.remaining !== null ? BigInt(object.remaining.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MaxCallsLimitAmino): MaxCallsLimit { + const message = createBaseMaxCallsLimit(); + if (object.remaining !== undefined && object.remaining !== null) { + message.remaining = BigInt(object.remaining); + } + return message; + }, + toAmino(message: MaxCallsLimit): MaxCallsLimitAmino { + const obj: any = {}; + obj.remaining = message.remaining !== BigInt(0) ? message.remaining.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MaxCallsLimitAminoMsg): MaxCallsLimit { + return MaxCallsLimit.fromAmino(object.value); + }, + toAminoMsg(message: MaxCallsLimit): MaxCallsLimitAminoMsg { + return { + type: "wasm/MaxCallsLimit", + value: MaxCallsLimit.toAmino(message) + }; + }, + fromProtoMsg(message: MaxCallsLimitProtoMsg): MaxCallsLimit { + return MaxCallsLimit.decode(message.value); + }, + toProto(message: MaxCallsLimit): Uint8Array { + return MaxCallsLimit.encode(message).finish(); + }, + toProtoMsg(message: MaxCallsLimit): MaxCallsLimitProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit", + value: MaxCallsLimit.encode(message).finish() + }; + } +}; +function createBaseMaxFundsLimit(): MaxFundsLimit { + return { + $typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit", + amounts: [] + }; +} +export const MaxFundsLimit = { + typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit", + aminoType: "wasm/MaxFundsLimit", + encode(message: MaxFundsLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amounts) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MaxFundsLimit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMaxFundsLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amounts.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MaxFundsLimit { + const message = createBaseMaxFundsLimit(); + message.amounts = object.amounts?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MaxFundsLimitAmino): MaxFundsLimit { + const message = createBaseMaxFundsLimit(); + message.amounts = object.amounts?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MaxFundsLimit): MaxFundsLimitAmino { + const obj: any = {}; + if (message.amounts) { + obj.amounts = message.amounts.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amounts = message.amounts; + } + return obj; + }, + fromAminoMsg(object: MaxFundsLimitAminoMsg): MaxFundsLimit { + return MaxFundsLimit.fromAmino(object.value); + }, + toAminoMsg(message: MaxFundsLimit): MaxFundsLimitAminoMsg { + return { + type: "wasm/MaxFundsLimit", + value: MaxFundsLimit.toAmino(message) + }; + }, + fromProtoMsg(message: MaxFundsLimitProtoMsg): MaxFundsLimit { + return MaxFundsLimit.decode(message.value); + }, + toProto(message: MaxFundsLimit): Uint8Array { + return MaxFundsLimit.encode(message).finish(); + }, + toProtoMsg(message: MaxFundsLimit): MaxFundsLimitProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit", + value: MaxFundsLimit.encode(message).finish() + }; + } +}; +function createBaseCombinedLimit(): CombinedLimit { + return { + $typeUrl: "/cosmwasm.wasm.v1.CombinedLimit", + callsRemaining: BigInt(0), + amounts: [] + }; +} +export const CombinedLimit = { + typeUrl: "/cosmwasm.wasm.v1.CombinedLimit", + aminoType: "wasm/CombinedLimit", + encode(message: CombinedLimit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.callsRemaining !== BigInt(0)) { + writer.uint32(8).uint64(message.callsRemaining); + } + for (const v of message.amounts) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CombinedLimit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCombinedLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.callsRemaining = reader.uint64(); + break; + case 2: + message.amounts.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CombinedLimit { + const message = createBaseCombinedLimit(); + message.callsRemaining = object.callsRemaining !== undefined && object.callsRemaining !== null ? BigInt(object.callsRemaining.toString()) : BigInt(0); + message.amounts = object.amounts?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CombinedLimitAmino): CombinedLimit { + const message = createBaseCombinedLimit(); + if (object.calls_remaining !== undefined && object.calls_remaining !== null) { + message.callsRemaining = BigInt(object.calls_remaining); + } + message.amounts = object.amounts?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: CombinedLimit): CombinedLimitAmino { + const obj: any = {}; + obj.calls_remaining = message.callsRemaining !== BigInt(0) ? message.callsRemaining.toString() : undefined; + if (message.amounts) { + obj.amounts = message.amounts.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amounts = message.amounts; + } + return obj; + }, + fromAminoMsg(object: CombinedLimitAminoMsg): CombinedLimit { + return CombinedLimit.fromAmino(object.value); + }, + toAminoMsg(message: CombinedLimit): CombinedLimitAminoMsg { + return { + type: "wasm/CombinedLimit", + value: CombinedLimit.toAmino(message) + }; + }, + fromProtoMsg(message: CombinedLimitProtoMsg): CombinedLimit { + return CombinedLimit.decode(message.value); + }, + toProto(message: CombinedLimit): Uint8Array { + return CombinedLimit.encode(message).finish(); + }, + toProtoMsg(message: CombinedLimit): CombinedLimitProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.CombinedLimit", + value: CombinedLimit.encode(message).finish() + }; + } +}; +function createBaseAllowAllMessagesFilter(): AllowAllMessagesFilter { + return { + $typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter" + }; +} +export const AllowAllMessagesFilter = { + typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter", + aminoType: "wasm/AllowAllMessagesFilter", + encode(_: AllowAllMessagesFilter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AllowAllMessagesFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowAllMessagesFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): AllowAllMessagesFilter { + const message = createBaseAllowAllMessagesFilter(); + return message; + }, + fromAmino(_: AllowAllMessagesFilterAmino): AllowAllMessagesFilter { + const message = createBaseAllowAllMessagesFilter(); + return message; + }, + toAmino(_: AllowAllMessagesFilter): AllowAllMessagesFilterAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: AllowAllMessagesFilterAminoMsg): AllowAllMessagesFilter { + return AllowAllMessagesFilter.fromAmino(object.value); + }, + toAminoMsg(message: AllowAllMessagesFilter): AllowAllMessagesFilterAminoMsg { + return { + type: "wasm/AllowAllMessagesFilter", + value: AllowAllMessagesFilter.toAmino(message) + }; + }, + fromProtoMsg(message: AllowAllMessagesFilterProtoMsg): AllowAllMessagesFilter { + return AllowAllMessagesFilter.decode(message.value); + }, + toProto(message: AllowAllMessagesFilter): Uint8Array { + return AllowAllMessagesFilter.encode(message).finish(); + }, + toProtoMsg(message: AllowAllMessagesFilter): AllowAllMessagesFilterProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter", + value: AllowAllMessagesFilter.encode(message).finish() + }; + } +}; +function createBaseAcceptedMessageKeysFilter(): AcceptedMessageKeysFilter { + return { + $typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", + keys: [] + }; +} +export const AcceptedMessageKeysFilter = { + typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", + aminoType: "wasm/AcceptedMessageKeysFilter", + encode(message: AcceptedMessageKeysFilter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.keys) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AcceptedMessageKeysFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcceptedMessageKeysFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keys.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AcceptedMessageKeysFilter { + const message = createBaseAcceptedMessageKeysFilter(); + message.keys = object.keys?.map(e => e) || []; + return message; + }, + fromAmino(object: AcceptedMessageKeysFilterAmino): AcceptedMessageKeysFilter { + const message = createBaseAcceptedMessageKeysFilter(); + message.keys = object.keys?.map(e => e) || []; + return message; + }, + toAmino(message: AcceptedMessageKeysFilter): AcceptedMessageKeysFilterAmino { + const obj: any = {}; + if (message.keys) { + obj.keys = message.keys.map(e => e); + } else { + obj.keys = message.keys; + } + return obj; + }, + fromAminoMsg(object: AcceptedMessageKeysFilterAminoMsg): AcceptedMessageKeysFilter { + return AcceptedMessageKeysFilter.fromAmino(object.value); + }, + toAminoMsg(message: AcceptedMessageKeysFilter): AcceptedMessageKeysFilterAminoMsg { + return { + type: "wasm/AcceptedMessageKeysFilter", + value: AcceptedMessageKeysFilter.toAmino(message) + }; + }, + fromProtoMsg(message: AcceptedMessageKeysFilterProtoMsg): AcceptedMessageKeysFilter { + return AcceptedMessageKeysFilter.decode(message.value); + }, + toProto(message: AcceptedMessageKeysFilter): Uint8Array { + return AcceptedMessageKeysFilter.encode(message).finish(); + }, + toProtoMsg(message: AcceptedMessageKeysFilter): AcceptedMessageKeysFilterProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", + value: AcceptedMessageKeysFilter.encode(message).finish() + }; + } +}; +function createBaseAcceptedMessagesFilter(): AcceptedMessagesFilter { + return { + $typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter", + messages: [] + }; +} +export const AcceptedMessagesFilter = { + typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter", + aminoType: "wasm/AcceptedMessagesFilter", + encode(message: AcceptedMessagesFilter, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.messages) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AcceptedMessagesFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcceptedMessagesFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AcceptedMessagesFilter { + const message = createBaseAcceptedMessagesFilter(); + message.messages = object.messages?.map(e => e) || []; + return message; + }, + fromAmino(object: AcceptedMessagesFilterAmino): AcceptedMessagesFilter { + const message = createBaseAcceptedMessagesFilter(); + message.messages = object.messages?.map(e => toUtf8(JSON.stringify(e))) || []; + return message; + }, + toAmino(message: AcceptedMessagesFilter): AcceptedMessagesFilterAmino { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.messages = message.messages; + } + return obj; + }, + fromAminoMsg(object: AcceptedMessagesFilterAminoMsg): AcceptedMessagesFilter { + return AcceptedMessagesFilter.fromAmino(object.value); + }, + toAminoMsg(message: AcceptedMessagesFilter): AcceptedMessagesFilterAminoMsg { + return { + type: "wasm/AcceptedMessagesFilter", + value: AcceptedMessagesFilter.toAmino(message) + }; + }, + fromProtoMsg(message: AcceptedMessagesFilterProtoMsg): AcceptedMessagesFilter { + return AcceptedMessagesFilter.decode(message.value); + }, + toProto(message: AcceptedMessagesFilter): Uint8Array { + return AcceptedMessagesFilter.encode(message).finish(); + }, + toProtoMsg(message: AcceptedMessagesFilter): AcceptedMessagesFilterProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter", + value: AcceptedMessagesFilter.encode(message).finish() + }; + } +}; +export const Cosmwasm_wasmv1ContractAuthzLimitX_InterfaceDecoder = (input: BinaryReader | Uint8Array): MaxCallsLimit | MaxFundsLimit | CombinedLimit | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmwasm.wasm.v1.MaxCallsLimit": + return MaxCallsLimit.decode(data.value); + case "/cosmwasm.wasm.v1.MaxFundsLimit": + return MaxFundsLimit.decode(data.value); + case "/cosmwasm.wasm.v1.CombinedLimit": + return CombinedLimit.decode(data.value); + default: + return data; + } +}; +export const Cosmwasm_wasmv1ContractAuthzLimitX_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "wasm/MaxCallsLimit": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.MaxCallsLimit", + value: MaxCallsLimit.encode(MaxCallsLimit.fromPartial(MaxCallsLimit.fromAmino(content.value))).finish() + }); + case "wasm/MaxFundsLimit": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.MaxFundsLimit", + value: MaxFundsLimit.encode(MaxFundsLimit.fromPartial(MaxFundsLimit.fromAmino(content.value))).finish() + }); + case "wasm/CombinedLimit": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.CombinedLimit", + value: CombinedLimit.encode(CombinedLimit.fromPartial(CombinedLimit.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmwasm_wasmv1ContractAuthzLimitX_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmwasm.wasm.v1.MaxCallsLimit": + return { + type: "wasm/MaxCallsLimit", + value: MaxCallsLimit.toAmino(MaxCallsLimit.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.MaxFundsLimit": + return { + type: "wasm/MaxFundsLimit", + value: MaxFundsLimit.toAmino(MaxFundsLimit.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.CombinedLimit": + return { + type: "wasm/CombinedLimit", + value: CombinedLimit.toAmino(CombinedLimit.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; +export const Cosmwasm_wasmv1ContractAuthzFilterX_InterfaceDecoder = (input: BinaryReader | Uint8Array): AllowAllMessagesFilter | AcceptedMessageKeysFilter | AcceptedMessagesFilter | Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + case "/cosmwasm.wasm.v1.AllowAllMessagesFilter": + return AllowAllMessagesFilter.decode(data.value); + case "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter": + return AcceptedMessageKeysFilter.decode(data.value); + case "/cosmwasm.wasm.v1.AcceptedMessagesFilter": + return AcceptedMessagesFilter.decode(data.value); + default: + return data; + } +}; +export const Cosmwasm_wasmv1ContractAuthzFilterX_FromAmino = (content: AnyAmino): Any => { + switch (content.type) { + case "wasm/AllowAllMessagesFilter": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.AllowAllMessagesFilter", + value: AllowAllMessagesFilter.encode(AllowAllMessagesFilter.fromPartial(AllowAllMessagesFilter.fromAmino(content.value))).finish() + }); + case "wasm/AcceptedMessageKeysFilter": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter", + value: AcceptedMessageKeysFilter.encode(AcceptedMessageKeysFilter.fromPartial(AcceptedMessageKeysFilter.fromAmino(content.value))).finish() + }); + case "wasm/AcceptedMessagesFilter": + return Any.fromPartial({ + typeUrl: "/cosmwasm.wasm.v1.AcceptedMessagesFilter", + value: AcceptedMessagesFilter.encode(AcceptedMessagesFilter.fromPartial(AcceptedMessagesFilter.fromAmino(content.value))).finish() + }); + default: + return Any.fromAmino(content); + } +}; +export const Cosmwasm_wasmv1ContractAuthzFilterX_ToAmino = (content: Any) => { + switch (content.typeUrl) { + case "/cosmwasm.wasm.v1.AllowAllMessagesFilter": + return { + type: "wasm/AllowAllMessagesFilter", + value: AllowAllMessagesFilter.toAmino(AllowAllMessagesFilter.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter": + return { + type: "wasm/AcceptedMessageKeysFilter", + value: AcceptedMessageKeysFilter.toAmino(AcceptedMessageKeysFilter.decode(content.value, undefined)) + }; + case "/cosmwasm.wasm.v1.AcceptedMessagesFilter": + return { + type: "wasm/AcceptedMessagesFilter", + value: AcceptedMessagesFilter.toAmino(AcceptedMessagesFilter.decode(content.value, undefined)) + }; + default: + return Any.toAmino(content); + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/genesis.ts b/util/inj-types/cosmwasm/wasm/v1/genesis.ts new file mode 100644 index 00000000..7f7cccdc --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/genesis.ts @@ -0,0 +1,525 @@ +import { Params, ParamsAmino, ParamsSDKType, CodeInfo, CodeInfoAmino, CodeInfoSDKType, ContractInfo, ContractInfoAmino, ContractInfoSDKType, Model, ModelAmino, ModelSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntryAmino, ContractCodeHistoryEntrySDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** GenesisState - genesis state of x/wasm */ +export interface GenesisState { + params: Params; + codes: Code[]; + contracts: Contract[]; + sequences: Sequence[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState - genesis state of x/wasm */ +export interface GenesisStateAmino { + params: ParamsAmino; + codes?: CodeAmino[]; + contracts?: ContractAmino[]; + sequences?: SequenceAmino[]; +} +export interface GenesisStateAminoMsg { + type: "wasm/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState - genesis state of x/wasm */ +export interface GenesisStateSDKType { + params: ParamsSDKType; + codes: CodeSDKType[]; + contracts: ContractSDKType[]; + sequences: SequenceSDKType[]; +} +/** Code struct encompasses CodeInfo and CodeBytes */ +export interface Code { + codeId: bigint; + codeInfo: CodeInfo; + codeBytes: Uint8Array; + /** Pinned to wasmvm cache */ + pinned: boolean; +} +export interface CodeProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.Code"; + value: Uint8Array; +} +/** Code struct encompasses CodeInfo and CodeBytes */ +export interface CodeAmino { + code_id?: string; + code_info: CodeInfoAmino; + code_bytes?: string; + /** Pinned to wasmvm cache */ + pinned?: boolean; +} +export interface CodeAminoMsg { + type: "wasm/Code"; + value: CodeAmino; +} +/** Code struct encompasses CodeInfo and CodeBytes */ +export interface CodeSDKType { + code_id: bigint; + code_info: CodeInfoSDKType; + code_bytes: Uint8Array; + pinned: boolean; +} +/** Contract struct encompasses ContractAddress, ContractInfo, and ContractState */ +export interface Contract { + contractAddress: string; + contractInfo: ContractInfo; + contractState: Model[]; + contractCodeHistory: ContractCodeHistoryEntry[]; +} +export interface ContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.Contract"; + value: Uint8Array; +} +/** Contract struct encompasses ContractAddress, ContractInfo, and ContractState */ +export interface ContractAmino { + contract_address?: string; + contract_info: ContractInfoAmino; + contract_state: ModelAmino[]; + contract_code_history: ContractCodeHistoryEntryAmino[]; +} +export interface ContractAminoMsg { + type: "wasm/Contract"; + value: ContractAmino; +} +/** Contract struct encompasses ContractAddress, ContractInfo, and ContractState */ +export interface ContractSDKType { + contract_address: string; + contract_info: ContractInfoSDKType; + contract_state: ModelSDKType[]; + contract_code_history: ContractCodeHistoryEntrySDKType[]; +} +/** Sequence key and value of an id generation counter */ +export interface Sequence { + idKey: Uint8Array; + value: bigint; +} +export interface SequenceProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.Sequence"; + value: Uint8Array; +} +/** Sequence key and value of an id generation counter */ +export interface SequenceAmino { + id_key?: string; + value?: string; +} +export interface SequenceAminoMsg { + type: "wasm/Sequence"; + value: SequenceAmino; +} +/** Sequence key and value of an id generation counter */ +export interface SequenceSDKType { + id_key: Uint8Array; + value: bigint; +} +function createBaseGenesisState(): GenesisState { + return { + params: Params.fromPartial({}), + codes: [], + contracts: [], + sequences: [] + }; +} +export const GenesisState = { + typeUrl: "/cosmwasm.wasm.v1.GenesisState", + aminoType: "wasm/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.codes) { + Code.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.contracts) { + Contract.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.sequences) { + Sequence.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.codes.push(Code.decode(reader, reader.uint32())); + break; + case 3: + message.contracts.push(Contract.decode(reader, reader.uint32())); + break; + case 4: + message.sequences.push(Sequence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.codes = object.codes?.map(e => Code.fromPartial(e)) || []; + message.contracts = object.contracts?.map(e => Contract.fromPartial(e)) || []; + message.sequences = object.sequences?.map(e => Sequence.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.codes = object.codes?.map(e => Code.fromAmino(e)) || []; + message.contracts = object.contracts?.map(e => Contract.fromAmino(e)) || []; + message.sequences = object.sequences?.map(e => Sequence.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + if (message.codes) { + obj.codes = message.codes.map(e => e ? Code.toAmino(e) : undefined); + } else { + obj.codes = message.codes; + } + if (message.contracts) { + obj.contracts = message.contracts.map(e => e ? Contract.toAmino(e) : undefined); + } else { + obj.contracts = message.contracts; + } + if (message.sequences) { + obj.sequences = message.sequences.map(e => e ? Sequence.toAmino(e) : undefined); + } else { + obj.sequences = message.sequences; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "wasm/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; +function createBaseCode(): Code { + return { + codeId: BigInt(0), + codeInfo: CodeInfo.fromPartial({}), + codeBytes: new Uint8Array(), + pinned: false + }; +} +export const Code = { + typeUrl: "/cosmwasm.wasm.v1.Code", + aminoType: "wasm/Code", + encode(message: Code, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.codeInfo !== undefined) { + CodeInfo.encode(message.codeInfo, writer.uint32(18).fork()).ldelim(); + } + if (message.codeBytes.length !== 0) { + writer.uint32(26).bytes(message.codeBytes); + } + if (message.pinned === true) { + writer.uint32(32).bool(message.pinned); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Code { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.codeInfo = CodeInfo.decode(reader, reader.uint32()); + break; + case 3: + message.codeBytes = reader.bytes(); + break; + case 4: + message.pinned = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Code { + const message = createBaseCode(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.codeInfo = object.codeInfo !== undefined && object.codeInfo !== null ? CodeInfo.fromPartial(object.codeInfo) : undefined; + message.codeBytes = object.codeBytes ?? new Uint8Array(); + message.pinned = object.pinned ?? false; + return message; + }, + fromAmino(object: CodeAmino): Code { + const message = createBaseCode(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.code_info !== undefined && object.code_info !== null) { + message.codeInfo = CodeInfo.fromAmino(object.code_info); + } + if (object.code_bytes !== undefined && object.code_bytes !== null) { + message.codeBytes = bytesFromBase64(object.code_bytes); + } + if (object.pinned !== undefined && object.pinned !== null) { + message.pinned = object.pinned; + } + return message; + }, + toAmino(message: Code): CodeAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : CodeInfo.toAmino(CodeInfo.fromPartial({})); + obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; + obj.pinned = message.pinned === false ? undefined : message.pinned; + return obj; + }, + fromAminoMsg(object: CodeAminoMsg): Code { + return Code.fromAmino(object.value); + }, + toAminoMsg(message: Code): CodeAminoMsg { + return { + type: "wasm/Code", + value: Code.toAmino(message) + }; + }, + fromProtoMsg(message: CodeProtoMsg): Code { + return Code.decode(message.value); + }, + toProto(message: Code): Uint8Array { + return Code.encode(message).finish(); + }, + toProtoMsg(message: Code): CodeProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.Code", + value: Code.encode(message).finish() + }; + } +}; +function createBaseContract(): Contract { + return { + contractAddress: "", + contractInfo: ContractInfo.fromPartial({}), + contractState: [], + contractCodeHistory: [] + }; +} +export const Contract = { + typeUrl: "/cosmwasm.wasm.v1.Contract", + aminoType: "wasm/Contract", + encode(message: Contract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.contractInfo !== undefined) { + ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.contractState) { + Model.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.contractCodeHistory) { + ContractCodeHistoryEntry.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Contract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contractAddress = reader.string(); + break; + case 2: + message.contractInfo = ContractInfo.decode(reader, reader.uint32()); + break; + case 3: + message.contractState.push(Model.decode(reader, reader.uint32())); + break; + case 4: + message.contractCodeHistory.push(ContractCodeHistoryEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Contract { + const message = createBaseContract(); + message.contractAddress = object.contractAddress ?? ""; + message.contractInfo = object.contractInfo !== undefined && object.contractInfo !== null ? ContractInfo.fromPartial(object.contractInfo) : undefined; + message.contractState = object.contractState?.map(e => Model.fromPartial(e)) || []; + message.contractCodeHistory = object.contractCodeHistory?.map(e => ContractCodeHistoryEntry.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ContractAmino): Contract { + const message = createBaseContract(); + if (object.contract_address !== undefined && object.contract_address !== null) { + message.contractAddress = object.contract_address; + } + if (object.contract_info !== undefined && object.contract_info !== null) { + message.contractInfo = ContractInfo.fromAmino(object.contract_info); + } + message.contractState = object.contract_state?.map(e => Model.fromAmino(e)) || []; + message.contractCodeHistory = object.contract_code_history?.map(e => ContractCodeHistoryEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: Contract): ContractAmino { + const obj: any = {}; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : ContractInfo.toAmino(ContractInfo.fromPartial({})); + if (message.contractState) { + obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); + } else { + obj.contract_state = message.contractState; + } + if (message.contractCodeHistory) { + obj.contract_code_history = message.contractCodeHistory.map(e => e ? ContractCodeHistoryEntry.toAmino(e) : undefined); + } else { + obj.contract_code_history = message.contractCodeHistory; + } + return obj; + }, + fromAminoMsg(object: ContractAminoMsg): Contract { + return Contract.fromAmino(object.value); + }, + toAminoMsg(message: Contract): ContractAminoMsg { + return { + type: "wasm/Contract", + value: Contract.toAmino(message) + }; + }, + fromProtoMsg(message: ContractProtoMsg): Contract { + return Contract.decode(message.value); + }, + toProto(message: Contract): Uint8Array { + return Contract.encode(message).finish(); + }, + toProtoMsg(message: Contract): ContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.Contract", + value: Contract.encode(message).finish() + }; + } +}; +function createBaseSequence(): Sequence { + return { + idKey: new Uint8Array(), + value: BigInt(0) + }; +} +export const Sequence = { + typeUrl: "/cosmwasm.wasm.v1.Sequence", + aminoType: "wasm/Sequence", + encode(message: Sequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.idKey.length !== 0) { + writer.uint32(10).bytes(message.idKey); + } + if (message.value !== BigInt(0)) { + writer.uint32(16).uint64(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Sequence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSequence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.idKey = reader.bytes(); + break; + case 2: + message.value = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Sequence { + const message = createBaseSequence(); + message.idKey = object.idKey ?? new Uint8Array(); + message.value = object.value !== undefined && object.value !== null ? BigInt(object.value.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SequenceAmino): Sequence { + const message = createBaseSequence(); + if (object.id_key !== undefined && object.id_key !== null) { + message.idKey = bytesFromBase64(object.id_key); + } + if (object.value !== undefined && object.value !== null) { + message.value = BigInt(object.value); + } + return message; + }, + toAmino(message: Sequence): SequenceAmino { + const obj: any = {}; + obj.id_key = message.idKey ? base64FromBytes(message.idKey) : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SequenceAminoMsg): Sequence { + return Sequence.fromAmino(object.value); + }, + toAminoMsg(message: Sequence): SequenceAminoMsg { + return { + type: "wasm/Sequence", + value: Sequence.toAmino(message) + }; + }, + fromProtoMsg(message: SequenceProtoMsg): Sequence { + return Sequence.decode(message.value); + }, + toProto(message: Sequence): Uint8Array { + return Sequence.encode(message).finish(); + }, + toProtoMsg(message: Sequence): SequenceProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.Sequence", + value: Sequence.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/ibc.ts b/util/inj-types/cosmwasm/wasm/v1/ibc.ts new file mode 100644 index 00000000..aab65585 --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/ibc.ts @@ -0,0 +1,345 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +/** MsgIBCSend */ +export interface MsgIBCSend { + /** the channel by which the packet will be sent */ + channel: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeoutHeight: bigint; + /** + * Timeout timestamp (in nanoseconds) relative to the current block timestamp. + * The timeout is disabled when set to 0. + */ + timeoutTimestamp: bigint; + /** + * Data is the payload to transfer. We must not make assumption what format or + * content is in here. + */ + data: Uint8Array; +} +export interface MsgIBCSendProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend"; + value: Uint8Array; +} +/** MsgIBCSend */ +export interface MsgIBCSendAmino { + /** the channel by which the packet will be sent */ + channel?: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeout_height?: string; + /** + * Timeout timestamp (in nanoseconds) relative to the current block timestamp. + * The timeout is disabled when set to 0. + */ + timeout_timestamp?: string; + /** + * Data is the payload to transfer. We must not make assumption what format or + * content is in here. + */ + data?: string; +} +export interface MsgIBCSendAminoMsg { + type: "wasm/MsgIBCSend"; + value: MsgIBCSendAmino; +} +/** MsgIBCSend */ +export interface MsgIBCSendSDKType { + channel: string; + timeout_height: bigint; + timeout_timestamp: bigint; + data: Uint8Array; +} +/** MsgIBCSendResponse */ +export interface MsgIBCSendResponse { + /** Sequence number of the IBC packet sent */ + sequence: bigint; +} +export interface MsgIBCSendResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCSendResponse"; + value: Uint8Array; +} +/** MsgIBCSendResponse */ +export interface MsgIBCSendResponseAmino { + /** Sequence number of the IBC packet sent */ + sequence?: string; +} +export interface MsgIBCSendResponseAminoMsg { + type: "wasm/MsgIBCSendResponse"; + value: MsgIBCSendResponseAmino; +} +/** MsgIBCSendResponse */ +export interface MsgIBCSendResponseSDKType { + sequence: bigint; +} +/** MsgIBCCloseChannel port and channel need to be owned by the contract */ +export interface MsgIBCCloseChannel { + channel: string; +} +export interface MsgIBCCloseChannelProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel"; + value: Uint8Array; +} +/** MsgIBCCloseChannel port and channel need to be owned by the contract */ +export interface MsgIBCCloseChannelAmino { + channel?: string; +} +export interface MsgIBCCloseChannelAminoMsg { + type: "wasm/MsgIBCCloseChannel"; + value: MsgIBCCloseChannelAmino; +} +/** MsgIBCCloseChannel port and channel need to be owned by the contract */ +export interface MsgIBCCloseChannelSDKType { + channel: string; +} +function createBaseMsgIBCSend(): MsgIBCSend { + return { + channel: "", + timeoutHeight: BigInt(0), + timeoutTimestamp: BigInt(0), + data: new Uint8Array() + }; +} +export const MsgIBCSend = { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", + aminoType: "wasm/MsgIBCSend", + encode(message: MsgIBCSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.channel !== "") { + writer.uint32(18).string(message.channel); + } + if (message.timeoutHeight !== BigInt(0)) { + writer.uint32(32).uint64(message.timeoutHeight); + } + if (message.timeoutTimestamp !== BigInt(0)) { + writer.uint32(40).uint64(message.timeoutTimestamp); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.channel = reader.string(); + break; + case 4: + message.timeoutHeight = reader.uint64(); + break; + case 5: + message.timeoutTimestamp = reader.uint64(); + break; + case 6: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgIBCSend { + const message = createBaseMsgIBCSend(); + message.channel = object.channel ?? ""; + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0); + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgIBCSendAmino): MsgIBCSend { + const message = createBaseMsgIBCSend(); + if (object.channel !== undefined && object.channel !== null) { + message.channel = object.channel; + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = BigInt(object.timeout_height); + } + if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeout_timestamp); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgIBCSend): MsgIBCSendAmino { + const obj: any = {}; + obj.channel = message.channel === "" ? undefined : message.channel; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgIBCSendAminoMsg): MsgIBCSend { + return MsgIBCSend.fromAmino(object.value); + }, + toAminoMsg(message: MsgIBCSend): MsgIBCSendAminoMsg { + return { + type: "wasm/MsgIBCSend", + value: MsgIBCSend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIBCSendProtoMsg): MsgIBCSend { + return MsgIBCSend.decode(message.value); + }, + toProto(message: MsgIBCSend): Uint8Array { + return MsgIBCSend.encode(message).finish(); + }, + toProtoMsg(message: MsgIBCSend): MsgIBCSendProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", + value: MsgIBCSend.encode(message).finish() + }; + } +}; +function createBaseMsgIBCSendResponse(): MsgIBCSendResponse { + return { + sequence: BigInt(0) + }; +} +export const MsgIBCSendResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCSendResponse", + aminoType: "wasm/MsgIBCSendResponse", + encode(message: MsgIBCSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgIBCSendResponse { + const message = createBaseMsgIBCSendResponse(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgIBCSendResponseAmino): MsgIBCSendResponse { + const message = createBaseMsgIBCSendResponse(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: MsgIBCSendResponse): MsgIBCSendResponseAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgIBCSendResponseAminoMsg): MsgIBCSendResponse { + return MsgIBCSendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgIBCSendResponse): MsgIBCSendResponseAminoMsg { + return { + type: "wasm/MsgIBCSendResponse", + value: MsgIBCSendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIBCSendResponseProtoMsg): MsgIBCSendResponse { + return MsgIBCSendResponse.decode(message.value); + }, + toProto(message: MsgIBCSendResponse): Uint8Array { + return MsgIBCSendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgIBCSendResponse): MsgIBCSendResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCSendResponse", + value: MsgIBCSendResponse.encode(message).finish() + }; + } +}; +function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { + return { + channel: "" + }; +} +export const MsgIBCCloseChannel = { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", + aminoType: "wasm/MsgIBCCloseChannel", + encode(message: MsgIBCCloseChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.channel !== "") { + writer.uint32(18).string(message.channel); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCCloseChannel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCCloseChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.channel = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgIBCCloseChannel { + const message = createBaseMsgIBCCloseChannel(); + message.channel = object.channel ?? ""; + return message; + }, + fromAmino(object: MsgIBCCloseChannelAmino): MsgIBCCloseChannel { + const message = createBaseMsgIBCCloseChannel(); + if (object.channel !== undefined && object.channel !== null) { + message.channel = object.channel; + } + return message; + }, + toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { + const obj: any = {}; + obj.channel = message.channel === "" ? undefined : message.channel; + return obj; + }, + fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { + return MsgIBCCloseChannel.fromAmino(object.value); + }, + toAminoMsg(message: MsgIBCCloseChannel): MsgIBCCloseChannelAminoMsg { + return { + type: "wasm/MsgIBCCloseChannel", + value: MsgIBCCloseChannel.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIBCCloseChannelProtoMsg): MsgIBCCloseChannel { + return MsgIBCCloseChannel.decode(message.value); + }, + toProto(message: MsgIBCCloseChannel): Uint8Array { + return MsgIBCCloseChannel.encode(message).finish(); + }, + toProtoMsg(message: MsgIBCCloseChannel): MsgIBCCloseChannelProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", + value: MsgIBCCloseChannel.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/proposal_legacy.ts b/util/inj-types/cosmwasm/wasm/v1/proposal_legacy.ts new file mode 100644 index 00000000..a5dd8aa1 --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/proposal_legacy.ts @@ -0,0 +1,2550 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreCodeProposal. To submit WASM code to the system, + * a simple MsgStoreCode can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface StoreCodeProposal { + $typeUrl?: "/cosmwasm.wasm.v1.StoreCodeProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission?: AccessConfig; + /** UnpinCode code on upload, optional */ + unpinCode: boolean; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +export interface StoreCodeProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreCodeProposal. To submit WASM code to the system, + * a simple MsgStoreCode can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface StoreCodeProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + run_as?: string; + /** WASMByteCode can be raw or gzip compressed */ + wasm_byte_code?: string; + /** InstantiatePermission to apply on contract creation, optional */ + instantiate_permission?: AccessConfigAmino; + /** UnpinCode code on upload, optional */ + unpin_code?: boolean; + /** Source is the URL where the code is hosted */ + source?: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder?: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + code_hash?: string; +} +export interface StoreCodeProposalAminoMsg { + type: "wasm/StoreCodeProposal"; + value: StoreCodeProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreCodeProposal. To submit WASM code to the system, + * a simple MsgStoreCode can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface StoreCodeProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.StoreCodeProposal"; + title: string; + description: string; + run_as: string; + wasm_byte_code: Uint8Array; + instantiate_permission?: AccessConfigSDKType; + unpin_code: boolean; + source: string; + builder: string; + code_hash: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContractProposal. To instantiate a contract, + * a simple MsgInstantiateContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface InstantiateContractProposal { + $typeUrl?: "/cosmwasm.wasm.v1.InstantiateContractProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +export interface InstantiateContractProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContractProposal. To instantiate a contract, + * a simple MsgInstantiateContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface InstantiateContractProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + run_as?: string; + /** Admin is an optional address that can execute migrations */ + admin?: string; + /** CodeID is the reference to the stored WASM code */ + code_id?: string; + /** Label is optional metadata to be stored with a constract instance. */ + label?: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg?: any; + /** Funds coins that are transferred to the contract on instantiation */ + funds: CoinAmino[]; +} +export interface InstantiateContractProposalAminoMsg { + type: "wasm/InstantiateContractProposal"; + value: InstantiateContractProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContractProposal. To instantiate a contract, + * a simple MsgInstantiateContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface InstantiateContractProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.InstantiateContractProposal"; + title: string; + description: string; + run_as: string; + admin: string; + code_id: bigint; + label: string; + msg: Uint8Array; + funds: CoinSDKType[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContract2Proposal. To instantiate contract 2, + * a simple MsgInstantiateContract2 can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface InstantiateContract2Proposal { + $typeUrl?: "/cosmwasm.wasm.v1.InstantiateContract2Proposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's enviroment as sender */ + runAs: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encode message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; +} +export interface InstantiateContract2ProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContract2Proposal. To instantiate contract 2, + * a simple MsgInstantiateContract2 can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface InstantiateContract2ProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** RunAs is the address that is passed to the contract's enviroment as sender */ + run_as?: string; + /** Admin is an optional address that can execute migrations */ + admin?: string; + /** CodeID is the reference to the stored WASM code */ + code_id?: string; + /** Label is optional metadata to be stored with a constract instance. */ + label?: string; + /** Msg json encode message to be passed to the contract on instantiation */ + msg?: any; + /** Funds coins that are transferred to the contract on instantiation */ + funds: CoinAmino[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt?: string; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fix_msg?: boolean; +} +export interface InstantiateContract2ProposalAminoMsg { + type: "wasm/InstantiateContract2Proposal"; + value: InstantiateContract2ProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContract2Proposal. To instantiate contract 2, + * a simple MsgInstantiateContract2 can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface InstantiateContract2ProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.InstantiateContract2Proposal"; + title: string; + description: string; + run_as: string; + admin: string; + code_id: bigint; + label: string; + msg: Uint8Array; + funds: CoinSDKType[]; + salt: Uint8Array; + fix_msg: boolean; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit MigrateContractProposal. To migrate a contract, + * a simple MsgMigrateContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface MigrateContractProposal { + $typeUrl?: "/cosmwasm.wasm.v1.MigrateContractProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: bigint; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +export interface MigrateContractProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit MigrateContractProposal. To migrate a contract, + * a simple MsgMigrateContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface MigrateContractProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** Contract is the address of the smart contract */ + contract?: string; + /** CodeID references the new WASM code */ + code_id?: string; + /** Msg json encoded message to be passed to the contract on migration */ + msg?: any; +} +export interface MigrateContractProposalAminoMsg { + type: "wasm/MigrateContractProposal"; + value: MigrateContractProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit MigrateContractProposal. To migrate a contract, + * a simple MsgMigrateContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface MigrateContractProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.MigrateContractProposal"; + title: string; + description: string; + contract: string; + code_id: bigint; + msg: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit SudoContractProposal. To call sudo on a contract, + * a simple MsgSudoContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface SudoContractProposal { + $typeUrl?: "/cosmwasm.wasm.v1.SudoContractProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; +} +export interface SudoContractProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit SudoContractProposal. To call sudo on a contract, + * a simple MsgSudoContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface SudoContractProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** Contract is the address of the smart contract */ + contract?: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg?: any; +} +export interface SudoContractProposalAminoMsg { + type: "wasm/SudoContractProposal"; + value: SudoContractProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit SudoContractProposal. To call sudo on a contract, + * a simple MsgSudoContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface SudoContractProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.SudoContractProposal"; + title: string; + description: string; + contract: string; + msg: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ExecuteContractProposal. To call execute on a contract, + * a simple MsgExecuteContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface ExecuteContractProposal { + $typeUrl?: "/cosmwasm.wasm.v1.ExecuteContractProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as execute */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +export interface ExecuteContractProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ExecuteContractProposal. To call execute on a contract, + * a simple MsgExecuteContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface ExecuteContractProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + run_as?: string; + /** Contract is the address of the smart contract */ + contract?: string; + /** Msg json encoded message to be passed to the contract as execute */ + msg?: any; + /** Funds coins that are transferred to the contract on instantiation */ + funds: CoinAmino[]; +} +export interface ExecuteContractProposalAminoMsg { + type: "wasm/ExecuteContractProposal"; + value: ExecuteContractProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ExecuteContractProposal. To call execute on a contract, + * a simple MsgExecuteContract can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface ExecuteContractProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.ExecuteContractProposal"; + title: string; + description: string; + run_as: string; + contract: string; + msg: Uint8Array; + funds: CoinSDKType[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateAdminProposal. To set an admin for a contract, + * a simple MsgUpdateAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface UpdateAdminProposal { + $typeUrl?: "/cosmwasm.wasm.v1.UpdateAdminProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface UpdateAdminProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateAdminProposal. To set an admin for a contract, + * a simple MsgUpdateAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface UpdateAdminProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** NewAdmin address to be set */ + new_admin?: string; + /** Contract is the address of the smart contract */ + contract?: string; +} +export interface UpdateAdminProposalAminoMsg { + type: "wasm/UpdateAdminProposal"; + value: UpdateAdminProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateAdminProposal. To set an admin for a contract, + * a simple MsgUpdateAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface UpdateAdminProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.UpdateAdminProposal"; + title: string; + description: string; + new_admin: string; + contract: string; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ClearAdminProposal. To clear the admin of a contract, + * a simple MsgClearAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface ClearAdminProposal { + $typeUrl?: "/cosmwasm.wasm.v1.ClearAdminProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface ClearAdminProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ClearAdminProposal. To clear the admin of a contract, + * a simple MsgClearAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface ClearAdminProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** Contract is the address of the smart contract */ + contract?: string; +} +export interface ClearAdminProposalAminoMsg { + type: "wasm/ClearAdminProposal"; + value: ClearAdminProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ClearAdminProposal. To clear the admin of a contract, + * a simple MsgClearAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface ClearAdminProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.ClearAdminProposal"; + title: string; + description: string; + contract: string; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit PinCodesProposal. To pin a set of code ids in the wasmvm + * cache, a simple MsgPinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface PinCodesProposal { + $typeUrl?: "/cosmwasm.wasm.v1.PinCodesProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** CodeIDs references the new WASM codes */ + codeIds: bigint[]; +} +export interface PinCodesProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit PinCodesProposal. To pin a set of code ids in the wasmvm + * cache, a simple MsgPinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface PinCodesProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** CodeIDs references the new WASM codes */ + code_ids?: string[]; +} +export interface PinCodesProposalAminoMsg { + type: "wasm/PinCodesProposal"; + value: PinCodesProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit PinCodesProposal. To pin a set of code ids in the wasmvm + * cache, a simple MsgPinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface PinCodesProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.PinCodesProposal"; + title: string; + description: string; + code_ids: bigint[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm + * cache, a simple MsgUnpinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface UnpinCodesProposal { + $typeUrl?: "/cosmwasm.wasm.v1.UnpinCodesProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** CodeIDs references the WASM codes */ + codeIds: bigint[]; +} +export interface UnpinCodesProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm + * cache, a simple MsgUnpinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface UnpinCodesProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** CodeIDs references the WASM codes */ + code_ids?: string[]; +} +export interface UnpinCodesProposalAminoMsg { + type: "wasm/UnpinCodesProposal"; + value: UnpinCodesProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm + * cache, a simple MsgUnpinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + */ +/** @deprecated */ +export interface UnpinCodesProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.UnpinCodesProposal"; + title: string; + description: string; + code_ids: bigint[]; +} +/** + * AccessConfigUpdate contains the code id and the access config to be + * applied. + */ +export interface AccessConfigUpdate { + /** CodeID is the reference to the stored WASM code to be updated */ + codeId: bigint; + /** InstantiatePermission to apply to the set of code ids */ + instantiatePermission: AccessConfig; +} +export interface AccessConfigUpdateProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AccessConfigUpdate"; + value: Uint8Array; +} +/** + * AccessConfigUpdate contains the code id and the access config to be + * applied. + */ +export interface AccessConfigUpdateAmino { + /** CodeID is the reference to the stored WASM code to be updated */ + code_id?: string; + /** InstantiatePermission to apply to the set of code ids */ + instantiate_permission: AccessConfigAmino; +} +export interface AccessConfigUpdateAminoMsg { + type: "wasm/AccessConfigUpdate"; + value: AccessConfigUpdateAmino; +} +/** + * AccessConfigUpdate contains the code id and the access config to be + * applied. + */ +export interface AccessConfigUpdateSDKType { + code_id: bigint; + instantiate_permission: AccessConfigSDKType; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateInstantiateConfigProposal. To update instantiate config + * to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from + * the x/gov module via a v1 governance proposal. + */ +/** @deprecated */ +export interface UpdateInstantiateConfigProposal { + $typeUrl?: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** + * AccessConfigUpdate contains the list of code ids and the access config + * to be applied. + */ + accessConfigUpdates: AccessConfigUpdate[]; +} +export interface UpdateInstantiateConfigProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateInstantiateConfigProposal. To update instantiate config + * to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from + * the x/gov module via a v1 governance proposal. + */ +/** @deprecated */ +export interface UpdateInstantiateConfigProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** + * AccessConfigUpdate contains the list of code ids and the access config + * to be applied. + */ + access_config_updates: AccessConfigUpdateAmino[]; +} +export interface UpdateInstantiateConfigProposalAminoMsg { + type: "wasm/UpdateInstantiateConfigProposal"; + value: UpdateInstantiateConfigProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateInstantiateConfigProposal. To update instantiate config + * to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from + * the x/gov module via a v1 governance proposal. + */ +/** @deprecated */ +export interface UpdateInstantiateConfigProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal"; + title: string; + description: string; + access_config_updates: AccessConfigUpdateSDKType[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreAndInstantiateContractProposal. To store and instantiate + * the contract, a simple MsgStoreAndInstantiateContract can be invoked from + * the x/gov module via a v1 governance proposal. + */ +/** @deprecated */ +export interface StoreAndInstantiateContractProposal { + $typeUrl?: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal"; + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission?: AccessConfig; + /** UnpinCode code on upload, optional */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +export interface StoreAndInstantiateContractProposalProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal"; + value: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreAndInstantiateContractProposal. To store and instantiate + * the contract, a simple MsgStoreAndInstantiateContract can be invoked from + * the x/gov module via a v1 governance proposal. + */ +/** @deprecated */ +export interface StoreAndInstantiateContractProposalAmino { + /** Title is a short summary */ + title?: string; + /** Description is a human readable text */ + description?: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + run_as?: string; + /** WASMByteCode can be raw or gzip compressed */ + wasm_byte_code?: string; + /** InstantiatePermission to apply on contract creation, optional */ + instantiate_permission?: AccessConfigAmino; + /** UnpinCode code on upload, optional */ + unpin_code?: boolean; + /** Admin is an optional address that can execute migrations */ + admin?: string; + /** Label is optional metadata to be stored with a constract instance. */ + label?: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg?: any; + /** Funds coins that are transferred to the contract on instantiation */ + funds: CoinAmino[]; + /** Source is the URL where the code is hosted */ + source?: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder?: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + code_hash?: string; +} +export interface StoreAndInstantiateContractProposalAminoMsg { + type: "wasm/StoreAndInstantiateContractProposal"; + value: StoreAndInstantiateContractProposalAmino; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreAndInstantiateContractProposal. To store and instantiate + * the contract, a simple MsgStoreAndInstantiateContract can be invoked from + * the x/gov module via a v1 governance proposal. + */ +/** @deprecated */ +export interface StoreAndInstantiateContractProposalSDKType { + $typeUrl?: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal"; + title: string; + description: string; + run_as: string; + wasm_byte_code: Uint8Array; + instantiate_permission?: AccessConfigSDKType; + unpin_code: boolean; + admin: string; + label: string; + msg: Uint8Array; + funds: CoinSDKType[]; + source: string; + builder: string; + code_hash: Uint8Array; +} +function createBaseStoreCodeProposal(): StoreCodeProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", + title: "", + description: "", + runAs: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: undefined, + unpinCode: false, + source: "", + builder: "", + codeHash: new Uint8Array() + }; +} +export const StoreCodeProposal = { + typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", + aminoType: "wasm/StoreCodeProposal", + encode(message: StoreCodeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(34).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(58).fork()).ldelim(); + } + if (message.unpinCode === true) { + writer.uint32(64).bool(message.unpinCode); + } + if (message.source !== "") { + writer.uint32(74).string(message.source); + } + if (message.builder !== "") { + writer.uint32(82).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(90).bytes(message.codeHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StoreCodeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreCodeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.runAs = reader.string(); + break; + case 4: + message.wasmByteCode = reader.bytes(); + break; + case 7: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + case 8: + message.unpinCode = reader.bool(); + break; + case 9: + message.source = reader.string(); + break; + case 10: + message.builder = reader.string(); + break; + case 11: + message.codeHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): StoreCodeProposal { + const message = createBaseStoreCodeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + message.unpinCode = object.unpinCode ?? false; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: StoreCodeProposalAmino): StoreCodeProposal { + const message = createBaseStoreCodeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.run_as !== undefined && object.run_as !== null) { + message.runAs = object.run_as; + } + if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) { + message.wasmByteCode = fromBase64(object.wasm_byte_code); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + if (object.unpin_code !== undefined && object.unpin_code !== null) { + message.unpinCode = object.unpin_code; + } + if (object.source !== undefined && object.source !== null) { + message.source = object.source; + } + if (object.builder !== undefined && object.builder !== null) { + message.builder = object.builder; + } + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = bytesFromBase64(object.code_hash); + } + return message; + }, + toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + obj.unpin_code = message.unpinCode === false ? undefined : message.unpinCode; + obj.source = message.source === "" ? undefined : message.source; + obj.builder = message.builder === "" ? undefined : message.builder; + obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; + return obj; + }, + fromAminoMsg(object: StoreCodeProposalAminoMsg): StoreCodeProposal { + return StoreCodeProposal.fromAmino(object.value); + }, + toAminoMsg(message: StoreCodeProposal): StoreCodeProposalAminoMsg { + return { + type: "wasm/StoreCodeProposal", + value: StoreCodeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: StoreCodeProposalProtoMsg): StoreCodeProposal { + return StoreCodeProposal.decode(message.value); + }, + toProto(message: StoreCodeProposal): Uint8Array { + return StoreCodeProposal.encode(message).finish(); + }, + toProtoMsg(message: StoreCodeProposal): StoreCodeProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.StoreCodeProposal", + value: StoreCodeProposal.encode(message).finish() + }; + } +}; +function createBaseInstantiateContractProposal(): InstantiateContractProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", + title: "", + description: "", + runAs: "", + admin: "", + codeId: BigInt(0), + label: "", + msg: new Uint8Array(), + funds: [] + }; +} +export const InstantiateContractProposal = { + typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", + aminoType: "wasm/InstantiateContractProposal", + encode(message: InstantiateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.admin !== "") { + writer.uint32(34).string(message.admin); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(40).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(50).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(58).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InstantiateContractProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInstantiateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.runAs = reader.string(); + break; + case 4: + message.admin = reader.string(); + break; + case 5: + message.codeId = reader.uint64(); + break; + case 6: + message.label = reader.string(); + break; + case 7: + message.msg = reader.bytes(); + break; + case 8: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): InstantiateContractProposal { + const message = createBaseInstantiateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: InstantiateContractProposalAmino): InstantiateContractProposal { + const message = createBaseInstantiateContractProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.run_as !== undefined && object.run_as !== null) { + message.runAs = object.run_as; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + return obj; + }, + fromAminoMsg(object: InstantiateContractProposalAminoMsg): InstantiateContractProposal { + return InstantiateContractProposal.fromAmino(object.value); + }, + toAminoMsg(message: InstantiateContractProposal): InstantiateContractProposalAminoMsg { + return { + type: "wasm/InstantiateContractProposal", + value: InstantiateContractProposal.toAmino(message) + }; + }, + fromProtoMsg(message: InstantiateContractProposalProtoMsg): InstantiateContractProposal { + return InstantiateContractProposal.decode(message.value); + }, + toProto(message: InstantiateContractProposal): Uint8Array { + return InstantiateContractProposal.encode(message).finish(); + }, + toProtoMsg(message: InstantiateContractProposal): InstantiateContractProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.InstantiateContractProposal", + value: InstantiateContractProposal.encode(message).finish() + }; + } +}; +function createBaseInstantiateContract2Proposal(): InstantiateContract2Proposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal", + title: "", + description: "", + runAs: "", + admin: "", + codeId: BigInt(0), + label: "", + msg: new Uint8Array(), + funds: [], + salt: new Uint8Array(), + fixMsg: false + }; +} +export const InstantiateContract2Proposal = { + typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal", + aminoType: "wasm/InstantiateContract2Proposal", + encode(message: InstantiateContract2Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.admin !== "") { + writer.uint32(34).string(message.admin); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(40).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(50).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(58).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(66).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(74).bytes(message.salt); + } + if (message.fixMsg === true) { + writer.uint32(80).bool(message.fixMsg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InstantiateContract2Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInstantiateContract2Proposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.runAs = reader.string(); + break; + case 4: + message.admin = reader.string(); + break; + case 5: + message.codeId = reader.uint64(); + break; + case 6: + message.label = reader.string(); + break; + case 7: + message.msg = reader.bytes(); + break; + case 8: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + case 9: + message.salt = reader.bytes(); + break; + case 10: + message.fixMsg = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): InstantiateContract2Proposal { + const message = createBaseInstantiateContract2Proposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + message.salt = object.salt ?? new Uint8Array(); + message.fixMsg = object.fixMsg ?? false; + return message; + }, + fromAmino(object: InstantiateContract2ProposalAmino): InstantiateContract2Proposal { + const message = createBaseInstantiateContract2Proposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.run_as !== undefined && object.run_as !== null) { + message.runAs = object.run_as; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.fix_msg !== undefined && object.fix_msg !== null) { + message.fixMsg = object.fix_msg; + } + return message; + }, + toAmino(message: InstantiateContract2Proposal): InstantiateContract2ProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.fix_msg = message.fixMsg === false ? undefined : message.fixMsg; + return obj; + }, + fromAminoMsg(object: InstantiateContract2ProposalAminoMsg): InstantiateContract2Proposal { + return InstantiateContract2Proposal.fromAmino(object.value); + }, + toAminoMsg(message: InstantiateContract2Proposal): InstantiateContract2ProposalAminoMsg { + return { + type: "wasm/InstantiateContract2Proposal", + value: InstantiateContract2Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: InstantiateContract2ProposalProtoMsg): InstantiateContract2Proposal { + return InstantiateContract2Proposal.decode(message.value); + }, + toProto(message: InstantiateContract2Proposal): Uint8Array { + return InstantiateContract2Proposal.encode(message).finish(); + }, + toProtoMsg(message: InstantiateContract2Proposal): InstantiateContract2ProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.InstantiateContract2Proposal", + value: InstantiateContract2Proposal.encode(message).finish() + }; + } +}; +function createBaseMigrateContractProposal(): MigrateContractProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", + title: "", + description: "", + contract: "", + codeId: BigInt(0), + msg: new Uint8Array() + }; +} +export const MigrateContractProposal = { + typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", + aminoType: "wasm/MigrateContractProposal", + encode(message: MigrateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(40).uint64(message.codeId); + } + if (message.msg.length !== 0) { + writer.uint32(50).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MigrateContractProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 4: + message.contract = reader.string(); + break; + case 5: + message.codeId = reader.uint64(); + break; + case 6: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MigrateContractProposal { + const message = createBaseMigrateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: MigrateContractProposalAmino): MigrateContractProposal { + const message = createBaseMigrateContractProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: MigrateContractProposalAminoMsg): MigrateContractProposal { + return MigrateContractProposal.fromAmino(object.value); + }, + toAminoMsg(message: MigrateContractProposal): MigrateContractProposalAminoMsg { + return { + type: "wasm/MigrateContractProposal", + value: MigrateContractProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MigrateContractProposalProtoMsg): MigrateContractProposal { + return MigrateContractProposal.decode(message.value); + }, + toProto(message: MigrateContractProposal): Uint8Array { + return MigrateContractProposal.encode(message).finish(); + }, + toProtoMsg(message: MigrateContractProposal): MigrateContractProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MigrateContractProposal", + value: MigrateContractProposal.encode(message).finish() + }; + } +}; +function createBaseSudoContractProposal(): SudoContractProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", + title: "", + description: "", + contract: "", + msg: new Uint8Array() + }; +} +export const SudoContractProposal = { + typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", + aminoType: "wasm/SudoContractProposal", + encode(message: SudoContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SudoContractProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSudoContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + case 4: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SudoContractProposal { + const message = createBaseSudoContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: SudoContractProposalAmino): SudoContractProposal { + const message = createBaseSudoContractProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: SudoContractProposal): SudoContractProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: SudoContractProposalAminoMsg): SudoContractProposal { + return SudoContractProposal.fromAmino(object.value); + }, + toAminoMsg(message: SudoContractProposal): SudoContractProposalAminoMsg { + return { + type: "wasm/SudoContractProposal", + value: SudoContractProposal.toAmino(message) + }; + }, + fromProtoMsg(message: SudoContractProposalProtoMsg): SudoContractProposal { + return SudoContractProposal.decode(message.value); + }, + toProto(message: SudoContractProposal): Uint8Array { + return SudoContractProposal.encode(message).finish(); + }, + toProtoMsg(message: SudoContractProposal): SudoContractProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.SudoContractProposal", + value: SudoContractProposal.encode(message).finish() + }; + } +}; +function createBaseExecuteContractProposal(): ExecuteContractProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", + title: "", + description: "", + runAs: "", + contract: "", + msg: new Uint8Array(), + funds: [] + }; +} +export const ExecuteContractProposal = { + typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", + aminoType: "wasm/ExecuteContractProposal", + encode(message: ExecuteContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExecuteContractProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.runAs = reader.string(); + break; + case 4: + message.contract = reader.string(); + break; + case 5: + message.msg = reader.bytes(); + break; + case 6: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExecuteContractProposal { + const message = createBaseExecuteContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ExecuteContractProposalAmino): ExecuteContractProposal { + const message = createBaseExecuteContractProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.run_as !== undefined && object.run_as !== null) { + message.runAs = object.run_as; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + return obj; + }, + fromAminoMsg(object: ExecuteContractProposalAminoMsg): ExecuteContractProposal { + return ExecuteContractProposal.fromAmino(object.value); + }, + toAminoMsg(message: ExecuteContractProposal): ExecuteContractProposalAminoMsg { + return { + type: "wasm/ExecuteContractProposal", + value: ExecuteContractProposal.toAmino(message) + }; + }, + fromProtoMsg(message: ExecuteContractProposalProtoMsg): ExecuteContractProposal { + return ExecuteContractProposal.decode(message.value); + }, + toProto(message: ExecuteContractProposal): Uint8Array { + return ExecuteContractProposal.encode(message).finish(); + }, + toProtoMsg(message: ExecuteContractProposal): ExecuteContractProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ExecuteContractProposal", + value: ExecuteContractProposal.encode(message).finish() + }; + } +}; +function createBaseUpdateAdminProposal(): UpdateAdminProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", + title: "", + description: "", + newAdmin: "", + contract: "" + }; +} +export const UpdateAdminProposal = { + typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", + aminoType: "wasm/UpdateAdminProposal", + encode(message: UpdateAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UpdateAdminProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateAdminProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.newAdmin = reader.string(); + break; + case 4: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UpdateAdminProposal { + const message = createBaseUpdateAdminProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.newAdmin = object.newAdmin ?? ""; + message.contract = object.contract ?? ""; + return message; + }, + fromAmino(object: UpdateAdminProposalAmino): UpdateAdminProposal { + const message = createBaseUpdateAdminProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + return message; + }, + toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; + return obj; + }, + fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { + return UpdateAdminProposal.fromAmino(object.value); + }, + toAminoMsg(message: UpdateAdminProposal): UpdateAdminProposalAminoMsg { + return { + type: "wasm/UpdateAdminProposal", + value: UpdateAdminProposal.toAmino(message) + }; + }, + fromProtoMsg(message: UpdateAdminProposalProtoMsg): UpdateAdminProposal { + return UpdateAdminProposal.decode(message.value); + }, + toProto(message: UpdateAdminProposal): Uint8Array { + return UpdateAdminProposal.encode(message).finish(); + }, + toProtoMsg(message: UpdateAdminProposal): UpdateAdminProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.UpdateAdminProposal", + value: UpdateAdminProposal.encode(message).finish() + }; + } +}; +function createBaseClearAdminProposal(): ClearAdminProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", + title: "", + description: "", + contract: "" + }; +} +export const ClearAdminProposal = { + typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", + aminoType: "wasm/ClearAdminProposal", + encode(message: ClearAdminProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClearAdminProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClearAdminProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClearAdminProposal { + const message = createBaseClearAdminProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + return message; + }, + fromAmino(object: ClearAdminProposalAmino): ClearAdminProposal { + const message = createBaseClearAdminProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + return message; + }, + toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; + return obj; + }, + fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { + return ClearAdminProposal.fromAmino(object.value); + }, + toAminoMsg(message: ClearAdminProposal): ClearAdminProposalAminoMsg { + return { + type: "wasm/ClearAdminProposal", + value: ClearAdminProposal.toAmino(message) + }; + }, + fromProtoMsg(message: ClearAdminProposalProtoMsg): ClearAdminProposal { + return ClearAdminProposal.decode(message.value); + }, + toProto(message: ClearAdminProposal): Uint8Array { + return ClearAdminProposal.encode(message).finish(); + }, + toProtoMsg(message: ClearAdminProposal): ClearAdminProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ClearAdminProposal", + value: ClearAdminProposal.encode(message).finish() + }; + } +}; +function createBasePinCodesProposal(): PinCodesProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", + title: "", + description: "", + codeIds: [] + }; +} +export const PinCodesProposal = { + typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", + aminoType: "wasm/PinCodesProposal", + encode(message: PinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PinCodesProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePinCodesProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(reader.uint64()); + } + } else { + message.codeIds.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PinCodesProposal { + const message = createBasePinCodesProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: PinCodesProposalAmino): PinCodesProposal { + const message = createBasePinCodesProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.codeIds = object.code_ids?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: PinCodesProposal): PinCodesProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + if (message.codeIds) { + obj.code_ids = message.codeIds.map(e => e.toString()); + } else { + obj.code_ids = message.codeIds; + } + return obj; + }, + fromAminoMsg(object: PinCodesProposalAminoMsg): PinCodesProposal { + return PinCodesProposal.fromAmino(object.value); + }, + toAminoMsg(message: PinCodesProposal): PinCodesProposalAminoMsg { + return { + type: "wasm/PinCodesProposal", + value: PinCodesProposal.toAmino(message) + }; + }, + fromProtoMsg(message: PinCodesProposalProtoMsg): PinCodesProposal { + return PinCodesProposal.decode(message.value); + }, + toProto(message: PinCodesProposal): Uint8Array { + return PinCodesProposal.encode(message).finish(); + }, + toProtoMsg(message: PinCodesProposal): PinCodesProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.PinCodesProposal", + value: PinCodesProposal.encode(message).finish() + }; + } +}; +function createBaseUnpinCodesProposal(): UnpinCodesProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", + title: "", + description: "", + codeIds: [] + }; +} +export const UnpinCodesProposal = { + typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", + aminoType: "wasm/UnpinCodesProposal", + encode(message: UnpinCodesProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UnpinCodesProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnpinCodesProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(reader.uint64()); + } + } else { + message.codeIds.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UnpinCodesProposal { + const message = createBaseUnpinCodesProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: UnpinCodesProposalAmino): UnpinCodesProposal { + const message = createBaseUnpinCodesProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.codeIds = object.code_ids?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + if (message.codeIds) { + obj.code_ids = message.codeIds.map(e => e.toString()); + } else { + obj.code_ids = message.codeIds; + } + return obj; + }, + fromAminoMsg(object: UnpinCodesProposalAminoMsg): UnpinCodesProposal { + return UnpinCodesProposal.fromAmino(object.value); + }, + toAminoMsg(message: UnpinCodesProposal): UnpinCodesProposalAminoMsg { + return { + type: "wasm/UnpinCodesProposal", + value: UnpinCodesProposal.toAmino(message) + }; + }, + fromProtoMsg(message: UnpinCodesProposalProtoMsg): UnpinCodesProposal { + return UnpinCodesProposal.decode(message.value); + }, + toProto(message: UnpinCodesProposal): Uint8Array { + return UnpinCodesProposal.encode(message).finish(); + }, + toProtoMsg(message: UnpinCodesProposal): UnpinCodesProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.UnpinCodesProposal", + value: UnpinCodesProposal.encode(message).finish() + }; + } +}; +function createBaseAccessConfigUpdate(): AccessConfigUpdate { + return { + codeId: BigInt(0), + instantiatePermission: AccessConfig.fromPartial({}) + }; +} +export const AccessConfigUpdate = { + typeUrl: "/cosmwasm.wasm.v1.AccessConfigUpdate", + aminoType: "wasm/AccessConfigUpdate", + encode(message: AccessConfigUpdate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AccessConfigUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessConfigUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AccessConfigUpdate { + const message = createBaseAccessConfigUpdate(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + return message; + }, + fromAmino(object: AccessConfigUpdateAmino): AccessConfigUpdate { + const message = createBaseAccessConfigUpdate(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + return message; + }, + toAmino(message: AccessConfigUpdate): AccessConfigUpdateAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : AccessConfig.toAmino(AccessConfig.fromPartial({})); + return obj; + }, + fromAminoMsg(object: AccessConfigUpdateAminoMsg): AccessConfigUpdate { + return AccessConfigUpdate.fromAmino(object.value); + }, + toAminoMsg(message: AccessConfigUpdate): AccessConfigUpdateAminoMsg { + return { + type: "wasm/AccessConfigUpdate", + value: AccessConfigUpdate.toAmino(message) + }; + }, + fromProtoMsg(message: AccessConfigUpdateProtoMsg): AccessConfigUpdate { + return AccessConfigUpdate.decode(message.value); + }, + toProto(message: AccessConfigUpdate): Uint8Array { + return AccessConfigUpdate.encode(message).finish(); + }, + toProtoMsg(message: AccessConfigUpdate): AccessConfigUpdateProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AccessConfigUpdate", + value: AccessConfigUpdate.encode(message).finish() + }; + } +}; +function createBaseUpdateInstantiateConfigProposal(): UpdateInstantiateConfigProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", + title: "", + description: "", + accessConfigUpdates: [] + }; +} +export const UpdateInstantiateConfigProposal = { + typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", + aminoType: "wasm/UpdateInstantiateConfigProposal", + encode(message: UpdateInstantiateConfigProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.accessConfigUpdates) { + AccessConfigUpdate.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UpdateInstantiateConfigProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateInstantiateConfigProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.accessConfigUpdates.push(AccessConfigUpdate.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UpdateInstantiateConfigProposal { + const message = createBaseUpdateInstantiateConfigProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.accessConfigUpdates = object.accessConfigUpdates?.map(e => AccessConfigUpdate.fromPartial(e)) || []; + return message; + }, + fromAmino(object: UpdateInstantiateConfigProposalAmino): UpdateInstantiateConfigProposal { + const message = createBaseUpdateInstantiateConfigProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.accessConfigUpdates = object.access_config_updates?.map(e => AccessConfigUpdate.fromAmino(e)) || []; + return message; + }, + toAmino(message: UpdateInstantiateConfigProposal): UpdateInstantiateConfigProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + if (message.accessConfigUpdates) { + obj.access_config_updates = message.accessConfigUpdates.map(e => e ? AccessConfigUpdate.toAmino(e) : undefined); + } else { + obj.access_config_updates = message.accessConfigUpdates; + } + return obj; + }, + fromAminoMsg(object: UpdateInstantiateConfigProposalAminoMsg): UpdateInstantiateConfigProposal { + return UpdateInstantiateConfigProposal.fromAmino(object.value); + }, + toAminoMsg(message: UpdateInstantiateConfigProposal): UpdateInstantiateConfigProposalAminoMsg { + return { + type: "wasm/UpdateInstantiateConfigProposal", + value: UpdateInstantiateConfigProposal.toAmino(message) + }; + }, + fromProtoMsg(message: UpdateInstantiateConfigProposalProtoMsg): UpdateInstantiateConfigProposal { + return UpdateInstantiateConfigProposal.decode(message.value); + }, + toProto(message: UpdateInstantiateConfigProposal): Uint8Array { + return UpdateInstantiateConfigProposal.encode(message).finish(); + }, + toProtoMsg(message: UpdateInstantiateConfigProposal): UpdateInstantiateConfigProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal", + value: UpdateInstantiateConfigProposal.encode(message).finish() + }; + } +}; +function createBaseStoreAndInstantiateContractProposal(): StoreAndInstantiateContractProposal { + return { + $typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", + title: "", + description: "", + runAs: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: undefined, + unpinCode: false, + admin: "", + label: "", + msg: new Uint8Array(), + funds: [], + source: "", + builder: "", + codeHash: new Uint8Array() + }; +} +export const StoreAndInstantiateContractProposal = { + typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", + aminoType: "wasm/StoreAndInstantiateContractProposal", + encode(message: StoreAndInstantiateContractProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(34).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(42).fork()).ldelim(); + } + if (message.unpinCode === true) { + writer.uint32(48).bool(message.unpinCode); + } + if (message.admin !== "") { + writer.uint32(58).string(message.admin); + } + if (message.label !== "") { + writer.uint32(66).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(74).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(82).fork()).ldelim(); + } + if (message.source !== "") { + writer.uint32(90).string(message.source); + } + if (message.builder !== "") { + writer.uint32(98).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(106).bytes(message.codeHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StoreAndInstantiateContractProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreAndInstantiateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.runAs = reader.string(); + break; + case 4: + message.wasmByteCode = reader.bytes(); + break; + case 5: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + case 6: + message.unpinCode = reader.bool(); + break; + case 7: + message.admin = reader.string(); + break; + case 8: + message.label = reader.string(); + break; + case 9: + message.msg = reader.bytes(); + break; + case 10: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + case 11: + message.source = reader.string(); + break; + case 12: + message.builder = reader.string(); + break; + case 13: + message.codeHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): StoreAndInstantiateContractProposal { + const message = createBaseStoreAndInstantiateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + message.unpinCode = object.unpinCode ?? false; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: StoreAndInstantiateContractProposalAmino): StoreAndInstantiateContractProposal { + const message = createBaseStoreAndInstantiateContractProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.run_as !== undefined && object.run_as !== null) { + message.runAs = object.run_as; + } + if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) { + message.wasmByteCode = fromBase64(object.wasm_byte_code); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + if (object.unpin_code !== undefined && object.unpin_code !== null) { + message.unpinCode = object.unpin_code; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + if (object.source !== undefined && object.source !== null) { + message.source = object.source; + } + if (object.builder !== undefined && object.builder !== null) { + message.builder = object.builder; + } + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = bytesFromBase64(object.code_hash); + } + return message; + }, + toAmino(message: StoreAndInstantiateContractProposal): StoreAndInstantiateContractProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + obj.unpin_code = message.unpinCode === false ? undefined : message.unpinCode; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + obj.source = message.source === "" ? undefined : message.source; + obj.builder = message.builder === "" ? undefined : message.builder; + obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; + return obj; + }, + fromAminoMsg(object: StoreAndInstantiateContractProposalAminoMsg): StoreAndInstantiateContractProposal { + return StoreAndInstantiateContractProposal.fromAmino(object.value); + }, + toAminoMsg(message: StoreAndInstantiateContractProposal): StoreAndInstantiateContractProposalAminoMsg { + return { + type: "wasm/StoreAndInstantiateContractProposal", + value: StoreAndInstantiateContractProposal.toAmino(message) + }; + }, + fromProtoMsg(message: StoreAndInstantiateContractProposalProtoMsg): StoreAndInstantiateContractProposal { + return StoreAndInstantiateContractProposal.decode(message.value); + }, + toProto(message: StoreAndInstantiateContractProposal): Uint8Array { + return StoreAndInstantiateContractProposal.encode(message).finish(); + }, + toProtoMsg(message: StoreAndInstantiateContractProposal): StoreAndInstantiateContractProposalProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal", + value: StoreAndInstantiateContractProposal.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/query.lcd.ts b/util/inj-types/cosmwasm/wasm/v1/query.lcd.ts new file mode 100644 index 00000000..1554cd6d --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/query.lcd.ts @@ -0,0 +1,108 @@ +import { setPaginationParams } from "../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryContractInfoRequest, QueryContractInfoResponseSDKType, QueryContractHistoryRequest, QueryContractHistoryResponseSDKType, QueryContractsByCodeRequest, QueryContractsByCodeResponseSDKType, QueryAllContractStateRequest, QueryAllContractStateResponseSDKType, QueryRawContractStateRequest, QueryRawContractStateResponseSDKType, QuerySmartContractStateRequest, QuerySmartContractStateResponseSDKType, QueryCodeRequest, QueryCodeResponseSDKType, QueryCodesRequest, QueryCodesResponseSDKType, QueryPinnedCodesRequest, QueryPinnedCodesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryContractsByCreatorRequest, QueryContractsByCreatorResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* ContractInfo gets the contract meta data */ + contractInfo = async (params: QueryContractInfoRequest): Promise => { + const endpoint = `cosmwasm/wasm/v1/contract/${params.address}`; + return await this.req.get(endpoint); + }; + /* ContractHistory gets the contract code history */ + contractHistory = async (params: QueryContractHistoryRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmwasm/wasm/v1/contract/${params.address}/history`; + return await this.req.get(endpoint, options); + }; + /* ContractsByCode lists all smart contracts for a code id */ + contractsByCode = async (params: QueryContractsByCodeRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmwasm/wasm/v1/code/${params.codeId}/contracts`; + return await this.req.get(endpoint, options); + }; + /* AllContractState gets all raw store data for a single contract */ + allContractState = async (params: QueryAllContractStateRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmwasm/wasm/v1/contract/${params.address}/state`; + return await this.req.get(endpoint, options); + }; + /* RawContractState gets single key from the raw store data of a contract */ + rawContractState = async (params: QueryRawContractStateRequest): Promise => { + const endpoint = `cosmwasm/wasm/v1/contract/${params.address}/raw/${params.queryData}`; + return await this.req.get(endpoint); + }; + /* SmartContractState get smart query result from the contract */ + smartContractState = async (params: QuerySmartContractStateRequest): Promise => { + const endpoint = `cosmwasm/wasm/v1/contract/${params.address}/smart/${params.queryData}`; + return await this.req.get(endpoint); + }; + /* Code gets the binary code and metadata for a singe wasm code */ + code = async (params: QueryCodeRequest): Promise => { + const endpoint = `cosmwasm/wasm/v1/code/${params.codeId}`; + return await this.req.get(endpoint); + }; + /* Codes gets the metadata for all stored wasm codes */ + codes = async (params: QueryCodesRequest = { + pagination: undefined + }): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmwasm/wasm/v1/code`; + return await this.req.get(endpoint, options); + }; + /* PinnedCodes gets the pinned code ids */ + pinnedCodes = async (params: QueryPinnedCodesRequest = { + pagination: undefined + }): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmwasm/wasm/v1/codes/pinned`; + return await this.req.get(endpoint, options); + }; + /* Params gets the module params */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `cosmwasm/wasm/v1/codes/params`; + return await this.req.get(endpoint); + }; + /* ContractsByCreator gets the contracts by creator */ + contractsByCreator = async (params: QueryContractsByCreatorRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `cosmwasm/wasm/v1/contracts/creator/${params.creatorAddress}`; + return await this.req.get(endpoint, options); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/query.rpc.Query.ts b/util/inj-types/cosmwasm/wasm/v1/query.rpc.Query.ts new file mode 100644 index 00000000..deed7a9f --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/query.rpc.Query.ts @@ -0,0 +1,144 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryContractInfoRequest, QueryContractInfoResponse, QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, QueryAllContractStateRequest, QueryAllContractStateResponse, QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest, QuerySmartContractStateResponse, QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, QueryPinnedCodesRequest, QueryPinnedCodesResponse, QueryParamsRequest, QueryParamsResponse, QueryContractsByCreatorRequest, QueryContractsByCreatorResponse } from "./query"; +/** Query provides defines the gRPC querier service */ +export interface Query { + /** ContractInfo gets the contract meta data */ + contractInfo(request: QueryContractInfoRequest): Promise; + /** ContractHistory gets the contract code history */ + contractHistory(request: QueryContractHistoryRequest): Promise; + /** ContractsByCode lists all smart contracts for a code id */ + contractsByCode(request: QueryContractsByCodeRequest): Promise; + /** AllContractState gets all raw store data for a single contract */ + allContractState(request: QueryAllContractStateRequest): Promise; + /** RawContractState gets single key from the raw store data of a contract */ + rawContractState(request: QueryRawContractStateRequest): Promise; + /** SmartContractState get smart query result from the contract */ + smartContractState(request: QuerySmartContractStateRequest): Promise; + /** Code gets the binary code and metadata for a singe wasm code */ + code(request: QueryCodeRequest): Promise; + /** Codes gets the metadata for all stored wasm codes */ + codes(request?: QueryCodesRequest): Promise; + /** PinnedCodes gets the pinned code ids */ + pinnedCodes(request?: QueryPinnedCodesRequest): Promise; + /** Params gets the module params */ + params(request?: QueryParamsRequest): Promise; + /** ContractsByCreator gets the contracts by creator */ + contractsByCreator(request: QueryContractsByCreatorRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* ContractInfo gets the contract meta data */ + contractInfo = async (request: QueryContractInfoRequest): Promise => { + const data = QueryContractInfoRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "ContractInfo", data); + return promise.then(data => QueryContractInfoResponse.decode(new BinaryReader(data))); + }; + /* ContractHistory gets the contract code history */ + contractHistory = async (request: QueryContractHistoryRequest): Promise => { + const data = QueryContractHistoryRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "ContractHistory", data); + return promise.then(data => QueryContractHistoryResponse.decode(new BinaryReader(data))); + }; + /* ContractsByCode lists all smart contracts for a code id */ + contractsByCode = async (request: QueryContractsByCodeRequest): Promise => { + const data = QueryContractsByCodeRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "ContractsByCode", data); + return promise.then(data => QueryContractsByCodeResponse.decode(new BinaryReader(data))); + }; + /* AllContractState gets all raw store data for a single contract */ + allContractState = async (request: QueryAllContractStateRequest): Promise => { + const data = QueryAllContractStateRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "AllContractState", data); + return promise.then(data => QueryAllContractStateResponse.decode(new BinaryReader(data))); + }; + /* RawContractState gets single key from the raw store data of a contract */ + rawContractState = async (request: QueryRawContractStateRequest): Promise => { + const data = QueryRawContractStateRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "RawContractState", data); + return promise.then(data => QueryRawContractStateResponse.decode(new BinaryReader(data))); + }; + /* SmartContractState get smart query result from the contract */ + smartContractState = async (request: QuerySmartContractStateRequest): Promise => { + const data = QuerySmartContractStateRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "SmartContractState", data); + return promise.then(data => QuerySmartContractStateResponse.decode(new BinaryReader(data))); + }; + /* Code gets the binary code and metadata for a singe wasm code */ + code = async (request: QueryCodeRequest): Promise => { + const data = QueryCodeRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "Code", data); + return promise.then(data => QueryCodeResponse.decode(new BinaryReader(data))); + }; + /* Codes gets the metadata for all stored wasm codes */ + codes = async (request: QueryCodesRequest = { + pagination: undefined + }): Promise => { + const data = QueryCodesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "Codes", data); + return promise.then(data => QueryCodesResponse.decode(new BinaryReader(data))); + }; + /* PinnedCodes gets the pinned code ids */ + pinnedCodes = async (request: QueryPinnedCodesRequest = { + pagination: undefined + }): Promise => { + const data = QueryPinnedCodesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "PinnedCodes", data); + return promise.then(data => QueryPinnedCodesResponse.decode(new BinaryReader(data))); + }; + /* Params gets the module params */ + params = async (request: QueryParamsRequest = {}): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; + /* ContractsByCreator gets the contracts by creator */ + contractsByCreator = async (request: QueryContractsByCreatorRequest): Promise => { + const data = QueryContractsByCreatorRequest.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Query", "ContractsByCreator", data); + return promise.then(data => QueryContractsByCreatorResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + contractInfo(request: QueryContractInfoRequest): Promise { + return queryService.contractInfo(request); + }, + contractHistory(request: QueryContractHistoryRequest): Promise { + return queryService.contractHistory(request); + }, + contractsByCode(request: QueryContractsByCodeRequest): Promise { + return queryService.contractsByCode(request); + }, + allContractState(request: QueryAllContractStateRequest): Promise { + return queryService.allContractState(request); + }, + rawContractState(request: QueryRawContractStateRequest): Promise { + return queryService.rawContractState(request); + }, + smartContractState(request: QuerySmartContractStateRequest): Promise { + return queryService.smartContractState(request); + }, + code(request: QueryCodeRequest): Promise { + return queryService.code(request); + }, + codes(request?: QueryCodesRequest): Promise { + return queryService.codes(request); + }, + pinnedCodes(request?: QueryPinnedCodesRequest): Promise { + return queryService.pinnedCodes(request); + }, + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + }, + contractsByCreator(request: QueryContractsByCreatorRequest): Promise { + return queryService.contractsByCreator(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/query.ts b/util/inj-types/cosmwasm/wasm/v1/query.ts new file mode 100644 index 00000000..7a9e3bcc --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/query.ts @@ -0,0 +1,2534 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; +import { ContractInfo, ContractInfoAmino, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntryAmino, ContractCodeHistoryEntrySDKType, Model, ModelAmino, ModelSDKType, AccessConfig, AccessConfigAmino, AccessConfigSDKType, Params, ParamsAmino, ParamsSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +/** + * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoRequest { + /** address is the address of the contract to query */ + address: string; +} +export interface QueryContractInfoRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest"; + value: Uint8Array; +} +/** + * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoRequestAmino { + /** address is the address of the contract to query */ + address?: string; +} +export interface QueryContractInfoRequestAminoMsg { + type: "wasm/QueryContractInfoRequest"; + value: QueryContractInfoRequestAmino; +} +/** + * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoRequestSDKType { + address: string; +} +/** + * QueryContractInfoResponse is the response type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoResponse { + /** address is the address of the contract */ + address: string; + contractInfo: ContractInfo; +} +export interface QueryContractInfoResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse"; + value: Uint8Array; +} +/** + * QueryContractInfoResponse is the response type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoResponseAmino { + /** address is the address of the contract */ + address?: string; + contract_info: ContractInfoAmino; +} +export interface QueryContractInfoResponseAminoMsg { + type: "wasm/QueryContractInfoResponse"; + value: QueryContractInfoResponseAmino; +} +/** + * QueryContractInfoResponse is the response type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoResponseSDKType { + address: string; + contract_info: ContractInfoSDKType; +} +/** + * QueryContractHistoryRequest is the request type for the Query/ContractHistory + * RPC method + */ +export interface QueryContractHistoryRequest { + /** address is the address of the contract to query */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryContractHistoryRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest"; + value: Uint8Array; +} +/** + * QueryContractHistoryRequest is the request type for the Query/ContractHistory + * RPC method + */ +export interface QueryContractHistoryRequestAmino { + /** address is the address of the contract to query */ + address?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryContractHistoryRequestAminoMsg { + type: "wasm/QueryContractHistoryRequest"; + value: QueryContractHistoryRequestAmino; +} +/** + * QueryContractHistoryRequest is the request type for the Query/ContractHistory + * RPC method + */ +export interface QueryContractHistoryRequestSDKType { + address: string; + pagination?: PageRequestSDKType; +} +/** + * QueryContractHistoryResponse is the response type for the + * Query/ContractHistory RPC method + */ +export interface QueryContractHistoryResponse { + entries: ContractCodeHistoryEntry[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryContractHistoryResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse"; + value: Uint8Array; +} +/** + * QueryContractHistoryResponse is the response type for the + * Query/ContractHistory RPC method + */ +export interface QueryContractHistoryResponseAmino { + entries: ContractCodeHistoryEntryAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryContractHistoryResponseAminoMsg { + type: "wasm/QueryContractHistoryResponse"; + value: QueryContractHistoryResponseAmino; +} +/** + * QueryContractHistoryResponse is the response type for the + * Query/ContractHistory RPC method + */ +export interface QueryContractHistoryResponseSDKType { + entries: ContractCodeHistoryEntrySDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryContractsByCodeRequest is the request type for the Query/ContractsByCode + * RPC method + */ +export interface QueryContractsByCodeRequest { + /** + * grpc-gateway_out does not support Go style CodID + * pagination defines an optional pagination for the request. + */ + codeId: bigint; + pagination?: PageRequest; +} +export interface QueryContractsByCodeRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest"; + value: Uint8Array; +} +/** + * QueryContractsByCodeRequest is the request type for the Query/ContractsByCode + * RPC method + */ +export interface QueryContractsByCodeRequestAmino { + /** + * grpc-gateway_out does not support Go style CodID + * pagination defines an optional pagination for the request. + */ + code_id?: string; + pagination?: PageRequestAmino; +} +export interface QueryContractsByCodeRequestAminoMsg { + type: "wasm/QueryContractsByCodeRequest"; + value: QueryContractsByCodeRequestAmino; +} +/** + * QueryContractsByCodeRequest is the request type for the Query/ContractsByCode + * RPC method + */ +export interface QueryContractsByCodeRequestSDKType { + code_id: bigint; + pagination?: PageRequestSDKType; +} +/** + * QueryContractsByCodeResponse is the response type for the + * Query/ContractsByCode RPC method + */ +export interface QueryContractsByCodeResponse { + /** contracts are a set of contract addresses */ + contracts: string[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryContractsByCodeResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse"; + value: Uint8Array; +} +/** + * QueryContractsByCodeResponse is the response type for the + * Query/ContractsByCode RPC method + */ +export interface QueryContractsByCodeResponseAmino { + /** contracts are a set of contract addresses */ + contracts?: string[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryContractsByCodeResponseAminoMsg { + type: "wasm/QueryContractsByCodeResponse"; + value: QueryContractsByCodeResponseAmino; +} +/** + * QueryContractsByCodeResponse is the response type for the + * Query/ContractsByCode RPC method + */ +export interface QueryContractsByCodeResponseSDKType { + contracts: string[]; + pagination?: PageResponseSDKType; +} +/** + * QueryAllContractStateRequest is the request type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateRequest { + /** address is the address of the contract */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryAllContractStateRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest"; + value: Uint8Array; +} +/** + * QueryAllContractStateRequest is the request type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateRequestAmino { + /** address is the address of the contract */ + address?: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAllContractStateRequestAminoMsg { + type: "wasm/QueryAllContractStateRequest"; + value: QueryAllContractStateRequestAmino; +} +/** + * QueryAllContractStateRequest is the request type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateRequestSDKType { + address: string; + pagination?: PageRequestSDKType; +} +/** + * QueryAllContractStateResponse is the response type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateResponse { + models: Model[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryAllContractStateResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse"; + value: Uint8Array; +} +/** + * QueryAllContractStateResponse is the response type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateResponseAmino { + models: ModelAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryAllContractStateResponseAminoMsg { + type: "wasm/QueryAllContractStateResponse"; + value: QueryAllContractStateResponseAmino; +} +/** + * QueryAllContractStateResponse is the response type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateResponseSDKType { + models: ModelSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryRawContractStateRequest is the request type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateRequest { + /** address is the address of the contract */ + address: string; + queryData: Uint8Array; +} +export interface QueryRawContractStateRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest"; + value: Uint8Array; +} +/** + * QueryRawContractStateRequest is the request type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateRequestAmino { + /** address is the address of the contract */ + address?: string; + query_data?: string; +} +export interface QueryRawContractStateRequestAminoMsg { + type: "wasm/QueryRawContractStateRequest"; + value: QueryRawContractStateRequestAmino; +} +/** + * QueryRawContractStateRequest is the request type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateRequestSDKType { + address: string; + query_data: Uint8Array; +} +/** + * QueryRawContractStateResponse is the response type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateResponse { + /** Data contains the raw store data */ + data: Uint8Array; +} +export interface QueryRawContractStateResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse"; + value: Uint8Array; +} +/** + * QueryRawContractStateResponse is the response type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateResponseAmino { + /** Data contains the raw store data */ + data?: string; +} +export interface QueryRawContractStateResponseAminoMsg { + type: "wasm/QueryRawContractStateResponse"; + value: QueryRawContractStateResponseAmino; +} +/** + * QueryRawContractStateResponse is the response type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateResponseSDKType { + data: Uint8Array; +} +/** + * QuerySmartContractStateRequest is the request type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateRequest { + /** address is the address of the contract */ + address: string; + /** QueryData contains the query data passed to the contract */ + queryData: Uint8Array; +} +export interface QuerySmartContractStateRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest"; + value: Uint8Array; +} +/** + * QuerySmartContractStateRequest is the request type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateRequestAmino { + /** address is the address of the contract */ + address?: string; + /** QueryData contains the query data passed to the contract */ + query_data?: any; +} +export interface QuerySmartContractStateRequestAminoMsg { + type: "wasm/QuerySmartContractStateRequest"; + value: QuerySmartContractStateRequestAmino; +} +/** + * QuerySmartContractStateRequest is the request type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateRequestSDKType { + address: string; + query_data: Uint8Array; +} +/** + * QuerySmartContractStateResponse is the response type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateResponse { + /** Data contains the json data returned from the smart contract */ + data: Uint8Array; +} +export interface QuerySmartContractStateResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse"; + value: Uint8Array; +} +/** + * QuerySmartContractStateResponse is the response type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateResponseAmino { + /** Data contains the json data returned from the smart contract */ + data?: any; +} +export interface QuerySmartContractStateResponseAminoMsg { + type: "wasm/QuerySmartContractStateResponse"; + value: QuerySmartContractStateResponseAmino; +} +/** + * QuerySmartContractStateResponse is the response type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateResponseSDKType { + data: Uint8Array; +} +/** QueryCodeRequest is the request type for the Query/Code RPC method */ +export interface QueryCodeRequest { + /** grpc-gateway_out does not support Go style CodID */ + codeId: bigint; +} +export interface QueryCodeRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest"; + value: Uint8Array; +} +/** QueryCodeRequest is the request type for the Query/Code RPC method */ +export interface QueryCodeRequestAmino { + /** grpc-gateway_out does not support Go style CodID */ + code_id?: string; +} +export interface QueryCodeRequestAminoMsg { + type: "wasm/QueryCodeRequest"; + value: QueryCodeRequestAmino; +} +/** QueryCodeRequest is the request type for the Query/Code RPC method */ +export interface QueryCodeRequestSDKType { + code_id: bigint; +} +/** CodeInfoResponse contains code meta data from CodeInfo */ +export interface CodeInfoResponse { + codeId: bigint; + creator: string; + dataHash: Uint8Array; + instantiatePermission: AccessConfig; +} +export interface CodeInfoResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse"; + value: Uint8Array; +} +/** CodeInfoResponse contains code meta data from CodeInfo */ +export interface CodeInfoResponseAmino { + code_id: string; + creator?: string; + data_hash?: string; + instantiate_permission: AccessConfigAmino; +} +export interface CodeInfoResponseAminoMsg { + type: "wasm/CodeInfoResponse"; + value: CodeInfoResponseAmino; +} +/** CodeInfoResponse contains code meta data from CodeInfo */ +export interface CodeInfoResponseSDKType { + code_id: bigint; + creator: string; + data_hash: Uint8Array; + instantiate_permission: AccessConfigSDKType; +} +/** QueryCodeResponse is the response type for the Query/Code RPC method */ +export interface QueryCodeResponse { + codeInfo?: CodeInfoResponse; + data: Uint8Array; +} +export interface QueryCodeResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse"; + value: Uint8Array; +} +/** QueryCodeResponse is the response type for the Query/Code RPC method */ +export interface QueryCodeResponseAmino { + code_info?: CodeInfoResponseAmino; + data: string; +} +export interface QueryCodeResponseAminoMsg { + type: "wasm/QueryCodeResponse"; + value: QueryCodeResponseAmino; +} +/** QueryCodeResponse is the response type for the Query/Code RPC method */ +export interface QueryCodeResponseSDKType { + code_info?: CodeInfoResponseSDKType; + data: Uint8Array; +} +/** QueryCodesRequest is the request type for the Query/Codes RPC method */ +export interface QueryCodesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryCodesRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest"; + value: Uint8Array; +} +/** QueryCodesRequest is the request type for the Query/Codes RPC method */ +export interface QueryCodesRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryCodesRequestAminoMsg { + type: "wasm/QueryCodesRequest"; + value: QueryCodesRequestAmino; +} +/** QueryCodesRequest is the request type for the Query/Codes RPC method */ +export interface QueryCodesRequestSDKType { + pagination?: PageRequestSDKType; +} +/** QueryCodesResponse is the response type for the Query/Codes RPC method */ +export interface QueryCodesResponse { + codeInfos: CodeInfoResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryCodesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse"; + value: Uint8Array; +} +/** QueryCodesResponse is the response type for the Query/Codes RPC method */ +export interface QueryCodesResponseAmino { + code_infos: CodeInfoResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryCodesResponseAminoMsg { + type: "wasm/QueryCodesResponse"; + value: QueryCodesResponseAmino; +} +/** QueryCodesResponse is the response type for the Query/Codes RPC method */ +export interface QueryCodesResponseSDKType { + code_infos: CodeInfoResponseSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryPinnedCodesRequest is the request type for the Query/PinnedCodes + * RPC method + */ +export interface QueryPinnedCodesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryPinnedCodesRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest"; + value: Uint8Array; +} +/** + * QueryPinnedCodesRequest is the request type for the Query/PinnedCodes + * RPC method + */ +export interface QueryPinnedCodesRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryPinnedCodesRequestAminoMsg { + type: "wasm/QueryPinnedCodesRequest"; + value: QueryPinnedCodesRequestAmino; +} +/** + * QueryPinnedCodesRequest is the request type for the Query/PinnedCodes + * RPC method + */ +export interface QueryPinnedCodesRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * QueryPinnedCodesResponse is the response type for the + * Query/PinnedCodes RPC method + */ +export interface QueryPinnedCodesResponse { + codeIds: bigint[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryPinnedCodesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse"; + value: Uint8Array; +} +/** + * QueryPinnedCodesResponse is the response type for the + * Query/PinnedCodes RPC method + */ +export interface QueryPinnedCodesResponseAmino { + code_ids?: string[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryPinnedCodesResponseAminoMsg { + type: "wasm/QueryPinnedCodesResponse"; + value: QueryPinnedCodesResponseAmino; +} +/** + * QueryPinnedCodesResponse is the response type for the + * Query/PinnedCodes RPC method + */ +export interface QueryPinnedCodesResponseSDKType { + code_ids: bigint[]; + pagination?: PageResponseSDKType; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "wasm/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "wasm/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params: ParamsSDKType; +} +/** + * QueryContractsByCreatorRequest is the request type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorRequest { + /** CreatorAddress is the address of contract creator */ + creatorAddress: string; + /** Pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryContractsByCreatorRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest"; + value: Uint8Array; +} +/** + * QueryContractsByCreatorRequest is the request type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorRequestAmino { + /** CreatorAddress is the address of contract creator */ + creator_address?: string; + /** Pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryContractsByCreatorRequestAminoMsg { + type: "wasm/QueryContractsByCreatorRequest"; + value: QueryContractsByCreatorRequestAmino; +} +/** + * QueryContractsByCreatorRequest is the request type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorRequestSDKType { + creator_address: string; + pagination?: PageRequestSDKType; +} +/** + * QueryContractsByCreatorResponse is the response type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorResponse { + /** ContractAddresses result set */ + contractAddresses: string[]; + /** Pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryContractsByCreatorResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse"; + value: Uint8Array; +} +/** + * QueryContractsByCreatorResponse is the response type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorResponseAmino { + /** ContractAddresses result set */ + contract_addresses?: string[]; + /** Pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryContractsByCreatorResponseAminoMsg { + type: "wasm/QueryContractsByCreatorResponse"; + value: QueryContractsByCreatorResponseAmino; +} +/** + * QueryContractsByCreatorResponse is the response type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorResponseSDKType { + contract_addresses: string[]; + pagination?: PageResponseSDKType; +} +function createBaseQueryContractInfoRequest(): QueryContractInfoRequest { + return { + address: "" + }; +} +export const QueryContractInfoRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", + aminoType: "wasm/QueryContractInfoRequest", + encode(message: QueryContractInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractInfoRequest(); + 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: DeepPartial): QueryContractInfoRequest { + const message = createBaseQueryContractInfoRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryContractInfoRequestAmino): QueryContractInfoRequest { + const message = createBaseQueryContractInfoRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { + return QueryContractInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractInfoRequest): QueryContractInfoRequestAminoMsg { + return { + type: "wasm/QueryContractInfoRequest", + value: QueryContractInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractInfoRequestProtoMsg): QueryContractInfoRequest { + return QueryContractInfoRequest.decode(message.value); + }, + toProto(message: QueryContractInfoRequest): Uint8Array { + return QueryContractInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContractInfoRequest): QueryContractInfoRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", + value: QueryContractInfoRequest.encode(message).finish() + }; + } +}; +function createBaseQueryContractInfoResponse(): QueryContractInfoResponse { + return { + address: "", + contractInfo: ContractInfo.fromPartial({}) + }; +} +export const QueryContractInfoResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", + aminoType: "wasm/QueryContractInfoResponse", + encode(message: QueryContractInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.contractInfo !== undefined) { + ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.contractInfo = ContractInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractInfoResponse { + const message = createBaseQueryContractInfoResponse(); + message.address = object.address ?? ""; + message.contractInfo = object.contractInfo !== undefined && object.contractInfo !== null ? ContractInfo.fromPartial(object.contractInfo) : undefined; + return message; + }, + fromAmino(object: QueryContractInfoResponseAmino): QueryContractInfoResponse { + const message = createBaseQueryContractInfoResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.contract_info !== undefined && object.contract_info !== null) { + message.contractInfo = ContractInfo.fromAmino(object.contract_info); + } + return message; + }, + toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : ContractInfo.toAmino(ContractInfo.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryContractInfoResponseAminoMsg): QueryContractInfoResponse { + return QueryContractInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractInfoResponse): QueryContractInfoResponseAminoMsg { + return { + type: "wasm/QueryContractInfoResponse", + value: QueryContractInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractInfoResponseProtoMsg): QueryContractInfoResponse { + return QueryContractInfoResponse.decode(message.value); + }, + toProto(message: QueryContractInfoResponse): Uint8Array { + return QueryContractInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContractInfoResponse): QueryContractInfoResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", + value: QueryContractInfoResponse.encode(message).finish() + }; + } +}; +function createBaseQueryContractHistoryRequest(): QueryContractHistoryRequest { + return { + address: "", + pagination: undefined + }; +} +export const QueryContractHistoryRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", + aminoType: "wasm/QueryContractHistoryRequest", + encode(message: QueryContractHistoryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryContractHistoryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractHistoryRequest(); + 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: DeepPartial): QueryContractHistoryRequest { + const message = createBaseQueryContractHistoryRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractHistoryRequestAmino): QueryContractHistoryRequest { + const message = createBaseQueryContractHistoryRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractHistoryRequestAminoMsg): QueryContractHistoryRequest { + return QueryContractHistoryRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractHistoryRequest): QueryContractHistoryRequestAminoMsg { + return { + type: "wasm/QueryContractHistoryRequest", + value: QueryContractHistoryRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractHistoryRequestProtoMsg): QueryContractHistoryRequest { + return QueryContractHistoryRequest.decode(message.value); + }, + toProto(message: QueryContractHistoryRequest): Uint8Array { + return QueryContractHistoryRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContractHistoryRequest): QueryContractHistoryRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", + value: QueryContractHistoryRequest.encode(message).finish() + }; + } +}; +function createBaseQueryContractHistoryResponse(): QueryContractHistoryResponse { + return { + entries: [], + pagination: undefined + }; +} +export const QueryContractHistoryResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", + aminoType: "wasm/QueryContractHistoryResponse", + encode(message: QueryContractHistoryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.entries) { + ContractCodeHistoryEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractHistoryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entries.push(ContractCodeHistoryEntry.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: DeepPartial): QueryContractHistoryResponse { + const message = createBaseQueryContractHistoryResponse(); + message.entries = object.entries?.map(e => ContractCodeHistoryEntry.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractHistoryResponseAmino): QueryContractHistoryResponse { + const message = createBaseQueryContractHistoryResponse(); + message.entries = object.entries?.map(e => ContractCodeHistoryEntry.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractHistoryResponse): QueryContractHistoryResponseAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractHistoryResponseAminoMsg): QueryContractHistoryResponse { + return QueryContractHistoryResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractHistoryResponse): QueryContractHistoryResponseAminoMsg { + return { + type: "wasm/QueryContractHistoryResponse", + value: QueryContractHistoryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractHistoryResponseProtoMsg): QueryContractHistoryResponse { + return QueryContractHistoryResponse.decode(message.value); + }, + toProto(message: QueryContractHistoryResponse): Uint8Array { + return QueryContractHistoryResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContractHistoryResponse): QueryContractHistoryResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", + value: QueryContractHistoryResponse.encode(message).finish() + }; + } +}; +function createBaseQueryContractsByCodeRequest(): QueryContractsByCodeRequest { + return { + codeId: BigInt(0), + pagination: undefined + }; +} +export const QueryContractsByCodeRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", + aminoType: "wasm/QueryContractsByCodeRequest", + encode(message: QueryContractsByCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractsByCodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractsByCodeRequest { + const message = createBaseQueryContractsByCodeRequest(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractsByCodeRequestAmino): QueryContractsByCodeRequest { + const message = createBaseQueryContractsByCodeRequest(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractsByCodeRequestAminoMsg): QueryContractsByCodeRequest { + return QueryContractsByCodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAminoMsg { + return { + type: "wasm/QueryContractsByCodeRequest", + value: QueryContractsByCodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractsByCodeRequestProtoMsg): QueryContractsByCodeRequest { + return QueryContractsByCodeRequest.decode(message.value); + }, + toProto(message: QueryContractsByCodeRequest): Uint8Array { + return QueryContractsByCodeRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", + value: QueryContractsByCodeRequest.encode(message).finish() + }; + } +}; +function createBaseQueryContractsByCodeResponse(): QueryContractsByCodeResponse { + return { + contracts: [], + pagination: undefined + }; +} +export const QueryContractsByCodeResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", + aminoType: "wasm/QueryContractsByCodeResponse", + encode(message: QueryContractsByCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.contracts) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractsByCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contracts.push(reader.string()); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractsByCodeResponse { + const message = createBaseQueryContractsByCodeResponse(); + message.contracts = object.contracts?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractsByCodeResponseAmino): QueryContractsByCodeResponse { + const message = createBaseQueryContractsByCodeResponse(); + message.contracts = object.contracts?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractsByCodeResponse): QueryContractsByCodeResponseAmino { + const obj: any = {}; + if (message.contracts) { + obj.contracts = message.contracts.map(e => e); + } else { + obj.contracts = message.contracts; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractsByCodeResponseAminoMsg): QueryContractsByCodeResponse { + return QueryContractsByCodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractsByCodeResponse): QueryContractsByCodeResponseAminoMsg { + return { + type: "wasm/QueryContractsByCodeResponse", + value: QueryContractsByCodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractsByCodeResponseProtoMsg): QueryContractsByCodeResponse { + return QueryContractsByCodeResponse.decode(message.value); + }, + toProto(message: QueryContractsByCodeResponse): Uint8Array { + return QueryContractsByCodeResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContractsByCodeResponse): QueryContractsByCodeResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", + value: QueryContractsByCodeResponse.encode(message).finish() + }; + } +}; +function createBaseQueryAllContractStateRequest(): QueryAllContractStateRequest { + return { + address: "", + pagination: undefined + }; +} +export const QueryAllContractStateRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", + aminoType: "wasm/QueryAllContractStateRequest", + encode(message: QueryAllContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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: BinaryReader | Uint8Array, length?: number): QueryAllContractStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllContractStateRequest(); + 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: DeepPartial): QueryAllContractStateRequest { + const message = createBaseQueryAllContractStateRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllContractStateRequestAmino): QueryAllContractStateRequest { + const message = createBaseQueryAllContractStateRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllContractStateRequestAminoMsg): QueryAllContractStateRequest { + return QueryAllContractStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllContractStateRequest): QueryAllContractStateRequestAminoMsg { + return { + type: "wasm/QueryAllContractStateRequest", + value: QueryAllContractStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllContractStateRequestProtoMsg): QueryAllContractStateRequest { + return QueryAllContractStateRequest.decode(message.value); + }, + toProto(message: QueryAllContractStateRequest): Uint8Array { + return QueryAllContractStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllContractStateRequest): QueryAllContractStateRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", + value: QueryAllContractStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryAllContractStateResponse(): QueryAllContractStateResponse { + return { + models: [], + pagination: undefined + }; +} +export const QueryAllContractStateResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", + aminoType: "wasm/QueryAllContractStateResponse", + encode(message: QueryAllContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.models) { + Model.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllContractStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.models.push(Model.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: DeepPartial): QueryAllContractStateResponse { + const message = createBaseQueryAllContractStateResponse(); + message.models = object.models?.map(e => Model.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllContractStateResponseAmino): QueryAllContractStateResponse { + const message = createBaseQueryAllContractStateResponse(); + message.models = object.models?.map(e => Model.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllContractStateResponse): QueryAllContractStateResponseAmino { + const obj: any = {}; + if (message.models) { + obj.models = message.models.map(e => e ? Model.toAmino(e) : undefined); + } else { + obj.models = message.models; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllContractStateResponseAminoMsg): QueryAllContractStateResponse { + return QueryAllContractStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllContractStateResponse): QueryAllContractStateResponseAminoMsg { + return { + type: "wasm/QueryAllContractStateResponse", + value: QueryAllContractStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllContractStateResponseProtoMsg): QueryAllContractStateResponse { + return QueryAllContractStateResponse.decode(message.value); + }, + toProto(message: QueryAllContractStateResponse): Uint8Array { + return QueryAllContractStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllContractStateResponse): QueryAllContractStateResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", + value: QueryAllContractStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryRawContractStateRequest(): QueryRawContractStateRequest { + return { + address: "", + queryData: new Uint8Array() + }; +} +export const QueryRawContractStateRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", + aminoType: "wasm/QueryRawContractStateRequest", + encode(message: QueryRawContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRawContractStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRawContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.queryData = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryRawContractStateRequest { + const message = createBaseQueryRawContractStateRequest(); + message.address = object.address ?? ""; + message.queryData = object.queryData ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryRawContractStateRequestAmino): QueryRawContractStateRequest { + const message = createBaseQueryRawContractStateRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.query_data !== undefined && object.query_data !== null) { + message.queryData = bytesFromBase64(object.query_data); + } + return message; + }, + toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRawContractStateRequestAminoMsg): QueryRawContractStateRequest { + return QueryRawContractStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryRawContractStateRequest): QueryRawContractStateRequestAminoMsg { + return { + type: "wasm/QueryRawContractStateRequest", + value: QueryRawContractStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRawContractStateRequestProtoMsg): QueryRawContractStateRequest { + return QueryRawContractStateRequest.decode(message.value); + }, + toProto(message: QueryRawContractStateRequest): Uint8Array { + return QueryRawContractStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryRawContractStateRequest): QueryRawContractStateRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", + value: QueryRawContractStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryRawContractStateResponse(): QueryRawContractStateResponse { + return { + data: new Uint8Array() + }; +} +export const QueryRawContractStateResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", + aminoType: "wasm/QueryRawContractStateResponse", + encode(message: QueryRawContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRawContractStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRawContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryRawContractStateResponse { + const message = createBaseQueryRawContractStateResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryRawContractStateResponseAmino): QueryRawContractStateResponse { + const message = createBaseQueryRawContractStateResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: QueryRawContractStateResponse): QueryRawContractStateResponseAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRawContractStateResponseAminoMsg): QueryRawContractStateResponse { + return QueryRawContractStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryRawContractStateResponse): QueryRawContractStateResponseAminoMsg { + return { + type: "wasm/QueryRawContractStateResponse", + value: QueryRawContractStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRawContractStateResponseProtoMsg): QueryRawContractStateResponse { + return QueryRawContractStateResponse.decode(message.value); + }, + toProto(message: QueryRawContractStateResponse): Uint8Array { + return QueryRawContractStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryRawContractStateResponse): QueryRawContractStateResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", + value: QueryRawContractStateResponse.encode(message).finish() + }; + } +}; +function createBaseQuerySmartContractStateRequest(): QuerySmartContractStateRequest { + return { + address: "", + queryData: new Uint8Array() + }; +} +export const QuerySmartContractStateRequest = { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", + aminoType: "wasm/QuerySmartContractStateRequest", + encode(message: QuerySmartContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySmartContractStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySmartContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.queryData = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySmartContractStateRequest { + const message = createBaseQuerySmartContractStateRequest(); + message.address = object.address ?? ""; + message.queryData = object.queryData ?? new Uint8Array(); + return message; + }, + fromAmino(object: QuerySmartContractStateRequestAmino): QuerySmartContractStateRequest { + const message = createBaseQuerySmartContractStateRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.query_data !== undefined && object.query_data !== null) { + message.queryData = toUtf8(JSON.stringify(object.query_data)); + } + return message; + }, + toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySmartContractStateRequestAminoMsg): QuerySmartContractStateRequest { + return QuerySmartContractStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAminoMsg { + return { + type: "wasm/QuerySmartContractStateRequest", + value: QuerySmartContractStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySmartContractStateRequestProtoMsg): QuerySmartContractStateRequest { + return QuerySmartContractStateRequest.decode(message.value); + }, + toProto(message: QuerySmartContractStateRequest): Uint8Array { + return QuerySmartContractStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", + value: QuerySmartContractStateRequest.encode(message).finish() + }; + } +}; +function createBaseQuerySmartContractStateResponse(): QuerySmartContractStateResponse { + return { + data: new Uint8Array() + }; +} +export const QuerySmartContractStateResponse = { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", + aminoType: "wasm/QuerySmartContractStateResponse", + encode(message: QuerySmartContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySmartContractStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySmartContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySmartContractStateResponse { + const message = createBaseQuerySmartContractStateResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: QuerySmartContractStateResponseAmino): QuerySmartContractStateResponse { + const message = createBaseQuerySmartContractStateResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = toUtf8(JSON.stringify(object.data)); + } + return message; + }, + toAmino(message: QuerySmartContractStateResponse): QuerySmartContractStateResponseAmino { + const obj: any = {}; + obj.data = message.data ? JSON.parse(fromUtf8(message.data)) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySmartContractStateResponseAminoMsg): QuerySmartContractStateResponse { + return QuerySmartContractStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySmartContractStateResponse): QuerySmartContractStateResponseAminoMsg { + return { + type: "wasm/QuerySmartContractStateResponse", + value: QuerySmartContractStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySmartContractStateResponseProtoMsg): QuerySmartContractStateResponse { + return QuerySmartContractStateResponse.decode(message.value); + }, + toProto(message: QuerySmartContractStateResponse): Uint8Array { + return QuerySmartContractStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySmartContractStateResponse): QuerySmartContractStateResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", + value: QuerySmartContractStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryCodeRequest(): QueryCodeRequest { + return { + codeId: BigInt(0) + }; +} +export const QueryCodeRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", + aminoType: "wasm/QueryCodeRequest", + encode(message: QueryCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryCodeRequest { + const message = createBaseQueryCodeRequest(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryCodeRequestAmino): QueryCodeRequest { + const message = createBaseQueryCodeRequest(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + return message; + }, + toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { + return QueryCodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCodeRequest): QueryCodeRequestAminoMsg { + return { + type: "wasm/QueryCodeRequest", + value: QueryCodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCodeRequestProtoMsg): QueryCodeRequest { + return QueryCodeRequest.decode(message.value); + }, + toProto(message: QueryCodeRequest): Uint8Array { + return QueryCodeRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCodeRequest): QueryCodeRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", + value: QueryCodeRequest.encode(message).finish() + }; + } +}; +function createBaseCodeInfoResponse(): CodeInfoResponse { + return { + codeId: BigInt(0), + creator: "", + dataHash: new Uint8Array(), + instantiatePermission: AccessConfig.fromPartial({}) + }; +} +export const CodeInfoResponse = { + typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", + aminoType: "wasm/CodeInfoResponse", + encode(message: CodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.dataHash.length !== 0) { + writer.uint32(26).bytes(message.dataHash); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.creator = reader.string(); + break; + case 3: + message.dataHash = reader.bytes(); + break; + case 6: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CodeInfoResponse { + const message = createBaseCodeInfoResponse(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.creator = object.creator ?? ""; + message.dataHash = object.dataHash ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + return message; + }, + fromAmino(object: CodeInfoResponseAmino): CodeInfoResponse { + const message = createBaseCodeInfoResponse(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + if (object.data_hash !== undefined && object.data_hash !== null) { + message.dataHash = bytesFromBase64(object.data_hash); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + return message; + }, + toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { + const obj: any = {}; + obj.code_id = message.codeId ? message.codeId.toString() : "0"; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : AccessConfig.toAmino(AccessConfig.fromPartial({})); + return obj; + }, + fromAminoMsg(object: CodeInfoResponseAminoMsg): CodeInfoResponse { + return CodeInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: CodeInfoResponse): CodeInfoResponseAminoMsg { + return { + type: "wasm/CodeInfoResponse", + value: CodeInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: CodeInfoResponseProtoMsg): CodeInfoResponse { + return CodeInfoResponse.decode(message.value); + }, + toProto(message: CodeInfoResponse): Uint8Array { + return CodeInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: CodeInfoResponse): CodeInfoResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", + value: CodeInfoResponse.encode(message).finish() + }; + } +}; +function createBaseQueryCodeResponse(): QueryCodeResponse { + return { + codeInfo: undefined, + data: new Uint8Array() + }; +} +export const QueryCodeResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", + aminoType: "wasm/QueryCodeResponse", + encode(message: QueryCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeInfo !== undefined) { + CodeInfoResponse.encode(message.codeInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeInfo = CodeInfoResponse.decode(reader, reader.uint32()); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryCodeResponse { + const message = createBaseQueryCodeResponse(); + message.codeInfo = object.codeInfo !== undefined && object.codeInfo !== null ? CodeInfoResponse.fromPartial(object.codeInfo) : undefined; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryCodeResponseAmino): QueryCodeResponse { + const message = createBaseQueryCodeResponse(); + if (object.code_info !== undefined && object.code_info !== null) { + message.codeInfo = CodeInfoResponse.fromAmino(object.code_info); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: QueryCodeResponse): QueryCodeResponseAmino { + const obj: any = {}; + obj.code_info = message.codeInfo ? CodeInfoResponse.toAmino(message.codeInfo) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : ""; + return obj; + }, + fromAminoMsg(object: QueryCodeResponseAminoMsg): QueryCodeResponse { + return QueryCodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCodeResponse): QueryCodeResponseAminoMsg { + return { + type: "wasm/QueryCodeResponse", + value: QueryCodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCodeResponseProtoMsg): QueryCodeResponse { + return QueryCodeResponse.decode(message.value); + }, + toProto(message: QueryCodeResponse): Uint8Array { + return QueryCodeResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCodeResponse): QueryCodeResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", + value: QueryCodeResponse.encode(message).finish() + }; + } +}; +function createBaseQueryCodesRequest(): QueryCodesRequest { + return { + pagination: undefined + }; +} +export const QueryCodesRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", + aminoType: "wasm/QueryCodesRequest", + encode(message: QueryCodesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodesRequest(); + 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: DeepPartial): QueryCodesRequest { + const message = createBaseQueryCodesRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryCodesRequestAmino): QueryCodesRequest { + const message = createBaseQueryCodesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryCodesRequest): QueryCodesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryCodesRequestAminoMsg): QueryCodesRequest { + return QueryCodesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCodesRequest): QueryCodesRequestAminoMsg { + return { + type: "wasm/QueryCodesRequest", + value: QueryCodesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCodesRequestProtoMsg): QueryCodesRequest { + return QueryCodesRequest.decode(message.value); + }, + toProto(message: QueryCodesRequest): Uint8Array { + return QueryCodesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCodesRequest): QueryCodesRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", + value: QueryCodesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryCodesResponse(): QueryCodesResponse { + return { + codeInfos: [], + pagination: undefined + }; +} +export const QueryCodesResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", + aminoType: "wasm/QueryCodesResponse", + encode(message: QueryCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.codeInfos) { + CodeInfoResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeInfos.push(CodeInfoResponse.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: DeepPartial): QueryCodesResponse { + const message = createBaseQueryCodesResponse(); + message.codeInfos = object.codeInfos?.map(e => CodeInfoResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryCodesResponseAmino): QueryCodesResponse { + const message = createBaseQueryCodesResponse(); + message.codeInfos = object.code_infos?.map(e => CodeInfoResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryCodesResponse): QueryCodesResponseAmino { + const obj: any = {}; + if (message.codeInfos) { + obj.code_infos = message.codeInfos.map(e => e ? CodeInfoResponse.toAmino(e) : undefined); + } else { + obj.code_infos = message.codeInfos; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryCodesResponseAminoMsg): QueryCodesResponse { + return QueryCodesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCodesResponse): QueryCodesResponseAminoMsg { + return { + type: "wasm/QueryCodesResponse", + value: QueryCodesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCodesResponseProtoMsg): QueryCodesResponse { + return QueryCodesResponse.decode(message.value); + }, + toProto(message: QueryCodesResponse): Uint8Array { + return QueryCodesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCodesResponse): QueryCodesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", + value: QueryCodesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryPinnedCodesRequest(): QueryPinnedCodesRequest { + return { + pagination: undefined + }; +} +export const QueryPinnedCodesRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", + aminoType: "wasm/QueryPinnedCodesRequest", + encode(message: QueryPinnedCodesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPinnedCodesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPinnedCodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPinnedCodesRequest { + const message = createBaseQueryPinnedCodesRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryPinnedCodesRequestAmino): QueryPinnedCodesRequest { + const message = createBaseQueryPinnedCodesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryPinnedCodesRequest): QueryPinnedCodesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryPinnedCodesRequestAminoMsg): QueryPinnedCodesRequest { + return QueryPinnedCodesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPinnedCodesRequest): QueryPinnedCodesRequestAminoMsg { + return { + type: "wasm/QueryPinnedCodesRequest", + value: QueryPinnedCodesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPinnedCodesRequestProtoMsg): QueryPinnedCodesRequest { + return QueryPinnedCodesRequest.decode(message.value); + }, + toProto(message: QueryPinnedCodesRequest): Uint8Array { + return QueryPinnedCodesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPinnedCodesRequest): QueryPinnedCodesRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", + value: QueryPinnedCodesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryPinnedCodesResponse(): QueryPinnedCodesResponse { + return { + codeIds: [], + pagination: undefined + }; +} +export const QueryPinnedCodesResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", + aminoType: "wasm/QueryPinnedCodesResponse", + encode(message: QueryPinnedCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPinnedCodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPinnedCodesResponse(); + 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.codeIds.push(reader.uint64()); + } + } else { + message.codeIds.push(reader.uint64()); + } + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPinnedCodesResponse { + const message = createBaseQueryPinnedCodesResponse(); + message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryPinnedCodesResponseAmino): QueryPinnedCodesResponse { + const message = createBaseQueryPinnedCodesResponse(); + message.codeIds = object.code_ids?.map(e => BigInt(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryPinnedCodesResponse): QueryPinnedCodesResponseAmino { + const obj: any = {}; + if (message.codeIds) { + obj.code_ids = message.codeIds.map(e => e.toString()); + } else { + obj.code_ids = message.codeIds; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryPinnedCodesResponseAminoMsg): QueryPinnedCodesResponse { + return QueryPinnedCodesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPinnedCodesResponse): QueryPinnedCodesResponseAminoMsg { + return { + type: "wasm/QueryPinnedCodesResponse", + value: QueryPinnedCodesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPinnedCodesResponseProtoMsg): QueryPinnedCodesResponse { + return QueryPinnedCodesResponse.decode(message.value); + }, + toProto(message: QueryPinnedCodesResponse): Uint8Array { + return QueryPinnedCodesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPinnedCodesResponse): QueryPinnedCodesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", + value: QueryPinnedCodesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsRequest", + aminoType: "wasm/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "wasm/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsResponse", + aminoType: "wasm/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "wasm/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryContractsByCreatorRequest(): QueryContractsByCreatorRequest { + return { + creatorAddress: "", + pagination: undefined + }; +} +export const QueryContractsByCreatorRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest", + aminoType: "wasm/QueryContractsByCreatorRequest", + encode(message: QueryContractsByCreatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creatorAddress !== "") { + writer.uint32(10).string(message.creatorAddress); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractsByCreatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCreatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creatorAddress = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractsByCreatorRequest { + const message = createBaseQueryContractsByCreatorRequest(); + message.creatorAddress = object.creatorAddress ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractsByCreatorRequestAmino): QueryContractsByCreatorRequest { + const message = createBaseQueryContractsByCreatorRequest(); + if (object.creator_address !== undefined && object.creator_address !== null) { + message.creatorAddress = object.creator_address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractsByCreatorRequest): QueryContractsByCreatorRequestAmino { + const obj: any = {}; + obj.creator_address = message.creatorAddress === "" ? undefined : message.creatorAddress; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractsByCreatorRequestAminoMsg): QueryContractsByCreatorRequest { + return QueryContractsByCreatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractsByCreatorRequest): QueryContractsByCreatorRequestAminoMsg { + return { + type: "wasm/QueryContractsByCreatorRequest", + value: QueryContractsByCreatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractsByCreatorRequestProtoMsg): QueryContractsByCreatorRequest { + return QueryContractsByCreatorRequest.decode(message.value); + }, + toProto(message: QueryContractsByCreatorRequest): Uint8Array { + return QueryContractsByCreatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContractsByCreatorRequest): QueryContractsByCreatorRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest", + value: QueryContractsByCreatorRequest.encode(message).finish() + }; + } +}; +function createBaseQueryContractsByCreatorResponse(): QueryContractsByCreatorResponse { + return { + contractAddresses: [], + pagination: undefined + }; +} +export const QueryContractsByCreatorResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse", + aminoType: "wasm/QueryContractsByCreatorResponse", + encode(message: QueryContractsByCreatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.contractAddresses) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractsByCreatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCreatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contractAddresses.push(reader.string()); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractsByCreatorResponse { + const message = createBaseQueryContractsByCreatorResponse(); + message.contractAddresses = object.contractAddresses?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractsByCreatorResponseAmino): QueryContractsByCreatorResponse { + const message = createBaseQueryContractsByCreatorResponse(); + message.contractAddresses = object.contract_addresses?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractsByCreatorResponse): QueryContractsByCreatorResponseAmino { + const obj: any = {}; + if (message.contractAddresses) { + obj.contract_addresses = message.contractAddresses.map(e => e); + } else { + obj.contract_addresses = message.contractAddresses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractsByCreatorResponseAminoMsg): QueryContractsByCreatorResponse { + return QueryContractsByCreatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractsByCreatorResponse): QueryContractsByCreatorResponseAminoMsg { + return { + type: "wasm/QueryContractsByCreatorResponse", + value: QueryContractsByCreatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractsByCreatorResponseProtoMsg): QueryContractsByCreatorResponse { + return QueryContractsByCreatorResponse.decode(message.value); + }, + toProto(message: QueryContractsByCreatorResponse): Uint8Array { + return QueryContractsByCreatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContractsByCreatorResponse): QueryContractsByCreatorResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse", + value: QueryContractsByCreatorResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/tx.amino.ts b/util/inj-types/cosmwasm/wasm/v1/tx.amino.ts new file mode 100644 index 00000000..bdd72ab7 --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/tx.amino.ts @@ -0,0 +1,88 @@ +import { MsgStoreCode, MsgInstantiateContract, MsgInstantiateContract2, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin, MsgUpdateInstantiateConfig, MsgUpdateParams, MsgSudoContract, MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract, MsgRemoveCodeUploadParamsAddresses, MsgAddCodeUploadParamsAddresses, MsgStoreAndMigrateContract, MsgUpdateContractLabel } from "./tx"; +export const AminoConverter = { + "/cosmwasm.wasm.v1.MsgStoreCode": { + aminoType: "wasm/MsgStoreCode", + toAmino: MsgStoreCode.toAmino, + fromAmino: MsgStoreCode.fromAmino + }, + "/cosmwasm.wasm.v1.MsgInstantiateContract": { + aminoType: "wasm/MsgInstantiateContract", + toAmino: MsgInstantiateContract.toAmino, + fromAmino: MsgInstantiateContract.fromAmino + }, + "/cosmwasm.wasm.v1.MsgInstantiateContract2": { + aminoType: "wasm/MsgInstantiateContract2", + toAmino: MsgInstantiateContract2.toAmino, + fromAmino: MsgInstantiateContract2.fromAmino + }, + "/cosmwasm.wasm.v1.MsgExecuteContract": { + aminoType: "wasm/MsgExecuteContract", + toAmino: MsgExecuteContract.toAmino, + fromAmino: MsgExecuteContract.fromAmino + }, + "/cosmwasm.wasm.v1.MsgMigrateContract": { + aminoType: "wasm/MsgMigrateContract", + toAmino: MsgMigrateContract.toAmino, + fromAmino: MsgMigrateContract.fromAmino + }, + "/cosmwasm.wasm.v1.MsgUpdateAdmin": { + aminoType: "wasm/MsgUpdateAdmin", + toAmino: MsgUpdateAdmin.toAmino, + fromAmino: MsgUpdateAdmin.fromAmino + }, + "/cosmwasm.wasm.v1.MsgClearAdmin": { + aminoType: "wasm/MsgClearAdmin", + toAmino: MsgClearAdmin.toAmino, + fromAmino: MsgClearAdmin.fromAmino + }, + "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig": { + aminoType: "wasm/MsgUpdateInstantiateConfig", + toAmino: MsgUpdateInstantiateConfig.toAmino, + fromAmino: MsgUpdateInstantiateConfig.fromAmino + }, + "/cosmwasm.wasm.v1.MsgUpdateParams": { + aminoType: "wasm/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino + }, + "/cosmwasm.wasm.v1.MsgSudoContract": { + aminoType: "wasm/MsgSudoContract", + toAmino: MsgSudoContract.toAmino, + fromAmino: MsgSudoContract.fromAmino + }, + "/cosmwasm.wasm.v1.MsgPinCodes": { + aminoType: "wasm/MsgPinCodes", + toAmino: MsgPinCodes.toAmino, + fromAmino: MsgPinCodes.fromAmino + }, + "/cosmwasm.wasm.v1.MsgUnpinCodes": { + aminoType: "wasm/MsgUnpinCodes", + toAmino: MsgUnpinCodes.toAmino, + fromAmino: MsgUnpinCodes.fromAmino + }, + "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract": { + aminoType: "wasm/MsgStoreAndInstantiateContract", + toAmino: MsgStoreAndInstantiateContract.toAmino, + fromAmino: MsgStoreAndInstantiateContract.fromAmino + }, + "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses": { + aminoType: "wasm/MsgRemoveCodeUploadParamsAddresses", + toAmino: MsgRemoveCodeUploadParamsAddresses.toAmino, + fromAmino: MsgRemoveCodeUploadParamsAddresses.fromAmino + }, + "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses": { + aminoType: "wasm/MsgAddCodeUploadParamsAddresses", + toAmino: MsgAddCodeUploadParamsAddresses.toAmino, + fromAmino: MsgAddCodeUploadParamsAddresses.fromAmino + }, + "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract": { + aminoType: "wasm/MsgStoreAndMigrateContract", + toAmino: MsgStoreAndMigrateContract.toAmino, + fromAmino: MsgStoreAndMigrateContract.fromAmino + }, + "/cosmwasm.wasm.v1.MsgUpdateContractLabel": { + aminoType: "wasm/MsgUpdateContractLabel", + toAmino: MsgUpdateContractLabel.toAmino, + fromAmino: MsgUpdateContractLabel.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/tx.registry.ts b/util/inj-types/cosmwasm/wasm/v1/tx.registry.ts new file mode 100644 index 00000000..dc20b1aa --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/tx.registry.ts @@ -0,0 +1,323 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgStoreCode, MsgInstantiateContract, MsgInstantiateContract2, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin, MsgUpdateInstantiateConfig, MsgUpdateParams, MsgSudoContract, MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract, MsgRemoveCodeUploadParamsAddresses, MsgAddCodeUploadParamsAddresses, MsgStoreAndMigrateContract, MsgUpdateContractLabel } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ["/cosmwasm.wasm.v1.MsgInstantiateContract2", MsgInstantiateContract2], ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin], ["/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", MsgUpdateInstantiateConfig], ["/cosmwasm.wasm.v1.MsgUpdateParams", MsgUpdateParams], ["/cosmwasm.wasm.v1.MsgSudoContract", MsgSudoContract], ["/cosmwasm.wasm.v1.MsgPinCodes", MsgPinCodes], ["/cosmwasm.wasm.v1.MsgUnpinCodes", MsgUnpinCodes], ["/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", MsgStoreAndInstantiateContract], ["/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", MsgRemoveCodeUploadParamsAddresses], ["/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", MsgAddCodeUploadParamsAddresses], ["/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", MsgStoreAndMigrateContract], ["/cosmwasm.wasm.v1.MsgUpdateContractLabel", MsgUpdateContractLabel]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + storeCode(value: MsgStoreCode) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", + value: MsgStoreCode.encode(value).finish() + }; + }, + instantiateContract(value: MsgInstantiateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", + value: MsgInstantiateContract.encode(value).finish() + }; + }, + instantiateContract2(value: MsgInstantiateContract2) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", + value: MsgInstantiateContract2.encode(value).finish() + }; + }, + executeContract(value: MsgExecuteContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.encode(value).finish() + }; + }, + migrateContract(value: MsgMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", + value: MsgMigrateContract.encode(value).finish() + }; + }, + updateAdmin(value: MsgUpdateAdmin) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", + value: MsgUpdateAdmin.encode(value).finish() + }; + }, + clearAdmin(value: MsgClearAdmin) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", + value: MsgClearAdmin.encode(value).finish() + }; + }, + updateInstantiateConfig(value: MsgUpdateInstantiateConfig) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", + value: MsgUpdateInstantiateConfig.encode(value).finish() + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish() + }; + }, + sudoContract(value: MsgSudoContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", + value: MsgSudoContract.encode(value).finish() + }; + }, + pinCodes(value: MsgPinCodes) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", + value: MsgPinCodes.encode(value).finish() + }; + }, + unpinCodes(value: MsgUnpinCodes) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", + value: MsgUnpinCodes.encode(value).finish() + }; + }, + storeAndInstantiateContract(value: MsgStoreAndInstantiateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", + value: MsgStoreAndInstantiateContract.encode(value).finish() + }; + }, + removeCodeUploadParamsAddresses(value: MsgRemoveCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.encode(value).finish() + }; + }, + addCodeUploadParamsAddresses(value: MsgAddCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.encode(value).finish() + }; + }, + storeAndMigrateContract(value: MsgStoreAndMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.encode(value).finish() + }; + }, + updateContractLabel(value: MsgUpdateContractLabel) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value: MsgUpdateContractLabel.encode(value).finish() + }; + } + }, + withTypeUrl: { + storeCode(value: MsgStoreCode) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", + value + }; + }, + instantiateContract(value: MsgInstantiateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", + value + }; + }, + instantiateContract2(value: MsgInstantiateContract2) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", + value + }; + }, + executeContract(value: MsgExecuteContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value + }; + }, + migrateContract(value: MsgMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", + value + }; + }, + updateAdmin(value: MsgUpdateAdmin) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", + value + }; + }, + clearAdmin(value: MsgClearAdmin) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", + value + }; + }, + updateInstantiateConfig(value: MsgUpdateInstantiateConfig) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", + value + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", + value + }; + }, + sudoContract(value: MsgSudoContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", + value + }; + }, + pinCodes(value: MsgPinCodes) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", + value + }; + }, + unpinCodes(value: MsgUnpinCodes) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", + value + }; + }, + storeAndInstantiateContract(value: MsgStoreAndInstantiateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", + value + }; + }, + removeCodeUploadParamsAddresses(value: MsgRemoveCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value + }; + }, + addCodeUploadParamsAddresses(value: MsgAddCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value + }; + }, + storeAndMigrateContract(value: MsgStoreAndMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value + }; + }, + updateContractLabel(value: MsgUpdateContractLabel) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value + }; + } + }, + fromPartial: { + storeCode(value: MsgStoreCode) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", + value: MsgStoreCode.fromPartial(value) + }; + }, + instantiateContract(value: MsgInstantiateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", + value: MsgInstantiateContract.fromPartial(value) + }; + }, + instantiateContract2(value: MsgInstantiateContract2) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", + value: MsgInstantiateContract2.fromPartial(value) + }; + }, + executeContract(value: MsgExecuteContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.fromPartial(value) + }; + }, + migrateContract(value: MsgMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", + value: MsgMigrateContract.fromPartial(value) + }; + }, + updateAdmin(value: MsgUpdateAdmin) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", + value: MsgUpdateAdmin.fromPartial(value) + }; + }, + clearAdmin(value: MsgClearAdmin) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", + value: MsgClearAdmin.fromPartial(value) + }; + }, + updateInstantiateConfig(value: MsgUpdateInstantiateConfig) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", + value: MsgUpdateInstantiateConfig.fromPartial(value) + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value) + }; + }, + sudoContract(value: MsgSudoContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", + value: MsgSudoContract.fromPartial(value) + }; + }, + pinCodes(value: MsgPinCodes) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", + value: MsgPinCodes.fromPartial(value) + }; + }, + unpinCodes(value: MsgUnpinCodes) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", + value: MsgUnpinCodes.fromPartial(value) + }; + }, + storeAndInstantiateContract(value: MsgStoreAndInstantiateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", + value: MsgStoreAndInstantiateContract.fromPartial(value) + }; + }, + removeCodeUploadParamsAddresses(value: MsgRemoveCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.fromPartial(value) + }; + }, + addCodeUploadParamsAddresses(value: MsgAddCodeUploadParamsAddresses) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.fromPartial(value) + }; + }, + storeAndMigrateContract(value: MsgStoreAndMigrateContract) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.fromPartial(value) + }; + }, + updateContractLabel(value: MsgUpdateContractLabel) { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value: MsgUpdateContractLabel.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/tx.rpc.msg.ts b/util/inj-types/cosmwasm/wasm/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..8e7aaa88 --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/tx.rpc.msg.ts @@ -0,0 +1,222 @@ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgStoreCode, MsgStoreCodeResponse, MsgInstantiateContract, MsgInstantiateContractResponse, MsgInstantiateContract2, MsgInstantiateContract2Response, MsgExecuteContract, MsgExecuteContractResponse, MsgMigrateContract, MsgMigrateContractResponse, MsgUpdateAdmin, MsgUpdateAdminResponse, MsgClearAdmin, MsgClearAdminResponse, MsgUpdateInstantiateConfig, MsgUpdateInstantiateConfigResponse, MsgUpdateParams, MsgUpdateParamsResponse, MsgSudoContract, MsgSudoContractResponse, MsgPinCodes, MsgPinCodesResponse, MsgUnpinCodes, MsgUnpinCodesResponse, MsgStoreAndInstantiateContract, MsgStoreAndInstantiateContractResponse, MsgRemoveCodeUploadParamsAddresses, MsgRemoveCodeUploadParamsAddressesResponse, MsgAddCodeUploadParamsAddresses, MsgAddCodeUploadParamsAddressesResponse, MsgStoreAndMigrateContract, MsgStoreAndMigrateContractResponse, MsgUpdateContractLabel, MsgUpdateContractLabelResponse } from "./tx"; +/** Msg defines the wasm Msg service. */ +export interface Msg { + /** StoreCode to submit Wasm code to the system */ + storeCode(request: MsgStoreCode): Promise; + /** + * InstantiateContract creates a new smart contract instance for the given + * code id. + */ + instantiateContract(request: MsgInstantiateContract): Promise; + /** + * InstantiateContract2 creates a new smart contract instance for the given + * code id with a predictable address + */ + instantiateContract2(request: MsgInstantiateContract2): Promise; + /** Execute submits the given message data to a smart contract */ + executeContract(request: MsgExecuteContract): Promise; + /** Migrate runs a code upgrade/ downgrade for a smart contract */ + migrateContract(request: MsgMigrateContract): Promise; + /** UpdateAdmin sets a new admin for a smart contract */ + updateAdmin(request: MsgUpdateAdmin): Promise; + /** ClearAdmin removes any admin stored for a smart contract */ + clearAdmin(request: MsgClearAdmin): Promise; + /** UpdateInstantiateConfig updates instantiate config for a smart contract */ + updateInstantiateConfig(request: MsgUpdateInstantiateConfig): Promise; + /** + * UpdateParams defines a governance operation for updating the x/wasm + * module parameters. The authority is defined in the keeper. + * + * Since: 0.40 + */ + updateParams(request: MsgUpdateParams): Promise; + /** + * SudoContract defines a governance operation for calling sudo + * on a contract. The authority is defined in the keeper. + * + * Since: 0.40 + */ + sudoContract(request: MsgSudoContract): Promise; + /** + * PinCodes defines a governance operation for pinning a set of + * code ids in the wasmvm cache. The authority is defined in the keeper. + * + * Since: 0.40 + */ + pinCodes(request: MsgPinCodes): Promise; + /** + * UnpinCodes defines a governance operation for unpinning a set of + * code ids in the wasmvm cache. The authority is defined in the keeper. + * + * Since: 0.40 + */ + unpinCodes(request: MsgUnpinCodes): Promise; + /** + * StoreAndInstantiateContract defines a governance operation for storing + * and instantiating the contract. The authority is defined in the keeper. + * + * Since: 0.40 + */ + storeAndInstantiateContract(request: MsgStoreAndInstantiateContract): Promise; + /** + * RemoveCodeUploadParamsAddresses defines a governance operation for + * removing addresses from code upload params. + * The authority is defined in the keeper. + */ + removeCodeUploadParamsAddresses(request: MsgRemoveCodeUploadParamsAddresses): Promise; + /** + * AddCodeUploadParamsAddresses defines a governance operation for + * adding addresses to code upload params. + * The authority is defined in the keeper. + */ + addCodeUploadParamsAddresses(request: MsgAddCodeUploadParamsAddresses): Promise; + /** + * StoreAndMigrateContract defines a governance operation for storing + * and migrating the contract. The authority is defined in the keeper. + * + * Since: 0.42 + */ + storeAndMigrateContract(request: MsgStoreAndMigrateContract): Promise; + /** + * UpdateContractLabel sets a new label for a smart contract + * + * Since: 0.43 + */ + updateContractLabel(request: MsgUpdateContractLabel): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* StoreCode to submit Wasm code to the system */ + storeCode = async (request: MsgStoreCode): Promise => { + const data = MsgStoreCode.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "StoreCode", data); + return promise.then(data => MsgStoreCodeResponse.decode(new BinaryReader(data))); + }; + /* InstantiateContract creates a new smart contract instance for the given + code id. */ + instantiateContract = async (request: MsgInstantiateContract): Promise => { + const data = MsgInstantiateContract.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "InstantiateContract", data); + return promise.then(data => MsgInstantiateContractResponse.decode(new BinaryReader(data))); + }; + /* InstantiateContract2 creates a new smart contract instance for the given + code id with a predictable address */ + instantiateContract2 = async (request: MsgInstantiateContract2): Promise => { + const data = MsgInstantiateContract2.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "InstantiateContract2", data); + return promise.then(data => MsgInstantiateContract2Response.decode(new BinaryReader(data))); + }; + /* Execute submits the given message data to a smart contract */ + executeContract = async (request: MsgExecuteContract): Promise => { + const data = MsgExecuteContract.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "ExecuteContract", data); + return promise.then(data => MsgExecuteContractResponse.decode(new BinaryReader(data))); + }; + /* Migrate runs a code upgrade/ downgrade for a smart contract */ + migrateContract = async (request: MsgMigrateContract): Promise => { + const data = MsgMigrateContract.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "MigrateContract", data); + return promise.then(data => MsgMigrateContractResponse.decode(new BinaryReader(data))); + }; + /* UpdateAdmin sets a new admin for a smart contract */ + updateAdmin = async (request: MsgUpdateAdmin): Promise => { + const data = MsgUpdateAdmin.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "UpdateAdmin", data); + return promise.then(data => MsgUpdateAdminResponse.decode(new BinaryReader(data))); + }; + /* ClearAdmin removes any admin stored for a smart contract */ + clearAdmin = async (request: MsgClearAdmin): Promise => { + const data = MsgClearAdmin.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "ClearAdmin", data); + return promise.then(data => MsgClearAdminResponse.decode(new BinaryReader(data))); + }; + /* UpdateInstantiateConfig updates instantiate config for a smart contract */ + updateInstantiateConfig = async (request: MsgUpdateInstantiateConfig): Promise => { + const data = MsgUpdateInstantiateConfig.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "UpdateInstantiateConfig", data); + return promise.then(data => MsgUpdateInstantiateConfigResponse.decode(new BinaryReader(data))); + }; + /* UpdateParams defines a governance operation for updating the x/wasm + module parameters. The authority is defined in the keeper. + + Since: 0.40 */ + updateParams = async (request: MsgUpdateParams): Promise => { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "UpdateParams", data); + return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + }; + /* SudoContract defines a governance operation for calling sudo + on a contract. The authority is defined in the keeper. + + Since: 0.40 */ + sudoContract = async (request: MsgSudoContract): Promise => { + const data = MsgSudoContract.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "SudoContract", data); + return promise.then(data => MsgSudoContractResponse.decode(new BinaryReader(data))); + }; + /* PinCodes defines a governance operation for pinning a set of + code ids in the wasmvm cache. The authority is defined in the keeper. + + Since: 0.40 */ + pinCodes = async (request: MsgPinCodes): Promise => { + const data = MsgPinCodes.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "PinCodes", data); + return promise.then(data => MsgPinCodesResponse.decode(new BinaryReader(data))); + }; + /* UnpinCodes defines a governance operation for unpinning a set of + code ids in the wasmvm cache. The authority is defined in the keeper. + + Since: 0.40 */ + unpinCodes = async (request: MsgUnpinCodes): Promise => { + const data = MsgUnpinCodes.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "UnpinCodes", data); + return promise.then(data => MsgUnpinCodesResponse.decode(new BinaryReader(data))); + }; + /* StoreAndInstantiateContract defines a governance operation for storing + and instantiating the contract. The authority is defined in the keeper. + + Since: 0.40 */ + storeAndInstantiateContract = async (request: MsgStoreAndInstantiateContract): Promise => { + const data = MsgStoreAndInstantiateContract.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "StoreAndInstantiateContract", data); + return promise.then(data => MsgStoreAndInstantiateContractResponse.decode(new BinaryReader(data))); + }; + /* RemoveCodeUploadParamsAddresses defines a governance operation for + removing addresses from code upload params. + The authority is defined in the keeper. */ + removeCodeUploadParamsAddresses = async (request: MsgRemoveCodeUploadParamsAddresses): Promise => { + const data = MsgRemoveCodeUploadParamsAddresses.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "RemoveCodeUploadParamsAddresses", data); + return promise.then(data => MsgRemoveCodeUploadParamsAddressesResponse.decode(new BinaryReader(data))); + }; + /* AddCodeUploadParamsAddresses defines a governance operation for + adding addresses to code upload params. + The authority is defined in the keeper. */ + addCodeUploadParamsAddresses = async (request: MsgAddCodeUploadParamsAddresses): Promise => { + const data = MsgAddCodeUploadParamsAddresses.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "AddCodeUploadParamsAddresses", data); + return promise.then(data => MsgAddCodeUploadParamsAddressesResponse.decode(new BinaryReader(data))); + }; + /* StoreAndMigrateContract defines a governance operation for storing + and migrating the contract. The authority is defined in the keeper. + + Since: 0.42 */ + storeAndMigrateContract = async (request: MsgStoreAndMigrateContract): Promise => { + const data = MsgStoreAndMigrateContract.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "StoreAndMigrateContract", data); + return promise.then(data => MsgStoreAndMigrateContractResponse.decode(new BinaryReader(data))); + }; + /* UpdateContractLabel sets a new label for a smart contract + + Since: 0.43 */ + updateContractLabel = async (request: MsgUpdateContractLabel): Promise => { + const data = MsgUpdateContractLabel.encode(request).finish(); + const promise = this.rpc.request("cosmwasm.wasm.v1.Msg", "UpdateContractLabel", data); + return promise.then(data => MsgUpdateContractLabelResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/tx.ts b/util/inj-types/cosmwasm/wasm/v1/tx.ts new file mode 100644 index 00000000..c047ddd9 --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/tx.ts @@ -0,0 +1,4164 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, Params, ParamsAmino, ParamsSDKType } from "./types"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +/** MsgStoreCode submit Wasm code to the system */ +export interface MsgStoreCode { + /** Sender is the actor that signed the messages */ + sender: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** + * InstantiatePermission access control to apply on contract creation, + * optional + */ + instantiatePermission?: AccessConfig; +} +export interface MsgStoreCodeProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode"; + value: Uint8Array; +} +/** MsgStoreCode submit Wasm code to the system */ +export interface MsgStoreCodeAmino { + /** Sender is the actor that signed the messages */ + sender?: string; + /** WASMByteCode can be raw or gzip compressed */ + wasm_byte_code?: string; + /** + * InstantiatePermission access control to apply on contract creation, + * optional + */ + instantiate_permission?: AccessConfigAmino; +} +export interface MsgStoreCodeAminoMsg { + type: "wasm/MsgStoreCode"; + value: MsgStoreCodeAmino; +} +/** MsgStoreCode submit Wasm code to the system */ +export interface MsgStoreCodeSDKType { + sender: string; + wasm_byte_code: Uint8Array; + instantiate_permission?: AccessConfigSDKType; +} +/** MsgStoreCodeResponse returns store result data. */ +export interface MsgStoreCodeResponse { + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Checksum is the sha256 hash of the stored code */ + checksum: Uint8Array; +} +export interface MsgStoreCodeResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse"; + value: Uint8Array; +} +/** MsgStoreCodeResponse returns store result data. */ +export interface MsgStoreCodeResponseAmino { + /** CodeID is the reference to the stored WASM code */ + code_id?: string; + /** Checksum is the sha256 hash of the stored code */ + checksum?: string; +} +export interface MsgStoreCodeResponseAminoMsg { + type: "wasm/MsgStoreCodeResponse"; + value: MsgStoreCodeResponseAmino; +} +/** MsgStoreCodeResponse returns store result data. */ +export interface MsgStoreCodeResponseSDKType { + code_id: bigint; + checksum: Uint8Array; +} +/** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ +export interface MsgInstantiateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +export interface MsgInstantiateContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract"; + value: Uint8Array; +} +/** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ +export interface MsgInstantiateContractAmino { + /** Sender is the that actor that signed the messages */ + sender?: string; + /** Admin is an optional address that can execute migrations */ + admin?: string; + /** CodeID is the reference to the stored WASM code */ + code_id?: string; + /** Label is optional metadata to be stored with a contract instance. */ + label?: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg?: any; + /** Funds coins that are transferred to the contract on instantiation */ + funds: CoinAmino[]; +} +export interface MsgInstantiateContractAminoMsg { + type: "wasm/MsgInstantiateContract"; + value: MsgInstantiateContractAmino; +} +/** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ +export interface MsgInstantiateContractSDKType { + sender: string; + admin: string; + code_id: bigint; + label: string; + msg: Uint8Array; + funds: CoinSDKType[]; +} +/** MsgInstantiateContractResponse return instantiation result data */ +export interface MsgInstantiateContractResponse { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgInstantiateContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse"; + value: Uint8Array; +} +/** MsgInstantiateContractResponse return instantiation result data */ +export interface MsgInstantiateContractResponseAmino { + /** Address is the bech32 address of the new contract instance. */ + address?: string; + /** Data contains bytes to returned from the contract */ + data?: string; +} +export interface MsgInstantiateContractResponseAminoMsg { + type: "wasm/MsgInstantiateContractResponse"; + value: MsgInstantiateContractResponseAmino; +} +/** MsgInstantiateContractResponse return instantiation result data */ +export interface MsgInstantiateContractResponseSDKType { + address: string; + data: Uint8Array; +} +/** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ +export interface MsgInstantiateContract2 { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; +} +export interface MsgInstantiateContract2ProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2"; + value: Uint8Array; +} +/** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ +export interface MsgInstantiateContract2Amino { + /** Sender is the that actor that signed the messages */ + sender?: string; + /** Admin is an optional address that can execute migrations */ + admin?: string; + /** CodeID is the reference to the stored WASM code */ + code_id?: string; + /** Label is optional metadata to be stored with a contract instance. */ + label?: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg?: any; + /** Funds coins that are transferred to the contract on instantiation */ + funds: CoinAmino[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt?: string; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fix_msg?: boolean; +} +export interface MsgInstantiateContract2AminoMsg { + type: "wasm/MsgInstantiateContract2"; + value: MsgInstantiateContract2Amino; +} +/** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ +export interface MsgInstantiateContract2SDKType { + sender: string; + admin: string; + code_id: bigint; + label: string; + msg: Uint8Array; + funds: CoinSDKType[]; + salt: Uint8Array; + fix_msg: boolean; +} +/** MsgInstantiateContract2Response return instantiation result data */ +export interface MsgInstantiateContract2Response { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgInstantiateContract2ResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2Response"; + value: Uint8Array; +} +/** MsgInstantiateContract2Response return instantiation result data */ +export interface MsgInstantiateContract2ResponseAmino { + /** Address is the bech32 address of the new contract instance. */ + address?: string; + /** Data contains bytes to returned from the contract */ + data?: string; +} +export interface MsgInstantiateContract2ResponseAminoMsg { + type: "wasm/MsgInstantiateContract2Response"; + value: MsgInstantiateContract2ResponseAmino; +} +/** MsgInstantiateContract2Response return instantiation result data */ +export interface MsgInstantiateContract2ResponseSDKType { + address: string; + data: Uint8Array; +} +/** MsgExecuteContract submits the given message data to a smart contract */ +export interface MsgExecuteContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on execution */ + funds: Coin[]; +} +export interface MsgExecuteContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract"; + value: Uint8Array; +} +/** MsgExecuteContract submits the given message data to a smart contract */ +export interface MsgExecuteContractAmino { + /** Sender is the that actor that signed the messages */ + sender?: string; + /** Contract is the address of the smart contract */ + contract?: string; + /** Msg json encoded message to be passed to the contract */ + msg?: any; + /** Funds coins that are transferred to the contract on execution */ + funds: CoinAmino[]; +} +export interface MsgExecuteContractAminoMsg { + type: "wasm/MsgExecuteContract"; + value: MsgExecuteContractAmino; +} +/** MsgExecuteContract submits the given message data to a smart contract */ +export interface MsgExecuteContractSDKType { + sender: string; + contract: string; + msg: Uint8Array; + funds: CoinSDKType[]; +} +/** MsgExecuteContractResponse returns execution result data. */ +export interface MsgExecuteContractResponse { + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgExecuteContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse"; + value: Uint8Array; +} +/** MsgExecuteContractResponse returns execution result data. */ +export interface MsgExecuteContractResponseAmino { + /** Data contains bytes to returned from the contract */ + data?: string; +} +export interface MsgExecuteContractResponseAminoMsg { + type: "wasm/MsgExecuteContractResponse"; + value: MsgExecuteContractResponseAmino; +} +/** MsgExecuteContractResponse returns execution result data. */ +export interface MsgExecuteContractResponseSDKType { + data: Uint8Array; +} +/** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ +export interface MsgMigrateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: bigint; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +export interface MsgMigrateContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract"; + value: Uint8Array; +} +/** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ +export interface MsgMigrateContractAmino { + /** Sender is the that actor that signed the messages */ + sender?: string; + /** Contract is the address of the smart contract */ + contract?: string; + /** CodeID references the new WASM code */ + code_id?: string; + /** Msg json encoded message to be passed to the contract on migration */ + msg?: any; +} +export interface MsgMigrateContractAminoMsg { + type: "wasm/MsgMigrateContract"; + value: MsgMigrateContractAmino; +} +/** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ +export interface MsgMigrateContractSDKType { + sender: string; + contract: string; + code_id: bigint; + msg: Uint8Array; +} +/** MsgMigrateContractResponse returns contract migration result data. */ +export interface MsgMigrateContractResponse { + /** + * Data contains same raw bytes returned as data from the wasm contract. + * (May be empty) + */ + data: Uint8Array; +} +export interface MsgMigrateContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse"; + value: Uint8Array; +} +/** MsgMigrateContractResponse returns contract migration result data. */ +export interface MsgMigrateContractResponseAmino { + /** + * Data contains same raw bytes returned as data from the wasm contract. + * (May be empty) + */ + data?: string; +} +export interface MsgMigrateContractResponseAminoMsg { + type: "wasm/MsgMigrateContractResponse"; + value: MsgMigrateContractResponseAmino; +} +/** MsgMigrateContractResponse returns contract migration result data. */ +export interface MsgMigrateContractResponseSDKType { + data: Uint8Array; +} +/** MsgUpdateAdmin sets a new admin for a smart contract */ +export interface MsgUpdateAdmin { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgUpdateAdminProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin"; + value: Uint8Array; +} +/** MsgUpdateAdmin sets a new admin for a smart contract */ +export interface MsgUpdateAdminAmino { + /** Sender is the that actor that signed the messages */ + sender?: string; + /** NewAdmin address to be set */ + new_admin?: string; + /** Contract is the address of the smart contract */ + contract?: string; +} +export interface MsgUpdateAdminAminoMsg { + type: "wasm/MsgUpdateAdmin"; + value: MsgUpdateAdminAmino; +} +/** MsgUpdateAdmin sets a new admin for a smart contract */ +export interface MsgUpdateAdminSDKType { + sender: string; + new_admin: string; + contract: string; +} +/** MsgUpdateAdminResponse returns empty data */ +export interface MsgUpdateAdminResponse {} +export interface MsgUpdateAdminResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse"; + value: Uint8Array; +} +/** MsgUpdateAdminResponse returns empty data */ +export interface MsgUpdateAdminResponseAmino {} +export interface MsgUpdateAdminResponseAminoMsg { + type: "wasm/MsgUpdateAdminResponse"; + value: MsgUpdateAdminResponseAmino; +} +/** MsgUpdateAdminResponse returns empty data */ +export interface MsgUpdateAdminResponseSDKType {} +/** MsgClearAdmin removes any admin stored for a smart contract */ +export interface MsgClearAdmin { + /** Sender is the actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgClearAdminProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin"; + value: Uint8Array; +} +/** MsgClearAdmin removes any admin stored for a smart contract */ +export interface MsgClearAdminAmino { + /** Sender is the actor that signed the messages */ + sender?: string; + /** Contract is the address of the smart contract */ + contract?: string; +} +export interface MsgClearAdminAminoMsg { + type: "wasm/MsgClearAdmin"; + value: MsgClearAdminAmino; +} +/** MsgClearAdmin removes any admin stored for a smart contract */ +export interface MsgClearAdminSDKType { + sender: string; + contract: string; +} +/** MsgClearAdminResponse returns empty data */ +export interface MsgClearAdminResponse {} +export interface MsgClearAdminResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse"; + value: Uint8Array; +} +/** MsgClearAdminResponse returns empty data */ +export interface MsgClearAdminResponseAmino {} +export interface MsgClearAdminResponseAminoMsg { + type: "wasm/MsgClearAdminResponse"; + value: MsgClearAdminResponseAmino; +} +/** MsgClearAdminResponse returns empty data */ +export interface MsgClearAdminResponseSDKType {} +/** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ +export interface MsgUpdateInstantiateConfig { + /** Sender is the that actor that signed the messages */ + sender: string; + /** CodeID references the stored WASM code */ + codeId: bigint; + /** NewInstantiatePermission is the new access control */ + newInstantiatePermission?: AccessConfig; +} +export interface MsgUpdateInstantiateConfigProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig"; + value: Uint8Array; +} +/** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ +export interface MsgUpdateInstantiateConfigAmino { + /** Sender is the that actor that signed the messages */ + sender?: string; + /** CodeID references the stored WASM code */ + code_id?: string; + /** NewInstantiatePermission is the new access control */ + new_instantiate_permission?: AccessConfigAmino; +} +export interface MsgUpdateInstantiateConfigAminoMsg { + type: "wasm/MsgUpdateInstantiateConfig"; + value: MsgUpdateInstantiateConfigAmino; +} +/** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ +export interface MsgUpdateInstantiateConfigSDKType { + sender: string; + code_id: bigint; + new_instantiate_permission?: AccessConfigSDKType; +} +/** MsgUpdateInstantiateConfigResponse returns empty data */ +export interface MsgUpdateInstantiateConfigResponse {} +export interface MsgUpdateInstantiateConfigResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse"; + value: Uint8Array; +} +/** MsgUpdateInstantiateConfigResponse returns empty data */ +export interface MsgUpdateInstantiateConfigResponseAmino {} +export interface MsgUpdateInstantiateConfigResponseAminoMsg { + type: "wasm/MsgUpdateInstantiateConfigResponse"; + value: MsgUpdateInstantiateConfigResponseAmino; +} +/** MsgUpdateInstantiateConfigResponse returns empty data */ +export interface MsgUpdateInstantiateConfigResponseSDKType {} +/** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ +export interface MsgUpdateParams { + /** Authority is the address of the governance account. */ + authority: string; + /** + * params defines the x/wasm parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsAmino { + /** Authority is the address of the governance account. */ + authority?: string; + /** + * params defines the x/wasm parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "wasm/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsSDKType { + authority: string; + params: ParamsSDKType; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "wasm/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsResponseSDKType {} +/** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ +export interface MsgSudoContract { + /** Authority is the address of the governance account. */ + authority: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; +} +export interface MsgSudoContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract"; + value: Uint8Array; +} +/** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ +export interface MsgSudoContractAmino { + /** Authority is the address of the governance account. */ + authority?: string; + /** Contract is the address of the smart contract */ + contract?: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg?: any; +} +export interface MsgSudoContractAminoMsg { + type: "wasm/MsgSudoContract"; + value: MsgSudoContractAmino; +} +/** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ +export interface MsgSudoContractSDKType { + authority: string; + contract: string; + msg: Uint8Array; +} +/** + * MsgSudoContractResponse defines the response structure for executing a + * MsgSudoContract message. + * + * Since: 0.40 + */ +export interface MsgSudoContractResponse { + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgSudoContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContractResponse"; + value: Uint8Array; +} +/** + * MsgSudoContractResponse defines the response structure for executing a + * MsgSudoContract message. + * + * Since: 0.40 + */ +export interface MsgSudoContractResponseAmino { + /** Data contains bytes to returned from the contract */ + data?: string; +} +export interface MsgSudoContractResponseAminoMsg { + type: "wasm/MsgSudoContractResponse"; + value: MsgSudoContractResponseAmino; +} +/** + * MsgSudoContractResponse defines the response structure for executing a + * MsgSudoContract message. + * + * Since: 0.40 + */ +export interface MsgSudoContractResponseSDKType { + data: Uint8Array; +} +/** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ +export interface MsgPinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the new WASM codes */ + codeIds: bigint[]; +} +export interface MsgPinCodesProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes"; + value: Uint8Array; +} +/** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ +export interface MsgPinCodesAmino { + /** Authority is the address of the governance account. */ + authority?: string; + /** CodeIDs references the new WASM codes */ + code_ids?: string[]; +} +export interface MsgPinCodesAminoMsg { + type: "wasm/MsgPinCodes"; + value: MsgPinCodesAmino; +} +/** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ +export interface MsgPinCodesSDKType { + authority: string; + code_ids: bigint[]; +} +/** + * MsgPinCodesResponse defines the response structure for executing a + * MsgPinCodes message. + * + * Since: 0.40 + */ +export interface MsgPinCodesResponse {} +export interface MsgPinCodesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodesResponse"; + value: Uint8Array; +} +/** + * MsgPinCodesResponse defines the response structure for executing a + * MsgPinCodes message. + * + * Since: 0.40 + */ +export interface MsgPinCodesResponseAmino {} +export interface MsgPinCodesResponseAminoMsg { + type: "wasm/MsgPinCodesResponse"; + value: MsgPinCodesResponseAmino; +} +/** + * MsgPinCodesResponse defines the response structure for executing a + * MsgPinCodes message. + * + * Since: 0.40 + */ +export interface MsgPinCodesResponseSDKType {} +/** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ +export interface MsgUnpinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the WASM codes */ + codeIds: bigint[]; +} +export interface MsgUnpinCodesProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes"; + value: Uint8Array; +} +/** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesAmino { + /** Authority is the address of the governance account. */ + authority?: string; + /** CodeIDs references the WASM codes */ + code_ids?: string[]; +} +export interface MsgUnpinCodesAminoMsg { + type: "wasm/MsgUnpinCodes"; + value: MsgUnpinCodesAmino; +} +/** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesSDKType { + authority: string; + code_ids: bigint[]; +} +/** + * MsgUnpinCodesResponse defines the response structure for executing a + * MsgUnpinCodes message. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesResponse {} +export interface MsgUnpinCodesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodesResponse"; + value: Uint8Array; +} +/** + * MsgUnpinCodesResponse defines the response structure for executing a + * MsgUnpinCodes message. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesResponseAmino {} +export interface MsgUnpinCodesResponseAminoMsg { + type: "wasm/MsgUnpinCodesResponse"; + value: MsgUnpinCodesResponseAmino; +} +/** + * MsgUnpinCodesResponse defines the response structure for executing a + * MsgUnpinCodes message. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesResponseSDKType {} +/** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission?: AccessConfig; + /** + * UnpinCode code on upload, optional. As default the uploaded contract is + * pinned to cache. + */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** + * Funds coins that are transferred from the authority account to the contract + * on instantiation + */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +export interface MsgStoreAndInstantiateContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract"; + value: Uint8Array; +} +/** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractAmino { + /** Authority is the address of the governance account. */ + authority?: string; + /** WASMByteCode can be raw or gzip compressed */ + wasm_byte_code?: string; + /** InstantiatePermission to apply on contract creation, optional */ + instantiate_permission?: AccessConfigAmino; + /** + * UnpinCode code on upload, optional. As default the uploaded contract is + * pinned to cache. + */ + unpin_code?: boolean; + /** Admin is an optional address that can execute migrations */ + admin?: string; + /** Label is optional metadata to be stored with a constract instance. */ + label?: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg?: any; + /** + * Funds coins that are transferred from the authority account to the contract + * on instantiation + */ + funds: CoinAmino[]; + /** Source is the URL where the code is hosted */ + source?: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder?: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + code_hash?: string; +} +export interface MsgStoreAndInstantiateContractAminoMsg { + type: "wasm/MsgStoreAndInstantiateContract"; + value: MsgStoreAndInstantiateContractAmino; +} +/** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractSDKType { + authority: string; + wasm_byte_code: Uint8Array; + instantiate_permission?: AccessConfigSDKType; + unpin_code: boolean; + admin: string; + label: string; + msg: Uint8Array; + funds: CoinSDKType[]; + source: string; + builder: string; + code_hash: Uint8Array; +} +/** + * MsgStoreAndInstantiateContractResponse defines the response structure + * for executing a MsgStoreAndInstantiateContract message. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractResponse { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgStoreAndInstantiateContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse"; + value: Uint8Array; +} +/** + * MsgStoreAndInstantiateContractResponse defines the response structure + * for executing a MsgStoreAndInstantiateContract message. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractResponseAmino { + /** Address is the bech32 address of the new contract instance. */ + address?: string; + /** Data contains bytes to returned from the contract */ + data?: string; +} +export interface MsgStoreAndInstantiateContractResponseAminoMsg { + type: "wasm/MsgStoreAndInstantiateContractResponse"; + value: MsgStoreAndInstantiateContractResponseAmino; +} +/** + * MsgStoreAndInstantiateContractResponse defines the response structure + * for executing a MsgStoreAndInstantiateContract message. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractResponseSDKType { + address: string; + data: Uint8Array; +} +/** + * MsgAddCodeUploadParamsAddresses is the + * MsgAddCodeUploadParamsAddresses request type. + */ +export interface MsgAddCodeUploadParamsAddresses { + /** Authority is the address of the governance account. */ + authority: string; + addresses: string[]; +} +export interface MsgAddCodeUploadParamsAddressesProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses"; + value: Uint8Array; +} +/** + * MsgAddCodeUploadParamsAddresses is the + * MsgAddCodeUploadParamsAddresses request type. + */ +export interface MsgAddCodeUploadParamsAddressesAmino { + /** Authority is the address of the governance account. */ + authority?: string; + addresses?: string[]; +} +export interface MsgAddCodeUploadParamsAddressesAminoMsg { + type: "wasm/MsgAddCodeUploadParamsAddresses"; + value: MsgAddCodeUploadParamsAddressesAmino; +} +/** + * MsgAddCodeUploadParamsAddresses is the + * MsgAddCodeUploadParamsAddresses request type. + */ +export interface MsgAddCodeUploadParamsAddressesSDKType { + authority: string; + addresses: string[]; +} +/** + * MsgAddCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgAddCodeUploadParamsAddresses message. + */ +export interface MsgAddCodeUploadParamsAddressesResponse {} +export interface MsgAddCodeUploadParamsAddressesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse"; + value: Uint8Array; +} +/** + * MsgAddCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgAddCodeUploadParamsAddresses message. + */ +export interface MsgAddCodeUploadParamsAddressesResponseAmino {} +export interface MsgAddCodeUploadParamsAddressesResponseAminoMsg { + type: "wasm/MsgAddCodeUploadParamsAddressesResponse"; + value: MsgAddCodeUploadParamsAddressesResponseAmino; +} +/** + * MsgAddCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgAddCodeUploadParamsAddresses message. + */ +export interface MsgAddCodeUploadParamsAddressesResponseSDKType {} +/** + * MsgRemoveCodeUploadParamsAddresses is the + * MsgRemoveCodeUploadParamsAddresses request type. + */ +export interface MsgRemoveCodeUploadParamsAddresses { + /** Authority is the address of the governance account. */ + authority: string; + addresses: string[]; +} +export interface MsgRemoveCodeUploadParamsAddressesProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses"; + value: Uint8Array; +} +/** + * MsgRemoveCodeUploadParamsAddresses is the + * MsgRemoveCodeUploadParamsAddresses request type. + */ +export interface MsgRemoveCodeUploadParamsAddressesAmino { + /** Authority is the address of the governance account. */ + authority?: string; + addresses?: string[]; +} +export interface MsgRemoveCodeUploadParamsAddressesAminoMsg { + type: "wasm/MsgRemoveCodeUploadParamsAddresses"; + value: MsgRemoveCodeUploadParamsAddressesAmino; +} +/** + * MsgRemoveCodeUploadParamsAddresses is the + * MsgRemoveCodeUploadParamsAddresses request type. + */ +export interface MsgRemoveCodeUploadParamsAddressesSDKType { + authority: string; + addresses: string[]; +} +/** + * MsgRemoveCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgRemoveCodeUploadParamsAddresses message. + */ +export interface MsgRemoveCodeUploadParamsAddressesResponse {} +export interface MsgRemoveCodeUploadParamsAddressesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse"; + value: Uint8Array; +} +/** + * MsgRemoveCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgRemoveCodeUploadParamsAddresses message. + */ +export interface MsgRemoveCodeUploadParamsAddressesResponseAmino {} +export interface MsgRemoveCodeUploadParamsAddressesResponseAminoMsg { + type: "wasm/MsgRemoveCodeUploadParamsAddressesResponse"; + value: MsgRemoveCodeUploadParamsAddressesResponseAmino; +} +/** + * MsgRemoveCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgRemoveCodeUploadParamsAddresses message. + */ +export interface MsgRemoveCodeUploadParamsAddressesResponseSDKType {} +/** + * MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract + * request type. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission?: AccessConfig; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +export interface MsgStoreAndMigrateContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract"; + value: Uint8Array; +} +/** + * MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract + * request type. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractAmino { + /** Authority is the address of the governance account. */ + authority?: string; + /** WASMByteCode can be raw or gzip compressed */ + wasm_byte_code?: string; + /** InstantiatePermission to apply on contract creation, optional */ + instantiate_permission?: AccessConfigAmino; + /** Contract is the address of the smart contract */ + contract?: string; + /** Msg json encoded message to be passed to the contract on migration */ + msg?: any; +} +export interface MsgStoreAndMigrateContractAminoMsg { + type: "wasm/MsgStoreAndMigrateContract"; + value: MsgStoreAndMigrateContractAmino; +} +/** + * MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract + * request type. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractSDKType { + authority: string; + wasm_byte_code: Uint8Array; + instantiate_permission?: AccessConfigSDKType; + contract: string; + msg: Uint8Array; +} +/** + * MsgStoreAndMigrateContractResponse defines the response structure + * for executing a MsgStoreAndMigrateContract message. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractResponse { + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Checksum is the sha256 hash of the stored code */ + checksum: Uint8Array; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgStoreAndMigrateContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse"; + value: Uint8Array; +} +/** + * MsgStoreAndMigrateContractResponse defines the response structure + * for executing a MsgStoreAndMigrateContract message. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractResponseAmino { + /** CodeID is the reference to the stored WASM code */ + code_id?: string; + /** Checksum is the sha256 hash of the stored code */ + checksum?: string; + /** Data contains bytes to returned from the contract */ + data?: string; +} +export interface MsgStoreAndMigrateContractResponseAminoMsg { + type: "wasm/MsgStoreAndMigrateContractResponse"; + value: MsgStoreAndMigrateContractResponseAmino; +} +/** + * MsgStoreAndMigrateContractResponse defines the response structure + * for executing a MsgStoreAndMigrateContract message. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractResponseSDKType { + code_id: bigint; + checksum: Uint8Array; + data: Uint8Array; +} +/** MsgUpdateContractLabel sets a new label for a smart contract */ +export interface MsgUpdateContractLabel { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewLabel string to be set */ + newLabel: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgUpdateContractLabelProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel"; + value: Uint8Array; +} +/** MsgUpdateContractLabel sets a new label for a smart contract */ +export interface MsgUpdateContractLabelAmino { + /** Sender is the that actor that signed the messages */ + sender?: string; + /** NewLabel string to be set */ + new_label?: string; + /** Contract is the address of the smart contract */ + contract?: string; +} +export interface MsgUpdateContractLabelAminoMsg { + type: "wasm/MsgUpdateContractLabel"; + value: MsgUpdateContractLabelAmino; +} +/** MsgUpdateContractLabel sets a new label for a smart contract */ +export interface MsgUpdateContractLabelSDKType { + sender: string; + new_label: string; + contract: string; +} +/** MsgUpdateContractLabelResponse returns empty data */ +export interface MsgUpdateContractLabelResponse {} +export interface MsgUpdateContractLabelResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse"; + value: Uint8Array; +} +/** MsgUpdateContractLabelResponse returns empty data */ +export interface MsgUpdateContractLabelResponseAmino {} +export interface MsgUpdateContractLabelResponseAminoMsg { + type: "wasm/MsgUpdateContractLabelResponse"; + value: MsgUpdateContractLabelResponseAmino; +} +/** MsgUpdateContractLabelResponse returns empty data */ +export interface MsgUpdateContractLabelResponseSDKType {} +function createBaseMsgStoreCode(): MsgStoreCode { + return { + sender: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: undefined + }; +} +export const MsgStoreCode = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", + aminoType: "wasm/MsgStoreCode", + encode(message: MsgStoreCode, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreCode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.wasmByteCode = reader.bytes(); + break; + case 5: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreCode { + const message = createBaseMsgStoreCode(); + message.sender = object.sender ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + return message; + }, + fromAmino(object: MsgStoreCodeAmino): MsgStoreCode { + const message = createBaseMsgStoreCode(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) { + message.wasmByteCode = fromBase64(object.wasm_byte_code); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + return message; + }, + toAmino(message: MsgStoreCode): MsgStoreCodeAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreCodeAminoMsg): MsgStoreCode { + return MsgStoreCode.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreCode): MsgStoreCodeAminoMsg { + return { + type: "wasm/MsgStoreCode", + value: MsgStoreCode.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreCodeProtoMsg): MsgStoreCode { + return MsgStoreCode.decode(message.value); + }, + toProto(message: MsgStoreCode): Uint8Array { + return MsgStoreCode.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreCode): MsgStoreCodeProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", + value: MsgStoreCode.encode(message).finish() + }; + } +}; +function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { + return { + codeId: BigInt(0), + checksum: new Uint8Array() + }; +} +export const MsgStoreCodeResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", + aminoType: "wasm/MsgStoreCodeResponse", + encode(message: MsgStoreCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.checksum = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreCodeResponse { + const message = createBaseMsgStoreCodeResponse(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.checksum = object.checksum ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreCodeResponseAmino): MsgStoreCodeResponse { + const message = createBaseMsgStoreCodeResponse(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.checksum !== undefined && object.checksum !== null) { + message.checksum = bytesFromBase64(object.checksum); + } + return message; + }, + toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.checksum = message.checksum ? base64FromBytes(message.checksum) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { + return MsgStoreCodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreCodeResponse): MsgStoreCodeResponseAminoMsg { + return { + type: "wasm/MsgStoreCodeResponse", + value: MsgStoreCodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreCodeResponseProtoMsg): MsgStoreCodeResponse { + return MsgStoreCodeResponse.decode(message.value); + }, + toProto(message: MsgStoreCodeResponse): Uint8Array { + return MsgStoreCodeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreCodeResponse): MsgStoreCodeResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", + value: MsgStoreCodeResponse.encode(message).finish() + }; + } +}; +function createBaseMsgInstantiateContract(): MsgInstantiateContract { + return { + sender: "", + admin: "", + codeId: BigInt(0), + label: "", + msg: new Uint8Array(), + funds: [] + }; +} +export const MsgInstantiateContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", + aminoType: "wasm/MsgInstantiateContract", + encode(message: MsgInstantiateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInstantiateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.codeId = reader.uint64(); + break; + case 4: + message.label = reader.string(); + break; + case 5: + message.msg = reader.bytes(); + break; + case 6: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInstantiateContract { + const message = createBaseMsgInstantiateContract(); + message.sender = object.sender ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgInstantiateContractAmino): MsgInstantiateContract { + const message = createBaseMsgInstantiateContract(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + return obj; + }, + fromAminoMsg(object: MsgInstantiateContractAminoMsg): MsgInstantiateContract { + return MsgInstantiateContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgInstantiateContract): MsgInstantiateContractAminoMsg { + return { + type: "wasm/MsgInstantiateContract", + value: MsgInstantiateContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgInstantiateContractProtoMsg): MsgInstantiateContract { + return MsgInstantiateContract.decode(message.value); + }, + toProto(message: MsgInstantiateContract): Uint8Array { + return MsgInstantiateContract.encode(message).finish(); + }, + toProtoMsg(message: MsgInstantiateContract): MsgInstantiateContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", + value: MsgInstantiateContract.encode(message).finish() + }; + } +}; +function createBaseMsgInstantiateContractResponse(): MsgInstantiateContractResponse { + return { + address: "", + data: new Uint8Array() + }; +} +export const MsgInstantiateContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", + aminoType: "wasm/MsgInstantiateContractResponse", + encode(message: MsgInstantiateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInstantiateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInstantiateContractResponse { + const message = createBaseMsgInstantiateContractResponse(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgInstantiateContractResponseAmino): MsgInstantiateContractResponse { + const message = createBaseMsgInstantiateContractResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgInstantiateContractResponseAminoMsg): MsgInstantiateContractResponse { + return MsgInstantiateContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAminoMsg { + return { + type: "wasm/MsgInstantiateContractResponse", + value: MsgInstantiateContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgInstantiateContractResponseProtoMsg): MsgInstantiateContractResponse { + return MsgInstantiateContractResponse.decode(message.value); + }, + toProto(message: MsgInstantiateContractResponse): Uint8Array { + return MsgInstantiateContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", + value: MsgInstantiateContractResponse.encode(message).finish() + }; + } +}; +function createBaseMsgInstantiateContract2(): MsgInstantiateContract2 { + return { + sender: "", + admin: "", + codeId: BigInt(0), + label: "", + msg: new Uint8Array(), + funds: [], + salt: new Uint8Array(), + fixMsg: false + }; +} +export const MsgInstantiateContract2 = { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", + aminoType: "wasm/MsgInstantiateContract2", + encode(message: MsgInstantiateContract2, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(58).bytes(message.salt); + } + if (message.fixMsg === true) { + writer.uint32(64).bool(message.fixMsg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInstantiateContract2 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract2(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.codeId = reader.uint64(); + break; + case 4: + message.label = reader.string(); + break; + case 5: + message.msg = reader.bytes(); + break; + case 6: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + case 7: + message.salt = reader.bytes(); + break; + case 8: + message.fixMsg = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInstantiateContract2 { + const message = createBaseMsgInstantiateContract2(); + message.sender = object.sender ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + message.salt = object.salt ?? new Uint8Array(); + message.fixMsg = object.fixMsg ?? false; + return message; + }, + fromAmino(object: MsgInstantiateContract2Amino): MsgInstantiateContract2 { + const message = createBaseMsgInstantiateContract2(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.fix_msg !== undefined && object.fix_msg !== null) { + message.fixMsg = object.fix_msg; + } + return message; + }, + toAmino(message: MsgInstantiateContract2): MsgInstantiateContract2Amino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.fix_msg = message.fixMsg === false ? undefined : message.fixMsg; + return obj; + }, + fromAminoMsg(object: MsgInstantiateContract2AminoMsg): MsgInstantiateContract2 { + return MsgInstantiateContract2.fromAmino(object.value); + }, + toAminoMsg(message: MsgInstantiateContract2): MsgInstantiateContract2AminoMsg { + return { + type: "wasm/MsgInstantiateContract2", + value: MsgInstantiateContract2.toAmino(message) + }; + }, + fromProtoMsg(message: MsgInstantiateContract2ProtoMsg): MsgInstantiateContract2 { + return MsgInstantiateContract2.decode(message.value); + }, + toProto(message: MsgInstantiateContract2): Uint8Array { + return MsgInstantiateContract2.encode(message).finish(); + }, + toProtoMsg(message: MsgInstantiateContract2): MsgInstantiateContract2ProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", + value: MsgInstantiateContract2.encode(message).finish() + }; + } +}; +function createBaseMsgInstantiateContract2Response(): MsgInstantiateContract2Response { + return { + address: "", + data: new Uint8Array() + }; +} +export const MsgInstantiateContract2Response = { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2Response", + aminoType: "wasm/MsgInstantiateContract2Response", + encode(message: MsgInstantiateContract2Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInstantiateContract2Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInstantiateContract2Response { + const message = createBaseMsgInstantiateContract2Response(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgInstantiateContract2ResponseAmino): MsgInstantiateContract2Response { + const message = createBaseMsgInstantiateContract2Response(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgInstantiateContract2Response): MsgInstantiateContract2ResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgInstantiateContract2ResponseAminoMsg): MsgInstantiateContract2Response { + return MsgInstantiateContract2Response.fromAmino(object.value); + }, + toAminoMsg(message: MsgInstantiateContract2Response): MsgInstantiateContract2ResponseAminoMsg { + return { + type: "wasm/MsgInstantiateContract2Response", + value: MsgInstantiateContract2Response.toAmino(message) + }; + }, + fromProtoMsg(message: MsgInstantiateContract2ResponseProtoMsg): MsgInstantiateContract2Response { + return MsgInstantiateContract2Response.decode(message.value); + }, + toProto(message: MsgInstantiateContract2Response): Uint8Array { + return MsgInstantiateContract2Response.encode(message).finish(); + }, + toProtoMsg(message: MsgInstantiateContract2Response): MsgInstantiateContract2ResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2Response", + value: MsgInstantiateContract2Response.encode(message).finish() + }; + } +}; +function createBaseMsgExecuteContract(): MsgExecuteContract { + return { + sender: "", + contract: "", + msg: new Uint8Array(), + funds: [] + }; +} +export const MsgExecuteContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + aminoType: "wasm/MsgExecuteContract", + encode(message: MsgExecuteContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecuteContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecuteContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.contract = reader.string(); + break; + case 3: + message.msg = reader.bytes(); + break; + case 5: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecuteContract { + const message = createBaseMsgExecuteContract(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgExecuteContractAmino): MsgExecuteContract { + const message = createBaseMsgExecuteContract(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + return obj; + }, + fromAminoMsg(object: MsgExecuteContractAminoMsg): MsgExecuteContract { + return MsgExecuteContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecuteContract): MsgExecuteContractAminoMsg { + return { + type: "wasm/MsgExecuteContract", + value: MsgExecuteContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecuteContractProtoMsg): MsgExecuteContract { + return MsgExecuteContract.decode(message.value); + }, + toProto(message: MsgExecuteContract): Uint8Array { + return MsgExecuteContract.encode(message).finish(); + }, + toProtoMsg(message: MsgExecuteContract): MsgExecuteContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.encode(message).finish() + }; + } +}; +function createBaseMsgExecuteContractResponse(): MsgExecuteContractResponse { + return { + data: new Uint8Array() + }; +} +export const MsgExecuteContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", + aminoType: "wasm/MsgExecuteContractResponse", + encode(message: MsgExecuteContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecuteContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecuteContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecuteContractResponse { + const message = createBaseMsgExecuteContractResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgExecuteContractResponseAmino): MsgExecuteContractResponse { + const message = createBaseMsgExecuteContractResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgExecuteContractResponse): MsgExecuteContractResponseAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgExecuteContractResponseAminoMsg): MsgExecuteContractResponse { + return MsgExecuteContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecuteContractResponse): MsgExecuteContractResponseAminoMsg { + return { + type: "wasm/MsgExecuteContractResponse", + value: MsgExecuteContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecuteContractResponseProtoMsg): MsgExecuteContractResponse { + return MsgExecuteContractResponse.decode(message.value); + }, + toProto(message: MsgExecuteContractResponse): Uint8Array { + return MsgExecuteContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecuteContractResponse): MsgExecuteContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", + value: MsgExecuteContractResponse.encode(message).finish() + }; + } +}; +function createBaseMsgMigrateContract(): MsgMigrateContract { + return { + sender: "", + contract: "", + codeId: BigInt(0), + msg: new Uint8Array() + }; +} +export const MsgMigrateContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", + aminoType: "wasm/MsgMigrateContract", + encode(message: MsgMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(24).uint64(message.codeId); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMigrateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.contract = reader.string(); + break; + case 3: + message.codeId = reader.uint64(); + break; + case 4: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgMigrateContract { + const message = createBaseMsgMigrateContract(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgMigrateContractAmino): MsgMigrateContract { + const message = createBaseMsgMigrateContract(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgMigrateContractAminoMsg): MsgMigrateContract { + return MsgMigrateContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgMigrateContract): MsgMigrateContractAminoMsg { + return { + type: "wasm/MsgMigrateContract", + value: MsgMigrateContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMigrateContractProtoMsg): MsgMigrateContract { + return MsgMigrateContract.decode(message.value); + }, + toProto(message: MsgMigrateContract): Uint8Array { + return MsgMigrateContract.encode(message).finish(); + }, + toProtoMsg(message: MsgMigrateContract): MsgMigrateContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", + value: MsgMigrateContract.encode(message).finish() + }; + } +}; +function createBaseMsgMigrateContractResponse(): MsgMigrateContractResponse { + return { + data: new Uint8Array() + }; +} +export const MsgMigrateContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", + aminoType: "wasm/MsgMigrateContractResponse", + encode(message: MsgMigrateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMigrateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgMigrateContractResponse { + const message = createBaseMsgMigrateContractResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgMigrateContractResponseAmino): MsgMigrateContractResponse { + const message = createBaseMsgMigrateContractResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgMigrateContractResponse): MsgMigrateContractResponseAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgMigrateContractResponseAminoMsg): MsgMigrateContractResponse { + return MsgMigrateContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgMigrateContractResponse): MsgMigrateContractResponseAminoMsg { + return { + type: "wasm/MsgMigrateContractResponse", + value: MsgMigrateContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMigrateContractResponseProtoMsg): MsgMigrateContractResponse { + return MsgMigrateContractResponse.decode(message.value); + }, + toProto(message: MsgMigrateContractResponse): Uint8Array { + return MsgMigrateContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgMigrateContractResponse): MsgMigrateContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", + value: MsgMigrateContractResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateAdmin(): MsgUpdateAdmin { + return { + sender: "", + newAdmin: "", + contract: "" + }; +} +export const MsgUpdateAdmin = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", + aminoType: "wasm/MsgUpdateAdmin", + encode(message: MsgUpdateAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newAdmin !== "") { + writer.uint32(18).string(message.newAdmin); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.newAdmin = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateAdmin { + const message = createBaseMsgUpdateAdmin(); + message.sender = object.sender ?? ""; + message.newAdmin = object.newAdmin ?? ""; + message.contract = object.contract ?? ""; + return message; + }, + fromAmino(object: MsgUpdateAdminAmino): MsgUpdateAdmin { + const message = createBaseMsgUpdateAdmin(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + return message; + }, + toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; + return obj; + }, + fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { + return MsgUpdateAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateAdmin): MsgUpdateAdminAminoMsg { + return { + type: "wasm/MsgUpdateAdmin", + value: MsgUpdateAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateAdminProtoMsg): MsgUpdateAdmin { + return MsgUpdateAdmin.decode(message.value); + }, + toProto(message: MsgUpdateAdmin): Uint8Array { + return MsgUpdateAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateAdmin): MsgUpdateAdminProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", + value: MsgUpdateAdmin.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateAdminResponse(): MsgUpdateAdminResponse { + return {}; +} +export const MsgUpdateAdminResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", + aminoType: "wasm/MsgUpdateAdminResponse", + encode(_: MsgUpdateAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateAdminResponse { + const message = createBaseMsgUpdateAdminResponse(); + return message; + }, + fromAmino(_: MsgUpdateAdminResponseAmino): MsgUpdateAdminResponse { + const message = createBaseMsgUpdateAdminResponse(); + return message; + }, + toAmino(_: MsgUpdateAdminResponse): MsgUpdateAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateAdminResponseAminoMsg): MsgUpdateAdminResponse { + return MsgUpdateAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateAdminResponse): MsgUpdateAdminResponseAminoMsg { + return { + type: "wasm/MsgUpdateAdminResponse", + value: MsgUpdateAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateAdminResponseProtoMsg): MsgUpdateAdminResponse { + return MsgUpdateAdminResponse.decode(message.value); + }, + toProto(message: MsgUpdateAdminResponse): Uint8Array { + return MsgUpdateAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateAdminResponse): MsgUpdateAdminResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", + value: MsgUpdateAdminResponse.encode(message).finish() + }; + } +}; +function createBaseMsgClearAdmin(): MsgClearAdmin { + return { + sender: "", + contract: "" + }; +} +export const MsgClearAdmin = { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", + aminoType: "wasm/MsgClearAdmin", + encode(message: MsgClearAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgClearAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgClearAdmin { + const message = createBaseMsgClearAdmin(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + return message; + }, + fromAmino(object: MsgClearAdminAmino): MsgClearAdmin { + const message = createBaseMsgClearAdmin(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + return message; + }, + toAmino(message: MsgClearAdmin): MsgClearAdminAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; + return obj; + }, + fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { + return MsgClearAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgClearAdmin): MsgClearAdminAminoMsg { + return { + type: "wasm/MsgClearAdmin", + value: MsgClearAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgClearAdminProtoMsg): MsgClearAdmin { + return MsgClearAdmin.decode(message.value); + }, + toProto(message: MsgClearAdmin): Uint8Array { + return MsgClearAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgClearAdmin): MsgClearAdminProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", + value: MsgClearAdmin.encode(message).finish() + }; + } +}; +function createBaseMsgClearAdminResponse(): MsgClearAdminResponse { + return {}; +} +export const MsgClearAdminResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse", + aminoType: "wasm/MsgClearAdminResponse", + encode(_: MsgClearAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgClearAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgClearAdminResponse { + const message = createBaseMsgClearAdminResponse(); + return message; + }, + fromAmino(_: MsgClearAdminResponseAmino): MsgClearAdminResponse { + const message = createBaseMsgClearAdminResponse(); + return message; + }, + toAmino(_: MsgClearAdminResponse): MsgClearAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgClearAdminResponseAminoMsg): MsgClearAdminResponse { + return MsgClearAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgClearAdminResponse): MsgClearAdminResponseAminoMsg { + return { + type: "wasm/MsgClearAdminResponse", + value: MsgClearAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgClearAdminResponseProtoMsg): MsgClearAdminResponse { + return MsgClearAdminResponse.decode(message.value); + }, + toProto(message: MsgClearAdminResponse): Uint8Array { + return MsgClearAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgClearAdminResponse): MsgClearAdminResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse", + value: MsgClearAdminResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateInstantiateConfig(): MsgUpdateInstantiateConfig { + return { + sender: "", + codeId: BigInt(0), + newInstantiatePermission: undefined + }; +} +export const MsgUpdateInstantiateConfig = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", + aminoType: "wasm/MsgUpdateInstantiateConfig", + encode(message: MsgUpdateInstantiateConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(16).uint64(message.codeId); + } + if (message.newInstantiatePermission !== undefined) { + AccessConfig.encode(message.newInstantiatePermission, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateInstantiateConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateInstantiateConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.codeId = reader.uint64(); + break; + case 3: + message.newInstantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateInstantiateConfig { + const message = createBaseMsgUpdateInstantiateConfig(); + message.sender = object.sender ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.newInstantiatePermission = object.newInstantiatePermission !== undefined && object.newInstantiatePermission !== null ? AccessConfig.fromPartial(object.newInstantiatePermission) : undefined; + return message; + }, + fromAmino(object: MsgUpdateInstantiateConfigAmino): MsgUpdateInstantiateConfig { + const message = createBaseMsgUpdateInstantiateConfig(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.new_instantiate_permission !== undefined && object.new_instantiate_permission !== null) { + message.newInstantiatePermission = AccessConfig.fromAmino(object.new_instantiate_permission); + } + return message; + }, + toAmino(message: MsgUpdateInstantiateConfig): MsgUpdateInstantiateConfigAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.new_instantiate_permission = message.newInstantiatePermission ? AccessConfig.toAmino(message.newInstantiatePermission) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateInstantiateConfigAminoMsg): MsgUpdateInstantiateConfig { + return MsgUpdateInstantiateConfig.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateInstantiateConfig): MsgUpdateInstantiateConfigAminoMsg { + return { + type: "wasm/MsgUpdateInstantiateConfig", + value: MsgUpdateInstantiateConfig.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateInstantiateConfigProtoMsg): MsgUpdateInstantiateConfig { + return MsgUpdateInstantiateConfig.decode(message.value); + }, + toProto(message: MsgUpdateInstantiateConfig): Uint8Array { + return MsgUpdateInstantiateConfig.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateInstantiateConfig): MsgUpdateInstantiateConfigProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", + value: MsgUpdateInstantiateConfig.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateInstantiateConfigResponse(): MsgUpdateInstantiateConfigResponse { + return {}; +} +export const MsgUpdateInstantiateConfigResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse", + aminoType: "wasm/MsgUpdateInstantiateConfigResponse", + encode(_: MsgUpdateInstantiateConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateInstantiateConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateInstantiateConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateInstantiateConfigResponse { + const message = createBaseMsgUpdateInstantiateConfigResponse(); + return message; + }, + fromAmino(_: MsgUpdateInstantiateConfigResponseAmino): MsgUpdateInstantiateConfigResponse { + const message = createBaseMsgUpdateInstantiateConfigResponse(); + return message; + }, + toAmino(_: MsgUpdateInstantiateConfigResponse): MsgUpdateInstantiateConfigResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateInstantiateConfigResponseAminoMsg): MsgUpdateInstantiateConfigResponse { + return MsgUpdateInstantiateConfigResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateInstantiateConfigResponse): MsgUpdateInstantiateConfigResponseAminoMsg { + return { + type: "wasm/MsgUpdateInstantiateConfigResponse", + value: MsgUpdateInstantiateConfigResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateInstantiateConfigResponseProtoMsg): MsgUpdateInstantiateConfigResponse { + return MsgUpdateInstantiateConfigResponse.decode(message.value); + }, + toProto(message: MsgUpdateInstantiateConfigResponse): Uint8Array { + return MsgUpdateInstantiateConfigResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateInstantiateConfigResponse): MsgUpdateInstantiateConfigResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse", + value: MsgUpdateInstantiateConfigResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", + aminoType: "wasm/MsgUpdateParams", + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "wasm/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParamsResponse", + aminoType: "wasm/MsgUpdateParamsResponse", + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "wasm/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +function createBaseMsgSudoContract(): MsgSudoContract { + return { + authority: "", + contract: "", + msg: new Uint8Array() + }; +} +export const MsgSudoContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", + aminoType: "wasm/MsgSudoContract", + encode(message: MsgSudoContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSudoContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSudoContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.contract = reader.string(); + break; + case 3: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSudoContract { + const message = createBaseMsgSudoContract(); + message.authority = object.authority ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgSudoContractAmino): MsgSudoContract { + const message = createBaseMsgSudoContract(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: MsgSudoContract): MsgSudoContractAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSudoContractAminoMsg): MsgSudoContract { + return MsgSudoContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgSudoContract): MsgSudoContractAminoMsg { + return { + type: "wasm/MsgSudoContract", + value: MsgSudoContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSudoContractProtoMsg): MsgSudoContract { + return MsgSudoContract.decode(message.value); + }, + toProto(message: MsgSudoContract): Uint8Array { + return MsgSudoContract.encode(message).finish(); + }, + toProtoMsg(message: MsgSudoContract): MsgSudoContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", + value: MsgSudoContract.encode(message).finish() + }; + } +}; +function createBaseMsgSudoContractResponse(): MsgSudoContractResponse { + return { + data: new Uint8Array() + }; +} +export const MsgSudoContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContractResponse", + aminoType: "wasm/MsgSudoContractResponse", + encode(message: MsgSudoContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSudoContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSudoContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSudoContractResponse { + const message = createBaseMsgSudoContractResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgSudoContractResponseAmino): MsgSudoContractResponse { + const message = createBaseMsgSudoContractResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgSudoContractResponse): MsgSudoContractResponseAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSudoContractResponseAminoMsg): MsgSudoContractResponse { + return MsgSudoContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSudoContractResponse): MsgSudoContractResponseAminoMsg { + return { + type: "wasm/MsgSudoContractResponse", + value: MsgSudoContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSudoContractResponseProtoMsg): MsgSudoContractResponse { + return MsgSudoContractResponse.decode(message.value); + }, + toProto(message: MsgSudoContractResponse): Uint8Array { + return MsgSudoContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSudoContractResponse): MsgSudoContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContractResponse", + value: MsgSudoContractResponse.encode(message).finish() + }; + } +}; +function createBaseMsgPinCodes(): MsgPinCodes { + return { + authority: "", + codeIds: [] + }; +} +export const MsgPinCodes = { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", + aminoType: "wasm/MsgPinCodes", + encode(message: MsgPinCodes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + writer.uint32(18).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPinCodes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPinCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(reader.uint64()); + } + } else { + message.codeIds.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgPinCodes { + const message = createBaseMsgPinCodes(); + message.authority = object.authority ?? ""; + message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: MsgPinCodesAmino): MsgPinCodes { + const message = createBaseMsgPinCodes(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.codeIds = object.code_ids?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: MsgPinCodes): MsgPinCodesAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.codeIds) { + obj.code_ids = message.codeIds.map(e => e.toString()); + } else { + obj.code_ids = message.codeIds; + } + return obj; + }, + fromAminoMsg(object: MsgPinCodesAminoMsg): MsgPinCodes { + return MsgPinCodes.fromAmino(object.value); + }, + toAminoMsg(message: MsgPinCodes): MsgPinCodesAminoMsg { + return { + type: "wasm/MsgPinCodes", + value: MsgPinCodes.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPinCodesProtoMsg): MsgPinCodes { + return MsgPinCodes.decode(message.value); + }, + toProto(message: MsgPinCodes): Uint8Array { + return MsgPinCodes.encode(message).finish(); + }, + toProtoMsg(message: MsgPinCodes): MsgPinCodesProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", + value: MsgPinCodes.encode(message).finish() + }; + } +}; +function createBaseMsgPinCodesResponse(): MsgPinCodesResponse { + return {}; +} +export const MsgPinCodesResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodesResponse", + aminoType: "wasm/MsgPinCodesResponse", + encode(_: MsgPinCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPinCodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPinCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgPinCodesResponse { + const message = createBaseMsgPinCodesResponse(); + return message; + }, + fromAmino(_: MsgPinCodesResponseAmino): MsgPinCodesResponse { + const message = createBaseMsgPinCodesResponse(); + return message; + }, + toAmino(_: MsgPinCodesResponse): MsgPinCodesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgPinCodesResponseAminoMsg): MsgPinCodesResponse { + return MsgPinCodesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgPinCodesResponse): MsgPinCodesResponseAminoMsg { + return { + type: "wasm/MsgPinCodesResponse", + value: MsgPinCodesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPinCodesResponseProtoMsg): MsgPinCodesResponse { + return MsgPinCodesResponse.decode(message.value); + }, + toProto(message: MsgPinCodesResponse): Uint8Array { + return MsgPinCodesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgPinCodesResponse): MsgPinCodesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodesResponse", + value: MsgPinCodesResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUnpinCodes(): MsgUnpinCodes { + return { + authority: "", + codeIds: [] + }; +} +export const MsgUnpinCodes = { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", + aminoType: "wasm/MsgUnpinCodes", + encode(message: MsgUnpinCodes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + writer.uint32(18).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnpinCodes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpinCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(reader.uint64()); + } + } else { + message.codeIds.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUnpinCodes { + const message = createBaseMsgUnpinCodes(); + message.authority = object.authority ?? ""; + message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: MsgUnpinCodesAmino): MsgUnpinCodes { + const message = createBaseMsgUnpinCodes(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.codeIds = object.code_ids?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: MsgUnpinCodes): MsgUnpinCodesAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.codeIds) { + obj.code_ids = message.codeIds.map(e => e.toString()); + } else { + obj.code_ids = message.codeIds; + } + return obj; + }, + fromAminoMsg(object: MsgUnpinCodesAminoMsg): MsgUnpinCodes { + return MsgUnpinCodes.fromAmino(object.value); + }, + toAminoMsg(message: MsgUnpinCodes): MsgUnpinCodesAminoMsg { + return { + type: "wasm/MsgUnpinCodes", + value: MsgUnpinCodes.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUnpinCodesProtoMsg): MsgUnpinCodes { + return MsgUnpinCodes.decode(message.value); + }, + toProto(message: MsgUnpinCodes): Uint8Array { + return MsgUnpinCodes.encode(message).finish(); + }, + toProtoMsg(message: MsgUnpinCodes): MsgUnpinCodesProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", + value: MsgUnpinCodes.encode(message).finish() + }; + } +}; +function createBaseMsgUnpinCodesResponse(): MsgUnpinCodesResponse { + return {}; +} +export const MsgUnpinCodesResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodesResponse", + aminoType: "wasm/MsgUnpinCodesResponse", + encode(_: MsgUnpinCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnpinCodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpinCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUnpinCodesResponse { + const message = createBaseMsgUnpinCodesResponse(); + return message; + }, + fromAmino(_: MsgUnpinCodesResponseAmino): MsgUnpinCodesResponse { + const message = createBaseMsgUnpinCodesResponse(); + return message; + }, + toAmino(_: MsgUnpinCodesResponse): MsgUnpinCodesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUnpinCodesResponseAminoMsg): MsgUnpinCodesResponse { + return MsgUnpinCodesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUnpinCodesResponse): MsgUnpinCodesResponseAminoMsg { + return { + type: "wasm/MsgUnpinCodesResponse", + value: MsgUnpinCodesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUnpinCodesResponseProtoMsg): MsgUnpinCodesResponse { + return MsgUnpinCodesResponse.decode(message.value); + }, + toProto(message: MsgUnpinCodesResponse): Uint8Array { + return MsgUnpinCodesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUnpinCodesResponse): MsgUnpinCodesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodesResponse", + value: MsgUnpinCodesResponse.encode(message).finish() + }; + } +}; +function createBaseMsgStoreAndInstantiateContract(): MsgStoreAndInstantiateContract { + return { + authority: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: undefined, + unpinCode: false, + admin: "", + label: "", + msg: new Uint8Array(), + funds: [], + source: "", + builder: "", + codeHash: new Uint8Array() + }; +} +export const MsgStoreAndInstantiateContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", + aminoType: "wasm/MsgStoreAndInstantiateContract", + encode(message: MsgStoreAndInstantiateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(26).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(34).fork()).ldelim(); + } + if (message.unpinCode === true) { + writer.uint32(40).bool(message.unpinCode); + } + if (message.admin !== "") { + writer.uint32(50).string(message.admin); + } + if (message.label !== "") { + writer.uint32(58).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(66).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(74).fork()).ldelim(); + } + if (message.source !== "") { + writer.uint32(82).string(message.source); + } + if (message.builder !== "") { + writer.uint32(90).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(98).bytes(message.codeHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndInstantiateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndInstantiateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 3: + message.wasmByteCode = reader.bytes(); + break; + case 4: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + case 5: + message.unpinCode = reader.bool(); + break; + case 6: + message.admin = reader.string(); + break; + case 7: + message.label = reader.string(); + break; + case 8: + message.msg = reader.bytes(); + break; + case 9: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + case 10: + message.source = reader.string(); + break; + case 11: + message.builder = reader.string(); + break; + case 12: + message.codeHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreAndInstantiateContract { + const message = createBaseMsgStoreAndInstantiateContract(); + message.authority = object.authority ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + message.unpinCode = object.unpinCode ?? false; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreAndInstantiateContractAmino): MsgStoreAndInstantiateContract { + const message = createBaseMsgStoreAndInstantiateContract(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) { + message.wasmByteCode = fromBase64(object.wasm_byte_code); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + if (object.unpin_code !== undefined && object.unpin_code !== null) { + message.unpinCode = object.unpin_code; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + if (object.source !== undefined && object.source !== null) { + message.source = object.source; + } + if (object.builder !== undefined && object.builder !== null) { + message.builder = object.builder; + } + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = bytesFromBase64(object.code_hash); + } + return message; + }, + toAmino(message: MsgStoreAndInstantiateContract): MsgStoreAndInstantiateContractAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + obj.unpin_code = message.unpinCode === false ? undefined : message.unpinCode; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + obj.source = message.source === "" ? undefined : message.source; + obj.builder = message.builder === "" ? undefined : message.builder; + obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreAndInstantiateContractAminoMsg): MsgStoreAndInstantiateContract { + return MsgStoreAndInstantiateContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreAndInstantiateContract): MsgStoreAndInstantiateContractAminoMsg { + return { + type: "wasm/MsgStoreAndInstantiateContract", + value: MsgStoreAndInstantiateContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreAndInstantiateContractProtoMsg): MsgStoreAndInstantiateContract { + return MsgStoreAndInstantiateContract.decode(message.value); + }, + toProto(message: MsgStoreAndInstantiateContract): Uint8Array { + return MsgStoreAndInstantiateContract.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreAndInstantiateContract): MsgStoreAndInstantiateContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", + value: MsgStoreAndInstantiateContract.encode(message).finish() + }; + } +}; +function createBaseMsgStoreAndInstantiateContractResponse(): MsgStoreAndInstantiateContractResponse { + return { + address: "", + data: new Uint8Array() + }; +} +export const MsgStoreAndInstantiateContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse", + aminoType: "wasm/MsgStoreAndInstantiateContractResponse", + encode(message: MsgStoreAndInstantiateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndInstantiateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndInstantiateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreAndInstantiateContractResponse { + const message = createBaseMsgStoreAndInstantiateContractResponse(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreAndInstantiateContractResponseAmino): MsgStoreAndInstantiateContractResponse { + const message = createBaseMsgStoreAndInstantiateContractResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgStoreAndInstantiateContractResponse): MsgStoreAndInstantiateContractResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreAndInstantiateContractResponseAminoMsg): MsgStoreAndInstantiateContractResponse { + return MsgStoreAndInstantiateContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreAndInstantiateContractResponse): MsgStoreAndInstantiateContractResponseAminoMsg { + return { + type: "wasm/MsgStoreAndInstantiateContractResponse", + value: MsgStoreAndInstantiateContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreAndInstantiateContractResponseProtoMsg): MsgStoreAndInstantiateContractResponse { + return MsgStoreAndInstantiateContractResponse.decode(message.value); + }, + toProto(message: MsgStoreAndInstantiateContractResponse): Uint8Array { + return MsgStoreAndInstantiateContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreAndInstantiateContractResponse): MsgStoreAndInstantiateContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse", + value: MsgStoreAndInstantiateContractResponse.encode(message).finish() + }; + } +}; +function createBaseMsgAddCodeUploadParamsAddresses(): MsgAddCodeUploadParamsAddresses { + return { + authority: "", + addresses: [] + }; +} +export const MsgAddCodeUploadParamsAddresses = { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + aminoType: "wasm/MsgAddCodeUploadParamsAddresses", + encode(message: MsgAddCodeUploadParamsAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.addresses) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAddCodeUploadParamsAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddCodeUploadParamsAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgAddCodeUploadParamsAddresses { + const message = createBaseMsgAddCodeUploadParamsAddresses(); + message.authority = object.authority ?? ""; + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgAddCodeUploadParamsAddressesAmino): MsgAddCodeUploadParamsAddresses { + const message = createBaseMsgAddCodeUploadParamsAddresses(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + toAmino(message: MsgAddCodeUploadParamsAddresses): MsgAddCodeUploadParamsAddressesAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = message.addresses; + } + return obj; + }, + fromAminoMsg(object: MsgAddCodeUploadParamsAddressesAminoMsg): MsgAddCodeUploadParamsAddresses { + return MsgAddCodeUploadParamsAddresses.fromAmino(object.value); + }, + toAminoMsg(message: MsgAddCodeUploadParamsAddresses): MsgAddCodeUploadParamsAddressesAminoMsg { + return { + type: "wasm/MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAddCodeUploadParamsAddressesProtoMsg): MsgAddCodeUploadParamsAddresses { + return MsgAddCodeUploadParamsAddresses.decode(message.value); + }, + toProto(message: MsgAddCodeUploadParamsAddresses): Uint8Array { + return MsgAddCodeUploadParamsAddresses.encode(message).finish(); + }, + toProtoMsg(message: MsgAddCodeUploadParamsAddresses): MsgAddCodeUploadParamsAddressesProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.encode(message).finish() + }; + } +}; +function createBaseMsgAddCodeUploadParamsAddressesResponse(): MsgAddCodeUploadParamsAddressesResponse { + return {}; +} +export const MsgAddCodeUploadParamsAddressesResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse", + aminoType: "wasm/MsgAddCodeUploadParamsAddressesResponse", + encode(_: MsgAddCodeUploadParamsAddressesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAddCodeUploadParamsAddressesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddCodeUploadParamsAddressesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgAddCodeUploadParamsAddressesResponse { + const message = createBaseMsgAddCodeUploadParamsAddressesResponse(); + return message; + }, + fromAmino(_: MsgAddCodeUploadParamsAddressesResponseAmino): MsgAddCodeUploadParamsAddressesResponse { + const message = createBaseMsgAddCodeUploadParamsAddressesResponse(); + return message; + }, + toAmino(_: MsgAddCodeUploadParamsAddressesResponse): MsgAddCodeUploadParamsAddressesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgAddCodeUploadParamsAddressesResponseAminoMsg): MsgAddCodeUploadParamsAddressesResponse { + return MsgAddCodeUploadParamsAddressesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgAddCodeUploadParamsAddressesResponse): MsgAddCodeUploadParamsAddressesResponseAminoMsg { + return { + type: "wasm/MsgAddCodeUploadParamsAddressesResponse", + value: MsgAddCodeUploadParamsAddressesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAddCodeUploadParamsAddressesResponseProtoMsg): MsgAddCodeUploadParamsAddressesResponse { + return MsgAddCodeUploadParamsAddressesResponse.decode(message.value); + }, + toProto(message: MsgAddCodeUploadParamsAddressesResponse): Uint8Array { + return MsgAddCodeUploadParamsAddressesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAddCodeUploadParamsAddressesResponse): MsgAddCodeUploadParamsAddressesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse", + value: MsgAddCodeUploadParamsAddressesResponse.encode(message).finish() + }; + } +}; +function createBaseMsgRemoveCodeUploadParamsAddresses(): MsgRemoveCodeUploadParamsAddresses { + return { + authority: "", + addresses: [] + }; +} +export const MsgRemoveCodeUploadParamsAddresses = { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + aminoType: "wasm/MsgRemoveCodeUploadParamsAddresses", + encode(message: MsgRemoveCodeUploadParamsAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.addresses) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveCodeUploadParamsAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveCodeUploadParamsAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRemoveCodeUploadParamsAddresses { + const message = createBaseMsgRemoveCodeUploadParamsAddresses(); + message.authority = object.authority ?? ""; + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgRemoveCodeUploadParamsAddressesAmino): MsgRemoveCodeUploadParamsAddresses { + const message = createBaseMsgRemoveCodeUploadParamsAddresses(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + toAmino(message: MsgRemoveCodeUploadParamsAddresses): MsgRemoveCodeUploadParamsAddressesAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = message.addresses; + } + return obj; + }, + fromAminoMsg(object: MsgRemoveCodeUploadParamsAddressesAminoMsg): MsgRemoveCodeUploadParamsAddresses { + return MsgRemoveCodeUploadParamsAddresses.fromAmino(object.value); + }, + toAminoMsg(message: MsgRemoveCodeUploadParamsAddresses): MsgRemoveCodeUploadParamsAddressesAminoMsg { + return { + type: "wasm/MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRemoveCodeUploadParamsAddressesProtoMsg): MsgRemoveCodeUploadParamsAddresses { + return MsgRemoveCodeUploadParamsAddresses.decode(message.value); + }, + toProto(message: MsgRemoveCodeUploadParamsAddresses): Uint8Array { + return MsgRemoveCodeUploadParamsAddresses.encode(message).finish(); + }, + toProtoMsg(message: MsgRemoveCodeUploadParamsAddresses): MsgRemoveCodeUploadParamsAddressesProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.encode(message).finish() + }; + } +}; +function createBaseMsgRemoveCodeUploadParamsAddressesResponse(): MsgRemoveCodeUploadParamsAddressesResponse { + return {}; +} +export const MsgRemoveCodeUploadParamsAddressesResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse", + aminoType: "wasm/MsgRemoveCodeUploadParamsAddressesResponse", + encode(_: MsgRemoveCodeUploadParamsAddressesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveCodeUploadParamsAddressesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgRemoveCodeUploadParamsAddressesResponse { + const message = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + return message; + }, + fromAmino(_: MsgRemoveCodeUploadParamsAddressesResponseAmino): MsgRemoveCodeUploadParamsAddressesResponse { + const message = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + return message; + }, + toAmino(_: MsgRemoveCodeUploadParamsAddressesResponse): MsgRemoveCodeUploadParamsAddressesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRemoveCodeUploadParamsAddressesResponseAminoMsg): MsgRemoveCodeUploadParamsAddressesResponse { + return MsgRemoveCodeUploadParamsAddressesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRemoveCodeUploadParamsAddressesResponse): MsgRemoveCodeUploadParamsAddressesResponseAminoMsg { + return { + type: "wasm/MsgRemoveCodeUploadParamsAddressesResponse", + value: MsgRemoveCodeUploadParamsAddressesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRemoveCodeUploadParamsAddressesResponseProtoMsg): MsgRemoveCodeUploadParamsAddressesResponse { + return MsgRemoveCodeUploadParamsAddressesResponse.decode(message.value); + }, + toProto(message: MsgRemoveCodeUploadParamsAddressesResponse): Uint8Array { + return MsgRemoveCodeUploadParamsAddressesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRemoveCodeUploadParamsAddressesResponse): MsgRemoveCodeUploadParamsAddressesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse", + value: MsgRemoveCodeUploadParamsAddressesResponse.encode(message).finish() + }; + } +}; +function createBaseMsgStoreAndMigrateContract(): MsgStoreAndMigrateContract { + return { + authority: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: undefined, + contract: "", + msg: new Uint8Array() + }; +} +export const MsgStoreAndMigrateContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + aminoType: "wasm/MsgStoreAndMigrateContract", + encode(message: MsgStoreAndMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(26).fork()).ldelim(); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndMigrateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndMigrateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.wasmByteCode = reader.bytes(); + break; + case 3: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + case 4: + message.contract = reader.string(); + break; + case 5: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreAndMigrateContract { + const message = createBaseMsgStoreAndMigrateContract(); + message.authority = object.authority ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreAndMigrateContractAmino): MsgStoreAndMigrateContract { + const message = createBaseMsgStoreAndMigrateContract(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) { + message.wasmByteCode = fromBase64(object.wasm_byte_code); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: MsgStoreAndMigrateContract): MsgStoreAndMigrateContractAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreAndMigrateContractAminoMsg): MsgStoreAndMigrateContract { + return MsgStoreAndMigrateContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreAndMigrateContract): MsgStoreAndMigrateContractAminoMsg { + return { + type: "wasm/MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreAndMigrateContractProtoMsg): MsgStoreAndMigrateContract { + return MsgStoreAndMigrateContract.decode(message.value); + }, + toProto(message: MsgStoreAndMigrateContract): Uint8Array { + return MsgStoreAndMigrateContract.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreAndMigrateContract): MsgStoreAndMigrateContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.encode(message).finish() + }; + } +}; +function createBaseMsgStoreAndMigrateContractResponse(): MsgStoreAndMigrateContractResponse { + return { + codeId: BigInt(0), + checksum: new Uint8Array(), + data: new Uint8Array() + }; +} +export const MsgStoreAndMigrateContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse", + aminoType: "wasm/MsgStoreAndMigrateContractResponse", + encode(message: MsgStoreAndMigrateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndMigrateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndMigrateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.checksum = reader.bytes(); + break; + case 3: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreAndMigrateContractResponse { + const message = createBaseMsgStoreAndMigrateContractResponse(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.checksum = object.checksum ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreAndMigrateContractResponseAmino): MsgStoreAndMigrateContractResponse { + const message = createBaseMsgStoreAndMigrateContractResponse(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.checksum !== undefined && object.checksum !== null) { + message.checksum = bytesFromBase64(object.checksum); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgStoreAndMigrateContractResponse): MsgStoreAndMigrateContractResponseAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.checksum = message.checksum ? base64FromBytes(message.checksum) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreAndMigrateContractResponseAminoMsg): MsgStoreAndMigrateContractResponse { + return MsgStoreAndMigrateContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreAndMigrateContractResponse): MsgStoreAndMigrateContractResponseAminoMsg { + return { + type: "wasm/MsgStoreAndMigrateContractResponse", + value: MsgStoreAndMigrateContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreAndMigrateContractResponseProtoMsg): MsgStoreAndMigrateContractResponse { + return MsgStoreAndMigrateContractResponse.decode(message.value); + }, + toProto(message: MsgStoreAndMigrateContractResponse): Uint8Array { + return MsgStoreAndMigrateContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreAndMigrateContractResponse): MsgStoreAndMigrateContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse", + value: MsgStoreAndMigrateContractResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateContractLabel(): MsgUpdateContractLabel { + return { + sender: "", + newLabel: "", + contract: "" + }; +} +export const MsgUpdateContractLabel = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + aminoType: "wasm/MsgUpdateContractLabel", + encode(message: MsgUpdateContractLabel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newLabel !== "") { + writer.uint32(18).string(message.newLabel); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateContractLabel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateContractLabel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.newLabel = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateContractLabel { + const message = createBaseMsgUpdateContractLabel(); + message.sender = object.sender ?? ""; + message.newLabel = object.newLabel ?? ""; + message.contract = object.contract ?? ""; + return message; + }, + fromAmino(object: MsgUpdateContractLabelAmino): MsgUpdateContractLabel { + const message = createBaseMsgUpdateContractLabel(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.new_label !== undefined && object.new_label !== null) { + message.newLabel = object.new_label; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + return message; + }, + toAmino(message: MsgUpdateContractLabel): MsgUpdateContractLabelAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_label = message.newLabel === "" ? undefined : message.newLabel; + obj.contract = message.contract === "" ? undefined : message.contract; + return obj; + }, + fromAminoMsg(object: MsgUpdateContractLabelAminoMsg): MsgUpdateContractLabel { + return MsgUpdateContractLabel.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateContractLabel): MsgUpdateContractLabelAminoMsg { + return { + type: "wasm/MsgUpdateContractLabel", + value: MsgUpdateContractLabel.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateContractLabelProtoMsg): MsgUpdateContractLabel { + return MsgUpdateContractLabel.decode(message.value); + }, + toProto(message: MsgUpdateContractLabel): Uint8Array { + return MsgUpdateContractLabel.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateContractLabel): MsgUpdateContractLabelProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value: MsgUpdateContractLabel.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateContractLabelResponse(): MsgUpdateContractLabelResponse { + return {}; +} +export const MsgUpdateContractLabelResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse", + aminoType: "wasm/MsgUpdateContractLabelResponse", + encode(_: MsgUpdateContractLabelResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateContractLabelResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateContractLabelResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateContractLabelResponse { + const message = createBaseMsgUpdateContractLabelResponse(); + return message; + }, + fromAmino(_: MsgUpdateContractLabelResponseAmino): MsgUpdateContractLabelResponse { + const message = createBaseMsgUpdateContractLabelResponse(); + return message; + }, + toAmino(_: MsgUpdateContractLabelResponse): MsgUpdateContractLabelResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateContractLabelResponseAminoMsg): MsgUpdateContractLabelResponse { + return MsgUpdateContractLabelResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateContractLabelResponse): MsgUpdateContractLabelResponseAminoMsg { + return { + type: "wasm/MsgUpdateContractLabelResponse", + value: MsgUpdateContractLabelResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateContractLabelResponseProtoMsg): MsgUpdateContractLabelResponse { + return MsgUpdateContractLabelResponse.decode(message.value); + }, + toProto(message: MsgUpdateContractLabelResponse): Uint8Array { + return MsgUpdateContractLabelResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateContractLabelResponse): MsgUpdateContractLabelResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse", + value: MsgUpdateContractLabelResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/cosmwasm/wasm/v1/types.ts b/util/inj-types/cosmwasm/wasm/v1/types.ts new file mode 100644 index 00000000..96717f9f --- /dev/null +++ b/util/inj-types/cosmwasm/wasm/v1/types.ts @@ -0,0 +1,1670 @@ +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +/** AccessType permission types */ +export enum AccessType { + /** ACCESS_TYPE_UNSPECIFIED - AccessTypeUnspecified placeholder for empty value */ + ACCESS_TYPE_UNSPECIFIED = 0, + /** ACCESS_TYPE_NOBODY - AccessTypeNobody forbidden */ + ACCESS_TYPE_NOBODY = 1, + /** ACCESS_TYPE_EVERYBODY - AccessTypeEverybody unrestricted */ + ACCESS_TYPE_EVERYBODY = 3, + /** ACCESS_TYPE_ANY_OF_ADDRESSES - AccessTypeAnyOfAddresses allow any of the addresses */ + ACCESS_TYPE_ANY_OF_ADDRESSES = 4, + UNRECOGNIZED = -1, +} +export const AccessTypeSDKType = AccessType; +export const AccessTypeAmino = AccessType; +export function accessTypeFromJSON(object: any): AccessType { + switch (object) { + case 0: + case "ACCESS_TYPE_UNSPECIFIED": + return AccessType.ACCESS_TYPE_UNSPECIFIED; + case 1: + case "ACCESS_TYPE_NOBODY": + return AccessType.ACCESS_TYPE_NOBODY; + case 3: + case "ACCESS_TYPE_EVERYBODY": + return AccessType.ACCESS_TYPE_EVERYBODY; + case 4: + case "ACCESS_TYPE_ANY_OF_ADDRESSES": + return AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES; + case -1: + case "UNRECOGNIZED": + default: + return AccessType.UNRECOGNIZED; + } +} +export function accessTypeToJSON(object: AccessType): string { + switch (object) { + case AccessType.ACCESS_TYPE_UNSPECIFIED: + return "ACCESS_TYPE_UNSPECIFIED"; + case AccessType.ACCESS_TYPE_NOBODY: + return "ACCESS_TYPE_NOBODY"; + case AccessType.ACCESS_TYPE_EVERYBODY: + return "ACCESS_TYPE_EVERYBODY"; + case AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES: + return "ACCESS_TYPE_ANY_OF_ADDRESSES"; + case AccessType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ContractCodeHistoryOperationType actions that caused a code change */ +export enum ContractCodeHistoryOperationType { + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED - ContractCodeHistoryOperationTypeUnspecified placeholder for empty value */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED = 0, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT - ContractCodeHistoryOperationTypeInit on chain contract instantiation */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT = 1, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE - ContractCodeHistoryOperationTypeMigrate code migration */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE = 2, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS - ContractCodeHistoryOperationTypeGenesis based on genesis data */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS = 3, + UNRECOGNIZED = -1, +} +export const ContractCodeHistoryOperationTypeSDKType = ContractCodeHistoryOperationType; +export const ContractCodeHistoryOperationTypeAmino = ContractCodeHistoryOperationType; +export function contractCodeHistoryOperationTypeFromJSON(object: any): ContractCodeHistoryOperationType { + switch (object) { + case 0: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED; + case 1: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT; + case 2: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE; + case 3: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS; + case -1: + case "UNRECOGNIZED": + default: + return ContractCodeHistoryOperationType.UNRECOGNIZED; + } +} +export function contractCodeHistoryOperationTypeToJSON(object: ContractCodeHistoryOperationType): string { + switch (object) { + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS"; + case ContractCodeHistoryOperationType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** AccessTypeParam */ +export interface AccessTypeParam { + value: AccessType; +} +export interface AccessTypeParamProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam"; + value: Uint8Array; +} +/** AccessTypeParam */ +export interface AccessTypeParamAmino { + value?: AccessType; +} +export interface AccessTypeParamAminoMsg { + type: "wasm/AccessTypeParam"; + value: AccessTypeParamAmino; +} +/** AccessTypeParam */ +export interface AccessTypeParamSDKType { + value: AccessType; +} +/** AccessConfig access control type. */ +export interface AccessConfig { + permission: AccessType; + addresses: string[]; +} +export interface AccessConfigProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AccessConfig"; + value: Uint8Array; +} +/** AccessConfig access control type. */ +export interface AccessConfigAmino { + permission?: AccessType; + addresses?: string[]; +} +export interface AccessConfigAminoMsg { + type: "wasm/AccessConfig"; + value: AccessConfigAmino; +} +/** AccessConfig access control type. */ +export interface AccessConfigSDKType { + permission: AccessType; + addresses: string[]; +} +/** Params defines the set of wasm parameters. */ +export interface Params { + codeUploadAccess: AccessConfig; + instantiateDefaultPermission: AccessType; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.Params"; + value: Uint8Array; +} +/** Params defines the set of wasm parameters. */ +export interface ParamsAmino { + code_upload_access: AccessConfigAmino; + instantiate_default_permission?: AccessType; +} +export interface ParamsAminoMsg { + type: "wasm/Params"; + value: ParamsAmino; +} +/** Params defines the set of wasm parameters. */ +export interface ParamsSDKType { + code_upload_access: AccessConfigSDKType; + instantiate_default_permission: AccessType; +} +/** CodeInfo is data for the uploaded contract WASM code */ +export interface CodeInfo { + /** CodeHash is the unique identifier created by wasmvm */ + codeHash: Uint8Array; + /** Creator address who initially stored the code */ + creator: string; + /** InstantiateConfig access control to apply on contract creation, optional */ + instantiateConfig: AccessConfig; +} +export interface CodeInfoProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.CodeInfo"; + value: Uint8Array; +} +/** CodeInfo is data for the uploaded contract WASM code */ +export interface CodeInfoAmino { + /** CodeHash is the unique identifier created by wasmvm */ + code_hash?: string; + /** Creator address who initially stored the code */ + creator?: string; + /** InstantiateConfig access control to apply on contract creation, optional */ + instantiate_config: AccessConfigAmino; +} +export interface CodeInfoAminoMsg { + type: "wasm/CodeInfo"; + value: CodeInfoAmino; +} +/** CodeInfo is data for the uploaded contract WASM code */ +export interface CodeInfoSDKType { + code_hash: Uint8Array; + creator: string; + instantiate_config: AccessConfigSDKType; +} +/** ContractInfo stores a WASM contract instance */ +export interface ContractInfo { + /** CodeID is the reference to the stored Wasm code */ + codeId: bigint; + /** Creator address who initially instantiated the contract */ + creator: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Created Tx position when the contract was instantiated. */ + created?: AbsoluteTxPosition; + ibcPortId: string; + /** + * Extension is an extension point to store custom metadata within the + * persistence model. + */ + extension?: Any | undefined; +} +export interface ContractInfoProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ContractInfo"; + value: Uint8Array; +} +export type ContractInfoEncoded = Omit & { + /** + * Extension is an extension point to store custom metadata within the + * persistence model. + */ + extension?: AnyProtoMsg | undefined; +}; +/** ContractInfo stores a WASM contract instance */ +export interface ContractInfoAmino { + /** CodeID is the reference to the stored Wasm code */ + code_id?: string; + /** Creator address who initially instantiated the contract */ + creator?: string; + /** Admin is an optional address that can execute migrations */ + admin?: string; + /** Label is optional metadata to be stored with a contract instance. */ + label?: string; + /** Created Tx position when the contract was instantiated. */ + created?: AbsoluteTxPositionAmino; + ibc_port_id?: string; + /** + * Extension is an extension point to store custom metadata within the + * persistence model. + */ + extension?: AnyAmino; +} +export interface ContractInfoAminoMsg { + type: "wasm/ContractInfo"; + value: ContractInfoAmino; +} +/** ContractInfo stores a WASM contract instance */ +export interface ContractInfoSDKType { + code_id: bigint; + creator: string; + admin: string; + label: string; + created?: AbsoluteTxPositionSDKType; + ibc_port_id: string; + extension?: AnySDKType | undefined; +} +/** ContractCodeHistoryEntry metadata to a contract. */ +export interface ContractCodeHistoryEntry { + operation: ContractCodeHistoryOperationType; + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Updated Tx position when the operation was executed. */ + updated?: AbsoluteTxPosition; + msg: Uint8Array; +} +export interface ContractCodeHistoryEntryProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry"; + value: Uint8Array; +} +/** ContractCodeHistoryEntry metadata to a contract. */ +export interface ContractCodeHistoryEntryAmino { + operation?: ContractCodeHistoryOperationType; + /** CodeID is the reference to the stored WASM code */ + code_id?: string; + /** Updated Tx position when the operation was executed. */ + updated?: AbsoluteTxPositionAmino; + msg?: any; +} +export interface ContractCodeHistoryEntryAminoMsg { + type: "wasm/ContractCodeHistoryEntry"; + value: ContractCodeHistoryEntryAmino; +} +/** ContractCodeHistoryEntry metadata to a contract. */ +export interface ContractCodeHistoryEntrySDKType { + operation: ContractCodeHistoryOperationType; + code_id: bigint; + updated?: AbsoluteTxPositionSDKType; + msg: Uint8Array; +} +/** + * AbsoluteTxPosition is a unique transaction position that allows for global + * ordering of transactions. + */ +export interface AbsoluteTxPosition { + /** BlockHeight is the block the contract was created at */ + blockHeight: bigint; + /** + * TxIndex is a monotonic counter within the block (actual transaction index, + * or gas consumed) + */ + txIndex: bigint; +} +export interface AbsoluteTxPositionProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition"; + value: Uint8Array; +} +/** + * AbsoluteTxPosition is a unique transaction position that allows for global + * ordering of transactions. + */ +export interface AbsoluteTxPositionAmino { + /** BlockHeight is the block the contract was created at */ + block_height?: string; + /** + * TxIndex is a monotonic counter within the block (actual transaction index, + * or gas consumed) + */ + tx_index?: string; +} +export interface AbsoluteTxPositionAminoMsg { + type: "wasm/AbsoluteTxPosition"; + value: AbsoluteTxPositionAmino; +} +/** + * AbsoluteTxPosition is a unique transaction position that allows for global + * ordering of transactions. + */ +export interface AbsoluteTxPositionSDKType { + block_height: bigint; + tx_index: bigint; +} +/** Model is a struct that holds a KV pair */ +export interface Model { + /** hex-encode key to read it better (this is often ascii) */ + key: Uint8Array; + /** base64-encode raw value */ + value: Uint8Array; +} +export interface ModelProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.Model"; + value: Uint8Array; +} +/** Model is a struct that holds a KV pair */ +export interface ModelAmino { + /** hex-encode key to read it better (this is often ascii) */ + key?: string; + /** base64-encode raw value */ + value?: string; +} +export interface ModelAminoMsg { + type: "wasm/Model"; + value: ModelAmino; +} +/** Model is a struct that holds a KV pair */ +export interface ModelSDKType { + key: Uint8Array; + value: Uint8Array; +} +/** EventCodeStored is emitted when contract code is checked and stored */ +export interface EventCodeStored { + /** CodeID is the reference to the stored Wasm code */ + codeId: bigint; + /** Creator address who initially stored the code */ + creator: string; + accessConfig?: AccessConfig; + checksum: Uint8Array; +} +export interface EventCodeStoredProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.EventCodeStored"; + value: Uint8Array; +} +/** EventCodeStored is emitted when contract code is checked and stored */ +export interface EventCodeStoredAmino { + /** CodeID is the reference to the stored Wasm code */ + code_id?: string; + /** Creator address who initially stored the code */ + creator?: string; + access_config?: AccessConfigAmino; + checksum?: string; +} +export interface EventCodeStoredAminoMsg { + type: "wasm/EventCodeStored"; + value: EventCodeStoredAmino; +} +/** EventCodeStored is emitted when contract code is checked and stored */ +export interface EventCodeStoredSDKType { + code_id: bigint; + creator: string; + access_config?: AccessConfigSDKType; + checksum: Uint8Array; +} +/** EventContractInstantiated is emitted when contract is instantiated */ +export interface EventContractInstantiated { + contractAddress: string; + admin: string; + codeId: bigint; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + msg: Uint8Array; + label: string; + creator: string; +} +export interface EventContractInstantiatedProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.EventContractInstantiated"; + value: Uint8Array; +} +/** EventContractInstantiated is emitted when contract is instantiated */ +export interface EventContractInstantiatedAmino { + contract_address?: string; + admin?: string; + code_id?: string; + /** Funds coins that are transferred to the contract on instantiation */ + funds?: CoinAmino[]; + msg?: any; + label?: string; + creator?: string; +} +export interface EventContractInstantiatedAminoMsg { + type: "wasm/EventContractInstantiated"; + value: EventContractInstantiatedAmino; +} +/** EventContractInstantiated is emitted when contract is instantiated */ +export interface EventContractInstantiatedSDKType { + contract_address: string; + admin: string; + code_id: bigint; + funds: CoinSDKType[]; + msg: Uint8Array; + label: string; + creator: string; +} +/** EventContractMigrated is emitted when a contract get migrated to another code */ +export interface EventContractMigrated { + codeId: bigint; + contractAddress: string; + msg: Uint8Array; +} +export interface EventContractMigratedProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.EventContractMigrated"; + value: Uint8Array; +} +/** EventContractMigrated is emitted when a contract get migrated to another code */ +export interface EventContractMigratedAmino { + code_id?: string; + contract_address?: string; + msg?: any; +} +export interface EventContractMigratedAminoMsg { + type: "wasm/EventContractMigrated"; + value: EventContractMigratedAmino; +} +/** EventContractMigrated is emitted when a contract get migrated to another code */ +export interface EventContractMigratedSDKType { + code_id: bigint; + contract_address: string; + msg: Uint8Array; +} +/** EventContractAdminSet is emitted when new admin is set */ +export interface EventContractAdminSet { + contractAddress: string; + newAdmin: string; +} +export interface EventContractAdminSetProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.EventContractAdminSet"; + value: Uint8Array; +} +/** EventContractAdminSet is emitted when new admin is set */ +export interface EventContractAdminSetAmino { + contract_address?: string; + new_admin?: string; +} +export interface EventContractAdminSetAminoMsg { + type: "wasm/EventContractAdminSet"; + value: EventContractAdminSetAmino; +} +/** EventContractAdminSet is emitted when new admin is set */ +export interface EventContractAdminSetSDKType { + contract_address: string; + new_admin: string; +} +function createBaseAccessTypeParam(): AccessTypeParam { + return { + value: 0 + }; +} +export const AccessTypeParam = { + typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", + aminoType: "wasm/AccessTypeParam", + encode(message: AccessTypeParam, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.value !== 0) { + writer.uint32(8).int32(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AccessTypeParam { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessTypeParam(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AccessTypeParam { + const message = createBaseAccessTypeParam(); + message.value = object.value ?? 0; + return message; + }, + fromAmino(object: AccessTypeParamAmino): AccessTypeParam { + const message = createBaseAccessTypeParam(); + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: AccessTypeParam): AccessTypeParamAmino { + const obj: any = {}; + obj.value = message.value === 0 ? undefined : message.value; + return obj; + }, + fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { + return AccessTypeParam.fromAmino(object.value); + }, + toAminoMsg(message: AccessTypeParam): AccessTypeParamAminoMsg { + return { + type: "wasm/AccessTypeParam", + value: AccessTypeParam.toAmino(message) + }; + }, + fromProtoMsg(message: AccessTypeParamProtoMsg): AccessTypeParam { + return AccessTypeParam.decode(message.value); + }, + toProto(message: AccessTypeParam): Uint8Array { + return AccessTypeParam.encode(message).finish(); + }, + toProtoMsg(message: AccessTypeParam): AccessTypeParamProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", + value: AccessTypeParam.encode(message).finish() + }; + } +}; +function createBaseAccessConfig(): AccessConfig { + return { + permission: 0, + addresses: [] + }; +} +export const AccessConfig = { + typeUrl: "/cosmwasm.wasm.v1.AccessConfig", + aminoType: "wasm/AccessConfig", + encode(message: AccessConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.permission !== 0) { + writer.uint32(8).int32(message.permission); + } + for (const v of message.addresses) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AccessConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.permission = (reader.int32() as any); + break; + case 3: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AccessConfig { + const message = createBaseAccessConfig(); + message.permission = object.permission ?? 0; + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: AccessConfigAmino): AccessConfig { + const message = createBaseAccessConfig(); + if (object.permission !== undefined && object.permission !== null) { + message.permission = object.permission; + } + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + toAmino(message: AccessConfig): AccessConfigAmino { + const obj: any = {}; + obj.permission = message.permission === 0 ? undefined : message.permission; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = message.addresses; + } + return obj; + }, + fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { + return AccessConfig.fromAmino(object.value); + }, + toAminoMsg(message: AccessConfig): AccessConfigAminoMsg { + return { + type: "wasm/AccessConfig", + value: AccessConfig.toAmino(message) + }; + }, + fromProtoMsg(message: AccessConfigProtoMsg): AccessConfig { + return AccessConfig.decode(message.value); + }, + toProto(message: AccessConfig): Uint8Array { + return AccessConfig.encode(message).finish(); + }, + toProtoMsg(message: AccessConfig): AccessConfigProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AccessConfig", + value: AccessConfig.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + codeUploadAccess: AccessConfig.fromPartial({}), + instantiateDefaultPermission: 0 + }; +} +export const Params = { + typeUrl: "/cosmwasm.wasm.v1.Params", + aminoType: "wasm/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeUploadAccess !== undefined) { + AccessConfig.encode(message.codeUploadAccess, writer.uint32(10).fork()).ldelim(); + } + if (message.instantiateDefaultPermission !== 0) { + writer.uint32(16).int32(message.instantiateDefaultPermission); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.codeUploadAccess = AccessConfig.decode(reader, reader.uint32()); + break; + case 2: + message.instantiateDefaultPermission = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.codeUploadAccess = object.codeUploadAccess !== undefined && object.codeUploadAccess !== null ? AccessConfig.fromPartial(object.codeUploadAccess) : undefined; + message.instantiateDefaultPermission = object.instantiateDefaultPermission ?? 0; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.code_upload_access !== undefined && object.code_upload_access !== null) { + message.codeUploadAccess = AccessConfig.fromAmino(object.code_upload_access); + } + if (object.instantiate_default_permission !== undefined && object.instantiate_default_permission !== null) { + message.instantiateDefaultPermission = object.instantiate_default_permission; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : AccessConfig.toAmino(AccessConfig.fromPartial({})); + obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "wasm/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +function createBaseCodeInfo(): CodeInfo { + return { + codeHash: new Uint8Array(), + creator: "", + instantiateConfig: AccessConfig.fromPartial({}) + }; +} +export const CodeInfo = { + typeUrl: "/cosmwasm.wasm.v1.CodeInfo", + aminoType: "wasm/CodeInfo", + encode(message: CodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeHash.length !== 0) { + writer.uint32(10).bytes(message.codeHash); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.instantiateConfig !== undefined) { + AccessConfig.encode(message.instantiateConfig, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeHash = reader.bytes(); + break; + case 2: + message.creator = reader.string(); + break; + case 5: + message.instantiateConfig = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CodeInfo { + const message = createBaseCodeInfo(); + message.codeHash = object.codeHash ?? new Uint8Array(); + message.creator = object.creator ?? ""; + message.instantiateConfig = object.instantiateConfig !== undefined && object.instantiateConfig !== null ? AccessConfig.fromPartial(object.instantiateConfig) : undefined; + return message; + }, + fromAmino(object: CodeInfoAmino): CodeInfo { + const message = createBaseCodeInfo(); + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = bytesFromBase64(object.code_hash); + } + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + if (object.instantiate_config !== undefined && object.instantiate_config !== null) { + message.instantiateConfig = AccessConfig.fromAmino(object.instantiate_config); + } + return message; + }, + toAmino(message: CodeInfo): CodeInfoAmino { + const obj: any = {}; + obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : AccessConfig.toAmino(AccessConfig.fromPartial({})); + return obj; + }, + fromAminoMsg(object: CodeInfoAminoMsg): CodeInfo { + return CodeInfo.fromAmino(object.value); + }, + toAminoMsg(message: CodeInfo): CodeInfoAminoMsg { + return { + type: "wasm/CodeInfo", + value: CodeInfo.toAmino(message) + }; + }, + fromProtoMsg(message: CodeInfoProtoMsg): CodeInfo { + return CodeInfo.decode(message.value); + }, + toProto(message: CodeInfo): Uint8Array { + return CodeInfo.encode(message).finish(); + }, + toProtoMsg(message: CodeInfo): CodeInfoProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.CodeInfo", + value: CodeInfo.encode(message).finish() + }; + } +}; +function createBaseContractInfo(): ContractInfo { + return { + codeId: BigInt(0), + creator: "", + admin: "", + label: "", + created: undefined, + ibcPortId: "", + extension: undefined + }; +} +export const ContractInfo = { + typeUrl: "/cosmwasm.wasm.v1.ContractInfo", + aminoType: "wasm/ContractInfo", + encode(message: ContractInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.created !== undefined) { + AbsoluteTxPosition.encode(message.created, writer.uint32(42).fork()).ldelim(); + } + if (message.ibcPortId !== "") { + writer.uint32(50).string(message.ibcPortId); + } + if (message.extension !== undefined) { + Any.encode((message.extension as Any), writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContractInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.creator = reader.string(); + break; + case 3: + message.admin = reader.string(); + break; + case 4: + message.label = reader.string(); + break; + case 5: + message.created = AbsoluteTxPosition.decode(reader, reader.uint32()); + break; + case 6: + message.ibcPortId = reader.string(); + break; + case 7: + message.extension = (Cosmwasm_wasmv1ContractInfoExtension_InterfaceDecoder(reader) as Any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContractInfo { + const message = createBaseContractInfo(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.creator = object.creator ?? ""; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.created = object.created !== undefined && object.created !== null ? AbsoluteTxPosition.fromPartial(object.created) : undefined; + message.ibcPortId = object.ibcPortId ?? ""; + message.extension = object.extension !== undefined && object.extension !== null ? Any.fromPartial(object.extension) : undefined; + return message; + }, + fromAmino(object: ContractInfoAmino): ContractInfo { + const message = createBaseContractInfo(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.created !== undefined && object.created !== null) { + message.created = AbsoluteTxPosition.fromAmino(object.created); + } + if (object.ibc_port_id !== undefined && object.ibc_port_id !== null) { + message.ibcPortId = object.ibc_port_id; + } + if (object.extension !== undefined && object.extension !== null) { + message.extension = Cosmwasm_wasmv1ContractInfoExtension_FromAmino(object.extension); + } + return message; + }, + toAmino(message: ContractInfo): ContractInfoAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; + obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; + obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; + obj.extension = message.extension ? Cosmwasm_wasmv1ContractInfoExtension_ToAmino((message.extension as Any)) : undefined; + return obj; + }, + fromAminoMsg(object: ContractInfoAminoMsg): ContractInfo { + return ContractInfo.fromAmino(object.value); + }, + toAminoMsg(message: ContractInfo): ContractInfoAminoMsg { + return { + type: "wasm/ContractInfo", + value: ContractInfo.toAmino(message) + }; + }, + fromProtoMsg(message: ContractInfoProtoMsg): ContractInfo { + return ContractInfo.decode(message.value); + }, + toProto(message: ContractInfo): Uint8Array { + return ContractInfo.encode(message).finish(); + }, + toProtoMsg(message: ContractInfo): ContractInfoProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ContractInfo", + value: ContractInfo.encode(message).finish() + }; + } +}; +function createBaseContractCodeHistoryEntry(): ContractCodeHistoryEntry { + return { + operation: 0, + codeId: BigInt(0), + updated: undefined, + msg: new Uint8Array() + }; +} +export const ContractCodeHistoryEntry = { + typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", + aminoType: "wasm/ContractCodeHistoryEntry", + encode(message: ContractCodeHistoryEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.operation !== 0) { + writer.uint32(8).int32(message.operation); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(16).uint64(message.codeId); + } + if (message.updated !== undefined) { + AbsoluteTxPosition.encode(message.updated, writer.uint32(26).fork()).ldelim(); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContractCodeHistoryEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractCodeHistoryEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operation = (reader.int32() as any); + break; + case 2: + message.codeId = reader.uint64(); + break; + case 3: + message.updated = AbsoluteTxPosition.decode(reader, reader.uint32()); + break; + case 4: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContractCodeHistoryEntry { + const message = createBaseContractCodeHistoryEntry(); + message.operation = object.operation ?? 0; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.updated = object.updated !== undefined && object.updated !== null ? AbsoluteTxPosition.fromPartial(object.updated) : undefined; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: ContractCodeHistoryEntryAmino): ContractCodeHistoryEntry { + const message = createBaseContractCodeHistoryEntry(); + if (object.operation !== undefined && object.operation !== null) { + message.operation = object.operation; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.updated !== undefined && object.updated !== null) { + message.updated = AbsoluteTxPosition.fromAmino(object.updated); + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { + const obj: any = {}; + obj.operation = message.operation === 0 ? undefined : message.operation; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: ContractCodeHistoryEntryAminoMsg): ContractCodeHistoryEntry { + return ContractCodeHistoryEntry.fromAmino(object.value); + }, + toAminoMsg(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAminoMsg { + return { + type: "wasm/ContractCodeHistoryEntry", + value: ContractCodeHistoryEntry.toAmino(message) + }; + }, + fromProtoMsg(message: ContractCodeHistoryEntryProtoMsg): ContractCodeHistoryEntry { + return ContractCodeHistoryEntry.decode(message.value); + }, + toProto(message: ContractCodeHistoryEntry): Uint8Array { + return ContractCodeHistoryEntry.encode(message).finish(); + }, + toProtoMsg(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", + value: ContractCodeHistoryEntry.encode(message).finish() + }; + } +}; +function createBaseAbsoluteTxPosition(): AbsoluteTxPosition { + return { + blockHeight: BigInt(0), + txIndex: BigInt(0) + }; +} +export const AbsoluteTxPosition = { + typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", + aminoType: "wasm/AbsoluteTxPosition", + encode(message: AbsoluteTxPosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockHeight !== BigInt(0)) { + writer.uint32(8).uint64(message.blockHeight); + } + if (message.txIndex !== BigInt(0)) { + writer.uint32(16).uint64(message.txIndex); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AbsoluteTxPosition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAbsoluteTxPosition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockHeight = reader.uint64(); + break; + case 2: + message.txIndex = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AbsoluteTxPosition { + const message = createBaseAbsoluteTxPosition(); + message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? BigInt(object.blockHeight.toString()) : BigInt(0); + message.txIndex = object.txIndex !== undefined && object.txIndex !== null ? BigInt(object.txIndex.toString()) : BigInt(0); + return message; + }, + fromAmino(object: AbsoluteTxPositionAmino): AbsoluteTxPosition { + const message = createBaseAbsoluteTxPosition(); + if (object.block_height !== undefined && object.block_height !== null) { + message.blockHeight = BigInt(object.block_height); + } + if (object.tx_index !== undefined && object.tx_index !== null) { + message.txIndex = BigInt(object.tx_index); + } + return message; + }, + toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { + const obj: any = {}; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; + obj.tx_index = message.txIndex !== BigInt(0) ? message.txIndex.toString() : undefined; + return obj; + }, + fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { + return AbsoluteTxPosition.fromAmino(object.value); + }, + toAminoMsg(message: AbsoluteTxPosition): AbsoluteTxPositionAminoMsg { + return { + type: "wasm/AbsoluteTxPosition", + value: AbsoluteTxPosition.toAmino(message) + }; + }, + fromProtoMsg(message: AbsoluteTxPositionProtoMsg): AbsoluteTxPosition { + return AbsoluteTxPosition.decode(message.value); + }, + toProto(message: AbsoluteTxPosition): Uint8Array { + return AbsoluteTxPosition.encode(message).finish(); + }, + toProtoMsg(message: AbsoluteTxPosition): AbsoluteTxPositionProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", + value: AbsoluteTxPosition.encode(message).finish() + }; + } +}; +function createBaseModel(): Model { + return { + key: new Uint8Array(), + value: new Uint8Array() + }; +} +export const Model = { + typeUrl: "/cosmwasm.wasm.v1.Model", + aminoType: "wasm/Model", + encode(message: Model, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Model { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModel(); + 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: DeepPartial): Model { + const message = createBaseModel(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromAmino(object: ModelAmino): Model { + const message = createBaseModel(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: Model): ModelAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: ModelAminoMsg): Model { + return Model.fromAmino(object.value); + }, + toAminoMsg(message: Model): ModelAminoMsg { + return { + type: "wasm/Model", + value: Model.toAmino(message) + }; + }, + fromProtoMsg(message: ModelProtoMsg): Model { + return Model.decode(message.value); + }, + toProto(message: Model): Uint8Array { + return Model.encode(message).finish(); + }, + toProtoMsg(message: Model): ModelProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.Model", + value: Model.encode(message).finish() + }; + } +}; +function createBaseEventCodeStored(): EventCodeStored { + return { + codeId: BigInt(0), + creator: "", + accessConfig: undefined, + checksum: new Uint8Array() + }; +} +export const EventCodeStored = { + typeUrl: "/cosmwasm.wasm.v1.EventCodeStored", + aminoType: "wasm/EventCodeStored", + encode(message: EventCodeStored, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.accessConfig !== undefined) { + AccessConfig.encode(message.accessConfig, writer.uint32(26).fork()).ldelim(); + } + if (message.checksum.length !== 0) { + writer.uint32(34).bytes(message.checksum); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventCodeStored { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventCodeStored(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.creator = reader.string(); + break; + case 3: + message.accessConfig = AccessConfig.decode(reader, reader.uint32()); + break; + case 4: + message.checksum = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventCodeStored { + const message = createBaseEventCodeStored(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.creator = object.creator ?? ""; + message.accessConfig = object.accessConfig !== undefined && object.accessConfig !== null ? AccessConfig.fromPartial(object.accessConfig) : undefined; + message.checksum = object.checksum ?? new Uint8Array(); + return message; + }, + fromAmino(object: EventCodeStoredAmino): EventCodeStored { + const message = createBaseEventCodeStored(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + if (object.access_config !== undefined && object.access_config !== null) { + message.accessConfig = AccessConfig.fromAmino(object.access_config); + } + if (object.checksum !== undefined && object.checksum !== null) { + message.checksum = bytesFromBase64(object.checksum); + } + return message; + }, + toAmino(message: EventCodeStored): EventCodeStoredAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.access_config = message.accessConfig ? AccessConfig.toAmino(message.accessConfig) : undefined; + obj.checksum = message.checksum ? base64FromBytes(message.checksum) : undefined; + return obj; + }, + fromAminoMsg(object: EventCodeStoredAminoMsg): EventCodeStored { + return EventCodeStored.fromAmino(object.value); + }, + toAminoMsg(message: EventCodeStored): EventCodeStoredAminoMsg { + return { + type: "wasm/EventCodeStored", + value: EventCodeStored.toAmino(message) + }; + }, + fromProtoMsg(message: EventCodeStoredProtoMsg): EventCodeStored { + return EventCodeStored.decode(message.value); + }, + toProto(message: EventCodeStored): Uint8Array { + return EventCodeStored.encode(message).finish(); + }, + toProtoMsg(message: EventCodeStored): EventCodeStoredProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.EventCodeStored", + value: EventCodeStored.encode(message).finish() + }; + } +}; +function createBaseEventContractInstantiated(): EventContractInstantiated { + return { + contractAddress: "", + admin: "", + codeId: BigInt(0), + funds: [], + msg: new Uint8Array(), + label: "", + creator: "" + }; +} +export const EventContractInstantiated = { + typeUrl: "/cosmwasm.wasm.v1.EventContractInstantiated", + aminoType: "wasm/EventContractInstantiated", + encode(message: EventContractInstantiated, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(24).uint64(message.codeId); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + if (message.label !== "") { + writer.uint32(50).string(message.label); + } + if (message.creator !== "") { + writer.uint32(58).string(message.creator); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventContractInstantiated { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventContractInstantiated(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contractAddress = reader.string(); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.codeId = reader.uint64(); + break; + case 4: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + case 5: + message.msg = reader.bytes(); + break; + case 6: + message.label = reader.string(); + break; + case 7: + message.creator = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventContractInstantiated { + const message = createBaseEventContractInstantiated(); + message.contractAddress = object.contractAddress ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + message.msg = object.msg ?? new Uint8Array(); + message.label = object.label ?? ""; + message.creator = object.creator ?? ""; + return message; + }, + fromAmino(object: EventContractInstantiatedAmino): EventContractInstantiated { + const message = createBaseEventContractInstantiated(); + if (object.contract_address !== undefined && object.contract_address !== null) { + message.contractAddress = object.contract_address; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + return message; + }, + toAmino(message: EventContractInstantiated): EventContractInstantiatedAmino { + const obj: any = {}; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + obj.label = message.label === "" ? undefined : message.label; + obj.creator = message.creator === "" ? undefined : message.creator; + return obj; + }, + fromAminoMsg(object: EventContractInstantiatedAminoMsg): EventContractInstantiated { + return EventContractInstantiated.fromAmino(object.value); + }, + toAminoMsg(message: EventContractInstantiated): EventContractInstantiatedAminoMsg { + return { + type: "wasm/EventContractInstantiated", + value: EventContractInstantiated.toAmino(message) + }; + }, + fromProtoMsg(message: EventContractInstantiatedProtoMsg): EventContractInstantiated { + return EventContractInstantiated.decode(message.value); + }, + toProto(message: EventContractInstantiated): Uint8Array { + return EventContractInstantiated.encode(message).finish(); + }, + toProtoMsg(message: EventContractInstantiated): EventContractInstantiatedProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.EventContractInstantiated", + value: EventContractInstantiated.encode(message).finish() + }; + } +}; +function createBaseEventContractMigrated(): EventContractMigrated { + return { + codeId: BigInt(0), + contractAddress: "", + msg: new Uint8Array() + }; +} +export const EventContractMigrated = { + typeUrl: "/cosmwasm.wasm.v1.EventContractMigrated", + aminoType: "wasm/EventContractMigrated", + encode(message: EventContractMigrated, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.contractAddress !== "") { + writer.uint32(18).string(message.contractAddress); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventContractMigrated { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventContractMigrated(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.contractAddress = reader.string(); + break; + case 3: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventContractMigrated { + const message = createBaseEventContractMigrated(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.contractAddress = object.contractAddress ?? ""; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: EventContractMigratedAmino): EventContractMigrated { + const message = createBaseEventContractMigrated(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.contract_address !== undefined && object.contract_address !== null) { + message.contractAddress = object.contract_address; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: EventContractMigrated): EventContractMigratedAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: EventContractMigratedAminoMsg): EventContractMigrated { + return EventContractMigrated.fromAmino(object.value); + }, + toAminoMsg(message: EventContractMigrated): EventContractMigratedAminoMsg { + return { + type: "wasm/EventContractMigrated", + value: EventContractMigrated.toAmino(message) + }; + }, + fromProtoMsg(message: EventContractMigratedProtoMsg): EventContractMigrated { + return EventContractMigrated.decode(message.value); + }, + toProto(message: EventContractMigrated): Uint8Array { + return EventContractMigrated.encode(message).finish(); + }, + toProtoMsg(message: EventContractMigrated): EventContractMigratedProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.EventContractMigrated", + value: EventContractMigrated.encode(message).finish() + }; + } +}; +function createBaseEventContractAdminSet(): EventContractAdminSet { + return { + contractAddress: "", + newAdmin: "" + }; +} +export const EventContractAdminSet = { + typeUrl: "/cosmwasm.wasm.v1.EventContractAdminSet", + aminoType: "wasm/EventContractAdminSet", + encode(message: EventContractAdminSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.newAdmin !== "") { + writer.uint32(18).string(message.newAdmin); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventContractAdminSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventContractAdminSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contractAddress = reader.string(); + break; + case 2: + message.newAdmin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventContractAdminSet { + const message = createBaseEventContractAdminSet(); + message.contractAddress = object.contractAddress ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, + fromAmino(object: EventContractAdminSetAmino): EventContractAdminSet { + const message = createBaseEventContractAdminSet(); + if (object.contract_address !== undefined && object.contract_address !== null) { + message.contractAddress = object.contract_address; + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + return message; + }, + toAmino(message: EventContractAdminSet): EventContractAdminSetAmino { + const obj: any = {}; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + return obj; + }, + fromAminoMsg(object: EventContractAdminSetAminoMsg): EventContractAdminSet { + return EventContractAdminSet.fromAmino(object.value); + }, + toAminoMsg(message: EventContractAdminSet): EventContractAdminSetAminoMsg { + return { + type: "wasm/EventContractAdminSet", + value: EventContractAdminSet.toAmino(message) + }; + }, + fromProtoMsg(message: EventContractAdminSetProtoMsg): EventContractAdminSet { + return EventContractAdminSet.decode(message.value); + }, + toProto(message: EventContractAdminSet): Uint8Array { + return EventContractAdminSet.encode(message).finish(); + }, + toProtoMsg(message: EventContractAdminSet): EventContractAdminSetProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.EventContractAdminSet", + value: EventContractAdminSet.encode(message).finish() + }; + } +}; +export const Cosmwasm_wasmv1ContractInfoExtension_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any => { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const data = Any.decode(reader, reader.uint32()); + switch (data.typeUrl) { + default: + return data; + } +}; +export const Cosmwasm_wasmv1ContractInfoExtension_FromAmino = (content: AnyAmino): Any => { + return Any.fromAmino(content); +}; +export const Cosmwasm_wasmv1ContractInfoExtension_ToAmino = (content: Any) => { + return Any.toAmino(content); +}; \ No newline at end of file diff --git a/util/inj-types/gogoproto/bundle.ts b/util/inj-types/gogoproto/bundle.ts new file mode 100644 index 00000000..28ba4a2d --- /dev/null +++ b/util/inj-types/gogoproto/bundle.ts @@ -0,0 +1,4 @@ +import * as _103 from "./gogo"; +export const gogoproto = { + ..._103 +}; \ No newline at end of file diff --git a/util/inj-types/gogoproto/gogo.ts b/util/inj-types/gogoproto/gogo.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/util/inj-types/gogoproto/gogo.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/util/inj-types/google/api/annotations.ts b/util/inj-types/google/api/annotations.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/util/inj-types/google/api/annotations.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/util/inj-types/google/api/http.ts b/util/inj-types/google/api/http.ts new file mode 100644 index 00000000..6394c26f --- /dev/null +++ b/util/inj-types/google/api/http.ts @@ -0,0 +1,1352 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fullyDecodeReservedExpansion: boolean; +} +export interface HttpProtoMsg { + typeUrl: "/google.api.Http"; + value: Uint8Array; +} +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface HttpAmino { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules?: HttpRuleAmino[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fully_decode_reserved_expansion?: boolean; +} +export interface HttpAminoMsg { + type: "/google.api.Http"; + value: HttpAmino; +} +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface HttpSDKType { + rules: HttpRuleSDKType[]; + fully_decode_reserved_expansion: boolean; +} +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRule { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: string; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: string; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: string; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: string; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: string; + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + */ + custom?: CustomHttpPattern; + /** + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} +export interface HttpRuleProtoMsg { + typeUrl: "/google.api.HttpRule"; + value: Uint8Array; +} +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRuleAmino { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + */ + selector?: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: string; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: string; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: string; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: string; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: string; + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + */ + custom?: CustomHttpPatternAmino; + /** + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body?: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + response_body?: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additional_bindings?: HttpRuleAmino[]; +} +export interface HttpRuleAminoMsg { + type: "/google.api.HttpRule"; + value: HttpRuleAmino; +} +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRuleSDKType { + selector: string; + get?: string; + put?: string; + post?: string; + delete?: string; + patch?: string; + custom?: CustomHttpPatternSDKType; + body: string; + response_body: string; + additional_bindings: HttpRuleSDKType[]; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} +export interface CustomHttpPatternProtoMsg { + typeUrl: "/google.api.CustomHttpPattern"; + value: Uint8Array; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPatternAmino { + /** The name of this custom HTTP verb. */ + kind?: string; + /** The path matched by this custom verb. */ + path?: string; +} +export interface CustomHttpPatternAminoMsg { + type: "/google.api.CustomHttpPattern"; + value: CustomHttpPatternAmino; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPatternSDKType { + kind: string; + path: string; +} +function createBaseHttp(): Http { + return { + rules: [], + fullyDecodeReservedExpansion: false + }; +} +export const Http = { + typeUrl: "/google.api.Http", + encode(message: Http, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fullyDecodeReservedExpansion === true) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rules.push(HttpRule.decode(reader, reader.uint32())); + break; + case 2: + message.fullyDecodeReservedExpansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map(e => HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, + fromAmino(object: HttpAmino): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map(e => HttpRule.fromAmino(e)) || []; + if (object.fully_decode_reserved_expansion !== undefined && object.fully_decode_reserved_expansion !== null) { + message.fullyDecodeReservedExpansion = object.fully_decode_reserved_expansion; + } + return message; + }, + toAmino(message: Http): HttpAmino { + const obj: any = {}; + if (message.rules) { + obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e) : undefined); + } else { + obj.rules = message.rules; + } + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion === false ? undefined : message.fullyDecodeReservedExpansion; + return obj; + }, + fromAminoMsg(object: HttpAminoMsg): Http { + return Http.fromAmino(object.value); + }, + fromProtoMsg(message: HttpProtoMsg): Http { + return Http.decode(message.value); + }, + toProto(message: Http): Uint8Array { + return Http.encode(message).finish(); + }, + toProtoMsg(message: Http): HttpProtoMsg { + return { + typeUrl: "/google.api.Http", + value: Http.encode(message).finish() + }; + } +}; +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [] + }; +} +export const HttpRule = { + typeUrl: "/google.api.HttpRule", + encode(message: HttpRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selector = reader.string(); + break; + case 2: + message.get = reader.string(); + break; + case 3: + message.put = reader.string(); + break; + case 4: + message.post = reader.string(); + break; + case 5: + message.delete = reader.string(); + break; + case 6: + message.patch = reader.string(); + break; + case 8: + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 7: + message.body = reader.string(); + break; + case 12: + message.responseBody = reader.string(); + break; + case 11: + message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HttpRule { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = object.custom !== undefined && object.custom !== null ? CustomHttpPattern.fromPartial(object.custom) : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map(e => HttpRule.fromPartial(e)) || []; + return message; + }, + fromAmino(object: HttpRuleAmino): HttpRule { + const message = createBaseHttpRule(); + if (object.selector !== undefined && object.selector !== null) { + message.selector = object.selector; + } + if (object.get !== undefined && object.get !== null) { + message.get = object.get; + } + if (object.put !== undefined && object.put !== null) { + message.put = object.put; + } + if (object.post !== undefined && object.post !== null) { + message.post = object.post; + } + if (object.delete !== undefined && object.delete !== null) { + message.delete = object.delete; + } + if (object.patch !== undefined && object.patch !== null) { + message.patch = object.patch; + } + if (object.custom !== undefined && object.custom !== null) { + message.custom = CustomHttpPattern.fromAmino(object.custom); + } + if (object.body !== undefined && object.body !== null) { + message.body = object.body; + } + if (object.response_body !== undefined && object.response_body !== null) { + message.responseBody = object.response_body; + } + message.additionalBindings = object.additional_bindings?.map(e => HttpRule.fromAmino(e)) || []; + return message; + }, + toAmino(message: HttpRule): HttpRuleAmino { + const obj: any = {}; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.get = message.get === null ? undefined : message.get; + obj.put = message.put === null ? undefined : message.put; + obj.post = message.post === null ? undefined : message.post; + obj.delete = message.delete === null ? undefined : message.delete; + obj.patch = message.patch === null ? undefined : message.patch; + obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; + obj.body = message.body === "" ? undefined : message.body; + obj.response_body = message.responseBody === "" ? undefined : message.responseBody; + if (message.additionalBindings) { + obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); + } else { + obj.additional_bindings = message.additionalBindings; + } + return obj; + }, + fromAminoMsg(object: HttpRuleAminoMsg): HttpRule { + return HttpRule.fromAmino(object.value); + }, + fromProtoMsg(message: HttpRuleProtoMsg): HttpRule { + return HttpRule.decode(message.value); + }, + toProto(message: HttpRule): Uint8Array { + return HttpRule.encode(message).finish(); + }, + toProtoMsg(message: HttpRule): HttpRuleProtoMsg { + return { + typeUrl: "/google.api.HttpRule", + value: HttpRule.encode(message).finish() + }; + } +}; +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { + kind: "", + path: "" + }; +} +export const CustomHttpPattern = { + typeUrl: "/google.api.CustomHttpPattern", + encode(message: CustomHttpPattern, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.kind = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, + fromAmino(object: CustomHttpPatternAmino): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + if (object.kind !== undefined && object.kind !== null) { + message.kind = object.kind; + } + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + return message; + }, + toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { + const obj: any = {}; + obj.kind = message.kind === "" ? undefined : message.kind; + obj.path = message.path === "" ? undefined : message.path; + return obj; + }, + fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { + return CustomHttpPattern.fromAmino(object.value); + }, + fromProtoMsg(message: CustomHttpPatternProtoMsg): CustomHttpPattern { + return CustomHttpPattern.decode(message.value); + }, + toProto(message: CustomHttpPattern): Uint8Array { + return CustomHttpPattern.encode(message).finish(); + }, + toProtoMsg(message: CustomHttpPattern): CustomHttpPatternProtoMsg { + return { + typeUrl: "/google.api.CustomHttpPattern", + value: CustomHttpPattern.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/google/bundle.ts b/util/inj-types/google/bundle.ts new file mode 100644 index 00000000..0e57123f --- /dev/null +++ b/util/inj-types/google/bundle.ts @@ -0,0 +1,12 @@ +import * as _160 from "./protobuf/descriptor"; +import * as _161 from "./protobuf/any"; +import * as _162 from "./protobuf/timestamp"; +import * as _163 from "./protobuf/duration"; +export namespace google { + export const protobuf = { + ..._160, + ..._161, + ..._162, + ..._163 + }; +} \ No newline at end of file diff --git a/util/inj-types/google/protobuf/any.ts b/util/inj-types/google/protobuf/any.ts new file mode 100644 index 00000000..003fd111 --- /dev/null +++ b/util/inj-types/google/protobuf/any.ts @@ -0,0 +1,399 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + $typeUrl?: "/google.protobuf.Any" | string; + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} +export interface AnyProtoMsg { + typeUrl: "/google.protobuf.Any"; + value: Uint8Array; +} +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface AnyAmino { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + type: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: any; +} +export interface AnyAminoMsg { + type: string; + value: AnyAmino; +} +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface AnySDKType { + $typeUrl?: "/google.protobuf.Any" | string; + type_url: string; + value: Uint8Array; +} +function createBaseAny(): Any { + return { + $typeUrl: "/google.protobuf.Any", + typeUrl: "", + value: new Uint8Array() + }; +} +export const Any = { + typeUrl: "/google.protobuf.Any", + encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.typeUrl = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Any { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromAmino(object: AnyAmino): Any { + return { + typeUrl: object.type, + value: object.value + }; + }, + toAmino(message: Any): AnyAmino { + const obj: any = {}; + obj.type = message.typeUrl; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: AnyAminoMsg): Any { + return Any.fromAmino(object.value); + }, + fromProtoMsg(message: AnyProtoMsg): Any { + return Any.decode(message.value); + }, + toProto(message: Any): Uint8Array { + return Any.encode(message).finish(); + }, + toProtoMsg(message: Any): AnyProtoMsg { + return { + typeUrl: "/google.protobuf.Any", + value: Any.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/google/protobuf/descriptor.ts b/util/inj-types/google/protobuf/descriptor.ts new file mode 100644 index 00000000..e732be3c --- /dev/null +++ b/util/inj-types/google/protobuf/descriptor.ts @@ -0,0 +1,5180 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} +export const FieldDescriptorProto_TypeSDKType = FieldDescriptorProto_Type; +export const FieldDescriptorProto_TypeAmino = FieldDescriptorProto_Type; +export function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProto_Type.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProto_Type.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProto_Type.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProto_Type.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProto_Type.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProto_Type.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProto_Type.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProto_Type.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProto_Type.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProto_Type.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProto_Type.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProto_Type.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProto_Type.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProto_Type.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProto_Type.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProto_Type.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProto_Type.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProto_Type.TYPE_SINT64; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Type.UNRECOGNIZED; + } +} +export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Type): string { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + UNRECOGNIZED = -1, +} +export const FieldDescriptorProto_LabelSDKType = FieldDescriptorProto_Label; +export const FieldDescriptorProto_LabelAmino = FieldDescriptorProto_Label; +export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} +export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** + * SPEED - Generate complete code for parsing, serialization, + * etc. + */ + SPEED = 1, + /** CODE_SIZE - Use ReflectionOps to implement these methods. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -1, +} +export const FileOptions_OptimizeModeSDKType = FileOptions_OptimizeMode; +export const FileOptions_OptimizeModeAmino = FileOptions_OptimizeMode; +export function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode { + switch (object) { + case 1: + case "SPEED": + return FileOptions_OptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptions_OptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptions_OptimizeMode.LITE_RUNTIME; + case -1: + case "UNRECOGNIZED": + default: + return FileOptions_OptimizeMode.UNRECOGNIZED; + } +} +export function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode): string { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} +export const FieldOptions_CTypeSDKType = FieldOptions_CType; +export const FieldOptions_CTypeAmino = FieldOptions_CType; +export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { + switch (object) { + case 0: + case "STRING": + return FieldOptions_CType.STRING; + case 1: + case "CORD": + return FieldOptions_CType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptions_CType.STRING_PIECE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_CType.UNRECOGNIZED; + } +} +export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptions_CType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = 0, + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = 1, + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = 2, + UNRECOGNIZED = -1, +} +export const FieldOptions_JSTypeSDKType = FieldOptions_JSType; +export const FieldOptions_JSTypeAmino = FieldOptions_JSType; +export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptions_JSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptions_JSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptions_JSType.JS_NUMBER; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_JSType.UNRECOGNIZED; + } +} +export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + */ +export enum MethodOptions_IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = 1, + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = 2, + UNRECOGNIZED = -1, +} +export const MethodOptions_IdempotencyLevelSDKType = MethodOptions_IdempotencyLevel; +export const MethodOptions_IdempotencyLevelAmino = MethodOptions_IdempotencyLevel; +export function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptions_IdempotencyLevel.IDEMPOTENT; + case -1: + case "UNRECOGNIZED": + default: + return MethodOptions_IdempotencyLevel.UNRECOGNIZED; + } +} +export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_IdempotencyLevel): string { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} +export interface FileDescriptorSetProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorSet"; + value: Uint8Array; +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSetAmino { + file?: FileDescriptorProtoAmino[]; +} +export interface FileDescriptorSetAminoMsg { + type: "/google.protobuf.FileDescriptorSet"; + value: FileDescriptorSetAmino; +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSetSDKType { + file: FileDescriptorProtoSDKType[]; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name: string; + package: string; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options?: FileOptions; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + sourceCodeInfo?: SourceCodeInfo; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax: string; +} +export interface FileDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorProto"; + value: Uint8Array; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProtoAmino { + /** file name, relative to root of source tree */ + name?: string; + package?: string; + /** Names of files imported by this file. */ + dependency?: string[]; + /** Indexes of the public imported files in the dependency list above. */ + public_dependency?: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weak_dependency?: number[]; + /** All top-level definitions in this file. */ + message_type?: DescriptorProtoAmino[]; + enum_type?: EnumDescriptorProtoAmino[]; + service?: ServiceDescriptorProtoAmino[]; + extension?: FieldDescriptorProtoAmino[]; + options?: FileOptionsAmino; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + source_code_info?: SourceCodeInfoAmino; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax?: string; +} +export interface FileDescriptorProtoAminoMsg { + type: "/google.protobuf.FileDescriptorProto"; + value: FileDescriptorProtoAmino; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProtoSDKType { + name: string; + package: string; + dependency: string[]; + public_dependency: number[]; + weak_dependency: number[]; + message_type: DescriptorProtoSDKType[]; + enum_type: EnumDescriptorProtoSDKType[]; + service: ServiceDescriptorProtoSDKType[]; + extension: FieldDescriptorProtoSDKType[]; + options?: FileOptionsSDKType; + source_code_info?: SourceCodeInfoSDKType; + syntax: string; +} +/** Describes a message type. */ +export interface DescriptorProto { + name: string; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; +} +export interface DescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.DescriptorProto"; + value: Uint8Array; +} +/** Describes a message type. */ +export interface DescriptorProtoAmino { + name?: string; + field?: FieldDescriptorProtoAmino[]; + extension?: FieldDescriptorProtoAmino[]; + nested_type?: DescriptorProtoAmino[]; + enum_type?: EnumDescriptorProtoAmino[]; + extension_range?: DescriptorProto_ExtensionRangeAmino[]; + oneof_decl?: OneofDescriptorProtoAmino[]; + options?: MessageOptionsAmino; + reserved_range?: DescriptorProto_ReservedRangeAmino[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reserved_name?: string[]; +} +export interface DescriptorProtoAminoMsg { + type: "/google.protobuf.DescriptorProto"; + value: DescriptorProtoAmino; +} +/** Describes a message type. */ +export interface DescriptorProtoSDKType { + name: string; + field: FieldDescriptorProtoSDKType[]; + extension: FieldDescriptorProtoSDKType[]; + nested_type: DescriptorProtoSDKType[]; + enum_type: EnumDescriptorProtoSDKType[]; + extension_range: DescriptorProto_ExtensionRangeSDKType[]; + oneof_decl: OneofDescriptorProtoSDKType[]; + options?: MessageOptionsSDKType; + reserved_range: DescriptorProto_ReservedRangeSDKType[]; + reserved_name: string[]; +} +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options?: ExtensionRangeOptions; +} +export interface DescriptorProto_ExtensionRangeProtoMsg { + typeUrl: "/google.protobuf.ExtensionRange"; + value: Uint8Array; +} +export interface DescriptorProto_ExtensionRangeAmino { + /** Inclusive. */ + start?: number; + /** Exclusive. */ + end?: number; + options?: ExtensionRangeOptionsAmino; +} +export interface DescriptorProto_ExtensionRangeAminoMsg { + type: "/google.protobuf.ExtensionRange"; + value: DescriptorProto_ExtensionRangeAmino; +} +export interface DescriptorProto_ExtensionRangeSDKType { + start: number; + end: number; + options?: ExtensionRangeOptionsSDKType; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; +} +export interface DescriptorProto_ReservedRangeProtoMsg { + typeUrl: "/google.protobuf.ReservedRange"; + value: Uint8Array; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRangeAmino { + /** Inclusive. */ + start?: number; + /** Exclusive. */ + end?: number; +} +export interface DescriptorProto_ReservedRangeAminoMsg { + type: "/google.protobuf.ReservedRange"; + value: DescriptorProto_ReservedRangeAmino; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRangeSDKType { + start: number; + end: number; +} +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface ExtensionRangeOptionsProtoMsg { + typeUrl: "/google.protobuf.ExtensionRangeOptions"; + value: Uint8Array; +} +export interface ExtensionRangeOptionsAmino { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface ExtensionRangeOptionsAminoMsg { + type: "/google.protobuf.ExtensionRangeOptions"; + value: ExtensionRangeOptionsAmino; +} +export interface ExtensionRangeOptionsSDKType { + uninterpreted_option: UninterpretedOptionSDKType[]; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name: string; + number: number; + label: FieldDescriptorProto_Label; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type: FieldDescriptorProto_Type; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + typeName: string; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee: string; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? + */ + defaultValue: string; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex: number; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + jsonName: string; + options?: FieldOptions; +} +export interface FieldDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FieldDescriptorProto"; + value: Uint8Array; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProtoAmino { + name?: string; + number?: number; + label?: FieldDescriptorProto_Label; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type?: FieldDescriptorProto_Type; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + type_name?: string; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee?: string; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? + */ + default_value?: string; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneof_index?: number; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + json_name?: string; + options?: FieldOptionsAmino; +} +export interface FieldDescriptorProtoAminoMsg { + type: "/google.protobuf.FieldDescriptorProto"; + value: FieldDescriptorProtoAmino; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProtoSDKType { + name: string; + number: number; + label: FieldDescriptorProto_Label; + type: FieldDescriptorProto_Type; + type_name: string; + extendee: string; + default_value: string; + oneof_index: number; + json_name: string; + options?: FieldOptionsSDKType; +} +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options?: OneofOptions; +} +export interface OneofDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.OneofDescriptorProto"; + value: Uint8Array; +} +/** Describes a oneof. */ +export interface OneofDescriptorProtoAmino { + name?: string; + options?: OneofOptionsAmino; +} +export interface OneofDescriptorProtoAminoMsg { + type: "/google.protobuf.OneofDescriptorProto"; + value: OneofDescriptorProtoAmino; +} +/** Describes a oneof. */ +export interface OneofDescriptorProtoSDKType { + name: string; + options?: OneofOptionsSDKType; +} +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name: string; + value: EnumValueDescriptorProto[]; + options?: EnumOptions; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; +} +export interface EnumDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumDescriptorProto"; + value: Uint8Array; +} +/** Describes an enum type. */ +export interface EnumDescriptorProtoAmino { + name?: string; + value?: EnumValueDescriptorProtoAmino[]; + options?: EnumOptionsAmino; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reserved_range?: EnumDescriptorProto_EnumReservedRangeAmino[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reserved_name?: string[]; +} +export interface EnumDescriptorProtoAminoMsg { + type: "/google.protobuf.EnumDescriptorProto"; + value: EnumDescriptorProtoAmino; +} +/** Describes an enum type. */ +export interface EnumDescriptorProtoSDKType { + name: string; + value: EnumValueDescriptorProtoSDKType[]; + options?: EnumOptionsSDKType; + reserved_range: EnumDescriptorProto_EnumReservedRangeSDKType[]; + reserved_name: string[]; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRange { + /** Inclusive. */ + start: number; + /** Inclusive. */ + end: number; +} +export interface EnumDescriptorProto_EnumReservedRangeProtoMsg { + typeUrl: "/google.protobuf.EnumReservedRange"; + value: Uint8Array; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRangeAmino { + /** Inclusive. */ + start?: number; + /** Inclusive. */ + end?: number; +} +export interface EnumDescriptorProto_EnumReservedRangeAminoMsg { + type: "/google.protobuf.EnumReservedRange"; + value: EnumDescriptorProto_EnumReservedRangeAmino; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRangeSDKType { + start: number; + end: number; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options?: EnumValueOptions; +} +export interface EnumValueDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumValueDescriptorProto"; + value: Uint8Array; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProtoAmino { + name?: string; + number?: number; + options?: EnumValueOptionsAmino; +} +export interface EnumValueDescriptorProtoAminoMsg { + type: "/google.protobuf.EnumValueDescriptorProto"; + value: EnumValueDescriptorProtoAmino; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProtoSDKType { + name: string; + number: number; + options?: EnumValueOptionsSDKType; +} +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions; +} +export interface ServiceDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.ServiceDescriptorProto"; + value: Uint8Array; +} +/** Describes a service. */ +export interface ServiceDescriptorProtoAmino { + name?: string; + method?: MethodDescriptorProtoAmino[]; + options?: ServiceOptionsAmino; +} +export interface ServiceDescriptorProtoAminoMsg { + type: "/google.protobuf.ServiceDescriptorProto"; + value: ServiceDescriptorProtoAmino; +} +/** Describes a service. */ +export interface ServiceDescriptorProtoSDKType { + name: string; + method: MethodDescriptorProtoSDKType[]; + options?: ServiceOptionsSDKType; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name: string; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType: string; + outputType: string; + options?: MethodOptions; + /** Identifies if client streams multiple client messages */ + clientStreaming: boolean; + /** Identifies if server streams multiple server messages */ + serverStreaming: boolean; +} +export interface MethodDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.MethodDescriptorProto"; + value: Uint8Array; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProtoAmino { + name?: string; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + input_type?: string; + output_type?: string; + options?: MethodOptionsAmino; + /** Identifies if client streams multiple client messages */ + client_streaming?: boolean; + /** Identifies if server streams multiple server messages */ + server_streaming?: boolean; +} +export interface MethodDescriptorProtoAminoMsg { + type: "/google.protobuf.MethodDescriptorProto"; + value: MethodDescriptorProtoAmino; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProtoSDKType { + name: string; + input_type: string; + output_type: string; + options?: MethodOptionsSDKType; + client_streaming: boolean; + server_streaming: boolean; +} +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage: string; + /** + * If set, all the classes from the .proto file are wrapped in a single + * outer class with the given name. This applies to both Proto1 + * (equivalent to the old "--one_java_file" option) and Proto2 (where + * a .proto always translates to a single class, but you may want to + * explicitly choose the class name). + */ + javaOuterClassname: string; + /** + * If set true, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the outer class + * named by java_outer_classname. However, the outer class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + javaMultipleFiles: boolean; + /** This option does nothing. */ + /** @deprecated */ + javaGenerateEqualsAndHash: boolean; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + javaStringCheckUtf8: boolean; + optimizeFor: FileOptions_OptimizeMode; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage: string; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices: boolean; + javaGenericServices: boolean; + pyGenericServices: boolean; + phpGenericServices: boolean; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated: boolean; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix: string; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace: string; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix: string; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix: string; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace: string; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace: string; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage: string; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} +export interface FileOptionsProtoMsg { + typeUrl: "/google.protobuf.FileOptions"; + value: Uint8Array; +} +export interface FileOptionsAmino { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + java_package?: string; + /** + * If set, all the classes from the .proto file are wrapped in a single + * outer class with the given name. This applies to both Proto1 + * (equivalent to the old "--one_java_file" option) and Proto2 (where + * a .proto always translates to a single class, but you may want to + * explicitly choose the class name). + */ + java_outer_classname?: string; + /** + * If set true, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the outer class + * named by java_outer_classname. However, the outer class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + java_multiple_files?: boolean; + /** This option does nothing. */ + /** @deprecated */ + java_generate_equals_and_hash?: boolean; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + java_string_check_utf8?: boolean; + optimize_for?: FileOptions_OptimizeMode; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + go_package?: string; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + cc_generic_services?: boolean; + java_generic_services?: boolean; + py_generic_services?: boolean; + php_generic_services?: boolean; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated?: boolean; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + cc_enable_arenas?: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objc_class_prefix?: string; + /** Namespace for generated classes; defaults to the package. */ + csharp_namespace?: string; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swift_prefix?: string; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + php_class_prefix?: string; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + php_namespace?: string; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + php_metadata_namespace?: string; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + ruby_package?: string; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface FileOptionsAminoMsg { + type: "/google.protobuf.FileOptions"; + value: FileOptionsAmino; +} +export interface FileOptionsSDKType { + java_package: string; + java_outer_classname: string; + java_multiple_files: boolean; + /** @deprecated */ + java_generate_equals_and_hash: boolean; + java_string_check_utf8: boolean; + optimize_for: FileOptions_OptimizeMode; + go_package: string; + cc_generic_services: boolean; + java_generic_services: boolean; + py_generic_services: boolean; + php_generic_services: boolean; + deprecated: boolean; + cc_enable_arenas: boolean; + objc_class_prefix: string; + csharp_namespace: string; + swift_prefix: string; + php_class_prefix: string; + php_namespace: string; + php_metadata_namespace: string; + ruby_package: string; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + messageSetWireFormat: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface MessageOptionsProtoMsg { + typeUrl: "/google.protobuf.MessageOptions"; + value: Uint8Array; +} +export interface MessageOptionsAmino { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + message_set_wire_format?: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + no_standard_descriptor_accessor?: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated?: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + map_entry?: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface MessageOptionsAminoMsg { + type: "/google.protobuf.MessageOptions"; + value: MessageOptionsAmino; +} +export interface MessageOptionsSDKType { + message_set_wire_format: boolean; + no_standard_descriptor_accessor: boolean; + deprecated: boolean; + map_entry: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface FieldOptions { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + */ + ctype: FieldOptions_CType; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + */ + packed: boolean; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype: FieldOptions_JSType; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + */ + lazy: boolean; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated: boolean; + /** For Google-internal migration only. Do not use. */ + weak: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface FieldOptionsProtoMsg { + typeUrl: "/google.protobuf.FieldOptions"; + value: Uint8Array; +} +export interface FieldOptionsAmino { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + */ + ctype?: FieldOptions_CType; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + */ + packed?: boolean; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype?: FieldOptions_JSType; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + */ + lazy?: boolean; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated?: boolean; + /** For Google-internal migration only. Do not use. */ + weak?: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface FieldOptionsAminoMsg { + type: "/google.protobuf.FieldOptions"; + value: FieldOptionsAmino; +} +export interface FieldOptionsSDKType { + ctype: FieldOptions_CType; + packed: boolean; + jstype: FieldOptions_JSType; + lazy: boolean; + deprecated: boolean; + weak: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface OneofOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface OneofOptionsProtoMsg { + typeUrl: "/google.protobuf.OneofOptions"; + value: Uint8Array; +} +export interface OneofOptionsAmino { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface OneofOptionsAminoMsg { + type: "/google.protobuf.OneofOptions"; + value: OneofOptionsAmino; +} +export interface OneofOptionsSDKType { + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias: boolean; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface EnumOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumOptions"; + value: Uint8Array; +} +export interface EnumOptionsAmino { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allow_alias?: boolean; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated?: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface EnumOptionsAminoMsg { + type: "/google.protobuf.EnumOptions"; + value: EnumOptionsAmino; +} +export interface EnumOptionsSDKType { + allow_alias: boolean; + deprecated: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface EnumValueOptions { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface EnumValueOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumValueOptions"; + value: Uint8Array; +} +export interface EnumValueOptionsAmino { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated?: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface EnumValueOptionsAminoMsg { + type: "/google.protobuf.EnumValueOptions"; + value: EnumValueOptionsAmino; +} +export interface EnumValueOptionsSDKType { + deprecated: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface ServiceOptions { + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface ServiceOptionsProtoMsg { + typeUrl: "/google.protobuf.ServiceOptions"; + value: Uint8Array; +} +export interface ServiceOptionsAmino { + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated?: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface ServiceOptionsAminoMsg { + type: "/google.protobuf.ServiceOptions"; + value: ServiceOptionsAmino; +} +export interface ServiceOptionsSDKType { + deprecated: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface MethodOptions { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated: boolean; + idempotencyLevel: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface MethodOptionsProtoMsg { + typeUrl: "/google.protobuf.MethodOptions"; + value: Uint8Array; +} +export interface MethodOptionsAmino { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated?: boolean; + idempotency_level?: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option?: UninterpretedOptionAmino[]; +} +export interface MethodOptionsAminoMsg { + type: "/google.protobuf.MethodOptions"; + value: MethodOptionsAmino; +} +export interface MethodOptionsSDKType { + deprecated: boolean; + idempotency_level: MethodOptions_IdempotencyLevel; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue: string; + positiveIntValue: bigint; + negativeIntValue: bigint; + doubleValue: number; + stringValue: Uint8Array; + aggregateValue: string; +} +export interface UninterpretedOptionProtoMsg { + typeUrl: "/google.protobuf.UninterpretedOption"; + value: Uint8Array; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOptionAmino { + name?: UninterpretedOption_NamePartAmino[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifier_value?: string; + positive_int_value?: string; + negative_int_value?: string; + double_value?: number; + string_value?: string; + aggregate_value?: string; +} +export interface UninterpretedOptionAminoMsg { + type: "/google.protobuf.UninterpretedOption"; + value: UninterpretedOptionAmino; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOptionSDKType { + name: UninterpretedOption_NamePartSDKType[]; + identifier_value: string; + positive_int_value: bigint; + negative_int_value: bigint; + double_value: number; + string_value: Uint8Array; + aggregate_value: string; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} +export interface UninterpretedOption_NamePartProtoMsg { + typeUrl: "/google.protobuf.NamePart"; + value: Uint8Array; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePartAmino { + name_part?: string; + is_extension?: boolean; +} +export interface UninterpretedOption_NamePartAminoMsg { + type: "/google.protobuf.NamePart"; + value: UninterpretedOption_NamePartAmino; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePartSDKType { + name_part: string; + is_extension: boolean; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfo { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_Location[]; +} +export interface SourceCodeInfoProtoMsg { + typeUrl: "/google.protobuf.SourceCodeInfo"; + value: Uint8Array; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfoAmino { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location?: SourceCodeInfo_LocationAmino[]; +} +export interface SourceCodeInfoAminoMsg { + type: "/google.protobuf.SourceCodeInfo"; + value: SourceCodeInfoAmino; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfoSDKType { + location: SourceCodeInfo_LocationSDKType[]; +} +export interface SourceCodeInfo_Location { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. *\/ + * /* Block comment attached to + * * grault. *\/ + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments: string; + trailingComments: string; + leadingDetachedComments: string[]; +} +export interface SourceCodeInfo_LocationProtoMsg { + typeUrl: "/google.protobuf.Location"; + value: Uint8Array; +} +export interface SourceCodeInfo_LocationAmino { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path?: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span?: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. *\/ + * /* Block comment attached to + * * grault. *\/ + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leading_comments?: string; + trailing_comments?: string; + leading_detached_comments?: string[]; +} +export interface SourceCodeInfo_LocationAminoMsg { + type: "/google.protobuf.Location"; + value: SourceCodeInfo_LocationAmino; +} +export interface SourceCodeInfo_LocationSDKType { + path: number[]; + span: number[]; + leading_comments: string; + trailing_comments: string; + leading_detached_comments: string[]; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfo { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_Annotation[]; +} +export interface GeneratedCodeInfoProtoMsg { + typeUrl: "/google.protobuf.GeneratedCodeInfo"; + value: Uint8Array; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfoAmino { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation?: GeneratedCodeInfo_AnnotationAmino[]; +} +export interface GeneratedCodeInfoAminoMsg { + type: "/google.protobuf.GeneratedCodeInfo"; + value: GeneratedCodeInfoAmino; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfoSDKType { + annotation: GeneratedCodeInfo_AnnotationSDKType[]; +} +export interface GeneratedCodeInfo_Annotation { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + sourceFile: string; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin: number; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; +} +export interface GeneratedCodeInfo_AnnotationProtoMsg { + typeUrl: "/google.protobuf.Annotation"; + value: Uint8Array; +} +export interface GeneratedCodeInfo_AnnotationAmino { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path?: number[]; + /** Identifies the filesystem path to the original source .proto. */ + source_file?: string; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin?: number; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end?: number; +} +export interface GeneratedCodeInfo_AnnotationAminoMsg { + type: "/google.protobuf.Annotation"; + value: GeneratedCodeInfo_AnnotationAmino; +} +export interface GeneratedCodeInfo_AnnotationSDKType { + path: number[]; + source_file: string; + begin: number; + end: number; +} +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { + file: [] + }; +} +export const FileDescriptorSet = { + typeUrl: "/google.protobuf.FileDescriptorSet", + encode(message: FileDescriptorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map(e => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FileDescriptorSetAmino): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map(e => FileDescriptorProto.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileDescriptorSet): FileDescriptorSetAmino { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); + } else { + obj.file = message.file; + } + return obj; + }, + fromAminoMsg(object: FileDescriptorSetAminoMsg): FileDescriptorSet { + return FileDescriptorSet.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorSetProtoMsg): FileDescriptorSet { + return FileDescriptorSet.decode(message.value); + }, + toProto(message: FileDescriptorSet): Uint8Array { + return FileDescriptorSet.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorSet): FileDescriptorSetProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorSet", + value: FileDescriptorSet.encode(message).finish() + }; + } +}; +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "" + }; +} +export const FileDescriptorProto = { + typeUrl: "/google.protobuf.FileDescriptorProto", + encode(message: FileDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== "") { + writer.uint32(18).string(message.package); + } + for (const v of message.dependency) { + writer.uint32(26).string(v!); + } + writer.uint32(82).fork(); + for (const v of message.publicDependency) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(90).fork(); + for (const v of message.weakDependency) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.messageType) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.sourceCodeInfo !== undefined) { + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + } + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.package = reader.string(); + break; + case 3: + message.dependency.push(reader.string()); + break; + case 10: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.publicDependency.push(reader.int32()); + } + } else { + message.publicDependency.push(reader.int32()); + } + break; + case 11: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weakDependency.push(reader.int32()); + } + } else { + message.weakDependency.push(reader.int32()); + } + break; + case 4: + message.messageType.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 8: + message.options = FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.sourceCodeInfo = SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map(e => e) || []; + message.publicDependency = object.publicDependency?.map(e => e) || []; + message.weakDependency = object.weakDependency?.map(e => e) || []; + message.messageType = object.messageType?.map(e => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map(e => EnumDescriptorProto.fromPartial(e)) || []; + message.service = object.service?.map(e => ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? FileOptions.fromPartial(object.options) : undefined; + message.sourceCodeInfo = object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; + message.syntax = object.syntax ?? ""; + return message; + }, + fromAmino(object: FileDescriptorProtoAmino): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.package !== undefined && object.package !== null) { + message.package = object.package; + } + message.dependency = object.dependency?.map(e => e) || []; + message.publicDependency = object.public_dependency?.map(e => e) || []; + message.weakDependency = object.weak_dependency?.map(e => e) || []; + message.messageType = object.message_type?.map(e => DescriptorProto.fromAmino(e)) || []; + message.enumType = object.enum_type?.map(e => EnumDescriptorProto.fromAmino(e)) || []; + message.service = object.service?.map(e => ServiceDescriptorProto.fromAmino(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = FileOptions.fromAmino(object.options); + } + if (object.source_code_info !== undefined && object.source_code_info !== null) { + message.sourceCodeInfo = SourceCodeInfo.fromAmino(object.source_code_info); + } + if (object.syntax !== undefined && object.syntax !== null) { + message.syntax = object.syntax; + } + return message; + }, + toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; + if (message.dependency) { + obj.dependency = message.dependency.map(e => e); + } else { + obj.dependency = message.dependency; + } + if (message.publicDependency) { + obj.public_dependency = message.publicDependency.map(e => e); + } else { + obj.public_dependency = message.publicDependency; + } + if (message.weakDependency) { + obj.weak_dependency = message.weakDependency.map(e => e); + } else { + obj.weak_dependency = message.weakDependency; + } + if (message.messageType) { + obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); + } else { + obj.message_type = message.messageType; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); + } else { + obj.enum_type = message.enumType; + } + if (message.service) { + obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); + } else { + obj.service = message.service; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.extension = message.extension; + } + obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; + obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; + obj.syntax = message.syntax === "" ? undefined : message.syntax; + return obj; + }, + fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { + return FileDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorProtoProtoMsg): FileDescriptorProto { + return FileDescriptorProto.decode(message.value); + }, + toProto(message: FileDescriptorProto): Uint8Array { + return FileDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorProto): FileDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorProto", + value: FileDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [] + }; +} +export const DescriptorProto = { + typeUrl: "/google.protobuf.DescriptorProto", + encode(message: DescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.nestedType) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.extensionRange) { + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.oneofDecl) { + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.reservedRange) { + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.nestedType.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.extensionRange.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + message.oneofDecl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + message.reservedRange.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DescriptorProto { + const message = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = object.field?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + message.nestedType = object.nestedType?.map(e => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map(e => EnumDescriptorProto.fromPartial(e)) || []; + message.extensionRange = object.extensionRange?.map(e => DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneofDecl = object.oneofDecl?.map(e => OneofDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? MessageOptions.fromPartial(object.options) : undefined; + message.reservedRange = object.reservedRange?.map(e => DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map(e => e) || []; + return message; + }, + fromAmino(object: DescriptorProtoAmino): DescriptorProto { + const message = createBaseDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.field = object.field?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + message.nestedType = object.nested_type?.map(e => DescriptorProto.fromAmino(e)) || []; + message.enumType = object.enum_type?.map(e => EnumDescriptorProto.fromAmino(e)) || []; + message.extensionRange = object.extension_range?.map(e => DescriptorProto_ExtensionRange.fromAmino(e)) || []; + message.oneofDecl = object.oneof_decl?.map(e => OneofDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = MessageOptions.fromAmino(object.options); + } + message.reservedRange = object.reserved_range?.map(e => DescriptorProto_ReservedRange.fromAmino(e)) || []; + message.reservedName = object.reserved_name?.map(e => e) || []; + return message; + }, + toAmino(message: DescriptorProto): DescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.field) { + obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.field = message.field; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.extension = message.extension; + } + if (message.nestedType) { + obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); + } else { + obj.nested_type = message.nestedType; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); + } else { + obj.enum_type = message.enumType; + } + if (message.extensionRange) { + obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); + } else { + obj.extension_range = message.extensionRange; + } + if (message.oneofDecl) { + obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); + } else { + obj.oneof_decl = message.oneofDecl; + } + obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); + } else { + obj.reserved_range = message.reservedRange; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = message.reservedName; + } + return obj; + }, + fromAminoMsg(object: DescriptorProtoAminoMsg): DescriptorProto { + return DescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProtoProtoMsg): DescriptorProto { + return DescriptorProto.decode(message.value); + }, + toProto(message: DescriptorProto): Uint8Array { + return DescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto): DescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.DescriptorProto", + value: DescriptorProto.encode(message).finish() + }; + } +}; +function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { + return { + start: 0, + end: 0, + options: undefined + }; +} +export const DescriptorProto_ExtensionRange = { + typeUrl: "/google.protobuf.ExtensionRange", + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + case 3: + message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.options = object.options !== undefined && object.options !== null ? ExtensionRangeOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: DescriptorProto_ExtensionRangeAmino): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + if (object.options !== undefined && object.options !== null) { + message.options = ExtensionRangeOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: DescriptorProto_ExtensionRangeAminoMsg): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProto_ExtensionRangeProtoMsg): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.decode(message.value); + }, + toProto(message: DescriptorProto_ExtensionRange): Uint8Array { + return DescriptorProto_ExtensionRange.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRange", + value: DescriptorProto_ExtensionRange.encode(message).finish() + }; + } +}; +function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { + return { + start: 0, + end: 0 + }; +} +export const DescriptorProto_ReservedRange = { + typeUrl: "/google.protobuf.ReservedRange", + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, + fromAmino(object: DescriptorProto_ReservedRangeAmino): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + return obj; + }, + fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProto_ReservedRangeProtoMsg): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.decode(message.value); + }, + toProto(message: DescriptorProto_ReservedRange): Uint8Array { + return DescriptorProto_ReservedRange.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ReservedRange", + value: DescriptorProto_ReservedRange.encode(message).finish() + }; + } +}; +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { + uninterpretedOption: [] + }; +} +export const ExtensionRangeOptions = { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + encode(message: ExtensionRangeOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ExtensionRangeOptionsAmino): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExtensionRangeOptions): ExtensionRangeOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: ExtensionRangeOptionsAminoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ExtensionRangeOptionsProtoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.decode(message.value); + }, + toProto(message: ExtensionRangeOptions): Uint8Array { + return ExtensionRangeOptions.encode(message).finish(); + }, + toProtoMsg(message: ExtensionRangeOptions): ExtensionRangeOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + value: ExtensionRangeOptions.encode(message).finish() + }; + } +}; +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined + }; +} +export const FieldDescriptorProto = { + typeUrl: "/google.protobuf.FieldDescriptorProto", + encode(message: FieldDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.number = reader.int32(); + break; + case 4: + message.label = (reader.int32() as any); + break; + case 5: + message.type = (reader.int32() as any); + break; + case 6: + message.typeName = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.defaultValue = reader.string(); + break; + case 9: + message.oneofIndex = reader.int32(); + break; + case 10: + message.jsonName = reader.string(); + break; + case 8: + message.options = FieldOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.typeName = object.typeName ?? ""; + message.extendee = object.extendee ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.oneofIndex = object.oneofIndex ?? 0; + message.jsonName = object.jsonName ?? ""; + message.options = object.options !== undefined && object.options !== null ? FieldOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: FieldDescriptorProtoAmino): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.type_name !== undefined && object.type_name !== null) { + message.typeName = object.type_name; + } + if (object.extendee !== undefined && object.extendee !== null) { + message.extendee = object.extendee; + } + if (object.default_value !== undefined && object.default_value !== null) { + message.defaultValue = object.default_value; + } + if (object.oneof_index !== undefined && object.oneof_index !== null) { + message.oneofIndex = object.oneof_index; + } + if (object.json_name !== undefined && object.json_name !== null) { + message.jsonName = object.json_name; + } + if (object.options !== undefined && object.options !== null) { + message.options = FieldOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: FieldDescriptorProtoAminoMsg): FieldDescriptorProto { + return FieldDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FieldDescriptorProtoProtoMsg): FieldDescriptorProto { + return FieldDescriptorProto.decode(message.value); + }, + toProto(message: FieldDescriptorProto): Uint8Array { + return FieldDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FieldDescriptorProto): FieldDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FieldDescriptorProto", + value: FieldDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { + name: "", + options: undefined + }; +} +export const OneofDescriptorProto = { + typeUrl: "/google.protobuf.OneofDescriptorProto", + encode(message: OneofDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = object.options !== undefined && object.options !== null ? OneofOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: OneofDescriptorProtoAmino): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.options !== undefined && object.options !== null) { + message.options = OneofOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: OneofDescriptorProtoAminoMsg): OneofDescriptorProto { + return OneofDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: OneofDescriptorProtoProtoMsg): OneofDescriptorProto { + return OneofDescriptorProto.decode(message.value); + }, + toProto(message: OneofDescriptorProto): Uint8Array { + return OneofDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: OneofDescriptorProto): OneofDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.OneofDescriptorProto", + value: OneofDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { + name: "", + value: [], + options: undefined, + reservedRange: [], + reservedName: [] + }; +} +export const EnumDescriptorProto = { + typeUrl: "/google.protobuf.EnumDescriptorProto", + encode(message: EnumDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.reservedRange) { + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = EnumOptions.decode(reader, reader.uint32()); + break; + case 4: + message.reservedRange.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + break; + case 5: + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = object.value?.map(e => EnumValueDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? EnumOptions.fromPartial(object.options) : undefined; + message.reservedRange = object.reservedRange?.map(e => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map(e => e) || []; + return message; + }, + fromAmino(object: EnumDescriptorProtoAmino): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.value = object.value?.map(e => EnumValueDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = EnumOptions.fromAmino(object.options); + } + message.reservedRange = object.reserved_range?.map(e => EnumDescriptorProto_EnumReservedRange.fromAmino(e)) || []; + message.reservedName = object.reserved_name?.map(e => e) || []; + return message; + }, + toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.value) { + obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); + } else { + obj.value = message.value; + } + obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); + } else { + obj.reserved_range = message.reservedRange; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = message.reservedName; + } + return obj; + }, + fromAminoMsg(object: EnumDescriptorProtoAminoMsg): EnumDescriptorProto { + return EnumDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProtoProtoMsg): EnumDescriptorProto { + return EnumDescriptorProto.decode(message.value); + }, + toProto(message: EnumDescriptorProto): Uint8Array { + return EnumDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto): EnumDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumDescriptorProto", + value: EnumDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { + return { + start: 0, + end: 0 + }; +} +export const EnumDescriptorProto_EnumReservedRange = { + typeUrl: "/google.protobuf.EnumReservedRange", + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, + fromAmino(object: EnumDescriptorProto_EnumReservedRangeAmino): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + return obj; + }, + fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProto_EnumReservedRangeProtoMsg): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.decode(message.value); + }, + toProto(message: EnumDescriptorProto_EnumReservedRange): Uint8Array { + return EnumDescriptorProto_EnumReservedRange.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.EnumReservedRange", + value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() + }; + } +}; +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { + name: "", + number: 0, + options: undefined + }; +} +export const EnumValueDescriptorProto = { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + 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.options = EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.options = object.options !== undefined && object.options !== null ? EnumValueOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: EnumValueDescriptorProtoAmino): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.options !== undefined && object.options !== null) { + message.options = EnumValueOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: EnumValueDescriptorProtoAminoMsg): EnumValueDescriptorProto { + return EnumValueDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueDescriptorProtoProtoMsg): EnumValueDescriptorProto { + return EnumValueDescriptorProto.decode(message.value); + }, + toProto(message: EnumValueDescriptorProto): Uint8Array { + return EnumValueDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumValueDescriptorProto): EnumValueDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + value: EnumValueDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { + name: "", + method: [], + options: undefined + }; +} +export const ServiceDescriptorProto = { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + encode(message: ServiceDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = object.method?.map(e => MethodDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? ServiceOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: ServiceDescriptorProtoAmino): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.method = object.method?.map(e => MethodDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = ServiceOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.method) { + obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); + } else { + obj.method = message.method; + } + obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: ServiceDescriptorProtoAminoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceDescriptorProtoProtoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.decode(message.value); + }, + toProto(message: ServiceDescriptorProto): Uint8Array { + return ServiceDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: ServiceDescriptorProto): ServiceDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + value: ServiceDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false + }; +} +export const MethodDescriptorProto = { + typeUrl: "/google.protobuf.MethodDescriptorProto", + encode(message: MethodDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + } + if (message.clientStreaming === true) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming === true) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.inputType = reader.string(); + break; + case 3: + message.outputType = reader.string(); + break; + case 4: + message.options = MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.inputType = object.inputType ?? ""; + message.outputType = object.outputType ?? ""; + message.options = object.options !== undefined && object.options !== null ? MethodOptions.fromPartial(object.options) : undefined; + message.clientStreaming = object.clientStreaming ?? false; + message.serverStreaming = object.serverStreaming ?? false; + return message; + }, + fromAmino(object: MethodDescriptorProtoAmino): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.input_type !== undefined && object.input_type !== null) { + message.inputType = object.input_type; + } + if (object.output_type !== undefined && object.output_type !== null) { + message.outputType = object.output_type; + } + if (object.options !== undefined && object.options !== null) { + message.options = MethodOptions.fromAmino(object.options); + } + if (object.client_streaming !== undefined && object.client_streaming !== null) { + message.clientStreaming = object.client_streaming; + } + if (object.server_streaming !== undefined && object.server_streaming !== null) { + message.serverStreaming = object.server_streaming; + } + return message; + }, + toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; + obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; + return obj; + }, + fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { + return MethodDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: MethodDescriptorProtoProtoMsg): MethodDescriptorProto { + return MethodDescriptorProto.decode(message.value); + }, + toProto(message: MethodDescriptorProto): Uint8Array { + return MethodDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: MethodDescriptorProto): MethodDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.MethodDescriptorProto", + value: MethodDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseFileOptions(): FileOptions { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + phpGenericServices: false, + deprecated: false, + ccEnableArenas: false, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + uninterpretedOption: [] + }; +} +export const FileOptions = { + typeUrl: "/google.protobuf.FileOptions", + encode(message: FileOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles === true) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash === true) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 === true) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== 1) { + writer.uint32(72).int32(message.optimizeFor); + } + if (message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices === true) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices === true) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices === true) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.phpGenericServices === true) { + writer.uint32(336).bool(message.phpGenericServices); + } + if (message.deprecated === true) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas === true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.javaPackage = reader.string(); + break; + case 8: + message.javaOuterClassname = reader.string(); + break; + case 10: + message.javaMultipleFiles = reader.bool(); + break; + case 20: + message.javaGenerateEqualsAndHash = reader.bool(); + break; + case 27: + message.javaStringCheckUtf8 = reader.bool(); + break; + case 9: + message.optimizeFor = (reader.int32() as any); + break; + case 11: + message.goPackage = reader.string(); + break; + case 16: + message.ccGenericServices = reader.bool(); + break; + case 17: + message.javaGenericServices = reader.bool(); + break; + case 18: + message.pyGenericServices = reader.bool(); + break; + case 42: + message.phpGenericServices = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.ccEnableArenas = reader.bool(); + break; + case 36: + message.objcClassPrefix = reader.string(); + break; + case 37: + message.csharpNamespace = reader.string(); + break; + case 39: + message.swiftPrefix = reader.string(); + break; + case 40: + message.phpClassPrefix = reader.string(); + break; + case 41: + message.phpNamespace = reader.string(); + break; + case 44: + message.phpMetadataNamespace = reader.string(); + break; + case 45: + message.rubyPackage = reader.string(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FileOptions { + const message = createBaseFileOptions(); + message.javaPackage = object.javaPackage ?? ""; + message.javaOuterClassname = object.javaOuterClassname ?? ""; + message.javaMultipleFiles = object.javaMultipleFiles ?? false; + message.javaGenerateEqualsAndHash = object.javaGenerateEqualsAndHash ?? false; + message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; + message.optimizeFor = object.optimizeFor ?? 1; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.phpGenericServices = object.phpGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? false; + message.objcClassPrefix = object.objcClassPrefix ?? ""; + message.csharpNamespace = object.csharpNamespace ?? ""; + message.swiftPrefix = object.swiftPrefix ?? ""; + message.phpClassPrefix = object.phpClassPrefix ?? ""; + message.phpNamespace = object.phpNamespace ?? ""; + message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; + message.rubyPackage = object.rubyPackage ?? ""; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FileOptionsAmino): FileOptions { + const message = createBaseFileOptions(); + if (object.java_package !== undefined && object.java_package !== null) { + message.javaPackage = object.java_package; + } + if (object.java_outer_classname !== undefined && object.java_outer_classname !== null) { + message.javaOuterClassname = object.java_outer_classname; + } + if (object.java_multiple_files !== undefined && object.java_multiple_files !== null) { + message.javaMultipleFiles = object.java_multiple_files; + } + if (object.java_generate_equals_and_hash !== undefined && object.java_generate_equals_and_hash !== null) { + message.javaGenerateEqualsAndHash = object.java_generate_equals_and_hash; + } + if (object.java_string_check_utf8 !== undefined && object.java_string_check_utf8 !== null) { + message.javaStringCheckUtf8 = object.java_string_check_utf8; + } + if (object.optimize_for !== undefined && object.optimize_for !== null) { + message.optimizeFor = object.optimize_for; + } + if (object.go_package !== undefined && object.go_package !== null) { + message.goPackage = object.go_package; + } + if (object.cc_generic_services !== undefined && object.cc_generic_services !== null) { + message.ccGenericServices = object.cc_generic_services; + } + if (object.java_generic_services !== undefined && object.java_generic_services !== null) { + message.javaGenericServices = object.java_generic_services; + } + if (object.py_generic_services !== undefined && object.py_generic_services !== null) { + message.pyGenericServices = object.py_generic_services; + } + if (object.php_generic_services !== undefined && object.php_generic_services !== null) { + message.phpGenericServices = object.php_generic_services; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.cc_enable_arenas !== undefined && object.cc_enable_arenas !== null) { + message.ccEnableArenas = object.cc_enable_arenas; + } + if (object.objc_class_prefix !== undefined && object.objc_class_prefix !== null) { + message.objcClassPrefix = object.objc_class_prefix; + } + if (object.csharp_namespace !== undefined && object.csharp_namespace !== null) { + message.csharpNamespace = object.csharp_namespace; + } + if (object.swift_prefix !== undefined && object.swift_prefix !== null) { + message.swiftPrefix = object.swift_prefix; + } + if (object.php_class_prefix !== undefined && object.php_class_prefix !== null) { + message.phpClassPrefix = object.php_class_prefix; + } + if (object.php_namespace !== undefined && object.php_namespace !== null) { + message.phpNamespace = object.php_namespace; + } + if (object.php_metadata_namespace !== undefined && object.php_metadata_namespace !== null) { + message.phpMetadataNamespace = object.php_metadata_namespace; + } + if (object.ruby_package !== undefined && object.ruby_package !== null) { + message.rubyPackage = object.ruby_package; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileOptions): FileOptionsAmino { + const obj: any = {}; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: FileOptionsAminoMsg): FileOptions { + return FileOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FileOptionsProtoMsg): FileOptions { + return FileOptions.decode(message.value); + }, + toProto(message: FileOptions): Uint8Array { + return FileOptions.encode(message).finish(); + }, + toProtoMsg(message: FileOptions): FileOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FileOptions", + value: FileOptions.encode(message).finish() + }; + } +}; +function createBaseMessageOptions(): MessageOptions { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + uninterpretedOption: [] + }; +} +export const MessageOptions = { + typeUrl: "/google.protobuf.MessageOptions", + encode(message: MessageOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.messageSetWireFormat === true) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor === true) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry === true) { + writer.uint32(56).bool(message.mapEntry); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageSetWireFormat = reader.bool(); + break; + case 2: + message.noStandardDescriptorAccessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.mapEntry = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MessageOptions { + const message = createBaseMessageOptions(); + message.messageSetWireFormat = object.messageSetWireFormat ?? false; + message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; + message.deprecated = object.deprecated ?? false; + message.mapEntry = object.mapEntry ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MessageOptionsAmino): MessageOptions { + const message = createBaseMessageOptions(); + if (object.message_set_wire_format !== undefined && object.message_set_wire_format !== null) { + message.messageSetWireFormat = object.message_set_wire_format; + } + if (object.no_standard_descriptor_accessor !== undefined && object.no_standard_descriptor_accessor !== null) { + message.noStandardDescriptorAccessor = object.no_standard_descriptor_accessor; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.map_entry !== undefined && object.map_entry !== null) { + message.mapEntry = object.map_entry; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MessageOptions): MessageOptionsAmino { + const obj: any = {}; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: MessageOptionsAminoMsg): MessageOptions { + return MessageOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MessageOptionsProtoMsg): MessageOptions { + return MessageOptions.decode(message.value); + }, + toProto(message: MessageOptions): Uint8Array { + return MessageOptions.encode(message).finish(); + }, + toProtoMsg(message: MessageOptions): MessageOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MessageOptions", + value: MessageOptions.encode(message).finish() + }; + } +}; +function createBaseFieldOptions(): FieldOptions { + return { + ctype: 1, + packed: false, + jstype: 1, + lazy: false, + deprecated: false, + weak: false, + uninterpretedOption: [] + }; +} +export const FieldOptions = { + typeUrl: "/google.protobuf.FieldOptions", + encode(message: FieldOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.ctype !== 1) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== 1) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy === true) { + writer.uint32(40).bool(message.lazy); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak === true) { + writer.uint32(80).bool(message.weak); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = (reader.int32() as any); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = (reader.int32() as any); + break; + case 5: + message.lazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 1; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 1; + message.lazy = object.lazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FieldOptionsAmino): FieldOptions { + const message = createBaseFieldOptions(); + if (object.ctype !== undefined && object.ctype !== null) { + message.ctype = object.ctype; + } + if (object.packed !== undefined && object.packed !== null) { + message.packed = object.packed; + } + if (object.jstype !== undefined && object.jstype !== null) { + message.jstype = object.jstype; + } + if (object.lazy !== undefined && object.lazy !== null) { + message.lazy = object.lazy; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.weak !== undefined && object.weak !== null) { + message.weak = object.weak; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: FieldOptions): FieldOptionsAmino { + const obj: any = {}; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: FieldOptionsAminoMsg): FieldOptions { + return FieldOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FieldOptionsProtoMsg): FieldOptions { + return FieldOptions.decode(message.value); + }, + toProto(message: FieldOptions): Uint8Array { + return FieldOptions.encode(message).finish(); + }, + toProtoMsg(message: FieldOptions): FieldOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FieldOptions", + value: FieldOptions.encode(message).finish() + }; + } +}; +function createBaseOneofOptions(): OneofOptions { + return { + uninterpretedOption: [] + }; +} +export const OneofOptions = { + typeUrl: "/google.protobuf.OneofOptions", + encode(message: OneofOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: OneofOptionsAmino): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: OneofOptions): OneofOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: OneofOptionsAminoMsg): OneofOptions { + return OneofOptions.fromAmino(object.value); + }, + fromProtoMsg(message: OneofOptionsProtoMsg): OneofOptions { + return OneofOptions.decode(message.value); + }, + toProto(message: OneofOptions): Uint8Array { + return OneofOptions.encode(message).finish(); + }, + toProtoMsg(message: OneofOptions): OneofOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.OneofOptions", + value: OneofOptions.encode(message).finish() + }; + } +}; +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + uninterpretedOption: [] + }; +} +export const EnumOptions = { + typeUrl: "/google.protobuf.EnumOptions", + encode(message: EnumOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.allowAlias === true) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allowAlias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumOptions { + const message = createBaseEnumOptions(); + message.allowAlias = object.allowAlias ?? false; + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EnumOptionsAmino): EnumOptions { + const message = createBaseEnumOptions(); + if (object.allow_alias !== undefined && object.allow_alias !== null) { + message.allowAlias = object.allow_alias; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: EnumOptions): EnumOptionsAmino { + const obj: any = {}; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: EnumOptionsAminoMsg): EnumOptions { + return EnumOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumOptionsProtoMsg): EnumOptions { + return EnumOptions.decode(message.value); + }, + toProto(message: EnumOptions): Uint8Array { + return EnumOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumOptions): EnumOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumOptions", + value: EnumOptions.encode(message).finish() + }; + } +}; +function createBaseEnumValueOptions(): EnumValueOptions { + return { + deprecated: false, + uninterpretedOption: [] + }; +} +export const EnumValueOptions = { + typeUrl: "/google.protobuf.EnumValueOptions", + encode(message: EnumValueOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EnumValueOptionsAmino): EnumValueOptions { + const message = createBaseEnumValueOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: EnumValueOptions): EnumValueOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: EnumValueOptionsAminoMsg): EnumValueOptions { + return EnumValueOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueOptionsProtoMsg): EnumValueOptions { + return EnumValueOptions.decode(message.value); + }, + toProto(message: EnumValueOptions): Uint8Array { + return EnumValueOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumValueOptions): EnumValueOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueOptions", + value: EnumValueOptions.encode(message).finish() + }; + } +}; +function createBaseServiceOptions(): ServiceOptions { + return { + deprecated: false, + uninterpretedOption: [] + }; +} +export const ServiceOptions = { + typeUrl: "/google.protobuf.ServiceOptions", + encode(message: ServiceOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ServiceOptions { + const message = createBaseServiceOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ServiceOptionsAmino): ServiceOptions { + const message = createBaseServiceOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: ServiceOptions): ServiceOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: ServiceOptionsAminoMsg): ServiceOptions { + return ServiceOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceOptionsProtoMsg): ServiceOptions { + return ServiceOptions.decode(message.value); + }, + toProto(message: ServiceOptions): Uint8Array { + return ServiceOptions.encode(message).finish(); + }, + toProtoMsg(message: ServiceOptions): ServiceOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceOptions", + value: ServiceOptions.encode(message).finish() + }; + } +}; +function createBaseMethodOptions(): MethodOptions { + return { + deprecated: false, + idempotencyLevel: 1, + uninterpretedOption: [] + }; +} +export const MethodOptions = { + typeUrl: "/google.protobuf.MethodOptions", + encode(message: MethodOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== 1) { + writer.uint32(272).int32(message.idempotencyLevel); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 34: + message.idempotencyLevel = (reader.int32() as any); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MethodOptions { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotencyLevel = object.idempotencyLevel ?? 1; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MethodOptionsAmino): MethodOptions { + const message = createBaseMethodOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.idempotency_level !== undefined && object.idempotency_level !== null) { + message.idempotencyLevel = object.idempotency_level; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MethodOptions): MethodOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: MethodOptionsAminoMsg): MethodOptions { + return MethodOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MethodOptionsProtoMsg): MethodOptions { + return MethodOptions.decode(message.value); + }, + toProto(message: MethodOptions): Uint8Array { + return MethodOptions.encode(message).finish(); + }, + toProtoMsg(message: MethodOptions): MethodOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MethodOptions", + value: MethodOptions.encode(message).finish() + }; + } +}; +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifierValue: "", + positiveIntValue: BigInt(0), + negativeIntValue: BigInt(0), + doubleValue: 0, + stringValue: new Uint8Array(), + aggregateValue: "" + }; +} +export const UninterpretedOption = { + typeUrl: "/google.protobuf.UninterpretedOption", + encode(message: UninterpretedOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (message.positiveIntValue !== BigInt(0)) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (message.negativeIntValue !== BigInt(0)) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.name.push(UninterpretedOption_NamePart.decode(reader, reader.uint32())); + break; + case 3: + message.identifierValue = reader.string(); + break; + case 4: + message.positiveIntValue = reader.uint64(); + break; + case 5: + message.negativeIntValue = reader.int64(); + break; + case 6: + message.doubleValue = reader.double(); + break; + case 7: + message.stringValue = reader.bytes(); + break; + case 8: + message.aggregateValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map(e => UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifierValue = object.identifierValue ?? ""; + message.positiveIntValue = object.positiveIntValue !== undefined && object.positiveIntValue !== null ? BigInt(object.positiveIntValue.toString()) : BigInt(0); + message.negativeIntValue = object.negativeIntValue !== undefined && object.negativeIntValue !== null ? BigInt(object.negativeIntValue.toString()) : BigInt(0); + message.doubleValue = object.doubleValue ?? 0; + message.stringValue = object.stringValue ?? new Uint8Array(); + message.aggregateValue = object.aggregateValue ?? ""; + return message; + }, + fromAmino(object: UninterpretedOptionAmino): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map(e => UninterpretedOption_NamePart.fromAmino(e)) || []; + if (object.identifier_value !== undefined && object.identifier_value !== null) { + message.identifierValue = object.identifier_value; + } + if (object.positive_int_value !== undefined && object.positive_int_value !== null) { + message.positiveIntValue = BigInt(object.positive_int_value); + } + if (object.negative_int_value !== undefined && object.negative_int_value !== null) { + message.negativeIntValue = BigInt(object.negative_int_value); + } + if (object.double_value !== undefined && object.double_value !== null) { + message.doubleValue = object.double_value; + } + if (object.string_value !== undefined && object.string_value !== null) { + message.stringValue = bytesFromBase64(object.string_value); + } + if (object.aggregate_value !== undefined && object.aggregate_value !== null) { + message.aggregateValue = object.aggregate_value; + } + return message; + }, + toAmino(message: UninterpretedOption): UninterpretedOptionAmino { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); + } else { + obj.name = message.name; + } + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; + obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; + return obj; + }, + fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { + return UninterpretedOption.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOptionProtoMsg): UninterpretedOption { + return UninterpretedOption.decode(message.value); + }, + toProto(message: UninterpretedOption): Uint8Array { + return UninterpretedOption.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption): UninterpretedOptionProtoMsg { + return { + typeUrl: "/google.protobuf.UninterpretedOption", + value: UninterpretedOption.encode(message).finish() + }; + } +}; +function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { + return { + namePart: "", + isExtension: false + }; +} +export const UninterpretedOption_NamePart = { + typeUrl: "/google.protobuf.NamePart", + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension === true) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption_NamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namePart = reader.string(); + break; + case 2: + message.isExtension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + message.namePart = object.namePart ?? ""; + message.isExtension = object.isExtension ?? false; + return message; + }, + fromAmino(object: UninterpretedOption_NamePartAmino): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + if (object.name_part !== undefined && object.name_part !== null) { + message.namePart = object.name_part; + } + if (object.is_extension !== undefined && object.is_extension !== null) { + message.isExtension = object.is_extension; + } + return message; + }, + toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { + const obj: any = {}; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; + return obj; + }, + fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOption_NamePartProtoMsg): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.decode(message.value); + }, + toProto(message: UninterpretedOption_NamePart): Uint8Array { + return UninterpretedOption_NamePart.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartProtoMsg { + return { + typeUrl: "/google.protobuf.NamePart", + value: UninterpretedOption_NamePart.encode(message).finish() + }; + } +}; +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { + location: [] + }; +} +export const SourceCodeInfo = { + typeUrl: "/google.protobuf.SourceCodeInfo", + encode(message: SourceCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.location.push(SourceCodeInfo_Location.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map(e => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SourceCodeInfoAmino): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map(e => SourceCodeInfo_Location.fromAmino(e)) || []; + return message; + }, + toAmino(message: SourceCodeInfo): SourceCodeInfoAmino { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); + } else { + obj.location = message.location; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfoAminoMsg): SourceCodeInfo { + return SourceCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfoProtoMsg): SourceCodeInfo { + return SourceCodeInfo.decode(message.value); + }, + toProto(message: SourceCodeInfo): Uint8Array { + return SourceCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo): SourceCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.SourceCodeInfo", + value: SourceCodeInfo.encode(message).finish() + }; + } +}; +function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { + return { + path: [], + span: [], + leadingComments: "", + trailingComments: "", + leadingDetachedComments: [] + }; +} +export const SourceCodeInfo_Location = { + typeUrl: "/google.protobuf.Location", + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.ldelim(); + if (message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } + for (const v of message.leadingDetachedComments) { + writer.uint32(50).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo_Location(); + 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.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + } else { + message.span.push(reader.int32()); + } + break; + case 3: + message.leadingComments = reader.string(); + break; + case 4: + message.trailingComments = reader.string(); + break; + case 6: + message.leadingDetachedComments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map(e => e) || []; + message.span = object.span?.map(e => e) || []; + message.leadingComments = object.leadingComments ?? ""; + message.trailingComments = object.trailingComments ?? ""; + message.leadingDetachedComments = object.leadingDetachedComments?.map(e => e) || []; + return message; + }, + fromAmino(object: SourceCodeInfo_LocationAmino): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map(e => e) || []; + message.span = object.span?.map(e => e) || []; + if (object.leading_comments !== undefined && object.leading_comments !== null) { + message.leadingComments = object.leading_comments; + } + if (object.trailing_comments !== undefined && object.trailing_comments !== null) { + message.trailingComments = object.trailing_comments; + } + message.leadingDetachedComments = object.leading_detached_comments?.map(e => e) || []; + return message; + }, + toAmino(message: SourceCodeInfo_Location): SourceCodeInfo_LocationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = message.path; + } + if (message.span) { + obj.span = message.span.map(e => e); + } else { + obj.span = message.span; + } + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; + if (message.leadingDetachedComments) { + obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); + } else { + obj.leading_detached_comments = message.leadingDetachedComments; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfo_LocationAminoMsg): SourceCodeInfo_Location { + return SourceCodeInfo_Location.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfo_LocationProtoMsg): SourceCodeInfo_Location { + return SourceCodeInfo_Location.decode(message.value); + }, + toProto(message: SourceCodeInfo_Location): Uint8Array { + return SourceCodeInfo_Location.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo_Location): SourceCodeInfo_LocationProtoMsg { + return { + typeUrl: "/google.protobuf.Location", + value: SourceCodeInfo_Location.encode(message).finish() + }; + } +}; +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { + annotation: [] + }; +} +export const GeneratedCodeInfo = { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + encode(message: GeneratedCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annotation.push(GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map(e => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GeneratedCodeInfoAmino): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map(e => GeneratedCodeInfo_Annotation.fromAmino(e)) || []; + return message; + }, + toAmino(message: GeneratedCodeInfo): GeneratedCodeInfoAmino { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); + } else { + obj.annotation = message.annotation; + } + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfoAminoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfoProtoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.decode(message.value); + }, + toProto(message: GeneratedCodeInfo): Uint8Array { + return GeneratedCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo): GeneratedCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + value: GeneratedCodeInfo.encode(message).finish() + }; + } +}; +function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { + return { + path: [], + sourceFile: "", + begin: 0, + end: 0 + }; +} +export const GeneratedCodeInfo_Annotation = { + typeUrl: "/google.protobuf.Annotation", + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + if (message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== 0) { + writer.uint32(32).int32(message.end); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo_Annotation(); + 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.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + case 2: + message.sourceFile = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map(e => e) || []; + message.sourceFile = object.sourceFile ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + return message; + }, + fromAmino(object: GeneratedCodeInfo_AnnotationAmino): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map(e => e) || []; + if (object.source_file !== undefined && object.source_file !== null) { + message.sourceFile = object.source_file; + } + if (object.begin !== undefined && object.begin !== null) { + message.begin = object.begin; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = message.path; + } + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfo_AnnotationProtoMsg): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.decode(message.value); + }, + toProto(message: GeneratedCodeInfo_Annotation): Uint8Array { + return GeneratedCodeInfo_Annotation.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationProtoMsg { + return { + typeUrl: "/google.protobuf.Annotation", + value: GeneratedCodeInfo_Annotation.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/google/protobuf/duration.ts b/util/inj-types/google/protobuf/duration.ts new file mode 100644 index 00000000..39911aa1 --- /dev/null +++ b/util/inj-types/google/protobuf/duration.ts @@ -0,0 +1,281 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (durations.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: bigint; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} +export interface DurationProtoMsg { + typeUrl: "/google.protobuf.Duration"; + value: Uint8Array; +} +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (durations.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export type DurationAmino = string; +export interface DurationAminoMsg { + type: "/google.protobuf.Duration"; + value: DurationAmino; +} +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (durations.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface DurationSDKType { + seconds: bigint; + nanos: number; +} +function createBaseDuration(): Duration { + return { + seconds: BigInt(0), + nanos: 0 + }; +} +export const Duration = { + typeUrl: "/google.protobuf.Duration", + encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seconds !== BigInt(0)) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Duration { + const message = createBaseDuration(); + message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); + message.nanos = object.nanos ?? 0; + return message; + }, + fromAmino(object: DurationAmino): Duration { + const value = BigInt(object); + return { + seconds: value / BigInt("1000000000"), + nanos: Number(value % BigInt("1000000000")) + }; + }, + toAmino(message: Duration): DurationAmino { + return (message.seconds * BigInt("1000000000") + BigInt(message.nanos)).toString(); + }, + fromAminoMsg(object: DurationAminoMsg): Duration { + return Duration.fromAmino(object.value); + }, + fromProtoMsg(message: DurationProtoMsg): Duration { + return Duration.decode(message.value); + }, + toProto(message: Duration): Uint8Array { + return Duration.encode(message).finish(); + }, + toProtoMsg(message: Duration): DurationProtoMsg { + return { + typeUrl: "/google.protobuf.Duration", + value: Duration.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/google/protobuf/timestamp.ts b/util/inj-types/google/protobuf/timestamp.ts new file mode 100644 index 00000000..b19983bd --- /dev/null +++ b/util/inj-types/google/protobuf/timestamp.ts @@ -0,0 +1,347 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: bigint; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} +export interface TimestampProtoMsg { + typeUrl: "/google.protobuf.Timestamp"; + value: Uint8Array; +} +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export type TimestampAmino = string; +export interface TimestampAminoMsg { + type: "/google.protobuf.Timestamp"; + value: TimestampAmino; +} +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface TimestampSDKType { + seconds: bigint; + nanos: number; +} +function createBaseTimestamp(): Timestamp { + return { + seconds: BigInt(0), + nanos: 0 + }; +} +export const Timestamp = { + typeUrl: "/google.protobuf.Timestamp", + encode(message: Timestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seconds !== BigInt(0)) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); + message.nanos = object.nanos ?? 0; + return message; + }, + fromAmino(object: TimestampAmino): Timestamp { + return fromJsonTimestamp(object); + }, + toAmino(message: Timestamp): TimestampAmino { + return fromTimestamp(message).toISOString().replace(/\.\d+Z$/, "Z"); + }, + fromAminoMsg(object: TimestampAminoMsg): Timestamp { + return Timestamp.fromAmino(object.value); + }, + fromProtoMsg(message: TimestampProtoMsg): Timestamp { + return Timestamp.decode(message.value); + }, + toProto(message: Timestamp): Uint8Array { + return Timestamp.encode(message).finish(); + }, + toProtoMsg(message: Timestamp): TimestampProtoMsg { + return { + typeUrl: "/google.protobuf.Timestamp", + value: Timestamp.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/helpers.ts b/util/inj-types/helpers.ts new file mode 100644 index 00000000..0500faac --- /dev/null +++ b/util/inj-types/helpers.ts @@ -0,0 +1,255 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.5.0 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== 'undefined') return globalThis; + if (typeof self !== 'undefined') return self; + if (typeof window !== 'undefined') return window; + if (typeof global !== 'undefined') return global; + throw 'Unable to locate global object'; +})(); + +const atob: (b64: string) => string = + globalThis.atob || + ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); + +export function bytesFromBase64(b64: string): Uint8Array { + const bin = atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +const btoa: (bin: string) => string = + globalThis.btoa || + ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); + +export function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return btoa(bin.join('')); +} + +export interface AminoHeight { + readonly revision_number?: string; + readonly revision_height?: string; +} + +export function omitDefault( + input: T +): T | undefined { + if (typeof input === 'string') { + return input === '' ? undefined : input; + } + + if (typeof input === 'number') { + return input === 0 ? undefined : input; + } + + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + + if (typeof input === 'bigint') { + return input === BigInt(0) ? undefined : input; + } + + throw new Error(`Got unsupported type ${typeof input}`); +} + +interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: bigint; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + + nanos: number; +} + +export function toDuration(duration: string): Duration { + return { + seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)), + nanos: parseInt(duration) % 1000000000 + }; +} + +export function fromDuration(duration: Duration): string { + return ( + parseInt(duration.seconds.toString()) * 1000000000 + + duration.nanos + ).toString(); +} + +export function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +export interface PageRequest { + key: Uint8Array; + offset: bigint; + limit: bigint; + countTotal: boolean; + reverse: boolean; +} + +export interface PageRequestParams { + 'pagination.key'?: string; + 'pagination.offset'?: string; + 'pagination.limit'?: string; + 'pagination.count_total'?: boolean; + 'pagination.reverse'?: boolean; +} + +export interface Params { + params: PageRequestParams; +} + +export const setPaginationParams = ( + options: Params, + pagination?: PageRequest +) => { + if (!pagination) { + return options; + } + + if (typeof pagination?.countTotal !== 'undefined') { + options.params['pagination.count_total'] = pagination.countTotal; + } + if (typeof pagination?.key !== 'undefined') { + // String to Uint8Array + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + + // Uint8Array to String + options.params['pagination.key'] = Buffer.from(pagination.key).toString( + 'base64' + ); + } + if (typeof pagination?.limit !== 'undefined') { + options.params['pagination.limit'] = pagination.limit.toString(); + } + if (typeof pagination?.offset !== 'undefined') { + options.params['pagination.offset'] = pagination.offset.toString(); + } + if (typeof pagination?.reverse !== 'undefined') { + options.params['pagination.reverse'] = pagination.reverse; + } + + return options; +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | bigint + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude>, + never + >; + +export interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: bigint; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + + nanos: number; +} + +export function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(date.getTime() / 1_000); + const nanos = (date.getTime() % 1000) * 1000000; + return { + seconds, + nanos + }; +} + +export function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1000; + millis += t.nanos / 1000000; + return new Date(millis); +} + +const timestampFromJSON = (object: any): Timestamp => { + return { + seconds: isSet(object.seconds) + ? BigInt(object.seconds.toString()) + : BigInt(0), + nanos: isSet(object.nanos) ? Number(object.nanos) : 0 + }; +}; + +export function fromJsonTimestamp(o: any): Timestamp { + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === 'string') { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } +} + +function numberToLong(number: number) { + return BigInt(Math.trunc(number)); +} + diff --git a/util/inj-types/ibc/applications/interchain_accounts/controller/v1/controller.ts b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/controller.ts new file mode 100644 index 00000000..00efdfad --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/controller.ts @@ -0,0 +1,103 @@ +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { DeepPartial } from "../../../../../helpers"; +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the controller submodule. + */ +export interface Params { + /** controller_enabled enables or disables the controller submodule. */ + controllerEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.Params"; + value: Uint8Array; +} +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the controller submodule. + */ +export interface ParamsAmino { + /** controller_enabled enables or disables the controller submodule. */ + controller_enabled?: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the controller submodule. + */ +export interface ParamsSDKType { + controller_enabled: boolean; +} +function createBaseParams(): Params { + return { + controllerEnabled: false + }; +} +export const Params = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.Params", + aminoType: "cosmos-sdk/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.controllerEnabled === true) { + writer.uint32(8).bool(message.controllerEnabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.controllerEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.controllerEnabled = object.controllerEnabled ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.controller_enabled !== undefined && object.controller_enabled !== null) { + message.controllerEnabled = object.controller_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.controller_enabled = message.controllerEnabled === false ? undefined : message.controllerEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.lcd.ts b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.lcd.ts new file mode 100644 index 00000000..98483dd5 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.lcd.ts @@ -0,0 +1,22 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryInterchainAccountRequest, QueryInterchainAccountResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* InterchainAccount returns the interchain account address for a given owner address on a given connection */ + interchainAccount = async (params: QueryInterchainAccountRequest): Promise => { + const endpoint = `ibc/apps/interchain_accounts/controller/v1/owners/${params.owner}/connections/${params.connectionId}`; + return await this.req.get(endpoint); + }; + /* Params queries all parameters of the ICA controller submodule. */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `ibc/apps/interchain_accounts/controller/v1/params`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.rpc.Query.ts b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.rpc.Query.ts new file mode 100644 index 00000000..317dc7a5 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.rpc.Query.ts @@ -0,0 +1,41 @@ +import { Rpc } from "../../../../../helpers"; +import { BinaryReader } from "../../../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryInterchainAccountRequest, QueryInterchainAccountResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** InterchainAccount returns the interchain account address for a given owner address on a given connection */ + interchainAccount(request: QueryInterchainAccountRequest): Promise; + /** Params queries all parameters of the ICA controller submodule. */ + params(request?: QueryParamsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* InterchainAccount returns the interchain account address for a given owner address on a given connection */ + interchainAccount = async (request: QueryInterchainAccountRequest): Promise => { + const data = QueryInterchainAccountRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.interchain_accounts.controller.v1.Query", "InterchainAccount", data); + return promise.then(data => QueryInterchainAccountResponse.decode(new BinaryReader(data))); + }; + /* Params queries all parameters of the ICA controller submodule. */ + params = async (request: QueryParamsRequest = {}): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.interchain_accounts.controller.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + interchainAccount(request: QueryInterchainAccountRequest): Promise { + return queryService.interchainAccount(request); + }, + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.ts b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.ts new file mode 100644 index 00000000..b7304662 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/query.ts @@ -0,0 +1,361 @@ +import { Params, ParamsAmino, ParamsSDKType } from "./controller"; +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { DeepPartial } from "../../../../../helpers"; +/** QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountRequest { + owner: string; + connectionId: string; +} +export interface QueryInterchainAccountRequestProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest"; + value: Uint8Array; +} +/** QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountRequestAmino { + owner?: string; + connection_id?: string; +} +export interface QueryInterchainAccountRequestAminoMsg { + type: "cosmos-sdk/QueryInterchainAccountRequest"; + value: QueryInterchainAccountRequestAmino; +} +/** QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountRequestSDKType { + owner: string; + connection_id: string; +} +/** QueryInterchainAccountResponse the response type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountResponse { + address: string; +} +export interface QueryInterchainAccountResponseProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse"; + value: Uint8Array; +} +/** QueryInterchainAccountResponse the response type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountResponseAmino { + address?: string; +} +export interface QueryInterchainAccountResponseAminoMsg { + type: "cosmos-sdk/QueryInterchainAccountResponse"; + value: QueryInterchainAccountResponseAmino; +} +/** QueryInterchainAccountResponse the response type for the Query/InterchainAccount RPC method. */ +export interface QueryInterchainAccountResponseSDKType { + address: string; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params?: ParamsSDKType; +} +function createBaseQueryInterchainAccountRequest(): QueryInterchainAccountRequest { + return { + owner: "", + connectionId: "" + }; +} +export const QueryInterchainAccountRequest = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest", + aminoType: "cosmos-sdk/QueryInterchainAccountRequest", + encode(message: QueryInterchainAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInterchainAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInterchainAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryInterchainAccountRequest { + const message = createBaseQueryInterchainAccountRequest(); + message.owner = object.owner ?? ""; + message.connectionId = object.connectionId ?? ""; + return message; + }, + fromAmino(object: QueryInterchainAccountRequestAmino): QueryInterchainAccountRequest { + const message = createBaseQueryInterchainAccountRequest(); + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + return message; + }, + toAmino(message: QueryInterchainAccountRequest): QueryInterchainAccountRequestAmino { + const obj: any = {}; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + return obj; + }, + fromAminoMsg(object: QueryInterchainAccountRequestAminoMsg): QueryInterchainAccountRequest { + return QueryInterchainAccountRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryInterchainAccountRequest): QueryInterchainAccountRequestAminoMsg { + return { + type: "cosmos-sdk/QueryInterchainAccountRequest", + value: QueryInterchainAccountRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryInterchainAccountRequestProtoMsg): QueryInterchainAccountRequest { + return QueryInterchainAccountRequest.decode(message.value); + }, + toProto(message: QueryInterchainAccountRequest): Uint8Array { + return QueryInterchainAccountRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryInterchainAccountRequest): QueryInterchainAccountRequestProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest", + value: QueryInterchainAccountRequest.encode(message).finish() + }; + } +}; +function createBaseQueryInterchainAccountResponse(): QueryInterchainAccountResponse { + return { + address: "" + }; +} +export const QueryInterchainAccountResponse = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse", + aminoType: "cosmos-sdk/QueryInterchainAccountResponse", + encode(message: QueryInterchainAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryInterchainAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInterchainAccountResponse(); + 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: DeepPartial): QueryInterchainAccountResponse { + const message = createBaseQueryInterchainAccountResponse(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryInterchainAccountResponseAmino): QueryInterchainAccountResponse { + const message = createBaseQueryInterchainAccountResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryInterchainAccountResponse): QueryInterchainAccountResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryInterchainAccountResponseAminoMsg): QueryInterchainAccountResponse { + return QueryInterchainAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryInterchainAccountResponse): QueryInterchainAccountResponseAminoMsg { + return { + type: "cosmos-sdk/QueryInterchainAccountResponse", + value: QueryInterchainAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryInterchainAccountResponseProtoMsg): QueryInterchainAccountResponse { + return QueryInterchainAccountResponse.decode(message.value); + }, + toProto(message: QueryInterchainAccountResponse): Uint8Array { + return QueryInterchainAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryInterchainAccountResponse): QueryInterchainAccountResponseProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse", + value: QueryInterchainAccountResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined + }; +} +export const QueryParamsResponse = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts new file mode 100644 index 00000000..3720c96f --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts @@ -0,0 +1,13 @@ +import { MsgRegisterInterchainAccount, MsgSendTx } from "./tx"; +export const AminoConverter = { + "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount": { + aminoType: "cosmos-sdk/MsgRegisterInterchainAccount", + toAmino: MsgRegisterInterchainAccount.toAmino, + fromAmino: MsgRegisterInterchainAccount.fromAmino + }, + "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx": { + aminoType: "cosmos-sdk/MsgSendTx", + toAmino: MsgSendTx.toAmino, + fromAmino: MsgSendTx.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts new file mode 100644 index 00000000..eaeddc0b --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.registry.ts @@ -0,0 +1,53 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgRegisterInterchainAccount, MsgSendTx } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", MsgRegisterInterchainAccount], ["/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", MsgSendTx]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + registerInterchainAccount(value: MsgRegisterInterchainAccount) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", + value: MsgRegisterInterchainAccount.encode(value).finish() + }; + }, + sendTx(value: MsgSendTx) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", + value: MsgSendTx.encode(value).finish() + }; + } + }, + withTypeUrl: { + registerInterchainAccount(value: MsgRegisterInterchainAccount) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", + value + }; + }, + sendTx(value: MsgSendTx) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", + value + }; + } + }, + fromPartial: { + registerInterchainAccount(value: MsgRegisterInterchainAccount) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", + value: MsgRegisterInterchainAccount.fromPartial(value) + }; + }, + sendTx(value: MsgSendTx) { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", + value: MsgSendTx.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.rpc.msg.ts b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..098a6108 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.rpc.msg.ts @@ -0,0 +1,28 @@ +import { Rpc } from "../../../../../helpers"; +import { BinaryReader } from "../../../../../binary"; +import { MsgRegisterInterchainAccount, MsgRegisterInterchainAccountResponse, MsgSendTx, MsgSendTxResponse } from "./tx"; +/** Msg defines the 27-interchain-accounts/controller Msg service. */ +export interface Msg { + /** RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount. */ + registerInterchainAccount(request: MsgRegisterInterchainAccount): Promise; + /** SendTx defines a rpc handler for MsgSendTx. */ + sendTx(request: MsgSendTx): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount. */ + registerInterchainAccount = async (request: MsgRegisterInterchainAccount): Promise => { + const data = MsgRegisterInterchainAccount.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.interchain_accounts.controller.v1.Msg", "RegisterInterchainAccount", data); + return promise.then(data => MsgRegisterInterchainAccountResponse.decode(new BinaryReader(data))); + }; + /* SendTx defines a rpc handler for MsgSendTx. */ + sendTx = async (request: MsgSendTx): Promise => { + const data = MsgSendTx.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.interchain_accounts.controller.v1.Msg", "SendTx", data); + return promise.then(data => MsgSendTxResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.ts b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.ts new file mode 100644 index 00000000..78496524 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/controller/v1/tx.ts @@ -0,0 +1,461 @@ +import { InterchainAccountPacketData, InterchainAccountPacketDataAmino, InterchainAccountPacketDataSDKType } from "../../v1/packet"; +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { DeepPartial } from "../../../../../helpers"; +/** MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount */ +export interface MsgRegisterInterchainAccount { + owner: string; + connectionId: string; + version: string; +} +export interface MsgRegisterInterchainAccountProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount"; + value: Uint8Array; +} +/** MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount */ +export interface MsgRegisterInterchainAccountAmino { + owner?: string; + connection_id?: string; + version?: string; +} +export interface MsgRegisterInterchainAccountAminoMsg { + type: "cosmos-sdk/MsgRegisterInterchainAccount"; + value: MsgRegisterInterchainAccountAmino; +} +/** MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount */ +export interface MsgRegisterInterchainAccountSDKType { + owner: string; + connection_id: string; + version: string; +} +/** MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount */ +export interface MsgRegisterInterchainAccountResponse { + channelId: string; + portId: string; +} +export interface MsgRegisterInterchainAccountResponseProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse"; + value: Uint8Array; +} +/** MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount */ +export interface MsgRegisterInterchainAccountResponseAmino { + channel_id?: string; + port_id?: string; +} +export interface MsgRegisterInterchainAccountResponseAminoMsg { + type: "cosmos-sdk/MsgRegisterInterchainAccountResponse"; + value: MsgRegisterInterchainAccountResponseAmino; +} +/** MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount */ +export interface MsgRegisterInterchainAccountResponseSDKType { + channel_id: string; + port_id: string; +} +/** MsgSendTx defines the payload for Msg/SendTx */ +export interface MsgSendTx { + owner: string; + connectionId: string; + packetData: InterchainAccountPacketData; + /** + * Relative timeout timestamp provided will be added to the current block time during transaction execution. + * The timeout timestamp must be non-zero. + */ + relativeTimeout: bigint; +} +export interface MsgSendTxProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx"; + value: Uint8Array; +} +/** MsgSendTx defines the payload for Msg/SendTx */ +export interface MsgSendTxAmino { + owner?: string; + connection_id?: string; + packet_data?: InterchainAccountPacketDataAmino; + /** + * Relative timeout timestamp provided will be added to the current block time during transaction execution. + * The timeout timestamp must be non-zero. + */ + relative_timeout?: string; +} +export interface MsgSendTxAminoMsg { + type: "cosmos-sdk/MsgSendTx"; + value: MsgSendTxAmino; +} +/** MsgSendTx defines the payload for Msg/SendTx */ +export interface MsgSendTxSDKType { + owner: string; + connection_id: string; + packet_data: InterchainAccountPacketDataSDKType; + relative_timeout: bigint; +} +/** MsgSendTxResponse defines the response for MsgSendTx */ +export interface MsgSendTxResponse { + sequence: bigint; +} +export interface MsgSendTxResponseProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse"; + value: Uint8Array; +} +/** MsgSendTxResponse defines the response for MsgSendTx */ +export interface MsgSendTxResponseAmino { + sequence?: string; +} +export interface MsgSendTxResponseAminoMsg { + type: "cosmos-sdk/MsgSendTxResponse"; + value: MsgSendTxResponseAmino; +} +/** MsgSendTxResponse defines the response for MsgSendTx */ +export interface MsgSendTxResponseSDKType { + sequence: bigint; +} +function createBaseMsgRegisterInterchainAccount(): MsgRegisterInterchainAccount { + return { + owner: "", + connectionId: "", + version: "" + }; +} +export const MsgRegisterInterchainAccount = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", + aminoType: "cosmos-sdk/MsgRegisterInterchainAccount", + encode(message: MsgRegisterInterchainAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterInterchainAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterInterchainAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + case 3: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRegisterInterchainAccount { + const message = createBaseMsgRegisterInterchainAccount(); + message.owner = object.owner ?? ""; + message.connectionId = object.connectionId ?? ""; + message.version = object.version ?? ""; + return message; + }, + fromAmino(object: MsgRegisterInterchainAccountAmino): MsgRegisterInterchainAccount { + const message = createBaseMsgRegisterInterchainAccount(); + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + return message; + }, + toAmino(message: MsgRegisterInterchainAccount): MsgRegisterInterchainAccountAmino { + const obj: any = {}; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.version = message.version === "" ? undefined : message.version; + return obj; + }, + fromAminoMsg(object: MsgRegisterInterchainAccountAminoMsg): MsgRegisterInterchainAccount { + return MsgRegisterInterchainAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgRegisterInterchainAccount): MsgRegisterInterchainAccountAminoMsg { + return { + type: "cosmos-sdk/MsgRegisterInterchainAccount", + value: MsgRegisterInterchainAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRegisterInterchainAccountProtoMsg): MsgRegisterInterchainAccount { + return MsgRegisterInterchainAccount.decode(message.value); + }, + toProto(message: MsgRegisterInterchainAccount): Uint8Array { + return MsgRegisterInterchainAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgRegisterInterchainAccount): MsgRegisterInterchainAccountProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount", + value: MsgRegisterInterchainAccount.encode(message).finish() + }; + } +}; +function createBaseMsgRegisterInterchainAccountResponse(): MsgRegisterInterchainAccountResponse { + return { + channelId: "", + portId: "" + }; +} +export const MsgRegisterInterchainAccountResponse = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse", + aminoType: "cosmos-sdk/MsgRegisterInterchainAccountResponse", + encode(message: MsgRegisterInterchainAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.channelId !== "") { + writer.uint32(10).string(message.channelId); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterInterchainAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterInterchainAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channelId = reader.string(); + break; + case 2: + message.portId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRegisterInterchainAccountResponse { + const message = createBaseMsgRegisterInterchainAccountResponse(); + message.channelId = object.channelId ?? ""; + message.portId = object.portId ?? ""; + return message; + }, + fromAmino(object: MsgRegisterInterchainAccountResponseAmino): MsgRegisterInterchainAccountResponse { + const message = createBaseMsgRegisterInterchainAccountResponse(); + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + return message; + }, + toAmino(message: MsgRegisterInterchainAccountResponse): MsgRegisterInterchainAccountResponseAmino { + const obj: any = {}; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + return obj; + }, + fromAminoMsg(object: MsgRegisterInterchainAccountResponseAminoMsg): MsgRegisterInterchainAccountResponse { + return MsgRegisterInterchainAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRegisterInterchainAccountResponse): MsgRegisterInterchainAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRegisterInterchainAccountResponse", + value: MsgRegisterInterchainAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRegisterInterchainAccountResponseProtoMsg): MsgRegisterInterchainAccountResponse { + return MsgRegisterInterchainAccountResponse.decode(message.value); + }, + toProto(message: MsgRegisterInterchainAccountResponse): Uint8Array { + return MsgRegisterInterchainAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRegisterInterchainAccountResponse): MsgRegisterInterchainAccountResponseProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse", + value: MsgRegisterInterchainAccountResponse.encode(message).finish() + }; + } +}; +function createBaseMsgSendTx(): MsgSendTx { + return { + owner: "", + connectionId: "", + packetData: InterchainAccountPacketData.fromPartial({}), + relativeTimeout: BigInt(0) + }; +} +export const MsgSendTx = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", + aminoType: "cosmos-sdk/MsgSendTx", + encode(message: MsgSendTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.packetData !== undefined) { + InterchainAccountPacketData.encode(message.packetData, writer.uint32(26).fork()).ldelim(); + } + if (message.relativeTimeout !== BigInt(0)) { + writer.uint32(32).uint64(message.relativeTimeout); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.owner = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + case 3: + message.packetData = InterchainAccountPacketData.decode(reader, reader.uint32()); + break; + case 4: + message.relativeTimeout = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSendTx { + const message = createBaseMsgSendTx(); + message.owner = object.owner ?? ""; + message.connectionId = object.connectionId ?? ""; + message.packetData = object.packetData !== undefined && object.packetData !== null ? InterchainAccountPacketData.fromPartial(object.packetData) : undefined; + message.relativeTimeout = object.relativeTimeout !== undefined && object.relativeTimeout !== null ? BigInt(object.relativeTimeout.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSendTxAmino): MsgSendTx { + const message = createBaseMsgSendTx(); + if (object.owner !== undefined && object.owner !== null) { + message.owner = object.owner; + } + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.packet_data !== undefined && object.packet_data !== null) { + message.packetData = InterchainAccountPacketData.fromAmino(object.packet_data); + } + if (object.relative_timeout !== undefined && object.relative_timeout !== null) { + message.relativeTimeout = BigInt(object.relative_timeout); + } + return message; + }, + toAmino(message: MsgSendTx): MsgSendTxAmino { + const obj: any = {}; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.packet_data = message.packetData ? InterchainAccountPacketData.toAmino(message.packetData) : undefined; + obj.relative_timeout = message.relativeTimeout !== BigInt(0) ? message.relativeTimeout.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSendTxAminoMsg): MsgSendTx { + return MsgSendTx.fromAmino(object.value); + }, + toAminoMsg(message: MsgSendTx): MsgSendTxAminoMsg { + return { + type: "cosmos-sdk/MsgSendTx", + value: MsgSendTx.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendTxProtoMsg): MsgSendTx { + return MsgSendTx.decode(message.value); + }, + toProto(message: MsgSendTx): Uint8Array { + return MsgSendTx.encode(message).finish(); + }, + toProtoMsg(message: MsgSendTx): MsgSendTxProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx", + value: MsgSendTx.encode(message).finish() + }; + } +}; +function createBaseMsgSendTxResponse(): MsgSendTxResponse { + return { + sequence: BigInt(0) + }; +} +export const MsgSendTxResponse = { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse", + aminoType: "cosmos-sdk/MsgSendTxResponse", + encode(message: MsgSendTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSendTxResponse { + const message = createBaseMsgSendTxResponse(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSendTxResponseAmino): MsgSendTxResponse { + const message = createBaseMsgSendTxResponse(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: MsgSendTxResponse): MsgSendTxResponseAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSendTxResponseAminoMsg): MsgSendTxResponse { + return MsgSendTxResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSendTxResponse): MsgSendTxResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSendTxResponse", + value: MsgSendTxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendTxResponseProtoMsg): MsgSendTxResponse { + return MsgSendTxResponse.decode(message.value); + }, + toProto(message: MsgSendTxResponse): Uint8Array { + return MsgSendTxResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSendTxResponse): MsgSendTxResponseProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse", + value: MsgSendTxResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/genesis/v1/genesis.ts b/util/inj-types/ibc/applications/interchain_accounts/genesis/v1/genesis.ts new file mode 100644 index 00000000..e62eaa55 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/genesis/v1/genesis.ts @@ -0,0 +1,657 @@ +import { Params as Params1 } from "../../controller/v1/controller"; +import { ParamsAmino as Params1Amino } from "../../controller/v1/controller"; +import { ParamsSDKType as Params1SDKType } from "../../controller/v1/controller"; +import { Params as Params2 } from "../../host/v1/host"; +import { ParamsAmino as Params2Amino } from "../../host/v1/host"; +import { ParamsSDKType as Params2SDKType } from "../../host/v1/host"; +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { DeepPartial } from "../../../../../helpers"; +/** GenesisState defines the interchain accounts genesis state */ +export interface GenesisState { + controllerGenesisState: ControllerGenesisState; + hostGenesisState: HostGenesisState; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the interchain accounts genesis state */ +export interface GenesisStateAmino { + controller_genesis_state?: ControllerGenesisStateAmino; + host_genesis_state?: HostGenesisStateAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the interchain accounts genesis state */ +export interface GenesisStateSDKType { + controller_genesis_state: ControllerGenesisStateSDKType; + host_genesis_state: HostGenesisStateSDKType; +} +/** ControllerGenesisState defines the interchain accounts controller genesis state */ +export interface ControllerGenesisState { + activeChannels: ActiveChannel[]; + interchainAccounts: RegisteredInterchainAccount[]; + ports: string[]; + params: Params1; +} +export interface ControllerGenesisStateProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.ControllerGenesisState"; + value: Uint8Array; +} +/** ControllerGenesisState defines the interchain accounts controller genesis state */ +export interface ControllerGenesisStateAmino { + active_channels?: ActiveChannelAmino[]; + interchain_accounts?: RegisteredInterchainAccountAmino[]; + ports?: string[]; + params?: Params1Amino; +} +export interface ControllerGenesisStateAminoMsg { + type: "cosmos-sdk/ControllerGenesisState"; + value: ControllerGenesisStateAmino; +} +/** ControllerGenesisState defines the interchain accounts controller genesis state */ +export interface ControllerGenesisStateSDKType { + active_channels: ActiveChannelSDKType[]; + interchain_accounts: RegisteredInterchainAccountSDKType[]; + ports: string[]; + params: Params1SDKType; +} +/** HostGenesisState defines the interchain accounts host genesis state */ +export interface HostGenesisState { + activeChannels: ActiveChannel[]; + interchainAccounts: RegisteredInterchainAccount[]; + port: string; + params: Params2; +} +export interface HostGenesisStateProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.HostGenesisState"; + value: Uint8Array; +} +/** HostGenesisState defines the interchain accounts host genesis state */ +export interface HostGenesisStateAmino { + active_channels?: ActiveChannelAmino[]; + interchain_accounts?: RegisteredInterchainAccountAmino[]; + port?: string; + params?: Params2Amino; +} +export interface HostGenesisStateAminoMsg { + type: "cosmos-sdk/HostGenesisState"; + value: HostGenesisStateAmino; +} +/** HostGenesisState defines the interchain accounts host genesis state */ +export interface HostGenesisStateSDKType { + active_channels: ActiveChannelSDKType[]; + interchain_accounts: RegisteredInterchainAccountSDKType[]; + port: string; + params: Params2SDKType; +} +/** + * ActiveChannel contains a connection ID, port ID and associated active channel ID, as well as a boolean flag to + * indicate if the channel is middleware enabled + */ +export interface ActiveChannel { + connectionId: string; + portId: string; + channelId: string; + isMiddlewareEnabled: boolean; +} +export interface ActiveChannelProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.ActiveChannel"; + value: Uint8Array; +} +/** + * ActiveChannel contains a connection ID, port ID and associated active channel ID, as well as a boolean flag to + * indicate if the channel is middleware enabled + */ +export interface ActiveChannelAmino { + connection_id?: string; + port_id?: string; + channel_id?: string; + is_middleware_enabled?: boolean; +} +export interface ActiveChannelAminoMsg { + type: "cosmos-sdk/ActiveChannel"; + value: ActiveChannelAmino; +} +/** + * ActiveChannel contains a connection ID, port ID and associated active channel ID, as well as a boolean flag to + * indicate if the channel is middleware enabled + */ +export interface ActiveChannelSDKType { + connection_id: string; + port_id: string; + channel_id: string; + is_middleware_enabled: boolean; +} +/** RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address */ +export interface RegisteredInterchainAccount { + connectionId: string; + portId: string; + accountAddress: string; +} +export interface RegisteredInterchainAccountProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.RegisteredInterchainAccount"; + value: Uint8Array; +} +/** RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address */ +export interface RegisteredInterchainAccountAmino { + connection_id?: string; + port_id?: string; + account_address?: string; +} +export interface RegisteredInterchainAccountAminoMsg { + type: "cosmos-sdk/RegisteredInterchainAccount"; + value: RegisteredInterchainAccountAmino; +} +/** RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address */ +export interface RegisteredInterchainAccountSDKType { + connection_id: string; + port_id: string; + account_address: string; +} +function createBaseGenesisState(): GenesisState { + return { + controllerGenesisState: ControllerGenesisState.fromPartial({}), + hostGenesisState: HostGenesisState.fromPartial({}) + }; +} +export const GenesisState = { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.controllerGenesisState !== undefined) { + ControllerGenesisState.encode(message.controllerGenesisState, writer.uint32(10).fork()).ldelim(); + } + if (message.hostGenesisState !== undefined) { + HostGenesisState.encode(message.hostGenesisState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.controllerGenesisState = ControllerGenesisState.decode(reader, reader.uint32()); + break; + case 2: + message.hostGenesisState = HostGenesisState.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.controllerGenesisState = object.controllerGenesisState !== undefined && object.controllerGenesisState !== null ? ControllerGenesisState.fromPartial(object.controllerGenesisState) : undefined; + message.hostGenesisState = object.hostGenesisState !== undefined && object.hostGenesisState !== null ? HostGenesisState.fromPartial(object.hostGenesisState) : undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.controller_genesis_state !== undefined && object.controller_genesis_state !== null) { + message.controllerGenesisState = ControllerGenesisState.fromAmino(object.controller_genesis_state); + } + if (object.host_genesis_state !== undefined && object.host_genesis_state !== null) { + message.hostGenesisState = HostGenesisState.fromAmino(object.host_genesis_state); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.controller_genesis_state = message.controllerGenesisState ? ControllerGenesisState.toAmino(message.controllerGenesisState) : undefined; + obj.host_genesis_state = message.hostGenesisState ? HostGenesisState.toAmino(message.hostGenesisState) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; +function createBaseControllerGenesisState(): ControllerGenesisState { + return { + activeChannels: [], + interchainAccounts: [], + ports: [], + params: Params1.fromPartial({}) + }; +} +export const ControllerGenesisState = { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.ControllerGenesisState", + aminoType: "cosmos-sdk/ControllerGenesisState", + encode(message: ControllerGenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.activeChannels) { + ActiveChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.interchainAccounts) { + RegisteredInterchainAccount.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.ports) { + writer.uint32(26).string(v!); + } + if (message.params !== undefined) { + Params1.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ControllerGenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseControllerGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.activeChannels.push(ActiveChannel.decode(reader, reader.uint32())); + break; + case 2: + message.interchainAccounts.push(RegisteredInterchainAccount.decode(reader, reader.uint32())); + break; + case 3: + message.ports.push(reader.string()); + break; + case 4: + message.params = Params1.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ControllerGenesisState { + const message = createBaseControllerGenesisState(); + message.activeChannels = object.activeChannels?.map(e => ActiveChannel.fromPartial(e)) || []; + message.interchainAccounts = object.interchainAccounts?.map(e => RegisteredInterchainAccount.fromPartial(e)) || []; + message.ports = object.ports?.map(e => e) || []; + message.params = object.params !== undefined && object.params !== null ? Params1.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: ControllerGenesisStateAmino): ControllerGenesisState { + const message = createBaseControllerGenesisState(); + message.activeChannels = object.active_channels?.map(e => ActiveChannel.fromAmino(e)) || []; + message.interchainAccounts = object.interchain_accounts?.map(e => RegisteredInterchainAccount.fromAmino(e)) || []; + message.ports = object.ports?.map(e => e) || []; + if (object.params !== undefined && object.params !== null) { + message.params = Params1.fromAmino(object.params); + } + return message; + }, + toAmino(message: ControllerGenesisState): ControllerGenesisStateAmino { + const obj: any = {}; + if (message.activeChannels) { + obj.active_channels = message.activeChannels.map(e => e ? ActiveChannel.toAmino(e) : undefined); + } else { + obj.active_channels = message.activeChannels; + } + if (message.interchainAccounts) { + obj.interchain_accounts = message.interchainAccounts.map(e => e ? RegisteredInterchainAccount.toAmino(e) : undefined); + } else { + obj.interchain_accounts = message.interchainAccounts; + } + if (message.ports) { + obj.ports = message.ports.map(e => e); + } else { + obj.ports = message.ports; + } + obj.params = message.params ? Params1.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: ControllerGenesisStateAminoMsg): ControllerGenesisState { + return ControllerGenesisState.fromAmino(object.value); + }, + toAminoMsg(message: ControllerGenesisState): ControllerGenesisStateAminoMsg { + return { + type: "cosmos-sdk/ControllerGenesisState", + value: ControllerGenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: ControllerGenesisStateProtoMsg): ControllerGenesisState { + return ControllerGenesisState.decode(message.value); + }, + toProto(message: ControllerGenesisState): Uint8Array { + return ControllerGenesisState.encode(message).finish(); + }, + toProtoMsg(message: ControllerGenesisState): ControllerGenesisStateProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.ControllerGenesisState", + value: ControllerGenesisState.encode(message).finish() + }; + } +}; +function createBaseHostGenesisState(): HostGenesisState { + return { + activeChannels: [], + interchainAccounts: [], + port: "", + params: Params2.fromPartial({}) + }; +} +export const HostGenesisState = { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.HostGenesisState", + aminoType: "cosmos-sdk/HostGenesisState", + encode(message: HostGenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.activeChannels) { + ActiveChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.interchainAccounts) { + RegisteredInterchainAccount.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.port !== "") { + writer.uint32(26).string(message.port); + } + if (message.params !== undefined) { + Params2.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HostGenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHostGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.activeChannels.push(ActiveChannel.decode(reader, reader.uint32())); + break; + case 2: + message.interchainAccounts.push(RegisteredInterchainAccount.decode(reader, reader.uint32())); + break; + case 3: + message.port = reader.string(); + break; + case 4: + message.params = Params2.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HostGenesisState { + const message = createBaseHostGenesisState(); + message.activeChannels = object.activeChannels?.map(e => ActiveChannel.fromPartial(e)) || []; + message.interchainAccounts = object.interchainAccounts?.map(e => RegisteredInterchainAccount.fromPartial(e)) || []; + message.port = object.port ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params2.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: HostGenesisStateAmino): HostGenesisState { + const message = createBaseHostGenesisState(); + message.activeChannels = object.active_channels?.map(e => ActiveChannel.fromAmino(e)) || []; + message.interchainAccounts = object.interchain_accounts?.map(e => RegisteredInterchainAccount.fromAmino(e)) || []; + if (object.port !== undefined && object.port !== null) { + message.port = object.port; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params2.fromAmino(object.params); + } + return message; + }, + toAmino(message: HostGenesisState): HostGenesisStateAmino { + const obj: any = {}; + if (message.activeChannels) { + obj.active_channels = message.activeChannels.map(e => e ? ActiveChannel.toAmino(e) : undefined); + } else { + obj.active_channels = message.activeChannels; + } + if (message.interchainAccounts) { + obj.interchain_accounts = message.interchainAccounts.map(e => e ? RegisteredInterchainAccount.toAmino(e) : undefined); + } else { + obj.interchain_accounts = message.interchainAccounts; + } + obj.port = message.port === "" ? undefined : message.port; + obj.params = message.params ? Params2.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: HostGenesisStateAminoMsg): HostGenesisState { + return HostGenesisState.fromAmino(object.value); + }, + toAminoMsg(message: HostGenesisState): HostGenesisStateAminoMsg { + return { + type: "cosmos-sdk/HostGenesisState", + value: HostGenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: HostGenesisStateProtoMsg): HostGenesisState { + return HostGenesisState.decode(message.value); + }, + toProto(message: HostGenesisState): Uint8Array { + return HostGenesisState.encode(message).finish(); + }, + toProtoMsg(message: HostGenesisState): HostGenesisStateProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.HostGenesisState", + value: HostGenesisState.encode(message).finish() + }; + } +}; +function createBaseActiveChannel(): ActiveChannel { + return { + connectionId: "", + portId: "", + channelId: "", + isMiddlewareEnabled: false + }; +} +export const ActiveChannel = { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.ActiveChannel", + aminoType: "cosmos-sdk/ActiveChannel", + encode(message: ActiveChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + if (message.isMiddlewareEnabled === true) { + writer.uint32(32).bool(message.isMiddlewareEnabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ActiveChannel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActiveChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.portId = reader.string(); + break; + case 3: + message.channelId = reader.string(); + break; + case 4: + message.isMiddlewareEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ActiveChannel { + const message = createBaseActiveChannel(); + message.connectionId = object.connectionId ?? ""; + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.isMiddlewareEnabled = object.isMiddlewareEnabled ?? false; + return message; + }, + fromAmino(object: ActiveChannelAmino): ActiveChannel { + const message = createBaseActiveChannel(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.is_middleware_enabled !== undefined && object.is_middleware_enabled !== null) { + message.isMiddlewareEnabled = object.is_middleware_enabled; + } + return message; + }, + toAmino(message: ActiveChannel): ActiveChannelAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.is_middleware_enabled = message.isMiddlewareEnabled === false ? undefined : message.isMiddlewareEnabled; + return obj; + }, + fromAminoMsg(object: ActiveChannelAminoMsg): ActiveChannel { + return ActiveChannel.fromAmino(object.value); + }, + toAminoMsg(message: ActiveChannel): ActiveChannelAminoMsg { + return { + type: "cosmos-sdk/ActiveChannel", + value: ActiveChannel.toAmino(message) + }; + }, + fromProtoMsg(message: ActiveChannelProtoMsg): ActiveChannel { + return ActiveChannel.decode(message.value); + }, + toProto(message: ActiveChannel): Uint8Array { + return ActiveChannel.encode(message).finish(); + }, + toProtoMsg(message: ActiveChannel): ActiveChannelProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.ActiveChannel", + value: ActiveChannel.encode(message).finish() + }; + } +}; +function createBaseRegisteredInterchainAccount(): RegisteredInterchainAccount { + return { + connectionId: "", + portId: "", + accountAddress: "" + }; +} +export const RegisteredInterchainAccount = { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.RegisteredInterchainAccount", + aminoType: "cosmos-sdk/RegisteredInterchainAccount", + encode(message: RegisteredInterchainAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + if (message.accountAddress !== "") { + writer.uint32(26).string(message.accountAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RegisteredInterchainAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredInterchainAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.portId = reader.string(); + break; + case 3: + message.accountAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RegisteredInterchainAccount { + const message = createBaseRegisteredInterchainAccount(); + message.connectionId = object.connectionId ?? ""; + message.portId = object.portId ?? ""; + message.accountAddress = object.accountAddress ?? ""; + return message; + }, + fromAmino(object: RegisteredInterchainAccountAmino): RegisteredInterchainAccount { + const message = createBaseRegisteredInterchainAccount(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.account_address !== undefined && object.account_address !== null) { + message.accountAddress = object.account_address; + } + return message; + }, + toAmino(message: RegisteredInterchainAccount): RegisteredInterchainAccountAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + return obj; + }, + fromAminoMsg(object: RegisteredInterchainAccountAminoMsg): RegisteredInterchainAccount { + return RegisteredInterchainAccount.fromAmino(object.value); + }, + toAminoMsg(message: RegisteredInterchainAccount): RegisteredInterchainAccountAminoMsg { + return { + type: "cosmos-sdk/RegisteredInterchainAccount", + value: RegisteredInterchainAccount.toAmino(message) + }; + }, + fromProtoMsg(message: RegisteredInterchainAccountProtoMsg): RegisteredInterchainAccount { + return RegisteredInterchainAccount.decode(message.value); + }, + toProto(message: RegisteredInterchainAccount): Uint8Array { + return RegisteredInterchainAccount.encode(message).finish(); + }, + toProtoMsg(message: RegisteredInterchainAccount): RegisteredInterchainAccountProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.genesis.v1.RegisteredInterchainAccount", + value: RegisteredInterchainAccount.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/host/v1/host.ts b/util/inj-types/ibc/applications/interchain_accounts/host/v1/host.ts new file mode 100644 index 00000000..319fdf16 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/host/v1/host.ts @@ -0,0 +1,122 @@ +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { DeepPartial } from "../../../../../helpers"; +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the host submodule. + */ +export interface Params { + /** host_enabled enables or disables the host submodule. */ + hostEnabled: boolean; + /** allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. */ + allowMessages: string[]; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.Params"; + value: Uint8Array; +} +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the host submodule. + */ +export interface ParamsAmino { + /** host_enabled enables or disables the host submodule. */ + host_enabled?: boolean; + /** allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. */ + allow_messages?: string[]; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the host submodule. + */ +export interface ParamsSDKType { + host_enabled: boolean; + allow_messages: string[]; +} +function createBaseParams(): Params { + return { + hostEnabled: false, + allowMessages: [] + }; +} +export const Params = { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.Params", + aminoType: "cosmos-sdk/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hostEnabled === true) { + writer.uint32(8).bool(message.hostEnabled); + } + for (const v of message.allowMessages) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hostEnabled = reader.bool(); + break; + case 2: + message.allowMessages.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.hostEnabled = object.hostEnabled ?? false; + message.allowMessages = object.allowMessages?.map(e => e) || []; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.host_enabled !== undefined && object.host_enabled !== null) { + message.hostEnabled = object.host_enabled; + } + message.allowMessages = object.allow_messages?.map(e => e) || []; + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.host_enabled = message.hostEnabled === false ? undefined : message.hostEnabled; + if (message.allowMessages) { + obj.allow_messages = message.allowMessages.map(e => e); + } else { + obj.allow_messages = message.allowMessages; + } + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.lcd.ts b/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.lcd.ts new file mode 100644 index 00000000..434db560 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.lcd.ts @@ -0,0 +1,17 @@ +import { LCDClient } from "@cosmology/lcd"; +import { QueryParamsRequest, QueryParamsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Params queries all parameters of the ICA host submodule. */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `ibc/apps/interchain_accounts/host/v1/params`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.rpc.Query.ts b/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.rpc.Query.ts new file mode 100644 index 00000000..10e9eea6 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.rpc.Query.ts @@ -0,0 +1,30 @@ +import { Rpc } from "../../../../../helpers"; +import { BinaryReader } from "../../../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParamsRequest, QueryParamsResponse } from "./query"; +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** Params queries all parameters of the ICA host submodule. */ + params(request?: QueryParamsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Params queries all parameters of the ICA host submodule. */ + params = async (request: QueryParamsRequest = {}): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.interchain_accounts.host.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.ts b/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.ts new file mode 100644 index 00000000..8132991c --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/host/v1/query.ts @@ -0,0 +1,166 @@ +import { Params, ParamsAmino, ParamsSDKType } from "./host"; +import { BinaryReader, BinaryWriter } from "../../../../../binary"; +import { DeepPartial } from "../../../../../helpers"; +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params?: ParamsSDKType; +} +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined + }; +} +export const QueryParamsResponse = { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/v1/account.ts b/util/inj-types/ibc/applications/interchain_accounts/v1/account.ts new file mode 100644 index 00000000..1e07eb87 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/v1/account.ts @@ -0,0 +1,111 @@ +import { BaseAccount, BaseAccountAmino, BaseAccountSDKType } from "../../../../cosmos/auth/v1beta1/auth"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain */ +export interface InterchainAccount { + $typeUrl?: "/ibc.applications.interchain_accounts.v1.InterchainAccount"; + baseAccount?: BaseAccount; + accountOwner: string; +} +export interface InterchainAccountProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.v1.InterchainAccount"; + value: Uint8Array; +} +/** An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain */ +export interface InterchainAccountAmino { + base_account?: BaseAccountAmino; + account_owner?: string; +} +export interface InterchainAccountAminoMsg { + type: "cosmos-sdk/InterchainAccount"; + value: InterchainAccountAmino; +} +/** An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain */ +export interface InterchainAccountSDKType { + $typeUrl?: "/ibc.applications.interchain_accounts.v1.InterchainAccount"; + base_account?: BaseAccountSDKType; + account_owner: string; +} +function createBaseInterchainAccount(): InterchainAccount { + return { + $typeUrl: "/ibc.applications.interchain_accounts.v1.InterchainAccount", + baseAccount: undefined, + accountOwner: "" + }; +} +export const InterchainAccount = { + typeUrl: "/ibc.applications.interchain_accounts.v1.InterchainAccount", + aminoType: "cosmos-sdk/InterchainAccount", + encode(message: InterchainAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.accountOwner !== "") { + writer.uint32(18).string(message.accountOwner); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InterchainAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterchainAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.accountOwner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): InterchainAccount { + const message = createBaseInterchainAccount(); + message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; + message.accountOwner = object.accountOwner ?? ""; + return message; + }, + fromAmino(object: InterchainAccountAmino): InterchainAccount { + const message = createBaseInterchainAccount(); + if (object.base_account !== undefined && object.base_account !== null) { + message.baseAccount = BaseAccount.fromAmino(object.base_account); + } + if (object.account_owner !== undefined && object.account_owner !== null) { + message.accountOwner = object.account_owner; + } + return message; + }, + toAmino(message: InterchainAccount): InterchainAccountAmino { + const obj: any = {}; + obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; + obj.account_owner = message.accountOwner === "" ? undefined : message.accountOwner; + return obj; + }, + fromAminoMsg(object: InterchainAccountAminoMsg): InterchainAccount { + return InterchainAccount.fromAmino(object.value); + }, + toAminoMsg(message: InterchainAccount): InterchainAccountAminoMsg { + return { + type: "cosmos-sdk/InterchainAccount", + value: InterchainAccount.toAmino(message) + }; + }, + fromProtoMsg(message: InterchainAccountProtoMsg): InterchainAccount { + return InterchainAccount.decode(message.value); + }, + toProto(message: InterchainAccount): Uint8Array { + return InterchainAccount.encode(message).finish(); + }, + toProtoMsg(message: InterchainAccount): InterchainAccountProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.v1.InterchainAccount", + value: InterchainAccount.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/v1/metadata.ts b/util/inj-types/ibc/applications/interchain_accounts/v1/metadata.ts new file mode 100644 index 00000000..f7b45929 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/v1/metadata.ts @@ -0,0 +1,194 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** + * Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring + * See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning + */ +export interface Metadata { + /** version defines the ICS27 protocol version */ + version: string; + /** controller_connection_id is the connection identifier associated with the controller chain */ + controllerConnectionId: string; + /** host_connection_id is the connection identifier associated with the host chain */ + hostConnectionId: string; + /** + * address defines the interchain account address to be fulfilled upon the OnChanOpenTry handshake step + * NOTE: the address field is empty on the OnChanOpenInit handshake step + */ + address: string; + /** encoding defines the supported codec format */ + encoding: string; + /** tx_type defines the type of transactions the interchain account can execute */ + txType: string; +} +export interface MetadataProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.v1.Metadata"; + value: Uint8Array; +} +/** + * Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring + * See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning + */ +export interface MetadataAmino { + /** version defines the ICS27 protocol version */ + version?: string; + /** controller_connection_id is the connection identifier associated with the controller chain */ + controller_connection_id?: string; + /** host_connection_id is the connection identifier associated with the host chain */ + host_connection_id?: string; + /** + * address defines the interchain account address to be fulfilled upon the OnChanOpenTry handshake step + * NOTE: the address field is empty on the OnChanOpenInit handshake step + */ + address?: string; + /** encoding defines the supported codec format */ + encoding?: string; + /** tx_type defines the type of transactions the interchain account can execute */ + tx_type?: string; +} +export interface MetadataAminoMsg { + type: "cosmos-sdk/Metadata"; + value: MetadataAmino; +} +/** + * Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring + * See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning + */ +export interface MetadataSDKType { + version: string; + controller_connection_id: string; + host_connection_id: string; + address: string; + encoding: string; + tx_type: string; +} +function createBaseMetadata(): Metadata { + return { + version: "", + controllerConnectionId: "", + hostConnectionId: "", + address: "", + encoding: "", + txType: "" + }; +} +export const Metadata = { + typeUrl: "/ibc.applications.interchain_accounts.v1.Metadata", + aminoType: "cosmos-sdk/Metadata", + encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.controllerConnectionId !== "") { + writer.uint32(18).string(message.controllerConnectionId); + } + if (message.hostConnectionId !== "") { + writer.uint32(26).string(message.hostConnectionId); + } + if (message.address !== "") { + writer.uint32(34).string(message.address); + } + if (message.encoding !== "") { + writer.uint32(42).string(message.encoding); + } + if (message.txType !== "") { + writer.uint32(50).string(message.txType); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.controllerConnectionId = reader.string(); + break; + case 3: + message.hostConnectionId = reader.string(); + break; + case 4: + message.address = reader.string(); + break; + case 5: + message.encoding = reader.string(); + break; + case 6: + message.txType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Metadata { + const message = createBaseMetadata(); + message.version = object.version ?? ""; + message.controllerConnectionId = object.controllerConnectionId ?? ""; + message.hostConnectionId = object.hostConnectionId ?? ""; + message.address = object.address ?? ""; + message.encoding = object.encoding ?? ""; + message.txType = object.txType ?? ""; + return message; + }, + fromAmino(object: MetadataAmino): Metadata { + const message = createBaseMetadata(); + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.controller_connection_id !== undefined && object.controller_connection_id !== null) { + message.controllerConnectionId = object.controller_connection_id; + } + if (object.host_connection_id !== undefined && object.host_connection_id !== null) { + message.hostConnectionId = object.host_connection_id; + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.encoding !== undefined && object.encoding !== null) { + message.encoding = object.encoding; + } + if (object.tx_type !== undefined && object.tx_type !== null) { + message.txType = object.tx_type; + } + return message; + }, + toAmino(message: Metadata): MetadataAmino { + const obj: any = {}; + obj.version = message.version === "" ? undefined : message.version; + obj.controller_connection_id = message.controllerConnectionId === "" ? undefined : message.controllerConnectionId; + obj.host_connection_id = message.hostConnectionId === "" ? undefined : message.hostConnectionId; + obj.address = message.address === "" ? undefined : message.address; + obj.encoding = message.encoding === "" ? undefined : message.encoding; + obj.tx_type = message.txType === "" ? undefined : message.txType; + return obj; + }, + fromAminoMsg(object: MetadataAminoMsg): Metadata { + return Metadata.fromAmino(object.value); + }, + toAminoMsg(message: Metadata): MetadataAminoMsg { + return { + type: "cosmos-sdk/Metadata", + value: Metadata.toAmino(message) + }; + }, + fromProtoMsg(message: MetadataProtoMsg): Metadata { + return Metadata.decode(message.value); + }, + toProto(message: Metadata): Uint8Array { + return Metadata.encode(message).finish(); + }, + toProtoMsg(message: Metadata): MetadataProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.v1.Metadata", + value: Metadata.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/interchain_accounts/v1/packet.ts b/util/inj-types/ibc/applications/interchain_accounts/v1/packet.ts new file mode 100644 index 00000000..20309220 --- /dev/null +++ b/util/inj-types/ibc/applications/interchain_accounts/v1/packet.ts @@ -0,0 +1,253 @@ +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * Type defines a classification of message issued from a controller chain to its associated interchain accounts + * host + */ +export enum Type { + /** TYPE_UNSPECIFIED - Default zero value enumeration */ + TYPE_UNSPECIFIED = 0, + /** TYPE_EXECUTE_TX - Execute a transaction on an interchain accounts host chain */ + TYPE_EXECUTE_TX = 1, + UNRECOGNIZED = -1, +} +export const TypeSDKType = Type; +export const TypeAmino = Type; +export function typeFromJSON(object: any): Type { + switch (object) { + case 0: + case "TYPE_UNSPECIFIED": + return Type.TYPE_UNSPECIFIED; + case 1: + case "TYPE_EXECUTE_TX": + return Type.TYPE_EXECUTE_TX; + case -1: + case "UNRECOGNIZED": + default: + return Type.UNRECOGNIZED; + } +} +export function typeToJSON(object: Type): string { + switch (object) { + case Type.TYPE_UNSPECIFIED: + return "TYPE_UNSPECIFIED"; + case Type.TYPE_EXECUTE_TX: + return "TYPE_EXECUTE_TX"; + case Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field. */ +export interface InterchainAccountPacketData { + type: Type; + data: Uint8Array; + memo: string; +} +export interface InterchainAccountPacketDataProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.v1.InterchainAccountPacketData"; + value: Uint8Array; +} +/** InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field. */ +export interface InterchainAccountPacketDataAmino { + type?: Type; + data?: string; + memo?: string; +} +export interface InterchainAccountPacketDataAminoMsg { + type: "cosmos-sdk/InterchainAccountPacketData"; + value: InterchainAccountPacketDataAmino; +} +/** InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field. */ +export interface InterchainAccountPacketDataSDKType { + type: Type; + data: Uint8Array; + memo: string; +} +/** CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain. */ +export interface CosmosTx { + messages: Any[]; +} +export interface CosmosTxProtoMsg { + typeUrl: "/ibc.applications.interchain_accounts.v1.CosmosTx"; + value: Uint8Array; +} +/** CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain. */ +export interface CosmosTxAmino { + messages?: AnyAmino[]; +} +export interface CosmosTxAminoMsg { + type: "cosmos-sdk/CosmosTx"; + value: CosmosTxAmino; +} +/** CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain. */ +export interface CosmosTxSDKType { + messages: AnySDKType[]; +} +function createBaseInterchainAccountPacketData(): InterchainAccountPacketData { + return { + type: 0, + data: new Uint8Array(), + memo: "" + }; +} +export const InterchainAccountPacketData = { + typeUrl: "/ibc.applications.interchain_accounts.v1.InterchainAccountPacketData", + aminoType: "cosmos-sdk/InterchainAccountPacketData", + encode(message: InterchainAccountPacketData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.memo !== "") { + writer.uint32(26).string(message.memo); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InterchainAccountPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterchainAccountPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.memo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): InterchainAccountPacketData { + const message = createBaseInterchainAccountPacketData(); + message.type = object.type ?? 0; + message.data = object.data ?? new Uint8Array(); + message.memo = object.memo ?? ""; + return message; + }, + fromAmino(object: InterchainAccountPacketDataAmino): InterchainAccountPacketData { + const message = createBaseInterchainAccountPacketData(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + return message; + }, + toAmino(message: InterchainAccountPacketData): InterchainAccountPacketDataAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.memo = message.memo === "" ? undefined : message.memo; + return obj; + }, + fromAminoMsg(object: InterchainAccountPacketDataAminoMsg): InterchainAccountPacketData { + return InterchainAccountPacketData.fromAmino(object.value); + }, + toAminoMsg(message: InterchainAccountPacketData): InterchainAccountPacketDataAminoMsg { + return { + type: "cosmos-sdk/InterchainAccountPacketData", + value: InterchainAccountPacketData.toAmino(message) + }; + }, + fromProtoMsg(message: InterchainAccountPacketDataProtoMsg): InterchainAccountPacketData { + return InterchainAccountPacketData.decode(message.value); + }, + toProto(message: InterchainAccountPacketData): Uint8Array { + return InterchainAccountPacketData.encode(message).finish(); + }, + toProtoMsg(message: InterchainAccountPacketData): InterchainAccountPacketDataProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.v1.InterchainAccountPacketData", + value: InterchainAccountPacketData.encode(message).finish() + }; + } +}; +function createBaseCosmosTx(): CosmosTx { + return { + messages: [] + }; +} +export const CosmosTx = { + typeUrl: "/ibc.applications.interchain_accounts.v1.CosmosTx", + aminoType: "cosmos-sdk/CosmosTx", + encode(message: CosmosTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CosmosTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCosmosTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CosmosTx { + const message = createBaseCosmosTx(); + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CosmosTxAmino): CosmosTx { + const message = createBaseCosmosTx(); + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: CosmosTx): CosmosTxAmino { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + return obj; + }, + fromAminoMsg(object: CosmosTxAminoMsg): CosmosTx { + return CosmosTx.fromAmino(object.value); + }, + toAminoMsg(message: CosmosTx): CosmosTxAminoMsg { + return { + type: "cosmos-sdk/CosmosTx", + value: CosmosTx.toAmino(message) + }; + }, + fromProtoMsg(message: CosmosTxProtoMsg): CosmosTx { + return CosmosTx.decode(message.value); + }, + toProto(message: CosmosTx): Uint8Array { + return CosmosTx.encode(message).finish(); + }, + toProtoMsg(message: CosmosTx): CosmosTxProtoMsg { + return { + typeUrl: "/ibc.applications.interchain_accounts.v1.CosmosTx", + value: CosmosTx.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/authz.ts b/util/inj-types/ibc/applications/transfer/v1/authz.ts new file mode 100644 index 00000000..0efb1a1e --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/authz.ts @@ -0,0 +1,256 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** Allocation defines the spend limit for a particular port and channel */ +export interface Allocation { + /** the port on which the packet will be sent */ + sourcePort: string; + /** the channel by which the packet will be sent */ + sourceChannel: string; + /** spend limitation on the channel */ + spendLimit: Coin[]; + /** allow list of receivers, an empty allow list permits any receiver address */ + allowList: string[]; +} +export interface AllocationProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.Allocation"; + value: Uint8Array; +} +/** Allocation defines the spend limit for a particular port and channel */ +export interface AllocationAmino { + /** the port on which the packet will be sent */ + source_port?: string; + /** the channel by which the packet will be sent */ + source_channel?: string; + /** spend limitation on the channel */ + spend_limit?: CoinAmino[]; + /** allow list of receivers, an empty allow list permits any receiver address */ + allow_list?: string[]; +} +export interface AllocationAminoMsg { + type: "cosmos-sdk/Allocation"; + value: AllocationAmino; +} +/** Allocation defines the spend limit for a particular port and channel */ +export interface AllocationSDKType { + source_port: string; + source_channel: string; + spend_limit: CoinSDKType[]; + allow_list: string[]; +} +/** + * TransferAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account for ibc transfer on a specific channel + */ +export interface TransferAuthorization { + $typeUrl?: "/ibc.applications.transfer.v1.TransferAuthorization"; + /** port and channel amounts */ + allocations: Allocation[]; +} +export interface TransferAuthorizationProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.TransferAuthorization"; + value: Uint8Array; +} +/** + * TransferAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account for ibc transfer on a specific channel + */ +export interface TransferAuthorizationAmino { + /** port and channel amounts */ + allocations?: AllocationAmino[]; +} +export interface TransferAuthorizationAminoMsg { + type: "cosmos-sdk/TransferAuthorization"; + value: TransferAuthorizationAmino; +} +/** + * TransferAuthorization allows the grantee to spend up to spend_limit coins from + * the granter's account for ibc transfer on a specific channel + */ +export interface TransferAuthorizationSDKType { + $typeUrl?: "/ibc.applications.transfer.v1.TransferAuthorization"; + allocations: AllocationSDKType[]; +} +function createBaseAllocation(): Allocation { + return { + sourcePort: "", + sourceChannel: "", + spendLimit: [], + allowList: [] + }; +} +export const Allocation = { + typeUrl: "/ibc.applications.transfer.v1.Allocation", + aminoType: "cosmos-sdk/Allocation", + encode(message: Allocation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sourcePort !== "") { + writer.uint32(10).string(message.sourcePort); + } + if (message.sourceChannel !== "") { + writer.uint32(18).string(message.sourceChannel); + } + for (const v of message.spendLimit) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.allowList) { + writer.uint32(34).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Allocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllocation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourcePort = reader.string(); + break; + case 2: + message.sourceChannel = reader.string(); + break; + case 3: + message.spendLimit.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.allowList.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Allocation { + const message = createBaseAllocation(); + message.sourcePort = object.sourcePort ?? ""; + message.sourceChannel = object.sourceChannel ?? ""; + message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || []; + message.allowList = object.allowList?.map(e => e) || []; + return message; + }, + fromAmino(object: AllocationAmino): Allocation { + const message = createBaseAllocation(); + if (object.source_port !== undefined && object.source_port !== null) { + message.sourcePort = object.source_port; + } + if (object.source_channel !== undefined && object.source_channel !== null) { + message.sourceChannel = object.source_channel; + } + message.spendLimit = object.spend_limit?.map(e => Coin.fromAmino(e)) || []; + message.allowList = object.allow_list?.map(e => e) || []; + return message; + }, + toAmino(message: Allocation): AllocationAmino { + const obj: any = {}; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + if (message.spendLimit) { + obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.spend_limit = message.spendLimit; + } + if (message.allowList) { + obj.allow_list = message.allowList.map(e => e); + } else { + obj.allow_list = message.allowList; + } + return obj; + }, + fromAminoMsg(object: AllocationAminoMsg): Allocation { + return Allocation.fromAmino(object.value); + }, + toAminoMsg(message: Allocation): AllocationAminoMsg { + return { + type: "cosmos-sdk/Allocation", + value: Allocation.toAmino(message) + }; + }, + fromProtoMsg(message: AllocationProtoMsg): Allocation { + return Allocation.decode(message.value); + }, + toProto(message: Allocation): Uint8Array { + return Allocation.encode(message).finish(); + }, + toProtoMsg(message: Allocation): AllocationProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.Allocation", + value: Allocation.encode(message).finish() + }; + } +}; +function createBaseTransferAuthorization(): TransferAuthorization { + return { + $typeUrl: "/ibc.applications.transfer.v1.TransferAuthorization", + allocations: [] + }; +} +export const TransferAuthorization = { + typeUrl: "/ibc.applications.transfer.v1.TransferAuthorization", + aminoType: "cosmos-sdk/TransferAuthorization", + encode(message: TransferAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.allocations) { + Allocation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TransferAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTransferAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allocations.push(Allocation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TransferAuthorization { + const message = createBaseTransferAuthorization(); + message.allocations = object.allocations?.map(e => Allocation.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TransferAuthorizationAmino): TransferAuthorization { + const message = createBaseTransferAuthorization(); + message.allocations = object.allocations?.map(e => Allocation.fromAmino(e)) || []; + return message; + }, + toAmino(message: TransferAuthorization): TransferAuthorizationAmino { + const obj: any = {}; + if (message.allocations) { + obj.allocations = message.allocations.map(e => e ? Allocation.toAmino(e) : undefined); + } else { + obj.allocations = message.allocations; + } + return obj; + }, + fromAminoMsg(object: TransferAuthorizationAminoMsg): TransferAuthorization { + return TransferAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: TransferAuthorization): TransferAuthorizationAminoMsg { + return { + type: "cosmos-sdk/TransferAuthorization", + value: TransferAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: TransferAuthorizationProtoMsg): TransferAuthorization { + return TransferAuthorization.decode(message.value); + }, + toProto(message: TransferAuthorization): Uint8Array { + return TransferAuthorization.encode(message).finish(); + }, + toProtoMsg(message: TransferAuthorization): TransferAuthorizationProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.TransferAuthorization", + value: TransferAuthorization.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/genesis.ts b/util/inj-types/ibc/applications/transfer/v1/genesis.ts new file mode 100644 index 00000000..9ff2ac6b --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/genesis.ts @@ -0,0 +1,151 @@ +import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; +import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** GenesisState defines the ibc-transfer genesis state */ +export interface GenesisState { + portId: string; + denomTraces: DenomTrace[]; + params: Params; + /** + * total_escrowed contains the total amount of tokens escrowed + * by the transfer module + */ + totalEscrowed: Coin[]; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the ibc-transfer genesis state */ +export interface GenesisStateAmino { + port_id?: string; + denom_traces?: DenomTraceAmino[]; + params?: ParamsAmino; + /** + * total_escrowed contains the total amount of tokens escrowed + * by the transfer module + */ + total_escrowed?: CoinAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the ibc-transfer genesis state */ +export interface GenesisStateSDKType { + port_id: string; + denom_traces: DenomTraceSDKType[]; + params: ParamsSDKType; + total_escrowed: CoinSDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + portId: "", + denomTraces: [], + params: Params.fromPartial({}), + totalEscrowed: [] + }; +} +export const GenesisState = { + typeUrl: "/ibc.applications.transfer.v1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + for (const v of message.denomTraces) { + DenomTrace.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.totalEscrowed) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.portId = reader.string(); + break; + case 2: + message.denomTraces.push(DenomTrace.decode(reader, reader.uint32())); + break; + case 3: + message.params = Params.decode(reader, reader.uint32()); + break; + case 4: + message.totalEscrowed.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.portId = object.portId ?? ""; + message.denomTraces = object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.totalEscrowed = object.totalEscrowed?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + message.denomTraces = object.denom_traces?.map(e => DenomTrace.fromAmino(e)) || []; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + message.totalEscrowed = object.total_escrowed?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + if (message.denomTraces) { + obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); + } else { + obj.denom_traces = message.denomTraces; + } + obj.params = message.params ? Params.toAmino(message.params) : undefined; + if (message.totalEscrowed) { + obj.total_escrowed = message.totalEscrowed.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_escrowed = message.totalEscrowed; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/query.lcd.ts b/util/inj-types/ibc/applications/transfer/v1/query.lcd.ts new file mode 100644 index 00000000..1176fc78 --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/query.lcd.ts @@ -0,0 +1,69 @@ +import { setPaginationParams } from "../../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryDenomTraceRequest, QueryDenomTraceResponseSDKType, QueryDenomTracesRequest, QueryDenomTracesResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDenomHashRequest, QueryDenomHashResponseSDKType, QueryEscrowAddressRequest, QueryEscrowAddressResponseSDKType, QueryTotalEscrowForDenomRequest, QueryTotalEscrowForDenomResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* DenomTrace queries a denomination trace information. */ + denomTrace = async (params: QueryDenomTraceRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.hash !== "undefined") { + options.params.hash = params.hash; + } + const endpoint = `ibc/apps/transfer/v1/denom_traces/${params.hash}`; + return await this.req.get(endpoint, options); + }; + /* DenomTraces queries all denomination traces. */ + denomTraces = async (params: QueryDenomTracesRequest = { + pagination: undefined + }): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `ibc/apps/transfer/v1/denom_traces`; + return await this.req.get(endpoint, options); + }; + /* Params queries all parameters of the ibc-transfer module. */ + params = async (_params: QueryParamsRequest = {}): Promise => { + const endpoint = `ibc/apps/transfer/v1/params`; + return await this.req.get(endpoint); + }; + /* DenomHash queries a denomination hash information. */ + denomHash = async (params: QueryDenomHashRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.trace !== "undefined") { + options.params.trace = params.trace; + } + const endpoint = `ibc/apps/transfer/v1/denom_hashes/${params.trace}`; + return await this.req.get(endpoint, options); + }; + /* EscrowAddress returns the escrow address for a particular port and channel id. */ + escrowAddress = async (params: QueryEscrowAddressRequest): Promise => { + const endpoint = `ibc/apps/transfer/v1/channels/${params.channelId}/ports/${params.portId}/escrow_address`; + return await this.req.get(endpoint); + }; + /* TotalEscrowForDenom returns the total amount of tokens in escrow based on the denom. */ + totalEscrowForDenom = async (params: QueryTotalEscrowForDenomRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.denom !== "undefined") { + options.params.denom = params.denom; + } + const endpoint = `ibc/apps/transfer/v1/denoms/${params.denom}/total_escrow`; + return await this.req.get(endpoint, options); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/query.rpc.Query.ts b/util/inj-types/ibc/applications/transfer/v1/query.rpc.Query.ts new file mode 100644 index 00000000..a6ca9a40 --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/query.rpc.Query.ts @@ -0,0 +1,87 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryDenomTraceRequest, QueryDenomTraceResponse, QueryDenomTracesRequest, QueryDenomTracesResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomHashRequest, QueryDenomHashResponse, QueryEscrowAddressRequest, QueryEscrowAddressResponse, QueryTotalEscrowForDenomRequest, QueryTotalEscrowForDenomResponse } from "./query"; +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** DenomTrace queries a denomination trace information. */ + denomTrace(request: QueryDenomTraceRequest): Promise; + /** DenomTraces queries all denomination traces. */ + denomTraces(request?: QueryDenomTracesRequest): Promise; + /** Params queries all parameters of the ibc-transfer module. */ + params(request?: QueryParamsRequest): Promise; + /** DenomHash queries a denomination hash information. */ + denomHash(request: QueryDenomHashRequest): Promise; + /** EscrowAddress returns the escrow address for a particular port and channel id. */ + escrowAddress(request: QueryEscrowAddressRequest): Promise; + /** TotalEscrowForDenom returns the total amount of tokens in escrow based on the denom. */ + totalEscrowForDenom(request: QueryTotalEscrowForDenomRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* DenomTrace queries a denomination trace information. */ + denomTrace = async (request: QueryDenomTraceRequest): Promise => { + const data = QueryDenomTraceRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTrace", data); + return promise.then(data => QueryDenomTraceResponse.decode(new BinaryReader(data))); + }; + /* DenomTraces queries all denomination traces. */ + denomTraces = async (request: QueryDenomTracesRequest = { + pagination: undefined + }): Promise => { + const data = QueryDenomTracesRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomTraces", data); + return promise.then(data => QueryDenomTracesResponse.decode(new BinaryReader(data))); + }; + /* Params queries all parameters of the ibc-transfer module. */ + params = async (request: QueryParamsRequest = {}): Promise => { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data))); + }; + /* DenomHash queries a denomination hash information. */ + denomHash = async (request: QueryDenomHashRequest): Promise => { + const data = QueryDenomHashRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "DenomHash", data); + return promise.then(data => QueryDenomHashResponse.decode(new BinaryReader(data))); + }; + /* EscrowAddress returns the escrow address for a particular port and channel id. */ + escrowAddress = async (request: QueryEscrowAddressRequest): Promise => { + const data = QueryEscrowAddressRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "EscrowAddress", data); + return promise.then(data => QueryEscrowAddressResponse.decode(new BinaryReader(data))); + }; + /* TotalEscrowForDenom returns the total amount of tokens in escrow based on the denom. */ + totalEscrowForDenom = async (request: QueryTotalEscrowForDenomRequest): Promise => { + const data = QueryTotalEscrowForDenomRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Query", "TotalEscrowForDenom", data); + return promise.then(data => QueryTotalEscrowForDenomResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + denomTrace(request: QueryDenomTraceRequest): Promise { + return queryService.denomTrace(request); + }, + denomTraces(request?: QueryDenomTracesRequest): Promise { + return queryService.denomTraces(request); + }, + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + }, + denomHash(request: QueryDenomHashRequest): Promise { + return queryService.denomHash(request); + }, + escrowAddress(request: QueryEscrowAddressRequest): Promise { + return queryService.escrowAddress(request); + }, + totalEscrowForDenom(request: QueryTotalEscrowForDenomRequest): Promise { + return queryService.totalEscrowForDenom(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/query.ts b/util/inj-types/ibc/applications/transfer/v1/query.ts new file mode 100644 index 00000000..4b606224 --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/query.ts @@ -0,0 +1,1174 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; +import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** + * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * method + */ +export interface QueryDenomTraceRequest { + /** hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. */ + hash?: string; +} +export interface QueryDenomTraceRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest"; + value: Uint8Array; +} +/** + * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * method + */ +export interface QueryDenomTraceRequestAmino { + /** hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. */ + hash?: string; +} +export interface QueryDenomTraceRequestAminoMsg { + type: "cosmos-sdk/QueryDenomTraceRequest"; + value: QueryDenomTraceRequestAmino; +} +/** + * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC + * method + */ +export interface QueryDenomTraceRequestSDKType { + hash?: string; +} +/** + * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * method. + */ +export interface QueryDenomTraceResponse { + /** denom_trace returns the requested denomination trace information. */ + denomTrace?: DenomTrace; +} +export interface QueryDenomTraceResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse"; + value: Uint8Array; +} +/** + * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * method. + */ +export interface QueryDenomTraceResponseAmino { + /** denom_trace returns the requested denomination trace information. */ + denom_trace?: DenomTraceAmino; +} +export interface QueryDenomTraceResponseAminoMsg { + type: "cosmos-sdk/QueryDenomTraceResponse"; + value: QueryDenomTraceResponseAmino; +} +/** + * QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC + * method. + */ +export interface QueryDenomTraceResponseSDKType { + denom_trace?: DenomTraceSDKType; +} +/** + * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * method + */ +export interface QueryDenomTracesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDenomTracesRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest"; + value: Uint8Array; +} +/** + * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * method + */ +export interface QueryDenomTracesRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomTracesRequestAminoMsg { + type: "cosmos-sdk/QueryDenomTracesRequest"; + value: QueryDenomTracesRequestAmino; +} +/** + * QueryConnectionsRequest is the request type for the Query/DenomTraces RPC + * method + */ +export interface QueryDenomTracesRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * method. + */ +export interface QueryDenomTracesResponse { + /** denom_traces returns all denominations trace information. */ + denomTraces: DenomTrace[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDenomTracesResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse"; + value: Uint8Array; +} +/** + * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * method. + */ +export interface QueryDenomTracesResponseAmino { + /** denom_traces returns all denominations trace information. */ + denom_traces?: DenomTraceAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDenomTracesResponseAminoMsg { + type: "cosmos-sdk/QueryDenomTracesResponse"; + value: QueryDenomTracesResponseAmino; +} +/** + * QueryConnectionsResponse is the response type for the Query/DenomTraces RPC + * method. + */ +export interface QueryDenomTracesResponseSDKType { + denom_traces: DenomTraceSDKType[]; + pagination?: PageResponseSDKType; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseSDKType { + params?: ParamsSDKType; +} +/** + * QueryDenomHashRequest is the request type for the Query/DenomHash RPC + * method + */ +export interface QueryDenomHashRequest { + /** The denomination trace ([port_id]/[channel_id])+/[denom] */ + trace?: string; +} +export interface QueryDenomHashRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashRequest"; + value: Uint8Array; +} +/** + * QueryDenomHashRequest is the request type for the Query/DenomHash RPC + * method + */ +export interface QueryDenomHashRequestAmino { + /** The denomination trace ([port_id]/[channel_id])+/[denom] */ + trace?: string; +} +export interface QueryDenomHashRequestAminoMsg { + type: "cosmos-sdk/QueryDenomHashRequest"; + value: QueryDenomHashRequestAmino; +} +/** + * QueryDenomHashRequest is the request type for the Query/DenomHash RPC + * method + */ +export interface QueryDenomHashRequestSDKType { + trace?: string; +} +/** + * QueryDenomHashResponse is the response type for the Query/DenomHash RPC + * method. + */ +export interface QueryDenomHashResponse { + /** hash (in hex format) of the denomination trace information. */ + hash: string; +} +export interface QueryDenomHashResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashResponse"; + value: Uint8Array; +} +/** + * QueryDenomHashResponse is the response type for the Query/DenomHash RPC + * method. + */ +export interface QueryDenomHashResponseAmino { + /** hash (in hex format) of the denomination trace information. */ + hash?: string; +} +export interface QueryDenomHashResponseAminoMsg { + type: "cosmos-sdk/QueryDenomHashResponse"; + value: QueryDenomHashResponseAmino; +} +/** + * QueryDenomHashResponse is the response type for the Query/DenomHash RPC + * method. + */ +export interface QueryDenomHashResponseSDKType { + hash: string; +} +/** QueryEscrowAddressRequest is the request type for the EscrowAddress RPC method. */ +export interface QueryEscrowAddressRequest { + /** unique port identifier */ + portId: string; + /** unique channel identifier */ + channelId: string; +} +export interface QueryEscrowAddressRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressRequest"; + value: Uint8Array; +} +/** QueryEscrowAddressRequest is the request type for the EscrowAddress RPC method. */ +export interface QueryEscrowAddressRequestAmino { + /** unique port identifier */ + port_id?: string; + /** unique channel identifier */ + channel_id?: string; +} +export interface QueryEscrowAddressRequestAminoMsg { + type: "cosmos-sdk/QueryEscrowAddressRequest"; + value: QueryEscrowAddressRequestAmino; +} +/** QueryEscrowAddressRequest is the request type for the EscrowAddress RPC method. */ +export interface QueryEscrowAddressRequestSDKType { + port_id: string; + channel_id: string; +} +/** QueryEscrowAddressResponse is the response type of the EscrowAddress RPC method. */ +export interface QueryEscrowAddressResponse { + /** the escrow account address */ + escrowAddress: string; +} +export interface QueryEscrowAddressResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressResponse"; + value: Uint8Array; +} +/** QueryEscrowAddressResponse is the response type of the EscrowAddress RPC method. */ +export interface QueryEscrowAddressResponseAmino { + /** the escrow account address */ + escrow_address?: string; +} +export interface QueryEscrowAddressResponseAminoMsg { + type: "cosmos-sdk/QueryEscrowAddressResponse"; + value: QueryEscrowAddressResponseAmino; +} +/** QueryEscrowAddressResponse is the response type of the EscrowAddress RPC method. */ +export interface QueryEscrowAddressResponseSDKType { + escrow_address: string; +} +/** QueryTotalEscrowForDenomRequest is the request type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomRequest { + denom?: string; +} +export interface QueryTotalEscrowForDenomRequestProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest"; + value: Uint8Array; +} +/** QueryTotalEscrowForDenomRequest is the request type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomRequestAmino { + denom?: string; +} +export interface QueryTotalEscrowForDenomRequestAminoMsg { + type: "cosmos-sdk/QueryTotalEscrowForDenomRequest"; + value: QueryTotalEscrowForDenomRequestAmino; +} +/** QueryTotalEscrowForDenomRequest is the request type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomRequestSDKType { + denom?: string; +} +/** QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomResponse { + amount: Coin; +} +export interface QueryTotalEscrowForDenomResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse"; + value: Uint8Array; +} +/** QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomResponseAmino { + amount?: CoinAmino; +} +export interface QueryTotalEscrowForDenomResponseAminoMsg { + type: "cosmos-sdk/QueryTotalEscrowForDenomResponse"; + value: QueryTotalEscrowForDenomResponseAmino; +} +/** QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. */ +export interface QueryTotalEscrowForDenomResponseSDKType { + amount: CoinSDKType; +} +function createBaseQueryDenomTraceRequest(): QueryDenomTraceRequest { + return { + hash: "" + }; +} +export const QueryDenomTraceRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", + aminoType: "cosmos-sdk/QueryDenomTraceRequest", + encode(message: QueryDenomTraceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTraceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTraceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomTraceRequest { + const message = createBaseQueryDenomTraceRequest(); + message.hash = object.hash ?? ""; + return message; + }, + fromAmino(object: QueryDenomTraceRequestAmino): QueryDenomTraceRequest { + const message = createBaseQueryDenomTraceRequest(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + return message; + }, + toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { + const obj: any = {}; + obj.hash = message.hash === "" ? undefined : message.hash; + return obj; + }, + fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { + return QueryDenomTraceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomTraceRequest): QueryDenomTraceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomTraceRequest", + value: QueryDenomTraceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomTraceRequestProtoMsg): QueryDenomTraceRequest { + return QueryDenomTraceRequest.decode(message.value); + }, + toProto(message: QueryDenomTraceRequest): Uint8Array { + return QueryDenomTraceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTraceRequest): QueryDenomTraceRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceRequest", + value: QueryDenomTraceRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDenomTraceResponse(): QueryDenomTraceResponse { + return { + denomTrace: undefined + }; +} +export const QueryDenomTraceResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", + aminoType: "cosmos-sdk/QueryDenomTraceResponse", + encode(message: QueryDenomTraceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denomTrace !== undefined) { + DenomTrace.encode(message.denomTrace, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTraceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTraceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denomTrace = DenomTrace.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomTraceResponse { + const message = createBaseQueryDenomTraceResponse(); + message.denomTrace = object.denomTrace !== undefined && object.denomTrace !== null ? DenomTrace.fromPartial(object.denomTrace) : undefined; + return message; + }, + fromAmino(object: QueryDenomTraceResponseAmino): QueryDenomTraceResponse { + const message = createBaseQueryDenomTraceResponse(); + if (object.denom_trace !== undefined && object.denom_trace !== null) { + message.denomTrace = DenomTrace.fromAmino(object.denom_trace); + } + return message; + }, + toAmino(message: QueryDenomTraceResponse): QueryDenomTraceResponseAmino { + const obj: any = {}; + obj.denom_trace = message.denomTrace ? DenomTrace.toAmino(message.denomTrace) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomTraceResponseAminoMsg): QueryDenomTraceResponse { + return QueryDenomTraceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomTraceResponse): QueryDenomTraceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomTraceResponse", + value: QueryDenomTraceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomTraceResponseProtoMsg): QueryDenomTraceResponse { + return QueryDenomTraceResponse.decode(message.value); + }, + toProto(message: QueryDenomTraceResponse): Uint8Array { + return QueryDenomTraceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTraceResponse): QueryDenomTraceResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTraceResponse", + value: QueryDenomTraceResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDenomTracesRequest(): QueryDenomTracesRequest { + return { + pagination: undefined + }; +} +export const QueryDenomTracesRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", + aminoType: "cosmos-sdk/QueryDenomTracesRequest", + encode(message: QueryDenomTracesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTracesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTracesRequest(); + 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: DeepPartial): QueryDenomTracesRequest { + const message = createBaseQueryDenomTracesRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomTracesRequestAmino): QueryDenomTracesRequest { + const message = createBaseQueryDenomTracesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomTracesRequest): QueryDenomTracesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomTracesRequestAminoMsg): QueryDenomTracesRequest { + return QueryDenomTracesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomTracesRequest): QueryDenomTracesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomTracesRequest", + value: QueryDenomTracesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomTracesRequestProtoMsg): QueryDenomTracesRequest { + return QueryDenomTracesRequest.decode(message.value); + }, + toProto(message: QueryDenomTracesRequest): Uint8Array { + return QueryDenomTracesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTracesRequest): QueryDenomTracesRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesRequest", + value: QueryDenomTracesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDenomTracesResponse(): QueryDenomTracesResponse { + return { + denomTraces: [], + pagination: undefined + }; +} +export const QueryDenomTracesResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", + aminoType: "cosmos-sdk/QueryDenomTracesResponse", + encode(message: QueryDenomTracesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denomTraces) { + DenomTrace.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomTracesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomTracesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denomTraces.push(DenomTrace.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: DeepPartial): QueryDenomTracesResponse { + const message = createBaseQueryDenomTracesResponse(); + message.denomTraces = object.denomTraces?.map(e => DenomTrace.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomTracesResponseAmino): QueryDenomTracesResponse { + const message = createBaseQueryDenomTracesResponse(); + message.denomTraces = object.denom_traces?.map(e => DenomTrace.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomTracesResponse): QueryDenomTracesResponseAmino { + const obj: any = {}; + if (message.denomTraces) { + obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); + } else { + obj.denom_traces = message.denomTraces; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomTracesResponseAminoMsg): QueryDenomTracesResponse { + return QueryDenomTracesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomTracesResponse): QueryDenomTracesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomTracesResponse", + value: QueryDenomTracesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomTracesResponseProtoMsg): QueryDenomTracesResponse { + return QueryDenomTracesResponse.decode(message.value); + }, + toProto(message: QueryDenomTracesResponse): Uint8Array { + return QueryDenomTracesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomTracesResponse): QueryDenomTracesResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomTracesResponse", + value: QueryDenomTracesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined + }; +} +export const QueryParamsResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryDenomHashRequest(): QueryDenomHashRequest { + return { + trace: "" + }; +} +export const QueryDenomHashRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashRequest", + aminoType: "cosmos-sdk/QueryDenomHashRequest", + encode(message: QueryDenomHashRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.trace !== "") { + writer.uint32(10).string(message.trace); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomHashRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomHashRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.trace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomHashRequest { + const message = createBaseQueryDenomHashRequest(); + message.trace = object.trace ?? ""; + return message; + }, + fromAmino(object: QueryDenomHashRequestAmino): QueryDenomHashRequest { + const message = createBaseQueryDenomHashRequest(); + if (object.trace !== undefined && object.trace !== null) { + message.trace = object.trace; + } + return message; + }, + toAmino(message: QueryDenomHashRequest): QueryDenomHashRequestAmino { + const obj: any = {}; + obj.trace = message.trace === "" ? undefined : message.trace; + return obj; + }, + fromAminoMsg(object: QueryDenomHashRequestAminoMsg): QueryDenomHashRequest { + return QueryDenomHashRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomHashRequest): QueryDenomHashRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomHashRequest", + value: QueryDenomHashRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomHashRequestProtoMsg): QueryDenomHashRequest { + return QueryDenomHashRequest.decode(message.value); + }, + toProto(message: QueryDenomHashRequest): Uint8Array { + return QueryDenomHashRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomHashRequest): QueryDenomHashRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashRequest", + value: QueryDenomHashRequest.encode(message).finish() + }; + } +}; +function createBaseQueryDenomHashResponse(): QueryDenomHashResponse { + return { + hash: "" + }; +} +export const QueryDenomHashResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashResponse", + aminoType: "cosmos-sdk/QueryDenomHashResponse", + encode(message: QueryDenomHashResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomHashResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomHashResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomHashResponse { + const message = createBaseQueryDenomHashResponse(); + message.hash = object.hash ?? ""; + return message; + }, + fromAmino(object: QueryDenomHashResponseAmino): QueryDenomHashResponse { + const message = createBaseQueryDenomHashResponse(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + return message; + }, + toAmino(message: QueryDenomHashResponse): QueryDenomHashResponseAmino { + const obj: any = {}; + obj.hash = message.hash === "" ? undefined : message.hash; + return obj; + }, + fromAminoMsg(object: QueryDenomHashResponseAminoMsg): QueryDenomHashResponse { + return QueryDenomHashResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomHashResponse): QueryDenomHashResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomHashResponse", + value: QueryDenomHashResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomHashResponseProtoMsg): QueryDenomHashResponse { + return QueryDenomHashResponse.decode(message.value); + }, + toProto(message: QueryDenomHashResponse): Uint8Array { + return QueryDenomHashResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomHashResponse): QueryDenomHashResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryDenomHashResponse", + value: QueryDenomHashResponse.encode(message).finish() + }; + } +}; +function createBaseQueryEscrowAddressRequest(): QueryEscrowAddressRequest { + return { + portId: "", + channelId: "" + }; +} +export const QueryEscrowAddressRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressRequest", + aminoType: "cosmos-sdk/QueryEscrowAddressRequest", + encode(message: QueryEscrowAddressRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryEscrowAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEscrowAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryEscrowAddressRequest { + const message = createBaseQueryEscrowAddressRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: QueryEscrowAddressRequestAmino): QueryEscrowAddressRequest { + const message = createBaseQueryEscrowAddressRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: QueryEscrowAddressRequest): QueryEscrowAddressRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: QueryEscrowAddressRequestAminoMsg): QueryEscrowAddressRequest { + return QueryEscrowAddressRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryEscrowAddressRequest): QueryEscrowAddressRequestAminoMsg { + return { + type: "cosmos-sdk/QueryEscrowAddressRequest", + value: QueryEscrowAddressRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryEscrowAddressRequestProtoMsg): QueryEscrowAddressRequest { + return QueryEscrowAddressRequest.decode(message.value); + }, + toProto(message: QueryEscrowAddressRequest): Uint8Array { + return QueryEscrowAddressRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryEscrowAddressRequest): QueryEscrowAddressRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressRequest", + value: QueryEscrowAddressRequest.encode(message).finish() + }; + } +}; +function createBaseQueryEscrowAddressResponse(): QueryEscrowAddressResponse { + return { + escrowAddress: "" + }; +} +export const QueryEscrowAddressResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressResponse", + aminoType: "cosmos-sdk/QueryEscrowAddressResponse", + encode(message: QueryEscrowAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.escrowAddress !== "") { + writer.uint32(10).string(message.escrowAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryEscrowAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEscrowAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.escrowAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryEscrowAddressResponse { + const message = createBaseQueryEscrowAddressResponse(); + message.escrowAddress = object.escrowAddress ?? ""; + return message; + }, + fromAmino(object: QueryEscrowAddressResponseAmino): QueryEscrowAddressResponse { + const message = createBaseQueryEscrowAddressResponse(); + if (object.escrow_address !== undefined && object.escrow_address !== null) { + message.escrowAddress = object.escrow_address; + } + return message; + }, + toAmino(message: QueryEscrowAddressResponse): QueryEscrowAddressResponseAmino { + const obj: any = {}; + obj.escrow_address = message.escrowAddress === "" ? undefined : message.escrowAddress; + return obj; + }, + fromAminoMsg(object: QueryEscrowAddressResponseAminoMsg): QueryEscrowAddressResponse { + return QueryEscrowAddressResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryEscrowAddressResponse): QueryEscrowAddressResponseAminoMsg { + return { + type: "cosmos-sdk/QueryEscrowAddressResponse", + value: QueryEscrowAddressResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryEscrowAddressResponseProtoMsg): QueryEscrowAddressResponse { + return QueryEscrowAddressResponse.decode(message.value); + }, + toProto(message: QueryEscrowAddressResponse): Uint8Array { + return QueryEscrowAddressResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryEscrowAddressResponse): QueryEscrowAddressResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryEscrowAddressResponse", + value: QueryEscrowAddressResponse.encode(message).finish() + }; + } +}; +function createBaseQueryTotalEscrowForDenomRequest(): QueryTotalEscrowForDenomRequest { + return { + denom: "" + }; +} +export const QueryTotalEscrowForDenomRequest = { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest", + aminoType: "cosmos-sdk/QueryTotalEscrowForDenomRequest", + encode(message: QueryTotalEscrowForDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalEscrowForDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalEscrowForDenomRequest(); + 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: DeepPartial): QueryTotalEscrowForDenomRequest { + const message = createBaseQueryTotalEscrowForDenomRequest(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryTotalEscrowForDenomRequestAmino): QueryTotalEscrowForDenomRequest { + const message = createBaseQueryTotalEscrowForDenomRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryTotalEscrowForDenomRequest): QueryTotalEscrowForDenomRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QueryTotalEscrowForDenomRequestAminoMsg): QueryTotalEscrowForDenomRequest { + return QueryTotalEscrowForDenomRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalEscrowForDenomRequest): QueryTotalEscrowForDenomRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTotalEscrowForDenomRequest", + value: QueryTotalEscrowForDenomRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalEscrowForDenomRequestProtoMsg): QueryTotalEscrowForDenomRequest { + return QueryTotalEscrowForDenomRequest.decode(message.value); + }, + toProto(message: QueryTotalEscrowForDenomRequest): Uint8Array { + return QueryTotalEscrowForDenomRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalEscrowForDenomRequest): QueryTotalEscrowForDenomRequestProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest", + value: QueryTotalEscrowForDenomRequest.encode(message).finish() + }; + } +}; +function createBaseQueryTotalEscrowForDenomResponse(): QueryTotalEscrowForDenomResponse { + return { + amount: Coin.fromPartial({}) + }; +} +export const QueryTotalEscrowForDenomResponse = { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse", + aminoType: "cosmos-sdk/QueryTotalEscrowForDenomResponse", + encode(message: QueryTotalEscrowForDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalEscrowForDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalEscrowForDenomResponse(); + 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: DeepPartial): QueryTotalEscrowForDenomResponse { + const message = createBaseQueryTotalEscrowForDenomResponse(); + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: QueryTotalEscrowForDenomResponseAmino): QueryTotalEscrowForDenomResponse { + const message = createBaseQueryTotalEscrowForDenomResponse(); + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: QueryTotalEscrowForDenomResponse): QueryTotalEscrowForDenomResponseAmino { + const obj: any = {}; + obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalEscrowForDenomResponseAminoMsg): QueryTotalEscrowForDenomResponse { + return QueryTotalEscrowForDenomResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalEscrowForDenomResponse): QueryTotalEscrowForDenomResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTotalEscrowForDenomResponse", + value: QueryTotalEscrowForDenomResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalEscrowForDenomResponseProtoMsg): QueryTotalEscrowForDenomResponse { + return QueryTotalEscrowForDenomResponse.decode(message.value); + }, + toProto(message: QueryTotalEscrowForDenomResponse): Uint8Array { + return QueryTotalEscrowForDenomResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalEscrowForDenomResponse): QueryTotalEscrowForDenomResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse", + value: QueryTotalEscrowForDenomResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/transfer.ts b/util/inj-types/ibc/applications/transfer/v1/transfer.ts new file mode 100644 index 00000000..53c42379 --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/transfer.ts @@ -0,0 +1,262 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** + * DenomTrace contains the base denomination for ICS20 fungible tokens and the + * source tracing information path. + */ +export interface DenomTrace { + /** + * path defines the chain of port/channel identifiers used for tracing the + * source of the fungible token. + */ + path: string; + /** base denomination of the relayed fungible token. */ + baseDenom: string; +} +export interface DenomTraceProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.DenomTrace"; + value: Uint8Array; +} +/** + * DenomTrace contains the base denomination for ICS20 fungible tokens and the + * source tracing information path. + */ +export interface DenomTraceAmino { + /** + * path defines the chain of port/channel identifiers used for tracing the + * source of the fungible token. + */ + path?: string; + /** base denomination of the relayed fungible token. */ + base_denom?: string; +} +export interface DenomTraceAminoMsg { + type: "cosmos-sdk/DenomTrace"; + value: DenomTraceAmino; +} +/** + * DenomTrace contains the base denomination for ICS20 fungible tokens and the + * source tracing information path. + */ +export interface DenomTraceSDKType { + path: string; + base_denom: string; +} +/** + * Params defines the set of IBC transfer parameters. + * NOTE: To prevent a single token from being transferred, set the + * TransfersEnabled parameter to true and then set the bank module's SendEnabled + * parameter for the denomination to false. + */ +export interface Params { + /** + * send_enabled enables or disables all cross-chain token transfers from this + * chain. + */ + sendEnabled: boolean; + /** + * receive_enabled enables or disables all cross-chain token transfers to this + * chain. + */ + receiveEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.Params"; + value: Uint8Array; +} +/** + * Params defines the set of IBC transfer parameters. + * NOTE: To prevent a single token from being transferred, set the + * TransfersEnabled parameter to true and then set the bank module's SendEnabled + * parameter for the denomination to false. + */ +export interface ParamsAmino { + /** + * send_enabled enables or disables all cross-chain token transfers from this + * chain. + */ + send_enabled?: boolean; + /** + * receive_enabled enables or disables all cross-chain token transfers to this + * chain. + */ + receive_enabled?: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** + * Params defines the set of IBC transfer parameters. + * NOTE: To prevent a single token from being transferred, set the + * TransfersEnabled parameter to true and then set the bank module's SendEnabled + * parameter for the denomination to false. + */ +export interface ParamsSDKType { + send_enabled: boolean; + receive_enabled: boolean; +} +function createBaseDenomTrace(): DenomTrace { + return { + path: "", + baseDenom: "" + }; +} +export const DenomTrace = { + typeUrl: "/ibc.applications.transfer.v1.DenomTrace", + aminoType: "cosmos-sdk/DenomTrace", + encode(message: DenomTrace, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.baseDenom !== "") { + writer.uint32(18).string(message.baseDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DenomTrace { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomTrace(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.baseDenom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DenomTrace { + const message = createBaseDenomTrace(); + message.path = object.path ?? ""; + message.baseDenom = object.baseDenom ?? ""; + return message; + }, + fromAmino(object: DenomTraceAmino): DenomTrace { + const message = createBaseDenomTrace(); + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + if (object.base_denom !== undefined && object.base_denom !== null) { + message.baseDenom = object.base_denom; + } + return message; + }, + toAmino(message: DenomTrace): DenomTraceAmino { + const obj: any = {}; + obj.path = message.path === "" ? undefined : message.path; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; + return obj; + }, + fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { + return DenomTrace.fromAmino(object.value); + }, + toAminoMsg(message: DenomTrace): DenomTraceAminoMsg { + return { + type: "cosmos-sdk/DenomTrace", + value: DenomTrace.toAmino(message) + }; + }, + fromProtoMsg(message: DenomTraceProtoMsg): DenomTrace { + return DenomTrace.decode(message.value); + }, + toProto(message: DenomTrace): Uint8Array { + return DenomTrace.encode(message).finish(); + }, + toProtoMsg(message: DenomTrace): DenomTraceProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.DenomTrace", + value: DenomTrace.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + sendEnabled: false, + receiveEnabled: false + }; +} +export const Params = { + typeUrl: "/ibc.applications.transfer.v1.Params", + aminoType: "cosmos-sdk/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sendEnabled === true) { + writer.uint32(8).bool(message.sendEnabled); + } + if (message.receiveEnabled === true) { + writer.uint32(16).bool(message.receiveEnabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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 = reader.bool(); + break; + case 2: + message.receiveEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled ?? false; + message.receiveEnabled = object.receiveEnabled ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.send_enabled !== undefined && object.send_enabled !== null) { + message.sendEnabled = object.send_enabled; + } + if (object.receive_enabled !== undefined && object.receive_enabled !== null) { + message.receiveEnabled = object.receive_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.send_enabled = message.sendEnabled === false ? undefined : message.sendEnabled; + obj.receive_enabled = message.receiveEnabled === false ? undefined : message.receiveEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/tx.amino.ts b/util/inj-types/ibc/applications/transfer/v1/tx.amino.ts new file mode 100644 index 00000000..65002c1e --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/tx.amino.ts @@ -0,0 +1,8 @@ +import { MsgTransfer } from "./tx"; +export const AminoConverter = { + "/ibc.applications.transfer.v1.MsgTransfer": { + aminoType: "cosmos-sdk/MsgTransfer", + toAmino: MsgTransfer.toAmino, + fromAmino: MsgTransfer.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/tx.registry.ts b/util/inj-types/ibc/applications/transfer/v1/tx.registry.ts new file mode 100644 index 00000000..dae96a3a --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/tx.registry.ts @@ -0,0 +1,35 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgTransfer } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + transfer(value: MsgTransfer) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value: MsgTransfer.encode(value).finish() + }; + } + }, + withTypeUrl: { + transfer(value: MsgTransfer) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value + }; + } + }, + fromPartial: { + transfer(value: MsgTransfer) { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value: MsgTransfer.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/tx.rpc.msg.ts b/util/inj-types/ibc/applications/transfer/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..31ad02a6 --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -0,0 +1,20 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgTransfer, MsgTransferResponse } from "./tx"; +/** Msg defines the ibc/transfer Msg service. */ +export interface Msg { + /** Transfer defines a rpc handler method for MsgTransfer. */ + transfer(request: MsgTransfer): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Transfer defines a rpc handler method for MsgTransfer. */ + transfer = async (request: MsgTransfer): Promise => { + const data = MsgTransfer.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.transfer.v1.Msg", "Transfer", data); + return promise.then(data => MsgTransferResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v1/tx.ts b/util/inj-types/ibc/applications/transfer/v1/tx.ts new file mode 100644 index 00000000..32c9d9ee --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v1/tx.ts @@ -0,0 +1,331 @@ +import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** + * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between + * ICS20 enabled chains. See ICS Spec here: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface MsgTransfer { + /** the port on which the packet will be sent */ + sourcePort: string; + /** the channel by which the packet will be sent */ + sourceChannel: string; + /** the tokens to be transferred */ + token: Coin; + /** the sender address */ + sender: string; + /** the recipient address on the destination chain */ + receiver: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeoutHeight: Height; + /** + * Timeout timestamp in absolute nanoseconds since unix epoch. + * The timeout is disabled when set to 0. + */ + timeoutTimestamp: bigint; + /** optional memo */ + memo: string; +} +export interface MsgTransferProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer"; + value: Uint8Array; +} +/** + * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between + * ICS20 enabled chains. See ICS Spec here: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface MsgTransferAmino { + /** the port on which the packet will be sent */ + source_port?: string; + /** the channel by which the packet will be sent */ + source_channel?: string; + /** the tokens to be transferred */ + token?: CoinAmino; + /** the sender address */ + sender?: string; + /** the recipient address on the destination chain */ + receiver?: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeout_height?: HeightAmino; + /** + * Timeout timestamp in absolute nanoseconds since unix epoch. + * The timeout is disabled when set to 0. + */ + timeout_timestamp?: string; + /** optional memo */ + memo?: string; +} +export interface MsgTransferAminoMsg { + type: "cosmos-sdk/MsgTransfer"; + value: MsgTransferAmino; +} +/** + * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between + * ICS20 enabled chains. See ICS Spec here: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface MsgTransferSDKType { + source_port: string; + source_channel: string; + token: CoinSDKType; + sender: string; + receiver: string; + timeout_height: HeightSDKType; + timeout_timestamp: bigint; + memo: string; +} +/** MsgTransferResponse defines the Msg/Transfer response type. */ +export interface MsgTransferResponse { + /** sequence number of the transfer packet sent */ + sequence: bigint; +} +export interface MsgTransferResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse"; + value: Uint8Array; +} +/** MsgTransferResponse defines the Msg/Transfer response type. */ +export interface MsgTransferResponseAmino { + /** sequence number of the transfer packet sent */ + sequence?: string; +} +export interface MsgTransferResponseAminoMsg { + type: "cosmos-sdk/MsgTransferResponse"; + value: MsgTransferResponseAmino; +} +/** MsgTransferResponse defines the Msg/Transfer response type. */ +export interface MsgTransferResponseSDKType { + sequence: bigint; +} +function createBaseMsgTransfer(): MsgTransfer { + return { + sourcePort: "", + sourceChannel: "", + token: Coin.fromPartial({}), + sender: "", + receiver: "", + timeoutHeight: Height.fromPartial({}), + timeoutTimestamp: BigInt(0), + memo: "" + }; +} +export const MsgTransfer = { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + aminoType: "cosmos-sdk/MsgTransfer", + encode(message: MsgTransfer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sourcePort !== "") { + writer.uint32(10).string(message.sourcePort); + } + if (message.sourceChannel !== "") { + writer.uint32(18).string(message.sourceChannel); + } + if (message.token !== undefined) { + Coin.encode(message.token, writer.uint32(26).fork()).ldelim(); + } + if (message.sender !== "") { + writer.uint32(34).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(42).string(message.receiver); + } + if (message.timeoutHeight !== undefined) { + Height.encode(message.timeoutHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.timeoutTimestamp !== BigInt(0)) { + writer.uint32(56).uint64(message.timeoutTimestamp); + } + if (message.memo !== "") { + writer.uint32(66).string(message.memo); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTransfer { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransfer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourcePort = reader.string(); + break; + case 2: + message.sourceChannel = reader.string(); + break; + case 3: + message.token = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.sender = reader.string(); + break; + case 5: + message.receiver = reader.string(); + break; + case 6: + message.timeoutHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.timeoutTimestamp = reader.uint64(); + break; + case 8: + message.memo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTransfer { + const message = createBaseMsgTransfer(); + message.sourcePort = object.sourcePort ?? ""; + message.sourceChannel = object.sourceChannel ?? ""; + message.token = object.token !== undefined && object.token !== null ? Coin.fromPartial(object.token) : undefined; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); + message.memo = object.memo ?? ""; + return message; + }, + fromAmino(object: MsgTransferAmino): MsgTransfer { + const message = createBaseMsgTransfer(); + if (object.source_port !== undefined && object.source_port !== null) { + message.sourcePort = object.source_port; + } + if (object.source_channel !== undefined && object.source_channel !== null) { + message.sourceChannel = object.source_channel; + } + if (object.token !== undefined && object.token !== null) { + message.token = Coin.fromAmino(object.token); + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.receiver !== undefined && object.receiver !== null) { + message.receiver = object.receiver; + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = Height.fromAmino(object.timeout_height); + } + if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeout_timestamp); + } + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + return message; + }, + toAmino(message: MsgTransfer): MsgTransferAmino { + const obj: any = {}; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.token = message.token ? Coin.toAmino(message.token) : undefined; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; + obj.memo = message.memo === "" ? undefined : message.memo; + return obj; + }, + fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { + return MsgTransfer.fromAmino(object.value); + }, + toAminoMsg(message: MsgTransfer): MsgTransferAminoMsg { + return { + type: "cosmos-sdk/MsgTransfer", + value: MsgTransfer.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTransferProtoMsg): MsgTransfer { + return MsgTransfer.decode(message.value); + }, + toProto(message: MsgTransfer): Uint8Array { + return MsgTransfer.encode(message).finish(); + }, + toProtoMsg(message: MsgTransfer): MsgTransferProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value: MsgTransfer.encode(message).finish() + }; + } +}; +function createBaseMsgTransferResponse(): MsgTransferResponse { + return { + sequence: BigInt(0) + }; +} +export const MsgTransferResponse = { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", + aminoType: "cosmos-sdk/MsgTransferResponse", + encode(message: MsgTransferResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTransferResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransferResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTransferResponse { + const message = createBaseMsgTransferResponse(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgTransferResponseAmino): MsgTransferResponse { + const message = createBaseMsgTransferResponse(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: MsgTransferResponse): MsgTransferResponseAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgTransferResponseAminoMsg): MsgTransferResponse { + return MsgTransferResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTransferResponse): MsgTransferResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTransferResponse", + value: MsgTransferResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTransferResponseProtoMsg): MsgTransferResponse { + return MsgTransferResponse.decode(message.value); + }, + toProto(message: MsgTransferResponse): Uint8Array { + return MsgTransferResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTransferResponse): MsgTransferResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", + value: MsgTransferResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/applications/transfer/v2/packet.ts b/util/inj-types/ibc/applications/transfer/v2/packet.ts new file mode 100644 index 00000000..14c41bee --- /dev/null +++ b/util/inj-types/ibc/applications/transfer/v2/packet.ts @@ -0,0 +1,174 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** + * FungibleTokenPacketData defines a struct for the packet payload + * See FungibleTokenPacketData spec: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface FungibleTokenPacketData { + /** the token denomination to be transferred */ + denom: string; + /** the token amount to be transferred */ + amount: string; + /** the sender address */ + sender: string; + /** the recipient address on the destination chain */ + receiver: string; + /** optional memo */ + memo: string; +} +export interface FungibleTokenPacketDataProtoMsg { + typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData"; + value: Uint8Array; +} +/** + * FungibleTokenPacketData defines a struct for the packet payload + * See FungibleTokenPacketData spec: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface FungibleTokenPacketDataAmino { + /** the token denomination to be transferred */ + denom?: string; + /** the token amount to be transferred */ + amount?: string; + /** the sender address */ + sender?: string; + /** the recipient address on the destination chain */ + receiver?: string; + /** optional memo */ + memo?: string; +} +export interface FungibleTokenPacketDataAminoMsg { + type: "cosmos-sdk/FungibleTokenPacketData"; + value: FungibleTokenPacketDataAmino; +} +/** + * FungibleTokenPacketData defines a struct for the packet payload + * See FungibleTokenPacketData spec: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface FungibleTokenPacketDataSDKType { + denom: string; + amount: string; + sender: string; + receiver: string; + memo: string; +} +function createBaseFungibleTokenPacketData(): FungibleTokenPacketData { + return { + denom: "", + amount: "", + sender: "", + receiver: "", + memo: "" + }; +} +export const FungibleTokenPacketData = { + typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", + aminoType: "cosmos-sdk/FungibleTokenPacketData", + encode(message: FungibleTokenPacketData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + if (message.memo !== "") { + writer.uint32(42).string(message.memo); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FungibleTokenPacketData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFungibleTokenPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + case 3: + message.sender = reader.string(); + break; + case 4: + message.receiver = reader.string(); + break; + case 5: + message.memo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FungibleTokenPacketData { + const message = createBaseFungibleTokenPacketData(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + message.memo = object.memo ?? ""; + return message; + }, + fromAmino(object: FungibleTokenPacketDataAmino): FungibleTokenPacketData { + const message = createBaseFungibleTokenPacketData(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.receiver !== undefined && object.receiver !== null) { + message.receiver = object.receiver; + } + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + return message; + }, + toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.memo = message.memo === "" ? undefined : message.memo; + return obj; + }, + fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { + return FungibleTokenPacketData.fromAmino(object.value); + }, + toAminoMsg(message: FungibleTokenPacketData): FungibleTokenPacketDataAminoMsg { + return { + type: "cosmos-sdk/FungibleTokenPacketData", + value: FungibleTokenPacketData.toAmino(message) + }; + }, + fromProtoMsg(message: FungibleTokenPacketDataProtoMsg): FungibleTokenPacketData { + return FungibleTokenPacketData.decode(message.value); + }, + toProto(message: FungibleTokenPacketData): Uint8Array { + return FungibleTokenPacketData.encode(message).finish(); + }, + toProtoMsg(message: FungibleTokenPacketData): FungibleTokenPacketDataProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v2.FungibleTokenPacketData", + value: FungibleTokenPacketData.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/bundle.ts b/util/inj-types/ibc/bundle.ts new file mode 100644 index 00000000..39ad5c3c --- /dev/null +++ b/util/inj-types/ibc/bundle.ts @@ -0,0 +1,184 @@ +import * as _104 from "./applications/interchain_accounts/controller/v1/controller"; +import * as _105 from "./applications/interchain_accounts/controller/v1/query"; +import * as _106 from "./applications/interchain_accounts/controller/v1/tx"; +import * as _107 from "./applications/interchain_accounts/genesis/v1/genesis"; +import * as _108 from "./applications/interchain_accounts/host/v1/host"; +import * as _109 from "./applications/interchain_accounts/host/v1/query"; +import * as _110 from "./applications/interchain_accounts/v1/account"; +import * as _111 from "./applications/interchain_accounts/v1/metadata"; +import * as _112 from "./applications/interchain_accounts/v1/packet"; +import * as _113 from "./applications/transfer/v1/authz"; +import * as _114 from "./applications/transfer/v1/genesis"; +import * as _115 from "./applications/transfer/v1/query"; +import * as _116 from "./applications/transfer/v1/transfer"; +import * as _117 from "./applications/transfer/v1/tx"; +import * as _118 from "./applications/transfer/v2/packet"; +import * as _119 from "./core/channel/v1/channel"; +import * as _120 from "./core/channel/v1/genesis"; +import * as _121 from "./core/channel/v1/query"; +import * as _122 from "./core/channel/v1/tx"; +import * as _123 from "./core/client/v1/client"; +import * as _124 from "./core/client/v1/genesis"; +import * as _125 from "./core/client/v1/query"; +import * as _126 from "./core/client/v1/tx"; +import * as _127 from "./core/commitment/v1/commitment"; +import * as _128 from "./core/connection/v1/connection"; +import * as _129 from "./core/connection/v1/genesis"; +import * as _130 from "./core/connection/v1/query"; +import * as _131 from "./core/connection/v1/tx"; +import * as _132 from "./lightclients/localhost/v2/localhost"; +import * as _133 from "./lightclients/solomachine/v2/solomachine"; +import * as _134 from "./lightclients/solomachine/v3/solomachine"; +import * as _135 from "./lightclients/tendermint/v1/tendermint"; +import * as _237 from "./applications/interchain_accounts/controller/v1/tx.amino"; +import * as _238 from "./applications/transfer/v1/tx.amino"; +import * as _239 from "./core/channel/v1/tx.amino"; +import * as _240 from "./core/client/v1/tx.amino"; +import * as _241 from "./core/connection/v1/tx.amino"; +import * as _242 from "./applications/interchain_accounts/controller/v1/tx.registry"; +import * as _243 from "./applications/transfer/v1/tx.registry"; +import * as _244 from "./core/channel/v1/tx.registry"; +import * as _245 from "./core/client/v1/tx.registry"; +import * as _246 from "./core/connection/v1/tx.registry"; +import * as _247 from "./applications/interchain_accounts/controller/v1/query.lcd"; +import * as _248 from "./applications/interchain_accounts/host/v1/query.lcd"; +import * as _249 from "./applications/transfer/v1/query.lcd"; +import * as _250 from "./core/channel/v1/query.lcd"; +import * as _251 from "./core/client/v1/query.lcd"; +import * as _252 from "./core/connection/v1/query.lcd"; +import * as _253 from "./applications/interchain_accounts/controller/v1/query.rpc.Query"; +import * as _254 from "./applications/interchain_accounts/host/v1/query.rpc.Query"; +import * as _255 from "./applications/transfer/v1/query.rpc.Query"; +import * as _256 from "./core/channel/v1/query.rpc.Query"; +import * as _257 from "./core/client/v1/query.rpc.Query"; +import * as _258 from "./core/connection/v1/query.rpc.Query"; +import * as _259 from "./applications/interchain_accounts/controller/v1/tx.rpc.msg"; +import * as _260 from "./applications/transfer/v1/tx.rpc.msg"; +import * as _261 from "./core/channel/v1/tx.rpc.msg"; +import * as _262 from "./core/client/v1/tx.rpc.msg"; +import * as _263 from "./core/connection/v1/tx.rpc.msg"; +import * as _271 from "./rpc.query"; +import * as _272 from "./rpc.tx"; +export namespace ibc { + export namespace applications { + export namespace interchain_accounts { + export namespace controller { + export const v1 = { + ..._104, + ..._105, + ..._106, + ..._237, + ..._242, + ..._247, + ..._253, + ..._259 + }; + } + export namespace genesis { + export const v1 = { + ..._107 + }; + } + export namespace host { + export const v1 = { + ..._108, + ..._109, + ..._248, + ..._254 + }; + } + export const v1 = { + ..._110, + ..._111, + ..._112 + }; + } + export namespace transfer { + export const v1 = { + ..._113, + ..._114, + ..._115, + ..._116, + ..._117, + ..._238, + ..._243, + ..._249, + ..._255, + ..._260 + }; + export const v2 = { + ..._118 + }; + } + } + export namespace core { + export namespace channel { + export const v1 = { + ..._119, + ..._120, + ..._121, + ..._122, + ..._239, + ..._244, + ..._250, + ..._256, + ..._261 + }; + } + export namespace client { + export const v1 = { + ..._123, + ..._124, + ..._125, + ..._126, + ..._240, + ..._245, + ..._251, + ..._257, + ..._262 + }; + } + export namespace commitment { + export const v1 = { + ..._127 + }; + } + export namespace connection { + export const v1 = { + ..._128, + ..._129, + ..._130, + ..._131, + ..._241, + ..._246, + ..._252, + ..._258, + ..._263 + }; + } + } + export namespace lightclients { + export namespace localhost { + export const v2 = { + ..._132 + }; + } + export namespace solomachine { + export const v2 = { + ..._133 + }; + export const v3 = { + ..._134 + }; + } + export namespace tendermint { + export const v1 = { + ..._135 + }; + } + } + export const ClientFactory = { + ..._271, + ..._272 + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/client.ts b/util/inj-types/ibc/client.ts new file mode 100644 index 00000000..f7ae572b --- /dev/null +++ b/util/inj-types/ibc/client.ts @@ -0,0 +1,59 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as ibcApplicationsInterchainAccountsControllerV1TxRegistry from "./applications/interchain_accounts/controller/v1/tx.registry"; +import * as ibcApplicationsTransferV1TxRegistry from "./applications/transfer/v1/tx.registry"; +import * as ibcCoreChannelV1TxRegistry from "./core/channel/v1/tx.registry"; +import * as ibcCoreClientV1TxRegistry from "./core/client/v1/tx.registry"; +import * as ibcCoreConnectionV1TxRegistry from "./core/connection/v1/tx.registry"; +import * as ibcApplicationsInterchainAccountsControllerV1TxAmino from "./applications/interchain_accounts/controller/v1/tx.amino"; +import * as ibcApplicationsTransferV1TxAmino from "./applications/transfer/v1/tx.amino"; +import * as ibcCoreChannelV1TxAmino from "./core/channel/v1/tx.amino"; +import * as ibcCoreClientV1TxAmino from "./core/client/v1/tx.amino"; +import * as ibcCoreConnectionV1TxAmino from "./core/connection/v1/tx.amino"; +export const ibcAminoConverters = { + ...ibcApplicationsInterchainAccountsControllerV1TxAmino.AminoConverter, + ...ibcApplicationsTransferV1TxAmino.AminoConverter, + ...ibcCoreChannelV1TxAmino.AminoConverter, + ...ibcCoreClientV1TxAmino.AminoConverter, + ...ibcCoreConnectionV1TxAmino.AminoConverter +}; +export const ibcProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...ibcApplicationsInterchainAccountsControllerV1TxRegistry.registry, ...ibcApplicationsTransferV1TxRegistry.registry, ...ibcCoreChannelV1TxRegistry.registry, ...ibcCoreClientV1TxRegistry.registry, ...ibcCoreConnectionV1TxRegistry.registry]; +export const getSigningIbcClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...ibcProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...ibcAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningIbcClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningIbcClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/channel.ts b/util/inj-types/ibc/core/channel/v1/channel.ts new file mode 100644 index 00000000..fbe1732d --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/channel.ts @@ -0,0 +1,1257 @@ +import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * State defines if a channel is in one of the following states: + * CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + */ +export enum State { + /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ + STATE_UNINITIALIZED_UNSPECIFIED = 0, + /** STATE_INIT - A channel has just started the opening handshake. */ + STATE_INIT = 1, + /** STATE_TRYOPEN - A channel has acknowledged the handshake step on the counterparty chain. */ + STATE_TRYOPEN = 2, + /** + * STATE_OPEN - A channel has completed the handshake. Open channels are + * ready to send and receive packets. + */ + STATE_OPEN = 3, + /** + * STATE_CLOSED - A channel has been closed and can no longer be used to send or receive + * packets. + */ + STATE_CLOSED = 4, + UNRECOGNIZED = -1, +} +export const StateSDKType = State; +export const StateAmino = State; +export function stateFromJSON(object: any): State { + switch (object) { + case 0: + case "STATE_UNINITIALIZED_UNSPECIFIED": + return State.STATE_UNINITIALIZED_UNSPECIFIED; + case 1: + case "STATE_INIT": + return State.STATE_INIT; + case 2: + case "STATE_TRYOPEN": + return State.STATE_TRYOPEN; + case 3: + case "STATE_OPEN": + return State.STATE_OPEN; + case 4: + case "STATE_CLOSED": + return State.STATE_CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return State.UNRECOGNIZED; + } +} +export function stateToJSON(object: State): string { + switch (object) { + case State.STATE_UNINITIALIZED_UNSPECIFIED: + return "STATE_UNINITIALIZED_UNSPECIFIED"; + case State.STATE_INIT: + return "STATE_INIT"; + case State.STATE_TRYOPEN: + return "STATE_TRYOPEN"; + case State.STATE_OPEN: + return "STATE_OPEN"; + case State.STATE_CLOSED: + return "STATE_CLOSED"; + case State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Order defines if a channel is ORDERED or UNORDERED */ +export enum Order { + /** ORDER_NONE_UNSPECIFIED - zero-value for channel ordering */ + ORDER_NONE_UNSPECIFIED = 0, + /** + * ORDER_UNORDERED - packets can be delivered in any order, which may differ from the order in + * which they were sent. + */ + ORDER_UNORDERED = 1, + /** ORDER_ORDERED - packets are delivered exactly in the order which they were sent */ + ORDER_ORDERED = 2, + UNRECOGNIZED = -1, +} +export const OrderSDKType = Order; +export const OrderAmino = Order; +export function orderFromJSON(object: any): Order { + switch (object) { + case 0: + case "ORDER_NONE_UNSPECIFIED": + return Order.ORDER_NONE_UNSPECIFIED; + case 1: + case "ORDER_UNORDERED": + return Order.ORDER_UNORDERED; + case 2: + case "ORDER_ORDERED": + return Order.ORDER_ORDERED; + case -1: + case "UNRECOGNIZED": + default: + return Order.UNRECOGNIZED; + } +} +export function orderToJSON(object: Order): string { + switch (object) { + case Order.ORDER_NONE_UNSPECIFIED: + return "ORDER_NONE_UNSPECIFIED"; + case Order.ORDER_UNORDERED: + return "ORDER_UNORDERED"; + case Order.ORDER_ORDERED: + return "ORDER_ORDERED"; + case Order.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Channel defines pipeline for exactly-once packet delivery between specific + * modules on separate blockchains, which has at least one end capable of + * sending packets and one end capable of receiving packets. + */ +export interface Channel { + /** current state of the channel end */ + state: State; + /** whether the channel is ordered or unordered */ + ordering: Order; + /** counterparty channel end */ + counterparty: Counterparty; + /** + * list of connection identifiers, in order, along which packets sent on + * this channel will travel + */ + connectionHops: string[]; + /** opaque channel version, which is agreed upon during the handshake */ + version: string; +} +export interface ChannelProtoMsg { + typeUrl: "/ibc.core.channel.v1.Channel"; + value: Uint8Array; +} +/** + * Channel defines pipeline for exactly-once packet delivery between specific + * modules on separate blockchains, which has at least one end capable of + * sending packets and one end capable of receiving packets. + */ +export interface ChannelAmino { + /** current state of the channel end */ + state?: State; + /** whether the channel is ordered or unordered */ + ordering?: Order; + /** counterparty channel end */ + counterparty?: CounterpartyAmino; + /** + * list of connection identifiers, in order, along which packets sent on + * this channel will travel + */ + connection_hops?: string[]; + /** opaque channel version, which is agreed upon during the handshake */ + version?: string; +} +export interface ChannelAminoMsg { + type: "cosmos-sdk/Channel"; + value: ChannelAmino; +} +/** + * Channel defines pipeline for exactly-once packet delivery between specific + * modules on separate blockchains, which has at least one end capable of + * sending packets and one end capable of receiving packets. + */ +export interface ChannelSDKType { + state: State; + ordering: Order; + counterparty: CounterpartySDKType; + connection_hops: string[]; + version: string; +} +/** + * IdentifiedChannel defines a channel with additional port and channel + * identifier fields. + */ +export interface IdentifiedChannel { + /** current state of the channel end */ + state: State; + /** whether the channel is ordered or unordered */ + ordering: Order; + /** counterparty channel end */ + counterparty: Counterparty; + /** + * list of connection identifiers, in order, along which packets sent on + * this channel will travel + */ + connectionHops: string[]; + /** opaque channel version, which is agreed upon during the handshake */ + version: string; + /** port identifier */ + portId: string; + /** channel identifier */ + channelId: string; +} +export interface IdentifiedChannelProtoMsg { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel"; + value: Uint8Array; +} +/** + * IdentifiedChannel defines a channel with additional port and channel + * identifier fields. + */ +export interface IdentifiedChannelAmino { + /** current state of the channel end */ + state?: State; + /** whether the channel is ordered or unordered */ + ordering?: Order; + /** counterparty channel end */ + counterparty?: CounterpartyAmino; + /** + * list of connection identifiers, in order, along which packets sent on + * this channel will travel + */ + connection_hops?: string[]; + /** opaque channel version, which is agreed upon during the handshake */ + version?: string; + /** port identifier */ + port_id?: string; + /** channel identifier */ + channel_id?: string; +} +export interface IdentifiedChannelAminoMsg { + type: "cosmos-sdk/IdentifiedChannel"; + value: IdentifiedChannelAmino; +} +/** + * IdentifiedChannel defines a channel with additional port and channel + * identifier fields. + */ +export interface IdentifiedChannelSDKType { + state: State; + ordering: Order; + counterparty: CounterpartySDKType; + connection_hops: string[]; + version: string; + port_id: string; + channel_id: string; +} +/** Counterparty defines a channel end counterparty */ +export interface Counterparty { + /** port on the counterparty chain which owns the other end of the channel. */ + portId: string; + /** channel end on the counterparty chain */ + channelId: string; +} +export interface CounterpartyProtoMsg { + typeUrl: "/ibc.core.channel.v1.Counterparty"; + value: Uint8Array; +} +/** Counterparty defines a channel end counterparty */ +export interface CounterpartyAmino { + /** port on the counterparty chain which owns the other end of the channel. */ + port_id?: string; + /** channel end on the counterparty chain */ + channel_id?: string; +} +export interface CounterpartyAminoMsg { + type: "cosmos-sdk/Counterparty"; + value: CounterpartyAmino; +} +/** Counterparty defines a channel end counterparty */ +export interface CounterpartySDKType { + port_id: string; + channel_id: string; +} +/** Packet defines a type that carries data across different chains through IBC */ +export interface Packet { + /** + * number corresponds to the order of sends and receives, where a Packet + * with an earlier sequence number must be sent and received before a Packet + * with a later sequence number. + */ + sequence: bigint; + /** identifies the port on the sending chain. */ + sourcePort: string; + /** identifies the channel end on the sending chain. */ + sourceChannel: string; + /** identifies the port on the receiving chain. */ + destinationPort: string; + /** identifies the channel end on the receiving chain. */ + destinationChannel: string; + /** actual opaque bytes transferred directly to the application module */ + data: Uint8Array; + /** block height after which the packet times out */ + timeoutHeight: Height; + /** block timestamp (in nanoseconds) after which the packet times out */ + timeoutTimestamp: bigint; +} +export interface PacketProtoMsg { + typeUrl: "/ibc.core.channel.v1.Packet"; + value: Uint8Array; +} +/** Packet defines a type that carries data across different chains through IBC */ +export interface PacketAmino { + /** + * number corresponds to the order of sends and receives, where a Packet + * with an earlier sequence number must be sent and received before a Packet + * with a later sequence number. + */ + sequence?: string; + /** identifies the port on the sending chain. */ + source_port?: string; + /** identifies the channel end on the sending chain. */ + source_channel?: string; + /** identifies the port on the receiving chain. */ + destination_port?: string; + /** identifies the channel end on the receiving chain. */ + destination_channel?: string; + /** actual opaque bytes transferred directly to the application module */ + data?: string; + /** block height after which the packet times out */ + timeout_height?: HeightAmino; + /** block timestamp (in nanoseconds) after which the packet times out */ + timeout_timestamp?: string; +} +export interface PacketAminoMsg { + type: "cosmos-sdk/Packet"; + value: PacketAmino; +} +/** Packet defines a type that carries data across different chains through IBC */ +export interface PacketSDKType { + sequence: bigint; + source_port: string; + source_channel: string; + destination_port: string; + destination_channel: string; + data: Uint8Array; + timeout_height: HeightSDKType; + timeout_timestamp: bigint; +} +/** + * PacketState defines the generic type necessary to retrieve and store + * packet commitments, acknowledgements, and receipts. + * Caller is responsible for knowing the context necessary to interpret this + * state as a commitment, acknowledgement, or a receipt. + */ +export interface PacketState { + /** channel port identifier. */ + portId: string; + /** channel unique identifier. */ + channelId: string; + /** packet sequence. */ + sequence: bigint; + /** embedded data that represents packet state. */ + data: Uint8Array; +} +export interface PacketStateProtoMsg { + typeUrl: "/ibc.core.channel.v1.PacketState"; + value: Uint8Array; +} +/** + * PacketState defines the generic type necessary to retrieve and store + * packet commitments, acknowledgements, and receipts. + * Caller is responsible for knowing the context necessary to interpret this + * state as a commitment, acknowledgement, or a receipt. + */ +export interface PacketStateAmino { + /** channel port identifier. */ + port_id?: string; + /** channel unique identifier. */ + channel_id?: string; + /** packet sequence. */ + sequence?: string; + /** embedded data that represents packet state. */ + data?: string; +} +export interface PacketStateAminoMsg { + type: "cosmos-sdk/PacketState"; + value: PacketStateAmino; +} +/** + * PacketState defines the generic type necessary to retrieve and store + * packet commitments, acknowledgements, and receipts. + * Caller is responsible for knowing the context necessary to interpret this + * state as a commitment, acknowledgement, or a receipt. + */ +export interface PacketStateSDKType { + port_id: string; + channel_id: string; + sequence: bigint; + data: Uint8Array; +} +/** + * PacketId is an identifer for a unique Packet + * Source chains refer to packets by source port/channel + * Destination chains refer to packets by destination port/channel + */ +export interface PacketId { + /** channel port identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** packet sequence */ + sequence: bigint; +} +export interface PacketIdProtoMsg { + typeUrl: "/ibc.core.channel.v1.PacketId"; + value: Uint8Array; +} +/** + * PacketId is an identifer for a unique Packet + * Source chains refer to packets by source port/channel + * Destination chains refer to packets by destination port/channel + */ +export interface PacketIdAmino { + /** channel port identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** packet sequence */ + sequence?: string; +} +export interface PacketIdAminoMsg { + type: "cosmos-sdk/PacketId"; + value: PacketIdAmino; +} +/** + * PacketId is an identifer for a unique Packet + * Source chains refer to packets by source port/channel + * Destination chains refer to packets by destination port/channel + */ +export interface PacketIdSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +/** + * Acknowledgement is the recommended acknowledgement format to be used by + * app-specific protocols. + * NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental + * conflicts with other protobuf message formats used for acknowledgements. + * The first byte of any message with this format will be the non-ASCII values + * `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: + * https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope + */ +export interface Acknowledgement { + result?: Uint8Array; + error?: string; +} +export interface AcknowledgementProtoMsg { + typeUrl: "/ibc.core.channel.v1.Acknowledgement"; + value: Uint8Array; +} +/** + * Acknowledgement is the recommended acknowledgement format to be used by + * app-specific protocols. + * NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental + * conflicts with other protobuf message formats used for acknowledgements. + * The first byte of any message with this format will be the non-ASCII values + * `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: + * https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope + */ +export interface AcknowledgementAmino { + result?: string; + error?: string; +} +export interface AcknowledgementAminoMsg { + type: "cosmos-sdk/Acknowledgement"; + value: AcknowledgementAmino; +} +/** + * Acknowledgement is the recommended acknowledgement format to be used by + * app-specific protocols. + * NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental + * conflicts with other protobuf message formats used for acknowledgements. + * The first byte of any message with this format will be the non-ASCII values + * `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: + * https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope + */ +export interface AcknowledgementSDKType { + result?: Uint8Array; + error?: string; +} +function createBaseChannel(): Channel { + return { + state: 0, + ordering: 0, + counterparty: Counterparty.fromPartial({}), + connectionHops: [], + version: "" + }; +} +export const Channel = { + typeUrl: "/ibc.core.channel.v1.Channel", + aminoType: "cosmos-sdk/Channel", + encode(message: Channel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.state !== 0) { + writer.uint32(8).int32(message.state); + } + if (message.ordering !== 0) { + writer.uint32(16).int32(message.ordering); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.connectionHops) { + writer.uint32(34).string(v!); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Channel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = (reader.int32() as any); + break; + case 2: + message.ordering = (reader.int32() as any); + break; + case 3: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 4: + message.connectionHops.push(reader.string()); + break; + case 5: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Channel { + const message = createBaseChannel(); + message.state = object.state ?? 0; + message.ordering = object.ordering ?? 0; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.connectionHops = object.connectionHops?.map(e => e) || []; + message.version = object.version ?? ""; + return message; + }, + fromAmino(object: ChannelAmino): Channel { + const message = createBaseChannel(); + if (object.state !== undefined && object.state !== null) { + message.state = object.state; + } + if (object.ordering !== undefined && object.ordering !== null) { + message.ordering = object.ordering; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + message.connectionHops = object.connection_hops?.map(e => e) || []; + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + return message; + }, + toAmino(message: Channel): ChannelAmino { + const obj: any = {}; + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + if (message.connectionHops) { + obj.connection_hops = message.connectionHops.map(e => e); + } else { + obj.connection_hops = message.connectionHops; + } + obj.version = message.version === "" ? undefined : message.version; + return obj; + }, + fromAminoMsg(object: ChannelAminoMsg): Channel { + return Channel.fromAmino(object.value); + }, + toAminoMsg(message: Channel): ChannelAminoMsg { + return { + type: "cosmos-sdk/Channel", + value: Channel.toAmino(message) + }; + }, + fromProtoMsg(message: ChannelProtoMsg): Channel { + return Channel.decode(message.value); + }, + toProto(message: Channel): Uint8Array { + return Channel.encode(message).finish(); + }, + toProtoMsg(message: Channel): ChannelProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Channel", + value: Channel.encode(message).finish() + }; + } +}; +function createBaseIdentifiedChannel(): IdentifiedChannel { + return { + state: 0, + ordering: 0, + counterparty: Counterparty.fromPartial({}), + connectionHops: [], + version: "", + portId: "", + channelId: "" + }; +} +export const IdentifiedChannel = { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", + aminoType: "cosmos-sdk/IdentifiedChannel", + encode(message: IdentifiedChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.state !== 0) { + writer.uint32(8).int32(message.state); + } + if (message.ordering !== 0) { + writer.uint32(16).int32(message.ordering); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.connectionHops) { + writer.uint32(34).string(v!); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.portId !== "") { + writer.uint32(50).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(58).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedChannel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = (reader.int32() as any); + break; + case 2: + message.ordering = (reader.int32() as any); + break; + case 3: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 4: + message.connectionHops.push(reader.string()); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.portId = reader.string(); + break; + case 7: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IdentifiedChannel { + const message = createBaseIdentifiedChannel(); + message.state = object.state ?? 0; + message.ordering = object.ordering ?? 0; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.connectionHops = object.connectionHops?.map(e => e) || []; + message.version = object.version ?? ""; + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { + const message = createBaseIdentifiedChannel(); + if (object.state !== undefined && object.state !== null) { + message.state = object.state; + } + if (object.ordering !== undefined && object.ordering !== null) { + message.ordering = object.ordering; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + message.connectionHops = object.connection_hops?.map(e => e) || []; + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { + const obj: any = {}; + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + if (message.connectionHops) { + obj.connection_hops = message.connectionHops.map(e => e); + } else { + obj.connection_hops = message.connectionHops; + } + obj.version = message.version === "" ? undefined : message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { + return IdentifiedChannel.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedChannel): IdentifiedChannelAminoMsg { + return { + type: "cosmos-sdk/IdentifiedChannel", + value: IdentifiedChannel.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedChannelProtoMsg): IdentifiedChannel { + return IdentifiedChannel.decode(message.value); + }, + toProto(message: IdentifiedChannel): Uint8Array { + return IdentifiedChannel.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedChannel): IdentifiedChannelProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", + value: IdentifiedChannel.encode(message).finish() + }; + } +}; +function createBaseCounterparty(): Counterparty { + return { + portId: "", + channelId: "" + }; +} +export const Counterparty = { + typeUrl: "/ibc.core.channel.v1.Counterparty", + aminoType: "cosmos-sdk/Counterparty", + encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Counterparty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterparty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Counterparty { + const message = createBaseCounterparty(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: CounterpartyAmino): Counterparty { + const message = createBaseCounterparty(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: Counterparty): CounterpartyAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { + return Counterparty.fromAmino(object.value); + }, + toAminoMsg(message: Counterparty): CounterpartyAminoMsg { + return { + type: "cosmos-sdk/Counterparty", + value: Counterparty.toAmino(message) + }; + }, + fromProtoMsg(message: CounterpartyProtoMsg): Counterparty { + return Counterparty.decode(message.value); + }, + toProto(message: Counterparty): Uint8Array { + return Counterparty.encode(message).finish(); + }, + toProtoMsg(message: Counterparty): CounterpartyProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Counterparty", + value: Counterparty.encode(message).finish() + }; + } +}; +function createBasePacket(): Packet { + return { + sequence: BigInt(0), + sourcePort: "", + sourceChannel: "", + destinationPort: "", + destinationChannel: "", + data: new Uint8Array(), + timeoutHeight: Height.fromPartial({}), + timeoutTimestamp: BigInt(0) + }; +} +export const Packet = { + typeUrl: "/ibc.core.channel.v1.Packet", + aminoType: "cosmos-sdk/Packet", + encode(message: Packet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.sourcePort !== "") { + writer.uint32(18).string(message.sourcePort); + } + if (message.sourceChannel !== "") { + writer.uint32(26).string(message.sourceChannel); + } + if (message.destinationPort !== "") { + writer.uint32(34).string(message.destinationPort); + } + if (message.destinationChannel !== "") { + writer.uint32(42).string(message.destinationChannel); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } + if (message.timeoutHeight !== undefined) { + Height.encode(message.timeoutHeight, writer.uint32(58).fork()).ldelim(); + } + if (message.timeoutTimestamp !== BigInt(0)) { + writer.uint32(64).uint64(message.timeoutTimestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Packet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.sourcePort = reader.string(); + break; + case 3: + message.sourceChannel = reader.string(); + break; + case 4: + message.destinationPort = reader.string(); + break; + case 5: + message.destinationChannel = reader.string(); + break; + case 6: + message.data = reader.bytes(); + break; + case 7: + message.timeoutHeight = Height.decode(reader, reader.uint32()); + break; + case 8: + message.timeoutTimestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Packet { + const message = createBasePacket(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.sourcePort = object.sourcePort ?? ""; + message.sourceChannel = object.sourceChannel ?? ""; + message.destinationPort = object.destinationPort ?? ""; + message.destinationChannel = object.destinationChannel ?? ""; + message.data = object.data ?? new Uint8Array(); + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PacketAmino): Packet { + const message = createBasePacket(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.source_port !== undefined && object.source_port !== null) { + message.sourcePort = object.source_port; + } + if (object.source_channel !== undefined && object.source_channel !== null) { + message.sourceChannel = object.source_channel; + } + if (object.destination_port !== undefined && object.destination_port !== null) { + message.destinationPort = object.destination_port; + } + if (object.destination_channel !== undefined && object.destination_channel !== null) { + message.destinationChannel = object.destination_channel; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = Height.fromAmino(object.timeout_height); + } + if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeout_timestamp); + } + return message; + }, + toAmino(message: Packet): PacketAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; + obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PacketAminoMsg): Packet { + return Packet.fromAmino(object.value); + }, + toAminoMsg(message: Packet): PacketAminoMsg { + return { + type: "cosmos-sdk/Packet", + value: Packet.toAmino(message) + }; + }, + fromProtoMsg(message: PacketProtoMsg): Packet { + return Packet.decode(message.value); + }, + toProto(message: Packet): Uint8Array { + return Packet.encode(message).finish(); + }, + toProtoMsg(message: Packet): PacketProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Packet", + value: Packet.encode(message).finish() + }; + } +}; +function createBasePacketState(): PacketState { + return { + portId: "", + channelId: "", + sequence: BigInt(0), + data: new Uint8Array() + }; +} +export const PacketState = { + typeUrl: "/ibc.core.channel.v1.PacketState", + aminoType: "cosmos-sdk/PacketState", + encode(message: PacketState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + if (message.data.length !== 0) { + writer.uint32(34).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + case 4: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketState { + const message = createBasePacketState(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: PacketStateAmino): PacketState { + const message = createBasePacketState(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: PacketState): PacketStateAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: PacketStateAminoMsg): PacketState { + return PacketState.fromAmino(object.value); + }, + toAminoMsg(message: PacketState): PacketStateAminoMsg { + return { + type: "cosmos-sdk/PacketState", + value: PacketState.toAmino(message) + }; + }, + fromProtoMsg(message: PacketStateProtoMsg): PacketState { + return PacketState.decode(message.value); + }, + toProto(message: PacketState): Uint8Array { + return PacketState.encode(message).finish(); + }, + toProtoMsg(message: PacketState): PacketStateProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.PacketState", + value: PacketState.encode(message).finish() + }; + } +}; +function createBasePacketId(): PacketId { + return { + portId: "", + channelId: "", + sequence: BigInt(0) + }; +} +export const PacketId = { + typeUrl: "/ibc.core.channel.v1.PacketId", + aminoType: "cosmos-sdk/PacketId", + encode(message: PacketId, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketId { + const message = createBasePacketId(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PacketIdAmino): PacketId { + const message = createBasePacketId(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: PacketId): PacketIdAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PacketIdAminoMsg): PacketId { + return PacketId.fromAmino(object.value); + }, + toAminoMsg(message: PacketId): PacketIdAminoMsg { + return { + type: "cosmos-sdk/PacketId", + value: PacketId.toAmino(message) + }; + }, + fromProtoMsg(message: PacketIdProtoMsg): PacketId { + return PacketId.decode(message.value); + }, + toProto(message: PacketId): Uint8Array { + return PacketId.encode(message).finish(); + }, + toProtoMsg(message: PacketId): PacketIdProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.PacketId", + value: PacketId.encode(message).finish() + }; + } +}; +function createBaseAcknowledgement(): Acknowledgement { + return { + result: undefined, + error: undefined + }; +} +export const Acknowledgement = { + typeUrl: "/ibc.core.channel.v1.Acknowledgement", + aminoType: "cosmos-sdk/Acknowledgement", + encode(message: Acknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== undefined) { + writer.uint32(170).bytes(message.result); + } + if (message.error !== undefined) { + writer.uint32(178).string(message.error); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Acknowledgement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcknowledgement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 21: + message.result = reader.bytes(); + break; + case 22: + message.error = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Acknowledgement { + const message = createBaseAcknowledgement(); + message.result = object.result ?? undefined; + message.error = object.error ?? undefined; + return message; + }, + fromAmino(object: AcknowledgementAmino): Acknowledgement { + const message = createBaseAcknowledgement(); + if (object.result !== undefined && object.result !== null) { + message.result = bytesFromBase64(object.result); + } + if (object.error !== undefined && object.error !== null) { + message.error = object.error; + } + return message; + }, + toAmino(message: Acknowledgement): AcknowledgementAmino { + const obj: any = {}; + obj.result = message.result ? base64FromBytes(message.result) : undefined; + obj.error = message.error === null ? undefined : message.error; + return obj; + }, + fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { + return Acknowledgement.fromAmino(object.value); + }, + toAminoMsg(message: Acknowledgement): AcknowledgementAminoMsg { + return { + type: "cosmos-sdk/Acknowledgement", + value: Acknowledgement.toAmino(message) + }; + }, + fromProtoMsg(message: AcknowledgementProtoMsg): Acknowledgement { + return Acknowledgement.decode(message.value); + }, + toProto(message: Acknowledgement): Uint8Array { + return Acknowledgement.encode(message).finish(); + }, + toProtoMsg(message: Acknowledgement): AcknowledgementProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Acknowledgement", + value: Acknowledgement.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/genesis.ts b/util/inj-types/ibc/core/channel/v1/genesis.ts new file mode 100644 index 00000000..41e06a4d --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/genesis.ts @@ -0,0 +1,343 @@ +import { IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** GenesisState defines the ibc channel submodule's genesis state. */ +export interface GenesisState { + channels: IdentifiedChannel[]; + acknowledgements: PacketState[]; + commitments: PacketState[]; + receipts: PacketState[]; + sendSequences: PacketSequence[]; + recvSequences: PacketSequence[]; + ackSequences: PacketSequence[]; + /** the sequence for the next generated channel identifier */ + nextChannelSequence: bigint; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.core.channel.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the ibc channel submodule's genesis state. */ +export interface GenesisStateAmino { + channels?: IdentifiedChannelAmino[]; + acknowledgements?: PacketStateAmino[]; + commitments?: PacketStateAmino[]; + receipts?: PacketStateAmino[]; + send_sequences?: PacketSequenceAmino[]; + recv_sequences?: PacketSequenceAmino[]; + ack_sequences?: PacketSequenceAmino[]; + /** the sequence for the next generated channel identifier */ + next_channel_sequence?: string; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the ibc channel submodule's genesis state. */ +export interface GenesisStateSDKType { + channels: IdentifiedChannelSDKType[]; + acknowledgements: PacketStateSDKType[]; + commitments: PacketStateSDKType[]; + receipts: PacketStateSDKType[]; + send_sequences: PacketSequenceSDKType[]; + recv_sequences: PacketSequenceSDKType[]; + ack_sequences: PacketSequenceSDKType[]; + next_channel_sequence: bigint; +} +/** + * PacketSequence defines the genesis type necessary to retrieve and store + * next send and receive sequences. + */ +export interface PacketSequence { + portId: string; + channelId: string; + sequence: bigint; +} +export interface PacketSequenceProtoMsg { + typeUrl: "/ibc.core.channel.v1.PacketSequence"; + value: Uint8Array; +} +/** + * PacketSequence defines the genesis type necessary to retrieve and store + * next send and receive sequences. + */ +export interface PacketSequenceAmino { + port_id?: string; + channel_id?: string; + sequence?: string; +} +export interface PacketSequenceAminoMsg { + type: "cosmos-sdk/PacketSequence"; + value: PacketSequenceAmino; +} +/** + * PacketSequence defines the genesis type necessary to retrieve and store + * next send and receive sequences. + */ +export interface PacketSequenceSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +function createBaseGenesisState(): GenesisState { + return { + channels: [], + acknowledgements: [], + commitments: [], + receipts: [], + sendSequences: [], + recvSequences: [], + ackSequences: [], + nextChannelSequence: BigInt(0) + }; +} +export const GenesisState = { + typeUrl: "/ibc.core.channel.v1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.channels) { + IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.acknowledgements) { + PacketState.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.commitments) { + PacketState.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.receipts) { + PacketState.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.sendSequences) { + PacketSequence.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.recvSequences) { + PacketSequence.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.ackSequences) { + PacketSequence.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.nextChannelSequence !== BigInt(0)) { + writer.uint32(64).uint64(message.nextChannelSequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.channels.push(IdentifiedChannel.decode(reader, reader.uint32())); + break; + case 2: + message.acknowledgements.push(PacketState.decode(reader, reader.uint32())); + break; + case 3: + message.commitments.push(PacketState.decode(reader, reader.uint32())); + break; + case 4: + message.receipts.push(PacketState.decode(reader, reader.uint32())); + break; + case 5: + message.sendSequences.push(PacketSequence.decode(reader, reader.uint32())); + break; + case 6: + message.recvSequences.push(PacketSequence.decode(reader, reader.uint32())); + break; + case 7: + message.ackSequences.push(PacketSequence.decode(reader, reader.uint32())); + break; + case 8: + message.nextChannelSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; + message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromPartial(e)) || []; + message.commitments = object.commitments?.map(e => PacketState.fromPartial(e)) || []; + message.receipts = object.receipts?.map(e => PacketState.fromPartial(e)) || []; + message.sendSequences = object.sendSequences?.map(e => PacketSequence.fromPartial(e)) || []; + message.recvSequences = object.recvSequences?.map(e => PacketSequence.fromPartial(e)) || []; + message.ackSequences = object.ackSequences?.map(e => PacketSequence.fromPartial(e)) || []; + message.nextChannelSequence = object.nextChannelSequence !== undefined && object.nextChannelSequence !== null ? BigInt(object.nextChannelSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromAmino(e)) || []; + message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromAmino(e)) || []; + message.commitments = object.commitments?.map(e => PacketState.fromAmino(e)) || []; + message.receipts = object.receipts?.map(e => PacketState.fromAmino(e)) || []; + message.sendSequences = object.send_sequences?.map(e => PacketSequence.fromAmino(e)) || []; + message.recvSequences = object.recv_sequences?.map(e => PacketSequence.fromAmino(e)) || []; + message.ackSequences = object.ack_sequences?.map(e => PacketSequence.fromAmino(e)) || []; + if (object.next_channel_sequence !== undefined && object.next_channel_sequence !== null) { + message.nextChannelSequence = BigInt(object.next_channel_sequence); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); + } else { + obj.channels = message.channels; + } + if (message.acknowledgements) { + obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.acknowledgements = message.acknowledgements; + } + if (message.commitments) { + obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.commitments = message.commitments; + } + if (message.receipts) { + obj.receipts = message.receipts.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.receipts = message.receipts; + } + if (message.sendSequences) { + obj.send_sequences = message.sendSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); + } else { + obj.send_sequences = message.sendSequences; + } + if (message.recvSequences) { + obj.recv_sequences = message.recvSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); + } else { + obj.recv_sequences = message.recvSequences; + } + if (message.ackSequences) { + obj.ack_sequences = message.ackSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); + } else { + obj.ack_sequences = message.ackSequences; + } + obj.next_channel_sequence = message.nextChannelSequence !== BigInt(0) ? message.nextChannelSequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; +function createBasePacketSequence(): PacketSequence { + return { + portId: "", + channelId: "", + sequence: BigInt(0) + }; +} +export const PacketSequence = { + typeUrl: "/ibc.core.channel.v1.PacketSequence", + aminoType: "cosmos-sdk/PacketSequence", + encode(message: PacketSequence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketSequence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketSequence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketSequence { + const message = createBasePacketSequence(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PacketSequenceAmino): PacketSequence { + const message = createBasePacketSequence(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: PacketSequence): PacketSequenceAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { + return PacketSequence.fromAmino(object.value); + }, + toAminoMsg(message: PacketSequence): PacketSequenceAminoMsg { + return { + type: "cosmos-sdk/PacketSequence", + value: PacketSequence.toAmino(message) + }; + }, + fromProtoMsg(message: PacketSequenceProtoMsg): PacketSequence { + return PacketSequence.decode(message.value); + }, + toProto(message: PacketSequence): Uint8Array { + return PacketSequence.encode(message).finish(); + }, + toProtoMsg(message: PacketSequence): PacketSequenceProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.PacketSequence", + value: PacketSequence.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/query.lcd.ts b/util/inj-types/ibc/core/channel/v1/query.lcd.ts new file mode 100644 index 00000000..6cf8d8df --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/query.lcd.ts @@ -0,0 +1,115 @@ +import { setPaginationParams } from "../../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryChannelRequest, QueryChannelResponseSDKType, QueryChannelsRequest, QueryChannelsResponseSDKType, QueryConnectionChannelsRequest, QueryConnectionChannelsResponseSDKType, QueryChannelClientStateRequest, QueryChannelClientStateResponseSDKType, QueryChannelConsensusStateRequest, QueryChannelConsensusStateResponseSDKType, QueryPacketCommitmentRequest, QueryPacketCommitmentResponseSDKType, QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponseSDKType, QueryPacketReceiptRequest, QueryPacketReceiptResponseSDKType, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponseSDKType, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponseSDKType, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponseSDKType, QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponseSDKType, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Channel queries an IBC Channel. */ + channel = async (params: QueryChannelRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}`; + return await this.req.get(endpoint); + }; + /* Channels queries all the IBC channels of a chain. */ + channels = async (params: QueryChannelsRequest = { + pagination: undefined + }): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `ibc/core/channel/v1/channels`; + return await this.req.get(endpoint, options); + }; + /* ConnectionChannels queries all the channels associated with a connection + end. */ + connectionChannels = async (params: QueryConnectionChannelsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `ibc/core/channel/v1/connections/${params.connection}/channels`; + return await this.req.get(endpoint, options); + }; + /* ChannelClientState queries for the client state for the channel associated + with the provided channel identifiers. */ + channelClientState = async (params: QueryChannelClientStateRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/client_state`; + return await this.req.get(endpoint); + }; + /* ChannelConsensusState queries for the consensus state for the channel + associated with the provided channel identifiers. */ + channelConsensusState = async (params: QueryChannelConsensusStateRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/consensus_state/revision/${params.revisionNumber}/height/${params.revisionHeight}`; + return await this.req.get(endpoint); + }; + /* PacketCommitment queries a stored packet commitment hash. */ + packetCommitment = async (params: QueryPacketCommitmentRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_commitments/${params.sequence}`; + return await this.req.get(endpoint); + }; + /* PacketCommitments returns all the packet commitments hashes associated + with a channel. */ + packetCommitments = async (params: QueryPacketCommitmentsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_commitments`; + return await this.req.get(endpoint, options); + }; + /* PacketReceipt queries if a given packet sequence has been received on the + queried chain */ + packetReceipt = async (params: QueryPacketReceiptRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_receipts/${params.sequence}`; + return await this.req.get(endpoint); + }; + /* PacketAcknowledgement queries a stored packet acknowledgement hash. */ + packetAcknowledgement = async (params: QueryPacketAcknowledgementRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_acks/${params.sequence}`; + return await this.req.get(endpoint); + }; + /* PacketAcknowledgements returns all the packet acknowledgements associated + with a channel. */ + packetAcknowledgements = async (params: QueryPacketAcknowledgementsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + if (typeof params?.packetCommitmentSequences !== "undefined") { + options.params.packet_commitment_sequences = params.packetCommitmentSequences; + } + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_acknowledgements`; + return await this.req.get(endpoint, options); + }; + /* UnreceivedPackets returns all the unreceived IBC packets associated with a + channel and sequences. */ + unreceivedPackets = async (params: QueryUnreceivedPacketsRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_commitments/${params.packetCommitmentSequences}/unreceived_packets`; + return await this.req.get(endpoint); + }; + /* UnreceivedAcks returns all the unreceived IBC acknowledgements associated + with a channel and sequences. */ + unreceivedAcks = async (params: QueryUnreceivedAcksRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/packet_commitments/${params.packetAckSequences}/unreceived_acks`; + return await this.req.get(endpoint); + }; + /* NextSequenceReceive returns the next receive sequence for a given channel. */ + nextSequenceReceive = async (params: QueryNextSequenceReceiveRequest): Promise => { + const endpoint = `ibc/core/channel/v1/channels/${params.channelId}/ports/${params.portId}/next_sequence`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/query.rpc.Query.ts b/util/inj-types/ibc/core/channel/v1/query.rpc.Query.ts new file mode 100644 index 00000000..7248d4c3 --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/query.rpc.Query.ts @@ -0,0 +1,196 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryChannelRequest, QueryChannelResponse, QueryChannelsRequest, QueryChannelsResponse, QueryConnectionChannelsRequest, QueryConnectionChannelsResponse, QueryChannelClientStateRequest, QueryChannelClientStateResponse, QueryChannelConsensusStateRequest, QueryChannelConsensusStateResponse, QueryPacketCommitmentRequest, QueryPacketCommitmentResponse, QueryPacketCommitmentsRequest, QueryPacketCommitmentsResponse, QueryPacketReceiptRequest, QueryPacketReceiptResponse, QueryPacketAcknowledgementRequest, QueryPacketAcknowledgementResponse, QueryPacketAcknowledgementsRequest, QueryPacketAcknowledgementsResponse, QueryUnreceivedPacketsRequest, QueryUnreceivedPacketsResponse, QueryUnreceivedAcksRequest, QueryUnreceivedAcksResponse, QueryNextSequenceReceiveRequest, QueryNextSequenceReceiveResponse } from "./query"; +/** Query provides defines the gRPC querier service */ +export interface Query { + /** Channel queries an IBC Channel. */ + channel(request: QueryChannelRequest): Promise; + /** Channels queries all the IBC channels of a chain. */ + channels(request?: QueryChannelsRequest): Promise; + /** + * ConnectionChannels queries all the channels associated with a connection + * end. + */ + connectionChannels(request: QueryConnectionChannelsRequest): Promise; + /** + * ChannelClientState queries for the client state for the channel associated + * with the provided channel identifiers. + */ + channelClientState(request: QueryChannelClientStateRequest): Promise; + /** + * ChannelConsensusState queries for the consensus state for the channel + * associated with the provided channel identifiers. + */ + channelConsensusState(request: QueryChannelConsensusStateRequest): Promise; + /** PacketCommitment queries a stored packet commitment hash. */ + packetCommitment(request: QueryPacketCommitmentRequest): Promise; + /** + * PacketCommitments returns all the packet commitments hashes associated + * with a channel. + */ + packetCommitments(request: QueryPacketCommitmentsRequest): Promise; + /** + * PacketReceipt queries if a given packet sequence has been received on the + * queried chain + */ + packetReceipt(request: QueryPacketReceiptRequest): Promise; + /** PacketAcknowledgement queries a stored packet acknowledgement hash. */ + packetAcknowledgement(request: QueryPacketAcknowledgementRequest): Promise; + /** + * PacketAcknowledgements returns all the packet acknowledgements associated + * with a channel. + */ + packetAcknowledgements(request: QueryPacketAcknowledgementsRequest): Promise; + /** + * UnreceivedPackets returns all the unreceived IBC packets associated with a + * channel and sequences. + */ + unreceivedPackets(request: QueryUnreceivedPacketsRequest): Promise; + /** + * UnreceivedAcks returns all the unreceived IBC acknowledgements associated + * with a channel and sequences. + */ + unreceivedAcks(request: QueryUnreceivedAcksRequest): Promise; + /** NextSequenceReceive returns the next receive sequence for a given channel. */ + nextSequenceReceive(request: QueryNextSequenceReceiveRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Channel queries an IBC Channel. */ + channel = async (request: QueryChannelRequest): Promise => { + const data = QueryChannelRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "Channel", data); + return promise.then(data => QueryChannelResponse.decode(new BinaryReader(data))); + }; + /* Channels queries all the IBC channels of a chain. */ + channels = async (request: QueryChannelsRequest = { + pagination: undefined + }): Promise => { + const data = QueryChannelsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "Channels", data); + return promise.then(data => QueryChannelsResponse.decode(new BinaryReader(data))); + }; + /* ConnectionChannels queries all the channels associated with a connection + end. */ + connectionChannels = async (request: QueryConnectionChannelsRequest): Promise => { + const data = QueryConnectionChannelsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "ConnectionChannels", data); + return promise.then(data => QueryConnectionChannelsResponse.decode(new BinaryReader(data))); + }; + /* ChannelClientState queries for the client state for the channel associated + with the provided channel identifiers. */ + channelClientState = async (request: QueryChannelClientStateRequest): Promise => { + const data = QueryChannelClientStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "ChannelClientState", data); + return promise.then(data => QueryChannelClientStateResponse.decode(new BinaryReader(data))); + }; + /* ChannelConsensusState queries for the consensus state for the channel + associated with the provided channel identifiers. */ + channelConsensusState = async (request: QueryChannelConsensusStateRequest): Promise => { + const data = QueryChannelConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "ChannelConsensusState", data); + return promise.then(data => QueryChannelConsensusStateResponse.decode(new BinaryReader(data))); + }; + /* PacketCommitment queries a stored packet commitment hash. */ + packetCommitment = async (request: QueryPacketCommitmentRequest): Promise => { + const data = QueryPacketCommitmentRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketCommitment", data); + return promise.then(data => QueryPacketCommitmentResponse.decode(new BinaryReader(data))); + }; + /* PacketCommitments returns all the packet commitments hashes associated + with a channel. */ + packetCommitments = async (request: QueryPacketCommitmentsRequest): Promise => { + const data = QueryPacketCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketCommitments", data); + return promise.then(data => QueryPacketCommitmentsResponse.decode(new BinaryReader(data))); + }; + /* PacketReceipt queries if a given packet sequence has been received on the + queried chain */ + packetReceipt = async (request: QueryPacketReceiptRequest): Promise => { + const data = QueryPacketReceiptRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketReceipt", data); + return promise.then(data => QueryPacketReceiptResponse.decode(new BinaryReader(data))); + }; + /* PacketAcknowledgement queries a stored packet acknowledgement hash. */ + packetAcknowledgement = async (request: QueryPacketAcknowledgementRequest): Promise => { + const data = QueryPacketAcknowledgementRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketAcknowledgement", data); + return promise.then(data => QueryPacketAcknowledgementResponse.decode(new BinaryReader(data))); + }; + /* PacketAcknowledgements returns all the packet acknowledgements associated + with a channel. */ + packetAcknowledgements = async (request: QueryPacketAcknowledgementsRequest): Promise => { + const data = QueryPacketAcknowledgementsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "PacketAcknowledgements", data); + return promise.then(data => QueryPacketAcknowledgementsResponse.decode(new BinaryReader(data))); + }; + /* UnreceivedPackets returns all the unreceived IBC packets associated with a + channel and sequences. */ + unreceivedPackets = async (request: QueryUnreceivedPacketsRequest): Promise => { + const data = QueryUnreceivedPacketsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "UnreceivedPackets", data); + return promise.then(data => QueryUnreceivedPacketsResponse.decode(new BinaryReader(data))); + }; + /* UnreceivedAcks returns all the unreceived IBC acknowledgements associated + with a channel and sequences. */ + unreceivedAcks = async (request: QueryUnreceivedAcksRequest): Promise => { + const data = QueryUnreceivedAcksRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "UnreceivedAcks", data); + return promise.then(data => QueryUnreceivedAcksResponse.decode(new BinaryReader(data))); + }; + /* NextSequenceReceive returns the next receive sequence for a given channel. */ + nextSequenceReceive = async (request: QueryNextSequenceReceiveRequest): Promise => { + const data = QueryNextSequenceReceiveRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Query", "NextSequenceReceive", data); + return promise.then(data => QueryNextSequenceReceiveResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + channel(request: QueryChannelRequest): Promise { + return queryService.channel(request); + }, + channels(request?: QueryChannelsRequest): Promise { + return queryService.channels(request); + }, + connectionChannels(request: QueryConnectionChannelsRequest): Promise { + return queryService.connectionChannels(request); + }, + channelClientState(request: QueryChannelClientStateRequest): Promise { + return queryService.channelClientState(request); + }, + channelConsensusState(request: QueryChannelConsensusStateRequest): Promise { + return queryService.channelConsensusState(request); + }, + packetCommitment(request: QueryPacketCommitmentRequest): Promise { + return queryService.packetCommitment(request); + }, + packetCommitments(request: QueryPacketCommitmentsRequest): Promise { + return queryService.packetCommitments(request); + }, + packetReceipt(request: QueryPacketReceiptRequest): Promise { + return queryService.packetReceipt(request); + }, + packetAcknowledgement(request: QueryPacketAcknowledgementRequest): Promise { + return queryService.packetAcknowledgement(request); + }, + packetAcknowledgements(request: QueryPacketAcknowledgementsRequest): Promise { + return queryService.packetAcknowledgements(request); + }, + unreceivedPackets(request: QueryUnreceivedPacketsRequest): Promise { + return queryService.unreceivedPackets(request); + }, + unreceivedAcks(request: QueryUnreceivedAcksRequest): Promise { + return queryService.unreceivedAcks(request); + }, + nextSequenceReceive(request: QueryNextSequenceReceiveRequest): Promise { + return queryService.nextSequenceReceive(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/query.ts b/util/inj-types/ibc/core/channel/v1/query.ts new file mode 100644 index 00000000..a3ffcf80 --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/query.ts @@ -0,0 +1,3475 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Channel, ChannelAmino, ChannelSDKType, IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; +import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType } from "../../client/v1/client"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** QueryChannelRequest is the request type for the Query/Channel RPC method */ +export interface QueryChannelRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; +} +export interface QueryChannelRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelRequest"; + value: Uint8Array; +} +/** QueryChannelRequest is the request type for the Query/Channel RPC method */ +export interface QueryChannelRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; +} +export interface QueryChannelRequestAminoMsg { + type: "cosmos-sdk/QueryChannelRequest"; + value: QueryChannelRequestAmino; +} +/** QueryChannelRequest is the request type for the Query/Channel RPC method */ +export interface QueryChannelRequestSDKType { + port_id: string; + channel_id: string; +} +/** + * QueryChannelResponse is the response type for the Query/Channel RPC method. + * Besides the Channel end, it includes a proof and the height from which the + * proof was retrieved. + */ +export interface QueryChannelResponse { + /** channel associated with the request identifiers */ + channel?: Channel; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryChannelResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelResponse"; + value: Uint8Array; +} +/** + * QueryChannelResponse is the response type for the Query/Channel RPC method. + * Besides the Channel end, it includes a proof and the height from which the + * proof was retrieved. + */ +export interface QueryChannelResponseAmino { + /** channel associated with the request identifiers */ + channel?: ChannelAmino; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryChannelResponseAminoMsg { + type: "cosmos-sdk/QueryChannelResponse"; + value: QueryChannelResponseAmino; +} +/** + * QueryChannelResponse is the response type for the Query/Channel RPC method. + * Besides the Channel end, it includes a proof and the height from which the + * proof was retrieved. + */ +export interface QueryChannelResponseSDKType { + channel?: ChannelSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** QueryChannelsRequest is the request type for the Query/Channels RPC method */ +export interface QueryChannelsRequest { + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryChannelsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest"; + value: Uint8Array; +} +/** QueryChannelsRequest is the request type for the Query/Channels RPC method */ +export interface QueryChannelsRequestAmino { + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryChannelsRequestAminoMsg { + type: "cosmos-sdk/QueryChannelsRequest"; + value: QueryChannelsRequestAmino; +} +/** QueryChannelsRequest is the request type for the Query/Channels RPC method */ +export interface QueryChannelsRequestSDKType { + pagination?: PageRequestSDKType; +} +/** QueryChannelsResponse is the response type for the Query/Channels RPC method. */ +export interface QueryChannelsResponse { + /** list of stored channels of the chain. */ + channels: IdentifiedChannel[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryChannelsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse"; + value: Uint8Array; +} +/** QueryChannelsResponse is the response type for the Query/Channels RPC method. */ +export interface QueryChannelsResponseAmino { + /** list of stored channels of the chain. */ + channels?: IdentifiedChannelAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; + /** query block height */ + height?: HeightAmino; +} +export interface QueryChannelsResponseAminoMsg { + type: "cosmos-sdk/QueryChannelsResponse"; + value: QueryChannelsResponseAmino; +} +/** QueryChannelsResponse is the response type for the Query/Channels RPC method. */ +export interface QueryChannelsResponseSDKType { + channels: IdentifiedChannelSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryConnectionChannelsRequest is the request type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsRequest { + /** connection unique identifier */ + connection: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryConnectionChannelsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest"; + value: Uint8Array; +} +/** + * QueryConnectionChannelsRequest is the request type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsRequestAmino { + /** connection unique identifier */ + connection?: string; + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryConnectionChannelsRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionChannelsRequest"; + value: QueryConnectionChannelsRequestAmino; +} +/** + * QueryConnectionChannelsRequest is the request type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsRequestSDKType { + connection: string; + pagination?: PageRequestSDKType; +} +/** + * QueryConnectionChannelsResponse is the Response type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsResponse { + /** list of channels associated with a connection. */ + channels: IdentifiedChannel[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryConnectionChannelsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse"; + value: Uint8Array; +} +/** + * QueryConnectionChannelsResponse is the Response type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsResponseAmino { + /** list of channels associated with a connection. */ + channels?: IdentifiedChannelAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; + /** query block height */ + height?: HeightAmino; +} +export interface QueryConnectionChannelsResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionChannelsResponse"; + value: QueryConnectionChannelsResponseAmino; +} +/** + * QueryConnectionChannelsResponse is the Response type for the + * Query/QueryConnectionChannels RPC method + */ +export interface QueryConnectionChannelsResponseSDKType { + channels: IdentifiedChannelSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryChannelClientStateRequest is the request type for the Query/ClientState + * RPC method + */ +export interface QueryChannelClientStateRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; +} +export interface QueryChannelClientStateRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest"; + value: Uint8Array; +} +/** + * QueryChannelClientStateRequest is the request type for the Query/ClientState + * RPC method + */ +export interface QueryChannelClientStateRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; +} +export interface QueryChannelClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryChannelClientStateRequest"; + value: QueryChannelClientStateRequestAmino; +} +/** + * QueryChannelClientStateRequest is the request type for the Query/ClientState + * RPC method + */ +export interface QueryChannelClientStateRequestSDKType { + port_id: string; + channel_id: string; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelClientStateResponse { + /** client state associated with the channel */ + identifiedClientState?: IdentifiedClientState; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryChannelClientStateResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse"; + value: Uint8Array; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelClientStateResponseAmino { + /** client state associated with the channel */ + identified_client_state?: IdentifiedClientStateAmino; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryChannelClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryChannelClientStateResponse"; + value: QueryChannelClientStateResponseAmino; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelClientStateResponseSDKType { + identified_client_state?: IdentifiedClientStateSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryChannelConsensusStateRequest is the request type for the + * Query/ConsensusState RPC method + */ +export interface QueryChannelConsensusStateRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** revision number of the consensus state */ + revisionNumber: bigint; + /** revision height of the consensus state */ + revisionHeight: bigint; +} +export interface QueryChannelConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryChannelConsensusStateRequest is the request type for the + * Query/ConsensusState RPC method + */ +export interface QueryChannelConsensusStateRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** revision number of the consensus state */ + revision_number?: string; + /** revision height of the consensus state */ + revision_height?: string; +} +export interface QueryChannelConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryChannelConsensusStateRequest"; + value: QueryChannelConsensusStateRequestAmino; +} +/** + * QueryChannelConsensusStateRequest is the request type for the + * Query/ConsensusState RPC method + */ +export interface QueryChannelConsensusStateRequestSDKType { + port_id: string; + channel_id: string; + revision_number: bigint; + revision_height: bigint; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelConsensusStateResponse { + /** consensus state associated with the channel */ + consensusState?: Any; + /** client ID associated with the consensus state */ + clientId: string; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryChannelConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse"; + value: Uint8Array; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelConsensusStateResponseAmino { + /** consensus state associated with the channel */ + consensus_state?: AnyAmino; + /** client ID associated with the consensus state */ + client_id?: string; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryChannelConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryChannelConsensusStateResponse"; + value: QueryChannelConsensusStateResponseAmino; +} +/** + * QueryChannelClientStateResponse is the Response type for the + * Query/QueryChannelClientState RPC method + */ +export interface QueryChannelConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + client_id: string; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryPacketCommitmentRequest is the request type for the + * Query/PacketCommitment RPC method + */ +export interface QueryPacketCommitmentRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** packet sequence */ + sequence: bigint; +} +export interface QueryPacketCommitmentRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest"; + value: Uint8Array; +} +/** + * QueryPacketCommitmentRequest is the request type for the + * Query/PacketCommitment RPC method + */ +export interface QueryPacketCommitmentRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** packet sequence */ + sequence?: string; +} +export interface QueryPacketCommitmentRequestAminoMsg { + type: "cosmos-sdk/QueryPacketCommitmentRequest"; + value: QueryPacketCommitmentRequestAmino; +} +/** + * QueryPacketCommitmentRequest is the request type for the + * Query/PacketCommitment RPC method + */ +export interface QueryPacketCommitmentRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +/** + * QueryPacketCommitmentResponse defines the client query response for a packet + * which also includes a proof and the height from which the proof was + * retrieved + */ +export interface QueryPacketCommitmentResponse { + /** packet associated with the request fields */ + commitment: Uint8Array; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryPacketCommitmentResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse"; + value: Uint8Array; +} +/** + * QueryPacketCommitmentResponse defines the client query response for a packet + * which also includes a proof and the height from which the proof was + * retrieved + */ +export interface QueryPacketCommitmentResponseAmino { + /** packet associated with the request fields */ + commitment?: string; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryPacketCommitmentResponseAminoMsg { + type: "cosmos-sdk/QueryPacketCommitmentResponse"; + value: QueryPacketCommitmentResponseAmino; +} +/** + * QueryPacketCommitmentResponse defines the client query response for a packet + * which also includes a proof and the height from which the proof was + * retrieved + */ +export interface QueryPacketCommitmentResponseSDKType { + commitment: Uint8Array; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryPacketCommitmentsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryPacketCommitmentsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest"; + value: Uint8Array; +} +/** + * QueryPacketCommitmentsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryPacketCommitmentsRequestAminoMsg { + type: "cosmos-sdk/QueryPacketCommitmentsRequest"; + value: QueryPacketCommitmentsRequestAmino; +} +/** + * QueryPacketCommitmentsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsRequestSDKType { + port_id: string; + channel_id: string; + pagination?: PageRequestSDKType; +} +/** + * QueryPacketCommitmentsResponse is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsResponse { + commitments: PacketState[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryPacketCommitmentsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse"; + value: Uint8Array; +} +/** + * QueryPacketCommitmentsResponse is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsResponseAmino { + commitments?: PacketStateAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; + /** query block height */ + height?: HeightAmino; +} +export interface QueryPacketCommitmentsResponseAminoMsg { + type: "cosmos-sdk/QueryPacketCommitmentsResponse"; + value: QueryPacketCommitmentsResponseAmino; +} +/** + * QueryPacketCommitmentsResponse is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketCommitmentsResponseSDKType { + commitments: PacketStateSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryPacketReceiptRequest is the request type for the + * Query/PacketReceipt RPC method + */ +export interface QueryPacketReceiptRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** packet sequence */ + sequence: bigint; +} +export interface QueryPacketReceiptRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest"; + value: Uint8Array; +} +/** + * QueryPacketReceiptRequest is the request type for the + * Query/PacketReceipt RPC method + */ +export interface QueryPacketReceiptRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** packet sequence */ + sequence?: string; +} +export interface QueryPacketReceiptRequestAminoMsg { + type: "cosmos-sdk/QueryPacketReceiptRequest"; + value: QueryPacketReceiptRequestAmino; +} +/** + * QueryPacketReceiptRequest is the request type for the + * Query/PacketReceipt RPC method + */ +export interface QueryPacketReceiptRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +/** + * QueryPacketReceiptResponse defines the client query response for a packet + * receipt which also includes a proof, and the height from which the proof was + * retrieved + */ +export interface QueryPacketReceiptResponse { + /** success flag for if receipt exists */ + received: boolean; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryPacketReceiptResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse"; + value: Uint8Array; +} +/** + * QueryPacketReceiptResponse defines the client query response for a packet + * receipt which also includes a proof, and the height from which the proof was + * retrieved + */ +export interface QueryPacketReceiptResponseAmino { + /** success flag for if receipt exists */ + received?: boolean; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryPacketReceiptResponseAminoMsg { + type: "cosmos-sdk/QueryPacketReceiptResponse"; + value: QueryPacketReceiptResponseAmino; +} +/** + * QueryPacketReceiptResponse defines the client query response for a packet + * receipt which also includes a proof, and the height from which the proof was + * retrieved + */ +export interface QueryPacketReceiptResponseSDKType { + received: boolean; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryPacketAcknowledgementRequest is the request type for the + * Query/PacketAcknowledgement RPC method + */ +export interface QueryPacketAcknowledgementRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** packet sequence */ + sequence: bigint; +} +export interface QueryPacketAcknowledgementRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest"; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgementRequest is the request type for the + * Query/PacketAcknowledgement RPC method + */ +export interface QueryPacketAcknowledgementRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** packet sequence */ + sequence?: string; +} +export interface QueryPacketAcknowledgementRequestAminoMsg { + type: "cosmos-sdk/QueryPacketAcknowledgementRequest"; + value: QueryPacketAcknowledgementRequestAmino; +} +/** + * QueryPacketAcknowledgementRequest is the request type for the + * Query/PacketAcknowledgement RPC method + */ +export interface QueryPacketAcknowledgementRequestSDKType { + port_id: string; + channel_id: string; + sequence: bigint; +} +/** + * QueryPacketAcknowledgementResponse defines the client query response for a + * packet which also includes a proof and the height from which the + * proof was retrieved + */ +export interface QueryPacketAcknowledgementResponse { + /** packet associated with the request fields */ + acknowledgement: Uint8Array; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryPacketAcknowledgementResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse"; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgementResponse defines the client query response for a + * packet which also includes a proof and the height from which the + * proof was retrieved + */ +export interface QueryPacketAcknowledgementResponseAmino { + /** packet associated with the request fields */ + acknowledgement?: string; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryPacketAcknowledgementResponseAminoMsg { + type: "cosmos-sdk/QueryPacketAcknowledgementResponse"; + value: QueryPacketAcknowledgementResponseAmino; +} +/** + * QueryPacketAcknowledgementResponse defines the client query response for a + * packet which also includes a proof and the height from which the + * proof was retrieved + */ +export interface QueryPacketAcknowledgementResponseSDKType { + acknowledgement: Uint8Array; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryPacketAcknowledgementsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketAcknowledgementsRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** pagination request */ + pagination?: PageRequest; + /** list of packet sequences */ + packetCommitmentSequences?: bigint[]; +} +export interface QueryPacketAcknowledgementsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest"; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgementsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketAcknowledgementsRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** pagination request */ + pagination?: PageRequestAmino; + /** list of packet sequences */ + packet_commitment_sequences?: string[]; +} +export interface QueryPacketAcknowledgementsRequestAminoMsg { + type: "cosmos-sdk/QueryPacketAcknowledgementsRequest"; + value: QueryPacketAcknowledgementsRequestAmino; +} +/** + * QueryPacketAcknowledgementsRequest is the request type for the + * Query/QueryPacketCommitments RPC method + */ +export interface QueryPacketAcknowledgementsRequestSDKType { + port_id: string; + channel_id: string; + pagination?: PageRequestSDKType; + packet_commitment_sequences?: bigint[]; +} +/** + * QueryPacketAcknowledgemetsResponse is the request type for the + * Query/QueryPacketAcknowledgements RPC method + */ +export interface QueryPacketAcknowledgementsResponse { + acknowledgements: PacketState[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryPacketAcknowledgementsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse"; + value: Uint8Array; +} +/** + * QueryPacketAcknowledgemetsResponse is the request type for the + * Query/QueryPacketAcknowledgements RPC method + */ +export interface QueryPacketAcknowledgementsResponseAmino { + acknowledgements?: PacketStateAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; + /** query block height */ + height?: HeightAmino; +} +export interface QueryPacketAcknowledgementsResponseAminoMsg { + type: "cosmos-sdk/QueryPacketAcknowledgementsResponse"; + value: QueryPacketAcknowledgementsResponseAmino; +} +/** + * QueryPacketAcknowledgemetsResponse is the request type for the + * Query/QueryPacketAcknowledgements RPC method + */ +export interface QueryPacketAcknowledgementsResponseSDKType { + acknowledgements: PacketStateSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryUnreceivedPacketsRequest is the request type for the + * Query/UnreceivedPackets RPC method + */ +export interface QueryUnreceivedPacketsRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** list of packet sequences */ + packetCommitmentSequences: bigint[]; +} +export interface QueryUnreceivedPacketsRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest"; + value: Uint8Array; +} +/** + * QueryUnreceivedPacketsRequest is the request type for the + * Query/UnreceivedPackets RPC method + */ +export interface QueryUnreceivedPacketsRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** list of packet sequences */ + packet_commitment_sequences?: string[]; +} +export interface QueryUnreceivedPacketsRequestAminoMsg { + type: "cosmos-sdk/QueryUnreceivedPacketsRequest"; + value: QueryUnreceivedPacketsRequestAmino; +} +/** + * QueryUnreceivedPacketsRequest is the request type for the + * Query/UnreceivedPackets RPC method + */ +export interface QueryUnreceivedPacketsRequestSDKType { + port_id: string; + channel_id: string; + packet_commitment_sequences: bigint[]; +} +/** + * QueryUnreceivedPacketsResponse is the response type for the + * Query/UnreceivedPacketCommitments RPC method + */ +export interface QueryUnreceivedPacketsResponse { + /** list of unreceived packet sequences */ + sequences: bigint[]; + /** query block height */ + height: Height; +} +export interface QueryUnreceivedPacketsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse"; + value: Uint8Array; +} +/** + * QueryUnreceivedPacketsResponse is the response type for the + * Query/UnreceivedPacketCommitments RPC method + */ +export interface QueryUnreceivedPacketsResponseAmino { + /** list of unreceived packet sequences */ + sequences?: string[]; + /** query block height */ + height?: HeightAmino; +} +export interface QueryUnreceivedPacketsResponseAminoMsg { + type: "cosmos-sdk/QueryUnreceivedPacketsResponse"; + value: QueryUnreceivedPacketsResponseAmino; +} +/** + * QueryUnreceivedPacketsResponse is the response type for the + * Query/UnreceivedPacketCommitments RPC method + */ +export interface QueryUnreceivedPacketsResponseSDKType { + sequences: bigint[]; + height: HeightSDKType; +} +/** + * QueryUnreceivedAcks is the request type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** list of acknowledgement sequences */ + packetAckSequences: bigint[]; +} +export interface QueryUnreceivedAcksRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest"; + value: Uint8Array; +} +/** + * QueryUnreceivedAcks is the request type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; + /** list of acknowledgement sequences */ + packet_ack_sequences?: string[]; +} +export interface QueryUnreceivedAcksRequestAminoMsg { + type: "cosmos-sdk/QueryUnreceivedAcksRequest"; + value: QueryUnreceivedAcksRequestAmino; +} +/** + * QueryUnreceivedAcks is the request type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksRequestSDKType { + port_id: string; + channel_id: string; + packet_ack_sequences: bigint[]; +} +/** + * QueryUnreceivedAcksResponse is the response type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksResponse { + /** list of unreceived acknowledgement sequences */ + sequences: bigint[]; + /** query block height */ + height: Height; +} +export interface QueryUnreceivedAcksResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse"; + value: Uint8Array; +} +/** + * QueryUnreceivedAcksResponse is the response type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksResponseAmino { + /** list of unreceived acknowledgement sequences */ + sequences?: string[]; + /** query block height */ + height?: HeightAmino; +} +export interface QueryUnreceivedAcksResponseAminoMsg { + type: "cosmos-sdk/QueryUnreceivedAcksResponse"; + value: QueryUnreceivedAcksResponseAmino; +} +/** + * QueryUnreceivedAcksResponse is the response type for the + * Query/UnreceivedAcks RPC method + */ +export interface QueryUnreceivedAcksResponseSDKType { + sequences: bigint[]; + height: HeightSDKType; +} +/** + * QueryNextSequenceReceiveRequest is the request type for the + * Query/QueryNextSequenceReceiveRequest RPC method + */ +export interface QueryNextSequenceReceiveRequest { + /** port unique identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; +} +export interface QueryNextSequenceReceiveRequestProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest"; + value: Uint8Array; +} +/** + * QueryNextSequenceReceiveRequest is the request type for the + * Query/QueryNextSequenceReceiveRequest RPC method + */ +export interface QueryNextSequenceReceiveRequestAmino { + /** port unique identifier */ + port_id?: string; + /** channel unique identifier */ + channel_id?: string; +} +export interface QueryNextSequenceReceiveRequestAminoMsg { + type: "cosmos-sdk/QueryNextSequenceReceiveRequest"; + value: QueryNextSequenceReceiveRequestAmino; +} +/** + * QueryNextSequenceReceiveRequest is the request type for the + * Query/QueryNextSequenceReceiveRequest RPC method + */ +export interface QueryNextSequenceReceiveRequestSDKType { + port_id: string; + channel_id: string; +} +/** + * QuerySequenceResponse is the request type for the + * Query/QueryNextSequenceReceiveResponse RPC method + */ +export interface QueryNextSequenceReceiveResponse { + /** next sequence receive number */ + nextSequenceReceive: bigint; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryNextSequenceReceiveResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse"; + value: Uint8Array; +} +/** + * QuerySequenceResponse is the request type for the + * Query/QueryNextSequenceReceiveResponse RPC method + */ +export interface QueryNextSequenceReceiveResponseAmino { + /** next sequence receive number */ + next_sequence_receive?: string; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryNextSequenceReceiveResponseAminoMsg { + type: "cosmos-sdk/QueryNextSequenceReceiveResponse"; + value: QueryNextSequenceReceiveResponseAmino; +} +/** + * QuerySequenceResponse is the request type for the + * Query/QueryNextSequenceReceiveResponse RPC method + */ +export interface QueryNextSequenceReceiveResponseSDKType { + next_sequence_receive: bigint; + proof: Uint8Array; + proof_height: HeightSDKType; +} +function createBaseQueryChannelRequest(): QueryChannelRequest { + return { + portId: "", + channelId: "" + }; +} +export const QueryChannelRequest = { + typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", + aminoType: "cosmos-sdk/QueryChannelRequest", + encode(message: QueryChannelRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryChannelRequest { + const message = createBaseQueryChannelRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: QueryChannelRequestAmino): QueryChannelRequest { + const message = createBaseQueryChannelRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { + return QueryChannelRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelRequest): QueryChannelRequestAminoMsg { + return { + type: "cosmos-sdk/QueryChannelRequest", + value: QueryChannelRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelRequestProtoMsg): QueryChannelRequest { + return QueryChannelRequest.decode(message.value); + }, + toProto(message: QueryChannelRequest): Uint8Array { + return QueryChannelRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelRequest): QueryChannelRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelRequest", + value: QueryChannelRequest.encode(message).finish() + }; + } +}; +function createBaseQueryChannelResponse(): QueryChannelResponse { + return { + channel: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryChannelResponse = { + typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", + aminoType: "cosmos-sdk/QueryChannelResponse", + encode(message: QueryChannelResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channel = Channel.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryChannelResponse { + const message = createBaseQueryChannelResponse(); + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryChannelResponseAmino): QueryChannelResponse { + const message = createBaseQueryChannelResponse(); + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryChannelResponse): QueryChannelResponseAmino { + const obj: any = {}; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryChannelResponseAminoMsg): QueryChannelResponse { + return QueryChannelResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelResponse): QueryChannelResponseAminoMsg { + return { + type: "cosmos-sdk/QueryChannelResponse", + value: QueryChannelResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelResponseProtoMsg): QueryChannelResponse { + return QueryChannelResponse.decode(message.value); + }, + toProto(message: QueryChannelResponse): Uint8Array { + return QueryChannelResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelResponse): QueryChannelResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelResponse", + value: QueryChannelResponse.encode(message).finish() + }; + } +}; +function createBaseQueryChannelsRequest(): QueryChannelsRequest { + return { + pagination: undefined + }; +} +export const QueryChannelsRequest = { + typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", + aminoType: "cosmos-sdk/QueryChannelsRequest", + encode(message: QueryChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelsRequest(); + 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: DeepPartial): QueryChannelsRequest { + const message = createBaseQueryChannelsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryChannelsRequestAmino): QueryChannelsRequest { + const message = createBaseQueryChannelsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryChannelsRequest): QueryChannelsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryChannelsRequestAminoMsg): QueryChannelsRequest { + return QueryChannelsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelsRequest): QueryChannelsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryChannelsRequest", + value: QueryChannelsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelsRequestProtoMsg): QueryChannelsRequest { + return QueryChannelsRequest.decode(message.value); + }, + toProto(message: QueryChannelsRequest): Uint8Array { + return QueryChannelsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelsRequest): QueryChannelsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest", + value: QueryChannelsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryChannelsResponse(): QueryChannelsResponse { + return { + channels: [], + pagination: undefined, + height: Height.fromPartial({}) + }; +} +export const QueryChannelsResponse = { + typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", + aminoType: "cosmos-sdk/QueryChannelsResponse", + encode(message: QueryChannelsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.channels) { + IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channels.push(IdentifiedChannel.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryChannelsResponse { + const message = createBaseQueryChannelsResponse(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + return message; + }, + fromAmino(object: QueryChannelsResponseAmino): QueryChannelsResponse { + const message = createBaseQueryChannelsResponse(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryChannelsResponse): QueryChannelsResponseAmino { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); + } else { + obj.channels = message.channels; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryChannelsResponseAminoMsg): QueryChannelsResponse { + return QueryChannelsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelsResponse): QueryChannelsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryChannelsResponse", + value: QueryChannelsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelsResponseProtoMsg): QueryChannelsResponse { + return QueryChannelsResponse.decode(message.value); + }, + toProto(message: QueryChannelsResponse): Uint8Array { + return QueryChannelsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelsResponse): QueryChannelsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse", + value: QueryChannelsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionChannelsRequest(): QueryConnectionChannelsRequest { + return { + connection: "", + pagination: undefined + }; +} +export const QueryConnectionChannelsRequest = { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", + aminoType: "cosmos-sdk/QueryConnectionChannelsRequest", + encode(message: QueryConnectionChannelsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connection !== "") { + writer.uint32(10).string(message.connection); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionChannelsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionChannelsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionChannelsRequest { + const message = createBaseQueryConnectionChannelsRequest(); + message.connection = object.connection ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryConnectionChannelsRequestAmino): QueryConnectionChannelsRequest { + const message = createBaseQueryConnectionChannelsRequest(); + if (object.connection !== undefined && object.connection !== null) { + message.connection = object.connection; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { + const obj: any = {}; + obj.connection = message.connection === "" ? undefined : message.connection; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConnectionChannelsRequestAminoMsg): QueryConnectionChannelsRequest { + return QueryConnectionChannelsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionChannelsRequest", + value: QueryConnectionChannelsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionChannelsRequestProtoMsg): QueryConnectionChannelsRequest { + return QueryConnectionChannelsRequest.decode(message.value); + }, + toProto(message: QueryConnectionChannelsRequest): Uint8Array { + return QueryConnectionChannelsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest", + value: QueryConnectionChannelsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionChannelsResponse(): QueryConnectionChannelsResponse { + return { + channels: [], + pagination: undefined, + height: Height.fromPartial({}) + }; +} +export const QueryConnectionChannelsResponse = { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", + aminoType: "cosmos-sdk/QueryConnectionChannelsResponse", + encode(message: QueryConnectionChannelsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.channels) { + IdentifiedChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionChannelsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionChannelsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channels.push(IdentifiedChannel.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionChannelsResponse { + const message = createBaseQueryConnectionChannelsResponse(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + return message; + }, + fromAmino(object: QueryConnectionChannelsResponseAmino): QueryConnectionChannelsResponse { + const message = createBaseQueryConnectionChannelsResponse(); + message.channels = object.channels?.map(e => IdentifiedChannel.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryConnectionChannelsResponse): QueryConnectionChannelsResponseAmino { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); + } else { + obj.channels = message.channels; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionChannelsResponseAminoMsg): QueryConnectionChannelsResponse { + return QueryConnectionChannelsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionChannelsResponse): QueryConnectionChannelsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionChannelsResponse", + value: QueryConnectionChannelsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionChannelsResponseProtoMsg): QueryConnectionChannelsResponse { + return QueryConnectionChannelsResponse.decode(message.value); + }, + toProto(message: QueryConnectionChannelsResponse): Uint8Array { + return QueryConnectionChannelsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionChannelsResponse): QueryConnectionChannelsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse", + value: QueryConnectionChannelsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryChannelClientStateRequest(): QueryChannelClientStateRequest { + return { + portId: "", + channelId: "" + }; +} +export const QueryChannelClientStateRequest = { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", + aminoType: "cosmos-sdk/QueryChannelClientStateRequest", + encode(message: QueryChannelClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelClientStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryChannelClientStateRequest { + const message = createBaseQueryChannelClientStateRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: QueryChannelClientStateRequestAmino): QueryChannelClientStateRequest { + const message = createBaseQueryChannelClientStateRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { + return QueryChannelClientStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryChannelClientStateRequest", + value: QueryChannelClientStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelClientStateRequestProtoMsg): QueryChannelClientStateRequest { + return QueryChannelClientStateRequest.decode(message.value); + }, + toProto(message: QueryChannelClientStateRequest): Uint8Array { + return QueryChannelClientStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest", + value: QueryChannelClientStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryChannelClientStateResponse(): QueryChannelClientStateResponse { + return { + identifiedClientState: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryChannelClientStateResponse = { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", + aminoType: "cosmos-sdk/QueryChannelClientStateResponse", + encode(message: QueryChannelClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.identifiedClientState !== undefined) { + IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelClientStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifiedClientState = IdentifiedClientState.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryChannelClientStateResponse { + const message = createBaseQueryChannelClientStateResponse(); + message.identifiedClientState = object.identifiedClientState !== undefined && object.identifiedClientState !== null ? IdentifiedClientState.fromPartial(object.identifiedClientState) : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryChannelClientStateResponseAmino): QueryChannelClientStateResponse { + const message = createBaseQueryChannelClientStateResponse(); + if (object.identified_client_state !== undefined && object.identified_client_state !== null) { + message.identifiedClientState = IdentifiedClientState.fromAmino(object.identified_client_state); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryChannelClientStateResponse): QueryChannelClientStateResponseAmino { + const obj: any = {}; + obj.identified_client_state = message.identifiedClientState ? IdentifiedClientState.toAmino(message.identifiedClientState) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryChannelClientStateResponseAminoMsg): QueryChannelClientStateResponse { + return QueryChannelClientStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelClientStateResponse): QueryChannelClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryChannelClientStateResponse", + value: QueryChannelClientStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelClientStateResponseProtoMsg): QueryChannelClientStateResponse { + return QueryChannelClientStateResponse.decode(message.value); + }, + toProto(message: QueryChannelClientStateResponse): Uint8Array { + return QueryChannelClientStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelClientStateResponse): QueryChannelClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse", + value: QueryChannelClientStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryChannelConsensusStateRequest(): QueryChannelConsensusStateRequest { + return { + portId: "", + channelId: "", + revisionNumber: BigInt(0), + revisionHeight: BigInt(0) + }; +} +export const QueryChannelConsensusStateRequest = { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", + aminoType: "cosmos-sdk/QueryChannelConsensusStateRequest", + encode(message: QueryChannelConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.revisionNumber !== BigInt(0)) { + writer.uint32(24).uint64(message.revisionNumber); + } + if (message.revisionHeight !== BigInt(0)) { + writer.uint32(32).uint64(message.revisionHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.revisionNumber = reader.uint64(); + break; + case 4: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryChannelConsensusStateRequest { + const message = createBaseQueryChannelConsensusStateRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryChannelConsensusStateRequestAmino): QueryChannelConsensusStateRequest { + const message = createBaseQueryChannelConsensusStateRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.revision_number !== undefined && object.revision_number !== null) { + message.revisionNumber = BigInt(object.revision_number); + } + if (object.revision_height !== undefined && object.revision_height !== null) { + message.revisionHeight = BigInt(object.revision_height); + } + return message; + }, + toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { + return QueryChannelConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryChannelConsensusStateRequest", + value: QueryChannelConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelConsensusStateRequestProtoMsg): QueryChannelConsensusStateRequest { + return QueryChannelConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryChannelConsensusStateRequest): Uint8Array { + return QueryChannelConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest", + value: QueryChannelConsensusStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryChannelConsensusStateResponse(): QueryChannelConsensusStateResponse { + return { + consensusState: undefined, + clientId: "", + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryChannelConsensusStateResponse = { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", + aminoType: "cosmos-sdk/QueryChannelConsensusStateResponse", + encode(message: QueryChannelConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryChannelConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChannelConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryChannelConsensusStateResponse { + const message = createBaseQueryChannelConsensusStateResponse(); + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + message.clientId = object.clientId ?? ""; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryChannelConsensusStateResponseAmino): QueryChannelConsensusStateResponse { + const message = createBaseQueryChannelConsensusStateResponse(); + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { + const obj: any = {}; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryChannelConsensusStateResponseAminoMsg): QueryChannelConsensusStateResponse { + return QueryChannelConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryChannelConsensusStateResponse", + value: QueryChannelConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryChannelConsensusStateResponseProtoMsg): QueryChannelConsensusStateResponse { + return QueryChannelConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryChannelConsensusStateResponse): Uint8Array { + return QueryChannelConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse", + value: QueryChannelConsensusStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryPacketCommitmentRequest(): QueryPacketCommitmentRequest { + return { + portId: "", + channelId: "", + sequence: BigInt(0) + }; +} +export const QueryPacketCommitmentRequest = { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", + aminoType: "cosmos-sdk/QueryPacketCommitmentRequest", + encode(message: QueryPacketCommitmentRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketCommitmentRequest { + const message = createBaseQueryPacketCommitmentRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryPacketCommitmentRequestAmino): QueryPacketCommitmentRequest { + const message = createBaseQueryPacketCommitmentRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { + return QueryPacketCommitmentRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketCommitmentRequest", + value: QueryPacketCommitmentRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketCommitmentRequestProtoMsg): QueryPacketCommitmentRequest { + return QueryPacketCommitmentRequest.decode(message.value); + }, + toProto(message: QueryPacketCommitmentRequest): Uint8Array { + return QueryPacketCommitmentRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest", + value: QueryPacketCommitmentRequest.encode(message).finish() + }; + } +}; +function createBaseQueryPacketCommitmentResponse(): QueryPacketCommitmentResponse { + return { + commitment: new Uint8Array(), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryPacketCommitmentResponse = { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", + aminoType: "cosmos-sdk/QueryPacketCommitmentResponse", + encode(message: QueryPacketCommitmentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.commitment.length !== 0) { + writer.uint32(10).bytes(message.commitment); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitment = reader.bytes(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketCommitmentResponse { + const message = createBaseQueryPacketCommitmentResponse(); + message.commitment = object.commitment ?? new Uint8Array(); + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryPacketCommitmentResponseAmino): QueryPacketCommitmentResponse { + const message = createBaseQueryPacketCommitmentResponse(); + if (object.commitment !== undefined && object.commitment !== null) { + message.commitment = bytesFromBase64(object.commitment); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryPacketCommitmentResponse): QueryPacketCommitmentResponseAmino { + const obj: any = {}; + obj.commitment = message.commitment ? base64FromBytes(message.commitment) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketCommitmentResponseAminoMsg): QueryPacketCommitmentResponse { + return QueryPacketCommitmentResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketCommitmentResponse): QueryPacketCommitmentResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketCommitmentResponse", + value: QueryPacketCommitmentResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketCommitmentResponseProtoMsg): QueryPacketCommitmentResponse { + return QueryPacketCommitmentResponse.decode(message.value); + }, + toProto(message: QueryPacketCommitmentResponse): Uint8Array { + return QueryPacketCommitmentResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketCommitmentResponse): QueryPacketCommitmentResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse", + value: QueryPacketCommitmentResponse.encode(message).finish() + }; + } +}; +function createBaseQueryPacketCommitmentsRequest(): QueryPacketCommitmentsRequest { + return { + portId: "", + channelId: "", + pagination: undefined + }; +} +export const QueryPacketCommitmentsRequest = { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", + aminoType: "cosmos-sdk/QueryPacketCommitmentsRequest", + encode(message: QueryPacketCommitmentsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketCommitmentsRequest { + const message = createBaseQueryPacketCommitmentsRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryPacketCommitmentsRequestAmino): QueryPacketCommitmentsRequest { + const message = createBaseQueryPacketCommitmentsRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryPacketCommitmentsRequestAminoMsg): QueryPacketCommitmentsRequest { + return QueryPacketCommitmentsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketCommitmentsRequest", + value: QueryPacketCommitmentsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketCommitmentsRequestProtoMsg): QueryPacketCommitmentsRequest { + return QueryPacketCommitmentsRequest.decode(message.value); + }, + toProto(message: QueryPacketCommitmentsRequest): Uint8Array { + return QueryPacketCommitmentsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest", + value: QueryPacketCommitmentsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryPacketCommitmentsResponse(): QueryPacketCommitmentsResponse { + return { + commitments: [], + pagination: undefined, + height: Height.fromPartial({}) + }; +} +export const QueryPacketCommitmentsResponse = { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", + aminoType: "cosmos-sdk/QueryPacketCommitmentsResponse", + encode(message: QueryPacketCommitmentsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.commitments) { + PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketCommitmentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitments.push(PacketState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketCommitmentsResponse { + const message = createBaseQueryPacketCommitmentsResponse(); + message.commitments = object.commitments?.map(e => PacketState.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + return message; + }, + fromAmino(object: QueryPacketCommitmentsResponseAmino): QueryPacketCommitmentsResponse { + const message = createBaseQueryPacketCommitmentsResponse(); + message.commitments = object.commitments?.map(e => PacketState.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryPacketCommitmentsResponse): QueryPacketCommitmentsResponseAmino { + const obj: any = {}; + if (message.commitments) { + obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.commitments = message.commitments; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketCommitmentsResponseAminoMsg): QueryPacketCommitmentsResponse { + return QueryPacketCommitmentsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketCommitmentsResponse): QueryPacketCommitmentsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketCommitmentsResponse", + value: QueryPacketCommitmentsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketCommitmentsResponseProtoMsg): QueryPacketCommitmentsResponse { + return QueryPacketCommitmentsResponse.decode(message.value); + }, + toProto(message: QueryPacketCommitmentsResponse): Uint8Array { + return QueryPacketCommitmentsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketCommitmentsResponse): QueryPacketCommitmentsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse", + value: QueryPacketCommitmentsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryPacketReceiptRequest(): QueryPacketReceiptRequest { + return { + portId: "", + channelId: "", + sequence: BigInt(0) + }; +} +export const QueryPacketReceiptRequest = { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", + aminoType: "cosmos-sdk/QueryPacketReceiptRequest", + encode(message: QueryPacketReceiptRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketReceiptRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketReceiptRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketReceiptRequest { + const message = createBaseQueryPacketReceiptRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryPacketReceiptRequestAmino): QueryPacketReceiptRequest { + const message = createBaseQueryPacketReceiptRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { + return QueryPacketReceiptRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketReceiptRequest", + value: QueryPacketReceiptRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketReceiptRequestProtoMsg): QueryPacketReceiptRequest { + return QueryPacketReceiptRequest.decode(message.value); + }, + toProto(message: QueryPacketReceiptRequest): Uint8Array { + return QueryPacketReceiptRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptRequest", + value: QueryPacketReceiptRequest.encode(message).finish() + }; + } +}; +function createBaseQueryPacketReceiptResponse(): QueryPacketReceiptResponse { + return { + received: false, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryPacketReceiptResponse = { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", + aminoType: "cosmos-sdk/QueryPacketReceiptResponse", + encode(message: QueryPacketReceiptResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.received === true) { + writer.uint32(16).bool(message.received); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketReceiptResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketReceiptResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.received = reader.bool(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketReceiptResponse { + const message = createBaseQueryPacketReceiptResponse(); + message.received = object.received ?? false; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryPacketReceiptResponseAmino): QueryPacketReceiptResponse { + const message = createBaseQueryPacketReceiptResponse(); + if (object.received !== undefined && object.received !== null) { + message.received = object.received; + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { + const obj: any = {}; + obj.received = message.received === false ? undefined : message.received; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketReceiptResponseAminoMsg): QueryPacketReceiptResponse { + return QueryPacketReceiptResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketReceiptResponse", + value: QueryPacketReceiptResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketReceiptResponseProtoMsg): QueryPacketReceiptResponse { + return QueryPacketReceiptResponse.decode(message.value); + }, + toProto(message: QueryPacketReceiptResponse): Uint8Array { + return QueryPacketReceiptResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketReceiptResponse", + value: QueryPacketReceiptResponse.encode(message).finish() + }; + } +}; +function createBaseQueryPacketAcknowledgementRequest(): QueryPacketAcknowledgementRequest { + return { + portId: "", + channelId: "", + sequence: BigInt(0) + }; +} +export const QueryPacketAcknowledgementRequest = { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", + aminoType: "cosmos-sdk/QueryPacketAcknowledgementRequest", + encode(message: QueryPacketAcknowledgementRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketAcknowledgementRequest { + const message = createBaseQueryPacketAcknowledgementRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryPacketAcknowledgementRequestAmino): QueryPacketAcknowledgementRequest { + const message = createBaseQueryPacketAcknowledgementRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { + return QueryPacketAcknowledgementRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketAcknowledgementRequest", + value: QueryPacketAcknowledgementRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketAcknowledgementRequestProtoMsg): QueryPacketAcknowledgementRequest { + return QueryPacketAcknowledgementRequest.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementRequest): Uint8Array { + return QueryPacketAcknowledgementRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest", + value: QueryPacketAcknowledgementRequest.encode(message).finish() + }; + } +}; +function createBaseQueryPacketAcknowledgementResponse(): QueryPacketAcknowledgementResponse { + return { + acknowledgement: new Uint8Array(), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryPacketAcknowledgementResponse = { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", + aminoType: "cosmos-sdk/QueryPacketAcknowledgementResponse", + encode(message: QueryPacketAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.acknowledgement.length !== 0) { + writer.uint32(10).bytes(message.acknowledgement); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.acknowledgement = reader.bytes(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketAcknowledgementResponse { + const message = createBaseQueryPacketAcknowledgementResponse(); + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryPacketAcknowledgementResponseAmino): QueryPacketAcknowledgementResponse { + const message = createBaseQueryPacketAcknowledgementResponse(); + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = bytesFromBase64(object.acknowledgement); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryPacketAcknowledgementResponse): QueryPacketAcknowledgementResponseAmino { + const obj: any = {}; + obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketAcknowledgementResponseAminoMsg): QueryPacketAcknowledgementResponse { + return QueryPacketAcknowledgementResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketAcknowledgementResponse): QueryPacketAcknowledgementResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketAcknowledgementResponse", + value: QueryPacketAcknowledgementResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketAcknowledgementResponseProtoMsg): QueryPacketAcknowledgementResponse { + return QueryPacketAcknowledgementResponse.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementResponse): Uint8Array { + return QueryPacketAcknowledgementResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketAcknowledgementResponse): QueryPacketAcknowledgementResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse", + value: QueryPacketAcknowledgementResponse.encode(message).finish() + }; + } +}; +function createBaseQueryPacketAcknowledgementsRequest(): QueryPacketAcknowledgementsRequest { + return { + portId: "", + channelId: "", + pagination: undefined, + packetCommitmentSequences: [] + }; +} +export const QueryPacketAcknowledgementsRequest = { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", + aminoType: "cosmos-sdk/QueryPacketAcknowledgementsRequest", + encode(message: QueryPacketAcknowledgementsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + writer.uint32(34).fork(); + for (const v of message.packetCommitmentSequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 4: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.packetCommitmentSequences.push(reader.uint64()); + } + } else { + message.packetCommitmentSequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketAcknowledgementsRequest { + const message = createBaseQueryPacketAcknowledgementsRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + message.packetCommitmentSequences = object.packetCommitmentSequences?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: QueryPacketAcknowledgementsRequestAmino): QueryPacketAcknowledgementsRequest { + const message = createBaseQueryPacketAcknowledgementsRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + message.packetCommitmentSequences = object.packet_commitment_sequences?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + if (message.packetCommitmentSequences) { + obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); + } else { + obj.packet_commitment_sequences = message.packetCommitmentSequences; + } + return obj; + }, + fromAminoMsg(object: QueryPacketAcknowledgementsRequestAminoMsg): QueryPacketAcknowledgementsRequest { + return QueryPacketAcknowledgementsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPacketAcknowledgementsRequest", + value: QueryPacketAcknowledgementsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketAcknowledgementsRequestProtoMsg): QueryPacketAcknowledgementsRequest { + return QueryPacketAcknowledgementsRequest.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementsRequest): Uint8Array { + return QueryPacketAcknowledgementsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest", + value: QueryPacketAcknowledgementsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryPacketAcknowledgementsResponse(): QueryPacketAcknowledgementsResponse { + return { + acknowledgements: [], + pagination: undefined, + height: Height.fromPartial({}) + }; +} +export const QueryPacketAcknowledgementsResponse = { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", + aminoType: "cosmos-sdk/QueryPacketAcknowledgementsResponse", + encode(message: QueryPacketAcknowledgementsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.acknowledgements) { + PacketState.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPacketAcknowledgementsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPacketAcknowledgementsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.acknowledgements.push(PacketState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPacketAcknowledgementsResponse { + const message = createBaseQueryPacketAcknowledgementsResponse(); + message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + return message; + }, + fromAmino(object: QueryPacketAcknowledgementsResponseAmino): QueryPacketAcknowledgementsResponse { + const message = createBaseQueryPacketAcknowledgementsResponse(); + message.acknowledgements = object.acknowledgements?.map(e => PacketState.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryPacketAcknowledgementsResponse): QueryPacketAcknowledgementsResponseAmino { + const obj: any = {}; + if (message.acknowledgements) { + obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); + } else { + obj.acknowledgements = message.acknowledgements; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryPacketAcknowledgementsResponseAminoMsg): QueryPacketAcknowledgementsResponse { + return QueryPacketAcknowledgementsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPacketAcknowledgementsResponse): QueryPacketAcknowledgementsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPacketAcknowledgementsResponse", + value: QueryPacketAcknowledgementsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPacketAcknowledgementsResponseProtoMsg): QueryPacketAcknowledgementsResponse { + return QueryPacketAcknowledgementsResponse.decode(message.value); + }, + toProto(message: QueryPacketAcknowledgementsResponse): Uint8Array { + return QueryPacketAcknowledgementsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPacketAcknowledgementsResponse): QueryPacketAcknowledgementsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse", + value: QueryPacketAcknowledgementsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryUnreceivedPacketsRequest(): QueryUnreceivedPacketsRequest { + return { + portId: "", + channelId: "", + packetCommitmentSequences: [] + }; +} +export const QueryUnreceivedPacketsRequest = { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", + aminoType: "cosmos-sdk/QueryUnreceivedPacketsRequest", + encode(message: QueryUnreceivedPacketsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + writer.uint32(26).fork(); + for (const v of message.packetCommitmentSequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedPacketsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedPacketsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.packetCommitmentSequences.push(reader.uint64()); + } + } else { + message.packetCommitmentSequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUnreceivedPacketsRequest { + const message = createBaseQueryUnreceivedPacketsRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.packetCommitmentSequences = object.packetCommitmentSequences?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: QueryUnreceivedPacketsRequestAmino): QueryUnreceivedPacketsRequest { + const message = createBaseQueryUnreceivedPacketsRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + message.packetCommitmentSequences = object.packet_commitment_sequences?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + if (message.packetCommitmentSequences) { + obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); + } else { + obj.packet_commitment_sequences = message.packetCommitmentSequences; + } + return obj; + }, + fromAminoMsg(object: QueryUnreceivedPacketsRequestAminoMsg): QueryUnreceivedPacketsRequest { + return QueryUnreceivedPacketsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUnreceivedPacketsRequest", + value: QueryUnreceivedPacketsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnreceivedPacketsRequestProtoMsg): QueryUnreceivedPacketsRequest { + return QueryUnreceivedPacketsRequest.decode(message.value); + }, + toProto(message: QueryUnreceivedPacketsRequest): Uint8Array { + return QueryUnreceivedPacketsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest", + value: QueryUnreceivedPacketsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryUnreceivedPacketsResponse(): QueryUnreceivedPacketsResponse { + return { + sequences: [], + height: Height.fromPartial({}) + }; +} +export const QueryUnreceivedPacketsResponse = { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", + aminoType: "cosmos-sdk/QueryUnreceivedPacketsResponse", + encode(message: QueryUnreceivedPacketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.sequences) { + writer.uint64(v); + } + writer.ldelim(); + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedPacketsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedPacketsResponse(); + 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.sequences.push(reader.uint64()); + } + } else { + message.sequences.push(reader.uint64()); + } + break; + case 2: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUnreceivedPacketsResponse { + const message = createBaseQueryUnreceivedPacketsResponse(); + message.sequences = object.sequences?.map(e => BigInt(e.toString())) || []; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + return message; + }, + fromAmino(object: QueryUnreceivedPacketsResponseAmino): QueryUnreceivedPacketsResponse { + const message = createBaseQueryUnreceivedPacketsResponse(); + message.sequences = object.sequences?.map(e => BigInt(e)) || []; + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryUnreceivedPacketsResponse): QueryUnreceivedPacketsResponseAmino { + const obj: any = {}; + if (message.sequences) { + obj.sequences = message.sequences.map(e => e.toString()); + } else { + obj.sequences = message.sequences; + } + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryUnreceivedPacketsResponseAminoMsg): QueryUnreceivedPacketsResponse { + return QueryUnreceivedPacketsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnreceivedPacketsResponse): QueryUnreceivedPacketsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUnreceivedPacketsResponse", + value: QueryUnreceivedPacketsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnreceivedPacketsResponseProtoMsg): QueryUnreceivedPacketsResponse { + return QueryUnreceivedPacketsResponse.decode(message.value); + }, + toProto(message: QueryUnreceivedPacketsResponse): Uint8Array { + return QueryUnreceivedPacketsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUnreceivedPacketsResponse): QueryUnreceivedPacketsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse", + value: QueryUnreceivedPacketsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryUnreceivedAcksRequest(): QueryUnreceivedAcksRequest { + return { + portId: "", + channelId: "", + packetAckSequences: [] + }; +} +export const QueryUnreceivedAcksRequest = { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", + aminoType: "cosmos-sdk/QueryUnreceivedAcksRequest", + encode(message: QueryUnreceivedAcksRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + writer.uint32(26).fork(); + for (const v of message.packetAckSequences) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedAcksRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedAcksRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.packetAckSequences.push(reader.uint64()); + } + } else { + message.packetAckSequences.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUnreceivedAcksRequest { + const message = createBaseQueryUnreceivedAcksRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.packetAckSequences = object.packetAckSequences?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: QueryUnreceivedAcksRequestAmino): QueryUnreceivedAcksRequest { + const message = createBaseQueryUnreceivedAcksRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + message.packetAckSequences = object.packet_ack_sequences?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + if (message.packetAckSequences) { + obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); + } else { + obj.packet_ack_sequences = message.packetAckSequences; + } + return obj; + }, + fromAminoMsg(object: QueryUnreceivedAcksRequestAminoMsg): QueryUnreceivedAcksRequest { + return QueryUnreceivedAcksRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUnreceivedAcksRequest", + value: QueryUnreceivedAcksRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnreceivedAcksRequestProtoMsg): QueryUnreceivedAcksRequest { + return QueryUnreceivedAcksRequest.decode(message.value); + }, + toProto(message: QueryUnreceivedAcksRequest): Uint8Array { + return QueryUnreceivedAcksRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksRequest", + value: QueryUnreceivedAcksRequest.encode(message).finish() + }; + } +}; +function createBaseQueryUnreceivedAcksResponse(): QueryUnreceivedAcksResponse { + return { + sequences: [], + height: Height.fromPartial({}) + }; +} +export const QueryUnreceivedAcksResponse = { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", + aminoType: "cosmos-sdk/QueryUnreceivedAcksResponse", + encode(message: QueryUnreceivedAcksResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.sequences) { + writer.uint64(v); + } + writer.ldelim(); + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnreceivedAcksResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnreceivedAcksResponse(); + 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.sequences.push(reader.uint64()); + } + } else { + message.sequences.push(reader.uint64()); + } + break; + case 2: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUnreceivedAcksResponse { + const message = createBaseQueryUnreceivedAcksResponse(); + message.sequences = object.sequences?.map(e => BigInt(e.toString())) || []; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + return message; + }, + fromAmino(object: QueryUnreceivedAcksResponseAmino): QueryUnreceivedAcksResponse { + const message = createBaseQueryUnreceivedAcksResponse(); + message.sequences = object.sequences?.map(e => BigInt(e)) || []; + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryUnreceivedAcksResponse): QueryUnreceivedAcksResponseAmino { + const obj: any = {}; + if (message.sequences) { + obj.sequences = message.sequences.map(e => e.toString()); + } else { + obj.sequences = message.sequences; + } + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryUnreceivedAcksResponseAminoMsg): QueryUnreceivedAcksResponse { + return QueryUnreceivedAcksResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnreceivedAcksResponse): QueryUnreceivedAcksResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUnreceivedAcksResponse", + value: QueryUnreceivedAcksResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnreceivedAcksResponseProtoMsg): QueryUnreceivedAcksResponse { + return QueryUnreceivedAcksResponse.decode(message.value); + }, + toProto(message: QueryUnreceivedAcksResponse): Uint8Array { + return QueryUnreceivedAcksResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUnreceivedAcksResponse): QueryUnreceivedAcksResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryUnreceivedAcksResponse", + value: QueryUnreceivedAcksResponse.encode(message).finish() + }; + } +}; +function createBaseQueryNextSequenceReceiveRequest(): QueryNextSequenceReceiveRequest { + return { + portId: "", + channelId: "" + }; +} +export const QueryNextSequenceReceiveRequest = { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", + aminoType: "cosmos-sdk/QueryNextSequenceReceiveRequest", + encode(message: QueryNextSequenceReceiveRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextSequenceReceiveRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceReceiveRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryNextSequenceReceiveRequest { + const message = createBaseQueryNextSequenceReceiveRequest(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: QueryNextSequenceReceiveRequestAmino): QueryNextSequenceReceiveRequest { + const message = createBaseQueryNextSequenceReceiveRequest(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { + return QueryNextSequenceReceiveRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAminoMsg { + return { + type: "cosmos-sdk/QueryNextSequenceReceiveRequest", + value: QueryNextSequenceReceiveRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryNextSequenceReceiveRequestProtoMsg): QueryNextSequenceReceiveRequest { + return QueryNextSequenceReceiveRequest.decode(message.value); + }, + toProto(message: QueryNextSequenceReceiveRequest): Uint8Array { + return QueryNextSequenceReceiveRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest", + value: QueryNextSequenceReceiveRequest.encode(message).finish() + }; + } +}; +function createBaseQueryNextSequenceReceiveResponse(): QueryNextSequenceReceiveResponse { + return { + nextSequenceReceive: BigInt(0), + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryNextSequenceReceiveResponse = { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", + aminoType: "cosmos-sdk/QueryNextSequenceReceiveResponse", + encode(message: QueryNextSequenceReceiveResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.nextSequenceReceive !== BigInt(0)) { + writer.uint32(8).uint64(message.nextSequenceReceive); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextSequenceReceiveResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextSequenceReceiveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextSequenceReceive = reader.uint64(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryNextSequenceReceiveResponse { + const message = createBaseQueryNextSequenceReceiveResponse(); + message.nextSequenceReceive = object.nextSequenceReceive !== undefined && object.nextSequenceReceive !== null ? BigInt(object.nextSequenceReceive.toString()) : BigInt(0); + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryNextSequenceReceiveResponseAmino): QueryNextSequenceReceiveResponse { + const message = createBaseQueryNextSequenceReceiveResponse(); + if (object.next_sequence_receive !== undefined && object.next_sequence_receive !== null) { + message.nextSequenceReceive = BigInt(object.next_sequence_receive); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { + const obj: any = {}; + obj.next_sequence_receive = message.nextSequenceReceive !== BigInt(0) ? message.nextSequenceReceive.toString() : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryNextSequenceReceiveResponseAminoMsg): QueryNextSequenceReceiveResponse { + return QueryNextSequenceReceiveResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAminoMsg { + return { + type: "cosmos-sdk/QueryNextSequenceReceiveResponse", + value: QueryNextSequenceReceiveResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryNextSequenceReceiveResponseProtoMsg): QueryNextSequenceReceiveResponse { + return QueryNextSequenceReceiveResponse.decode(message.value); + }, + toProto(message: QueryNextSequenceReceiveResponse): Uint8Array { + return QueryNextSequenceReceiveResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse", + value: QueryNextSequenceReceiveResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/tx.amino.ts b/util/inj-types/ibc/core/channel/v1/tx.amino.ts new file mode 100644 index 00000000..0884ce7d --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/tx.amino.ts @@ -0,0 +1,53 @@ +import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement } from "./tx"; +export const AminoConverter = { + "/ibc.core.channel.v1.MsgChannelOpenInit": { + aminoType: "cosmos-sdk/MsgChannelOpenInit", + toAmino: MsgChannelOpenInit.toAmino, + fromAmino: MsgChannelOpenInit.fromAmino + }, + "/ibc.core.channel.v1.MsgChannelOpenTry": { + aminoType: "cosmos-sdk/MsgChannelOpenTry", + toAmino: MsgChannelOpenTry.toAmino, + fromAmino: MsgChannelOpenTry.fromAmino + }, + "/ibc.core.channel.v1.MsgChannelOpenAck": { + aminoType: "cosmos-sdk/MsgChannelOpenAck", + toAmino: MsgChannelOpenAck.toAmino, + fromAmino: MsgChannelOpenAck.fromAmino + }, + "/ibc.core.channel.v1.MsgChannelOpenConfirm": { + aminoType: "cosmos-sdk/MsgChannelOpenConfirm", + toAmino: MsgChannelOpenConfirm.toAmino, + fromAmino: MsgChannelOpenConfirm.fromAmino + }, + "/ibc.core.channel.v1.MsgChannelCloseInit": { + aminoType: "cosmos-sdk/MsgChannelCloseInit", + toAmino: MsgChannelCloseInit.toAmino, + fromAmino: MsgChannelCloseInit.fromAmino + }, + "/ibc.core.channel.v1.MsgChannelCloseConfirm": { + aminoType: "cosmos-sdk/MsgChannelCloseConfirm", + toAmino: MsgChannelCloseConfirm.toAmino, + fromAmino: MsgChannelCloseConfirm.fromAmino + }, + "/ibc.core.channel.v1.MsgRecvPacket": { + aminoType: "cosmos-sdk/MsgRecvPacket", + toAmino: MsgRecvPacket.toAmino, + fromAmino: MsgRecvPacket.fromAmino + }, + "/ibc.core.channel.v1.MsgTimeout": { + aminoType: "cosmos-sdk/MsgTimeout", + toAmino: MsgTimeout.toAmino, + fromAmino: MsgTimeout.fromAmino + }, + "/ibc.core.channel.v1.MsgTimeoutOnClose": { + aminoType: "cosmos-sdk/MsgTimeoutOnClose", + toAmino: MsgTimeoutOnClose.toAmino, + fromAmino: MsgTimeoutOnClose.fromAmino + }, + "/ibc.core.channel.v1.MsgAcknowledgement": { + aminoType: "cosmos-sdk/MsgAcknowledgement", + toAmino: MsgAcknowledgement.toAmino, + fromAmino: MsgAcknowledgement.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/tx.registry.ts b/util/inj-types/ibc/core/channel/v1/tx.registry.ts new file mode 100644 index 00000000..dbcbbecd --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/tx.registry.ts @@ -0,0 +1,197 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + channelOpenInit(value: MsgChannelOpenInit) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + value: MsgChannelOpenInit.encode(value).finish() + }; + }, + channelOpenTry(value: MsgChannelOpenTry) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + value: MsgChannelOpenTry.encode(value).finish() + }; + }, + channelOpenAck(value: MsgChannelOpenAck) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + value: MsgChannelOpenAck.encode(value).finish() + }; + }, + channelOpenConfirm(value: MsgChannelOpenConfirm) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + value: MsgChannelOpenConfirm.encode(value).finish() + }; + }, + channelCloseInit(value: MsgChannelCloseInit) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + value: MsgChannelCloseInit.encode(value).finish() + }; + }, + channelCloseConfirm(value: MsgChannelCloseConfirm) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + value: MsgChannelCloseConfirm.encode(value).finish() + }; + }, + recvPacket(value: MsgRecvPacket) { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + value: MsgRecvPacket.encode(value).finish() + }; + }, + timeout(value: MsgTimeout) { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + value: MsgTimeout.encode(value).finish() + }; + }, + timeoutOnClose(value: MsgTimeoutOnClose) { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + value: MsgTimeoutOnClose.encode(value).finish() + }; + }, + acknowledgement(value: MsgAcknowledgement) { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + value: MsgAcknowledgement.encode(value).finish() + }; + } + }, + withTypeUrl: { + channelOpenInit(value: MsgChannelOpenInit) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + value + }; + }, + channelOpenTry(value: MsgChannelOpenTry) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + value + }; + }, + channelOpenAck(value: MsgChannelOpenAck) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + value + }; + }, + channelOpenConfirm(value: MsgChannelOpenConfirm) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + value + }; + }, + channelCloseInit(value: MsgChannelCloseInit) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + value + }; + }, + channelCloseConfirm(value: MsgChannelCloseConfirm) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + value + }; + }, + recvPacket(value: MsgRecvPacket) { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + value + }; + }, + timeout(value: MsgTimeout) { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + value + }; + }, + timeoutOnClose(value: MsgTimeoutOnClose) { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + value + }; + }, + acknowledgement(value: MsgAcknowledgement) { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + value + }; + } + }, + fromPartial: { + channelOpenInit(value: MsgChannelOpenInit) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + value: MsgChannelOpenInit.fromPartial(value) + }; + }, + channelOpenTry(value: MsgChannelOpenTry) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + value: MsgChannelOpenTry.fromPartial(value) + }; + }, + channelOpenAck(value: MsgChannelOpenAck) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + value: MsgChannelOpenAck.fromPartial(value) + }; + }, + channelOpenConfirm(value: MsgChannelOpenConfirm) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + value: MsgChannelOpenConfirm.fromPartial(value) + }; + }, + channelCloseInit(value: MsgChannelCloseInit) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + value: MsgChannelCloseInit.fromPartial(value) + }; + }, + channelCloseConfirm(value: MsgChannelCloseConfirm) { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + value: MsgChannelCloseConfirm.fromPartial(value) + }; + }, + recvPacket(value: MsgRecvPacket) { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + value: MsgRecvPacket.fromPartial(value) + }; + }, + timeout(value: MsgTimeout) { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + value: MsgTimeout.fromPartial(value) + }; + }, + timeoutOnClose(value: MsgTimeoutOnClose) { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + value: MsgTimeoutOnClose.fromPartial(value) + }; + }, + acknowledgement(value: MsgAcknowledgement) { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + value: MsgAcknowledgement.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/tx.rpc.msg.ts b/util/inj-types/ibc/core/channel/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..5bc8fa1c --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/tx.rpc.msg.ts @@ -0,0 +1,96 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgChannelOpenInit, MsgChannelOpenInitResponse, MsgChannelOpenTry, MsgChannelOpenTryResponse, MsgChannelOpenAck, MsgChannelOpenAckResponse, MsgChannelOpenConfirm, MsgChannelOpenConfirmResponse, MsgChannelCloseInit, MsgChannelCloseInitResponse, MsgChannelCloseConfirm, MsgChannelCloseConfirmResponse, MsgRecvPacket, MsgRecvPacketResponse, MsgTimeout, MsgTimeoutResponse, MsgTimeoutOnClose, MsgTimeoutOnCloseResponse, MsgAcknowledgement, MsgAcknowledgementResponse } from "./tx"; +/** Msg defines the ibc/channel Msg service. */ +export interface Msg { + /** ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. */ + channelOpenInit(request: MsgChannelOpenInit): Promise; + /** ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. */ + channelOpenTry(request: MsgChannelOpenTry): Promise; + /** ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. */ + channelOpenAck(request: MsgChannelOpenAck): Promise; + /** ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. */ + channelOpenConfirm(request: MsgChannelOpenConfirm): Promise; + /** ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. */ + channelCloseInit(request: MsgChannelCloseInit): Promise; + /** + * ChannelCloseConfirm defines a rpc handler method for + * MsgChannelCloseConfirm. + */ + channelCloseConfirm(request: MsgChannelCloseConfirm): Promise; + /** RecvPacket defines a rpc handler method for MsgRecvPacket. */ + recvPacket(request: MsgRecvPacket): Promise; + /** Timeout defines a rpc handler method for MsgTimeout. */ + timeout(request: MsgTimeout): Promise; + /** TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. */ + timeoutOnClose(request: MsgTimeoutOnClose): Promise; + /** Acknowledgement defines a rpc handler method for MsgAcknowledgement. */ + acknowledgement(request: MsgAcknowledgement): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. */ + channelOpenInit = async (request: MsgChannelOpenInit): Promise => { + const data = MsgChannelOpenInit.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenInit", data); + return promise.then(data => MsgChannelOpenInitResponse.decode(new BinaryReader(data))); + }; + /* ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. */ + channelOpenTry = async (request: MsgChannelOpenTry): Promise => { + const data = MsgChannelOpenTry.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenTry", data); + return promise.then(data => MsgChannelOpenTryResponse.decode(new BinaryReader(data))); + }; + /* ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. */ + channelOpenAck = async (request: MsgChannelOpenAck): Promise => { + const data = MsgChannelOpenAck.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenAck", data); + return promise.then(data => MsgChannelOpenAckResponse.decode(new BinaryReader(data))); + }; + /* ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. */ + channelOpenConfirm = async (request: MsgChannelOpenConfirm): Promise => { + const data = MsgChannelOpenConfirm.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelOpenConfirm", data); + return promise.then(data => MsgChannelOpenConfirmResponse.decode(new BinaryReader(data))); + }; + /* ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. */ + channelCloseInit = async (request: MsgChannelCloseInit): Promise => { + const data = MsgChannelCloseInit.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelCloseInit", data); + return promise.then(data => MsgChannelCloseInitResponse.decode(new BinaryReader(data))); + }; + /* ChannelCloseConfirm defines a rpc handler method for + MsgChannelCloseConfirm. */ + channelCloseConfirm = async (request: MsgChannelCloseConfirm): Promise => { + const data = MsgChannelCloseConfirm.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "ChannelCloseConfirm", data); + return promise.then(data => MsgChannelCloseConfirmResponse.decode(new BinaryReader(data))); + }; + /* RecvPacket defines a rpc handler method for MsgRecvPacket. */ + recvPacket = async (request: MsgRecvPacket): Promise => { + const data = MsgRecvPacket.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "RecvPacket", data); + return promise.then(data => MsgRecvPacketResponse.decode(new BinaryReader(data))); + }; + /* Timeout defines a rpc handler method for MsgTimeout. */ + timeout = async (request: MsgTimeout): Promise => { + const data = MsgTimeout.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "Timeout", data); + return promise.then(data => MsgTimeoutResponse.decode(new BinaryReader(data))); + }; + /* TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. */ + timeoutOnClose = async (request: MsgTimeoutOnClose): Promise => { + const data = MsgTimeoutOnClose.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "TimeoutOnClose", data); + return promise.then(data => MsgTimeoutOnCloseResponse.decode(new BinaryReader(data))); + }; + /* Acknowledgement defines a rpc handler method for MsgAcknowledgement. */ + acknowledgement = async (request: MsgAcknowledgement): Promise => { + const data = MsgAcknowledgement.encode(request).finish(); + const promise = this.rpc.request("ibc.core.channel.v1.Msg", "Acknowledgement", data); + return promise.then(data => MsgAcknowledgementResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/core/channel/v1/tx.ts b/util/inj-types/ibc/core/channel/v1/tx.ts new file mode 100644 index 00000000..9005f31b --- /dev/null +++ b/util/inj-types/ibc/core/channel/v1/tx.ts @@ -0,0 +1,2482 @@ +import { Channel, ChannelAmino, ChannelSDKType, Packet, PacketAmino, PacketSDKType } from "./channel"; +import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** ResponseResultType defines the possible outcomes of the execution of a message */ +export enum ResponseResultType { + /** RESPONSE_RESULT_TYPE_UNSPECIFIED - Default zero value enumeration */ + RESPONSE_RESULT_TYPE_UNSPECIFIED = 0, + /** RESPONSE_RESULT_TYPE_NOOP - The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) */ + RESPONSE_RESULT_TYPE_NOOP = 1, + /** RESPONSE_RESULT_TYPE_SUCCESS - The message was executed successfully */ + RESPONSE_RESULT_TYPE_SUCCESS = 2, + UNRECOGNIZED = -1, +} +export const ResponseResultTypeSDKType = ResponseResultType; +export const ResponseResultTypeAmino = ResponseResultType; +export function responseResultTypeFromJSON(object: any): ResponseResultType { + switch (object) { + case 0: + case "RESPONSE_RESULT_TYPE_UNSPECIFIED": + return ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED; + case 1: + case "RESPONSE_RESULT_TYPE_NOOP": + return ResponseResultType.RESPONSE_RESULT_TYPE_NOOP; + case 2: + case "RESPONSE_RESULT_TYPE_SUCCESS": + return ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS; + case -1: + case "UNRECOGNIZED": + default: + return ResponseResultType.UNRECOGNIZED; + } +} +export function responseResultTypeToJSON(object: ResponseResultType): string { + switch (object) { + case ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED: + return "RESPONSE_RESULT_TYPE_UNSPECIFIED"; + case ResponseResultType.RESPONSE_RESULT_TYPE_NOOP: + return "RESPONSE_RESULT_TYPE_NOOP"; + case ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS: + return "RESPONSE_RESULT_TYPE_SUCCESS"; + case ResponseResultType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It + * is called by a relayer on Chain A. + */ +export interface MsgChannelOpenInit { + portId: string; + channel: Channel; + signer: string; +} +export interface MsgChannelOpenInitProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit"; + value: Uint8Array; +} +/** + * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It + * is called by a relayer on Chain A. + */ +export interface MsgChannelOpenInitAmino { + port_id?: string; + channel?: ChannelAmino; + signer?: string; +} +export interface MsgChannelOpenInitAminoMsg { + type: "cosmos-sdk/MsgChannelOpenInit"; + value: MsgChannelOpenInitAmino; +} +/** + * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It + * is called by a relayer on Chain A. + */ +export interface MsgChannelOpenInitSDKType { + port_id: string; + channel: ChannelSDKType; + signer: string; +} +/** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ +export interface MsgChannelOpenInitResponse { + channelId: string; + version: string; +} +export interface MsgChannelOpenInitResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse"; + value: Uint8Array; +} +/** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ +export interface MsgChannelOpenInitResponseAmino { + channel_id?: string; + version?: string; +} +export interface MsgChannelOpenInitResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenInitResponse"; + value: MsgChannelOpenInitResponseAmino; +} +/** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ +export interface MsgChannelOpenInitResponseSDKType { + channel_id: string; + version: string; +} +/** + * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel + * on Chain B. The version field within the Channel field has been deprecated. Its + * value will be ignored by core IBC. + */ +export interface MsgChannelOpenTry { + portId: string; + /** Deprecated: this field is unused. Crossing hello's are no longer supported in core IBC. */ + /** @deprecated */ + previousChannelId: string; + /** NOTE: the version field within the channel has been deprecated. Its value will be ignored by core IBC. */ + channel: Channel; + counterpartyVersion: string; + proofInit: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenTryProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry"; + value: Uint8Array; +} +/** + * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel + * on Chain B. The version field within the Channel field has been deprecated. Its + * value will be ignored by core IBC. + */ +export interface MsgChannelOpenTryAmino { + port_id?: string; + /** Deprecated: this field is unused. Crossing hello's are no longer supported in core IBC. */ + /** @deprecated */ + previous_channel_id?: string; + /** NOTE: the version field within the channel has been deprecated. Its value will be ignored by core IBC. */ + channel?: ChannelAmino; + counterparty_version?: string; + proof_init?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgChannelOpenTryAminoMsg { + type: "cosmos-sdk/MsgChannelOpenTry"; + value: MsgChannelOpenTryAmino; +} +/** + * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel + * on Chain B. The version field within the Channel field has been deprecated. Its + * value will be ignored by core IBC. + */ +export interface MsgChannelOpenTrySDKType { + port_id: string; + /** @deprecated */ + previous_channel_id: string; + channel: ChannelSDKType; + counterparty_version: string; + proof_init: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ +export interface MsgChannelOpenTryResponse { + version: string; + channelId: string; +} +export interface MsgChannelOpenTryResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse"; + value: Uint8Array; +} +/** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ +export interface MsgChannelOpenTryResponseAmino { + version?: string; + channel_id?: string; +} +export interface MsgChannelOpenTryResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenTryResponse"; + value: MsgChannelOpenTryResponseAmino; +} +/** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ +export interface MsgChannelOpenTryResponseSDKType { + version: string; + channel_id: string; +} +/** + * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge + * the change of channel state to TRYOPEN on Chain B. + */ +export interface MsgChannelOpenAck { + portId: string; + channelId: string; + counterpartyChannelId: string; + counterpartyVersion: string; + proofTry: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenAckProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck"; + value: Uint8Array; +} +/** + * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge + * the change of channel state to TRYOPEN on Chain B. + */ +export interface MsgChannelOpenAckAmino { + port_id?: string; + channel_id?: string; + counterparty_channel_id?: string; + counterparty_version?: string; + proof_try?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgChannelOpenAckAminoMsg { + type: "cosmos-sdk/MsgChannelOpenAck"; + value: MsgChannelOpenAckAmino; +} +/** + * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge + * the change of channel state to TRYOPEN on Chain B. + */ +export interface MsgChannelOpenAckSDKType { + port_id: string; + channel_id: string; + counterparty_channel_id: string; + counterparty_version: string; + proof_try: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ +export interface MsgChannelOpenAckResponse {} +export interface MsgChannelOpenAckResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse"; + value: Uint8Array; +} +/** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ +export interface MsgChannelOpenAckResponseAmino {} +export interface MsgChannelOpenAckResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenAckResponse"; + value: MsgChannelOpenAckResponseAmino; +} +/** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ +export interface MsgChannelOpenAckResponseSDKType {} +/** + * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of channel state to OPEN on Chain A. + */ +export interface MsgChannelOpenConfirm { + portId: string; + channelId: string; + proofAck: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenConfirmProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm"; + value: Uint8Array; +} +/** + * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of channel state to OPEN on Chain A. + */ +export interface MsgChannelOpenConfirmAmino { + port_id?: string; + channel_id?: string; + proof_ack?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgChannelOpenConfirmAminoMsg { + type: "cosmos-sdk/MsgChannelOpenConfirm"; + value: MsgChannelOpenConfirmAmino; +} +/** + * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of channel state to OPEN on Chain A. + */ +export interface MsgChannelOpenConfirmSDKType { + port_id: string; + channel_id: string; + proof_ack: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** + * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + * type. + */ +export interface MsgChannelOpenConfirmResponse {} +export interface MsgChannelOpenConfirmResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse"; + value: Uint8Array; +} +/** + * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + * type. + */ +export interface MsgChannelOpenConfirmResponseAmino {} +export interface MsgChannelOpenConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenConfirmResponse"; + value: MsgChannelOpenConfirmResponseAmino; +} +/** + * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + * type. + */ +export interface MsgChannelOpenConfirmResponseSDKType {} +/** + * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + * to close a channel with Chain B. + */ +export interface MsgChannelCloseInit { + portId: string; + channelId: string; + signer: string; +} +export interface MsgChannelCloseInitProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit"; + value: Uint8Array; +} +/** + * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + * to close a channel with Chain B. + */ +export interface MsgChannelCloseInitAmino { + port_id?: string; + channel_id?: string; + signer?: string; +} +export interface MsgChannelCloseInitAminoMsg { + type: "cosmos-sdk/MsgChannelCloseInit"; + value: MsgChannelCloseInitAmino; +} +/** + * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + * to close a channel with Chain B. + */ +export interface MsgChannelCloseInitSDKType { + port_id: string; + channel_id: string; + signer: string; +} +/** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ +export interface MsgChannelCloseInitResponse {} +export interface MsgChannelCloseInitResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse"; + value: Uint8Array; +} +/** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ +export interface MsgChannelCloseInitResponseAmino {} +export interface MsgChannelCloseInitResponseAminoMsg { + type: "cosmos-sdk/MsgChannelCloseInitResponse"; + value: MsgChannelCloseInitResponseAmino; +} +/** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ +export interface MsgChannelCloseInitResponseSDKType {} +/** + * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + * to acknowledge the change of channel state to CLOSED on Chain A. + */ +export interface MsgChannelCloseConfirm { + portId: string; + channelId: string; + proofInit: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelCloseConfirmProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm"; + value: Uint8Array; +} +/** + * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + * to acknowledge the change of channel state to CLOSED on Chain A. + */ +export interface MsgChannelCloseConfirmAmino { + port_id?: string; + channel_id?: string; + proof_init?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgChannelCloseConfirmAminoMsg { + type: "cosmos-sdk/MsgChannelCloseConfirm"; + value: MsgChannelCloseConfirmAmino; +} +/** + * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + * to acknowledge the change of channel state to CLOSED on Chain A. + */ +export interface MsgChannelCloseConfirmSDKType { + port_id: string; + channel_id: string; + proof_init: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** + * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response + * type. + */ +export interface MsgChannelCloseConfirmResponse {} +export interface MsgChannelCloseConfirmResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse"; + value: Uint8Array; +} +/** + * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response + * type. + */ +export interface MsgChannelCloseConfirmResponseAmino {} +export interface MsgChannelCloseConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgChannelCloseConfirmResponse"; + value: MsgChannelCloseConfirmResponseAmino; +} +/** + * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response + * type. + */ +export interface MsgChannelCloseConfirmResponseSDKType {} +/** MsgRecvPacket receives incoming IBC packet */ +export interface MsgRecvPacket { + packet: Packet; + proofCommitment: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgRecvPacketProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket"; + value: Uint8Array; +} +/** MsgRecvPacket receives incoming IBC packet */ +export interface MsgRecvPacketAmino { + packet?: PacketAmino; + proof_commitment?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgRecvPacketAminoMsg { + type: "cosmos-sdk/MsgRecvPacket"; + value: MsgRecvPacketAmino; +} +/** MsgRecvPacket receives incoming IBC packet */ +export interface MsgRecvPacketSDKType { + packet: PacketSDKType; + proof_commitment: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponse { + result: ResponseResultType; +} +export interface MsgRecvPacketResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse"; + value: Uint8Array; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponseAmino { + result?: ResponseResultType; +} +export interface MsgRecvPacketResponseAminoMsg { + type: "cosmos-sdk/MsgRecvPacketResponse"; + value: MsgRecvPacketResponseAmino; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponseSDKType { + result: ResponseResultType; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeout { + packet: Packet; + proofUnreceived: Uint8Array; + proofHeight: Height; + nextSequenceRecv: bigint; + signer: string; +} +export interface MsgTimeoutProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeout"; + value: Uint8Array; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeoutAmino { + packet?: PacketAmino; + proof_unreceived?: string; + proof_height?: HeightAmino; + next_sequence_recv?: string; + signer?: string; +} +export interface MsgTimeoutAminoMsg { + type: "cosmos-sdk/MsgTimeout"; + value: MsgTimeoutAmino; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeoutSDKType { + packet: PacketSDKType; + proof_unreceived: Uint8Array; + proof_height: HeightSDKType; + next_sequence_recv: bigint; + signer: string; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponse { + result: ResponseResultType; +} +export interface MsgTimeoutResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse"; + value: Uint8Array; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponseAmino { + result?: ResponseResultType; +} +export interface MsgTimeoutResponseAminoMsg { + type: "cosmos-sdk/MsgTimeoutResponse"; + value: MsgTimeoutResponseAmino; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponseSDKType { + result: ResponseResultType; +} +/** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ +export interface MsgTimeoutOnClose { + packet: Packet; + proofUnreceived: Uint8Array; + proofClose: Uint8Array; + proofHeight: Height; + nextSequenceRecv: bigint; + signer: string; +} +export interface MsgTimeoutOnCloseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose"; + value: Uint8Array; +} +/** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ +export interface MsgTimeoutOnCloseAmino { + packet?: PacketAmino; + proof_unreceived?: string; + proof_close?: string; + proof_height?: HeightAmino; + next_sequence_recv?: string; + signer?: string; +} +export interface MsgTimeoutOnCloseAminoMsg { + type: "cosmos-sdk/MsgTimeoutOnClose"; + value: MsgTimeoutOnCloseAmino; +} +/** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ +export interface MsgTimeoutOnCloseSDKType { + packet: PacketSDKType; + proof_unreceived: Uint8Array; + proof_close: Uint8Array; + proof_height: HeightSDKType; + next_sequence_recv: bigint; + signer: string; +} +/** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ +export interface MsgTimeoutOnCloseResponse { + result: ResponseResultType; +} +export interface MsgTimeoutOnCloseResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse"; + value: Uint8Array; +} +/** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ +export interface MsgTimeoutOnCloseResponseAmino { + result?: ResponseResultType; +} +export interface MsgTimeoutOnCloseResponseAminoMsg { + type: "cosmos-sdk/MsgTimeoutOnCloseResponse"; + value: MsgTimeoutOnCloseResponseAmino; +} +/** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ +export interface MsgTimeoutOnCloseResponseSDKType { + result: ResponseResultType; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement */ +export interface MsgAcknowledgement { + packet: Packet; + acknowledgement: Uint8Array; + proofAcked: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgAcknowledgementProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement"; + value: Uint8Array; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement */ +export interface MsgAcknowledgementAmino { + packet?: PacketAmino; + acknowledgement?: string; + proof_acked?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgAcknowledgementAminoMsg { + type: "cosmos-sdk/MsgAcknowledgement"; + value: MsgAcknowledgementAmino; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement */ +export interface MsgAcknowledgementSDKType { + packet: PacketSDKType; + acknowledgement: Uint8Array; + proof_acked: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponse { + result: ResponseResultType; +} +export interface MsgAcknowledgementResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse"; + value: Uint8Array; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponseAmino { + result?: ResponseResultType; +} +export interface MsgAcknowledgementResponseAminoMsg { + type: "cosmos-sdk/MsgAcknowledgementResponse"; + value: MsgAcknowledgementResponseAmino; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponseSDKType { + result: ResponseResultType; +} +function createBaseMsgChannelOpenInit(): MsgChannelOpenInit { + return { + portId: "", + channel: Channel.fromPartial({}), + signer: "" + }; +} +export const MsgChannelOpenInit = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + aminoType: "cosmos-sdk/MsgChannelOpenInit", + encode(message: MsgChannelOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channel = Channel.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenInit { + const message = createBaseMsgChannelOpenInit(); + message.portId = object.portId ?? ""; + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenInitAmino): MsgChannelOpenInit { + const message = createBaseMsgChannelOpenInit(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { + return MsgChannelOpenInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenInit): MsgChannelOpenInitAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenInit", + value: MsgChannelOpenInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenInitProtoMsg): MsgChannelOpenInit { + return MsgChannelOpenInit.decode(message.value); + }, + toProto(message: MsgChannelOpenInit): Uint8Array { + return MsgChannelOpenInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenInit): MsgChannelOpenInitProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + value: MsgChannelOpenInit.encode(message).finish() + }; + } +}; +function createBaseMsgChannelOpenInitResponse(): MsgChannelOpenInitResponse { + return { + channelId: "", + version: "" + }; +} +export const MsgChannelOpenInitResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", + aminoType: "cosmos-sdk/MsgChannelOpenInitResponse", + encode(message: MsgChannelOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.channelId !== "") { + writer.uint32(10).string(message.channelId); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channelId = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenInitResponse { + const message = createBaseMsgChannelOpenInitResponse(); + message.channelId = object.channelId ?? ""; + message.version = object.version ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenInitResponseAmino): MsgChannelOpenInitResponse { + const message = createBaseMsgChannelOpenInitResponse(); + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + return message; + }, + toAmino(message: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseAmino { + const obj: any = {}; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.version = message.version === "" ? undefined : message.version; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenInitResponseAminoMsg): MsgChannelOpenInitResponse { + return MsgChannelOpenInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenInitResponse", + value: MsgChannelOpenInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenInitResponseProtoMsg): MsgChannelOpenInitResponse { + return MsgChannelOpenInitResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenInitResponse): Uint8Array { + return MsgChannelOpenInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", + value: MsgChannelOpenInitResponse.encode(message).finish() + }; + } +}; +function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { + return { + portId: "", + previousChannelId: "", + channel: Channel.fromPartial({}), + counterpartyVersion: "", + proofInit: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelOpenTry = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + aminoType: "cosmos-sdk/MsgChannelOpenTry", + encode(message: MsgChannelOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.previousChannelId !== "") { + writer.uint32(18).string(message.previousChannelId); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(26).fork()).ldelim(); + } + if (message.counterpartyVersion !== "") { + writer.uint32(34).string(message.counterpartyVersion); + } + if (message.proofInit.length !== 0) { + writer.uint32(42).bytes(message.proofInit); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenTry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.previousChannelId = reader.string(); + break; + case 3: + message.channel = Channel.decode(reader, reader.uint32()); + break; + case 4: + message.counterpartyVersion = reader.string(); + break; + case 5: + message.proofInit = reader.bytes(); + break; + case 6: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenTry { + const message = createBaseMsgChannelOpenTry(); + message.portId = object.portId ?? ""; + message.previousChannelId = object.previousChannelId ?? ""; + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; + message.counterpartyVersion = object.counterpartyVersion ?? ""; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenTryAmino): MsgChannelOpenTry { + const message = createBaseMsgChannelOpenTry(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.previous_channel_id !== undefined && object.previous_channel_id !== null) { + message.previousChannelId = object.previous_channel_id; + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + if (object.counterparty_version !== undefined && object.counterparty_version !== null) { + message.counterpartyVersion = object.counterparty_version; + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { + return MsgChannelOpenTry.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenTry): MsgChannelOpenTryAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenTry", + value: MsgChannelOpenTry.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenTryProtoMsg): MsgChannelOpenTry { + return MsgChannelOpenTry.decode(message.value); + }, + toProto(message: MsgChannelOpenTry): Uint8Array { + return MsgChannelOpenTry.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenTry): MsgChannelOpenTryProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + value: MsgChannelOpenTry.encode(message).finish() + }; + } +}; +function createBaseMsgChannelOpenTryResponse(): MsgChannelOpenTryResponse { + return { + version: "", + channelId: "" + }; +} +export const MsgChannelOpenTryResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", + aminoType: "cosmos-sdk/MsgChannelOpenTryResponse", + encode(message: MsgChannelOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenTryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenTryResponse { + const message = createBaseMsgChannelOpenTryResponse(); + message.version = object.version ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenTryResponseAmino): MsgChannelOpenTryResponse { + const message = createBaseMsgChannelOpenTryResponse(); + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseAmino { + const obj: any = {}; + obj.version = message.version === "" ? undefined : message.version; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenTryResponseAminoMsg): MsgChannelOpenTryResponse { + return MsgChannelOpenTryResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenTryResponse", + value: MsgChannelOpenTryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenTryResponseProtoMsg): MsgChannelOpenTryResponse { + return MsgChannelOpenTryResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenTryResponse): Uint8Array { + return MsgChannelOpenTryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", + value: MsgChannelOpenTryResponse.encode(message).finish() + }; + } +}; +function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { + return { + portId: "", + channelId: "", + counterpartyChannelId: "", + counterpartyVersion: "", + proofTry: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelOpenAck = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + aminoType: "cosmos-sdk/MsgChannelOpenAck", + encode(message: MsgChannelOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.counterpartyChannelId !== "") { + writer.uint32(26).string(message.counterpartyChannelId); + } + if (message.counterpartyVersion !== "") { + writer.uint32(34).string(message.counterpartyVersion); + } + if (message.proofTry.length !== 0) { + writer.uint32(42).bytes(message.proofTry); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.counterpartyChannelId = reader.string(); + break; + case 4: + message.counterpartyVersion = reader.string(); + break; + case 5: + message.proofTry = reader.bytes(); + break; + case 6: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenAck { + const message = createBaseMsgChannelOpenAck(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.counterpartyChannelId = object.counterpartyChannelId ?? ""; + message.counterpartyVersion = object.counterpartyVersion ?? ""; + message.proofTry = object.proofTry ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenAckAmino): MsgChannelOpenAck { + const message = createBaseMsgChannelOpenAck(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.counterparty_channel_id !== undefined && object.counterparty_channel_id !== null) { + message.counterpartyChannelId = object.counterparty_channel_id; + } + if (object.counterparty_version !== undefined && object.counterparty_version !== null) { + message.counterpartyVersion = object.counterparty_version; + } + if (object.proof_try !== undefined && object.proof_try !== null) { + message.proofTry = bytesFromBase64(object.proof_try); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; + obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { + return MsgChannelOpenAck.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenAck): MsgChannelOpenAckAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenAck", + value: MsgChannelOpenAck.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenAckProtoMsg): MsgChannelOpenAck { + return MsgChannelOpenAck.decode(message.value); + }, + toProto(message: MsgChannelOpenAck): Uint8Array { + return MsgChannelOpenAck.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenAck): MsgChannelOpenAckProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + value: MsgChannelOpenAck.encode(message).finish() + }; + } +}; +function createBaseMsgChannelOpenAckResponse(): MsgChannelOpenAckResponse { + return {}; +} +export const MsgChannelOpenAckResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", + aminoType: "cosmos-sdk/MsgChannelOpenAckResponse", + encode(_: MsgChannelOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenAckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelOpenAckResponse { + const message = createBaseMsgChannelOpenAckResponse(); + return message; + }, + fromAmino(_: MsgChannelOpenAckResponseAmino): MsgChannelOpenAckResponse { + const message = createBaseMsgChannelOpenAckResponse(); + return message; + }, + toAmino(_: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenAckResponseAminoMsg): MsgChannelOpenAckResponse { + return MsgChannelOpenAckResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenAckResponse", + value: MsgChannelOpenAckResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenAckResponseProtoMsg): MsgChannelOpenAckResponse { + return MsgChannelOpenAckResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenAckResponse): Uint8Array { + return MsgChannelOpenAckResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", + value: MsgChannelOpenAckResponse.encode(message).finish() + }; + } +}; +function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { + return { + portId: "", + channelId: "", + proofAck: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelOpenConfirm = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + aminoType: "cosmos-sdk/MsgChannelOpenConfirm", + encode(message: MsgChannelOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.proofAck.length !== 0) { + writer.uint32(26).bytes(message.proofAck); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.proofAck = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenConfirm { + const message = createBaseMsgChannelOpenConfirm(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.proofAck = object.proofAck ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenConfirmAmino): MsgChannelOpenConfirm { + const message = createBaseMsgChannelOpenConfirm(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.proof_ack !== undefined && object.proof_ack !== null) { + message.proofAck = bytesFromBase64(object.proof_ack); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { + return MsgChannelOpenConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenConfirm", + value: MsgChannelOpenConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenConfirmProtoMsg): MsgChannelOpenConfirm { + return MsgChannelOpenConfirm.decode(message.value); + }, + toProto(message: MsgChannelOpenConfirm): Uint8Array { + return MsgChannelOpenConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + value: MsgChannelOpenConfirm.encode(message).finish() + }; + } +}; +function createBaseMsgChannelOpenConfirmResponse(): MsgChannelOpenConfirmResponse { + return {}; +} +export const MsgChannelOpenConfirmResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", + aminoType: "cosmos-sdk/MsgChannelOpenConfirmResponse", + encode(_: MsgChannelOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelOpenConfirmResponse { + const message = createBaseMsgChannelOpenConfirmResponse(); + return message; + }, + fromAmino(_: MsgChannelOpenConfirmResponseAmino): MsgChannelOpenConfirmResponse { + const message = createBaseMsgChannelOpenConfirmResponse(); + return message; + }, + toAmino(_: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenConfirmResponseAminoMsg): MsgChannelOpenConfirmResponse { + return MsgChannelOpenConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenConfirmResponse", + value: MsgChannelOpenConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenConfirmResponseProtoMsg): MsgChannelOpenConfirmResponse { + return MsgChannelOpenConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenConfirmResponse): Uint8Array { + return MsgChannelOpenConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", + value: MsgChannelOpenConfirmResponse.encode(message).finish() + }; + } +}; +function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { + return { + portId: "", + channelId: "", + signer: "" + }; +} +export const MsgChannelCloseInit = { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + aminoType: "cosmos-sdk/MsgChannelCloseInit", + encode(message: MsgChannelCloseInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelCloseInit { + const message = createBaseMsgChannelCloseInit(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelCloseInitAmino): MsgChannelCloseInit { + const message = createBaseMsgChannelCloseInit(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { + return MsgChannelCloseInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseInit): MsgChannelCloseInitAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseInit", + value: MsgChannelCloseInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseInitProtoMsg): MsgChannelCloseInit { + return MsgChannelCloseInit.decode(message.value); + }, + toProto(message: MsgChannelCloseInit): Uint8Array { + return MsgChannelCloseInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseInit): MsgChannelCloseInitProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + value: MsgChannelCloseInit.encode(message).finish() + }; + } +}; +function createBaseMsgChannelCloseInitResponse(): MsgChannelCloseInitResponse { + return {}; +} +export const MsgChannelCloseInitResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", + aminoType: "cosmos-sdk/MsgChannelCloseInitResponse", + encode(_: MsgChannelCloseInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelCloseInitResponse { + const message = createBaseMsgChannelCloseInitResponse(); + return message; + }, + fromAmino(_: MsgChannelCloseInitResponseAmino): MsgChannelCloseInitResponse { + const message = createBaseMsgChannelCloseInitResponse(); + return message; + }, + toAmino(_: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseInitResponseAminoMsg): MsgChannelCloseInitResponse { + return MsgChannelCloseInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseInitResponse", + value: MsgChannelCloseInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseInitResponseProtoMsg): MsgChannelCloseInitResponse { + return MsgChannelCloseInitResponse.decode(message.value); + }, + toProto(message: MsgChannelCloseInitResponse): Uint8Array { + return MsgChannelCloseInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", + value: MsgChannelCloseInitResponse.encode(message).finish() + }; + } +}; +function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { + return { + portId: "", + channelId: "", + proofInit: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelCloseConfirm = { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + aminoType: "cosmos-sdk/MsgChannelCloseConfirm", + encode(message: MsgChannelCloseConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.proofInit.length !== 0) { + writer.uint32(26).bytes(message.proofInit); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.proofInit = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelCloseConfirm { + const message = createBaseMsgChannelCloseConfirm(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelCloseConfirmAmino): MsgChannelCloseConfirm { + const message = createBaseMsgChannelCloseConfirm(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { + return MsgChannelCloseConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseConfirm", + value: MsgChannelCloseConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseConfirmProtoMsg): MsgChannelCloseConfirm { + return MsgChannelCloseConfirm.decode(message.value); + }, + toProto(message: MsgChannelCloseConfirm): Uint8Array { + return MsgChannelCloseConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + value: MsgChannelCloseConfirm.encode(message).finish() + }; + } +}; +function createBaseMsgChannelCloseConfirmResponse(): MsgChannelCloseConfirmResponse { + return {}; +} +export const MsgChannelCloseConfirmResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", + aminoType: "cosmos-sdk/MsgChannelCloseConfirmResponse", + encode(_: MsgChannelCloseConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelCloseConfirmResponse { + const message = createBaseMsgChannelCloseConfirmResponse(); + return message; + }, + fromAmino(_: MsgChannelCloseConfirmResponseAmino): MsgChannelCloseConfirmResponse { + const message = createBaseMsgChannelCloseConfirmResponse(); + return message; + }, + toAmino(_: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseConfirmResponseAminoMsg): MsgChannelCloseConfirmResponse { + return MsgChannelCloseConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseConfirmResponse", + value: MsgChannelCloseConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseConfirmResponseProtoMsg): MsgChannelCloseConfirmResponse { + return MsgChannelCloseConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelCloseConfirmResponse): Uint8Array { + return MsgChannelCloseConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", + value: MsgChannelCloseConfirmResponse.encode(message).finish() + }; + } +}; +function createBaseMsgRecvPacket(): MsgRecvPacket { + return { + packet: Packet.fromPartial({}), + proofCommitment: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgRecvPacket = { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + aminoType: "cosmos-sdk/MsgRecvPacket", + encode(message: MsgRecvPacket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofCommitment.length !== 0) { + writer.uint32(18).bytes(message.proofCommitment); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecvPacket { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecvPacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofCommitment = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRecvPacket { + const message = createBaseMsgRecvPacket(); + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; + message.proofCommitment = object.proofCommitment ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgRecvPacketAmino): MsgRecvPacket { + const message = createBaseMsgRecvPacket(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_commitment !== undefined && object.proof_commitment !== null) { + message.proofCommitment = bytesFromBase64(object.proof_commitment); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgRecvPacket): MsgRecvPacketAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { + return MsgRecvPacket.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecvPacket): MsgRecvPacketAminoMsg { + return { + type: "cosmos-sdk/MsgRecvPacket", + value: MsgRecvPacket.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecvPacketProtoMsg): MsgRecvPacket { + return MsgRecvPacket.decode(message.value); + }, + toProto(message: MsgRecvPacket): Uint8Array { + return MsgRecvPacket.encode(message).finish(); + }, + toProtoMsg(message: MsgRecvPacket): MsgRecvPacketProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + value: MsgRecvPacket.encode(message).finish() + }; + } +}; +function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { + return { + result: 0 + }; +} +export const MsgRecvPacketResponse = { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", + aminoType: "cosmos-sdk/MsgRecvPacketResponse", + encode(message: MsgRecvPacketResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecvPacketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecvPacketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRecvPacketResponse { + const message = createBaseMsgRecvPacketResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgRecvPacketResponseAmino): MsgRecvPacketResponse { + const message = createBaseMsgRecvPacketResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgRecvPacketResponse): MsgRecvPacketResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgRecvPacketResponseAminoMsg): MsgRecvPacketResponse { + return MsgRecvPacketResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecvPacketResponse): MsgRecvPacketResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRecvPacketResponse", + value: MsgRecvPacketResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecvPacketResponseProtoMsg): MsgRecvPacketResponse { + return MsgRecvPacketResponse.decode(message.value); + }, + toProto(message: MsgRecvPacketResponse): Uint8Array { + return MsgRecvPacketResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRecvPacketResponse): MsgRecvPacketResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", + value: MsgRecvPacketResponse.encode(message).finish() + }; + } +}; +function createBaseMsgTimeout(): MsgTimeout { + return { + packet: Packet.fromPartial({}), + proofUnreceived: new Uint8Array(), + proofHeight: Height.fromPartial({}), + nextSequenceRecv: BigInt(0), + signer: "" + }; +} +export const MsgTimeout = { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + aminoType: "cosmos-sdk/MsgTimeout", + encode(message: MsgTimeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofUnreceived.length !== 0) { + writer.uint32(18).bytes(message.proofUnreceived); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.nextSequenceRecv !== BigInt(0)) { + writer.uint32(32).uint64(message.nextSequenceRecv); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeout { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofUnreceived = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.nextSequenceRecv = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTimeout { + const message = createBaseMsgTimeout(); + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0); + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgTimeoutAmino): MsgTimeout { + const message = createBaseMsgTimeout(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_unreceived !== undefined && object.proof_unreceived !== null) { + message.proofUnreceived = bytesFromBase64(object.proof_unreceived); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.next_sequence_recv !== undefined && object.next_sequence_recv !== null) { + message.nextSequenceRecv = BigInt(object.next_sequence_recv); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgTimeout): MsgTimeoutAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { + return MsgTimeout.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeout): MsgTimeoutAminoMsg { + return { + type: "cosmos-sdk/MsgTimeout", + value: MsgTimeout.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutProtoMsg): MsgTimeout { + return MsgTimeout.decode(message.value); + }, + toProto(message: MsgTimeout): Uint8Array { + return MsgTimeout.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeout): MsgTimeoutProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + value: MsgTimeout.encode(message).finish() + }; + } +}; +function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { + return { + result: 0 + }; +} +export const MsgTimeoutResponse = { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", + aminoType: "cosmos-sdk/MsgTimeoutResponse", + encode(message: MsgTimeoutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTimeoutResponse { + const message = createBaseMsgTimeoutResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgTimeoutResponseAmino): MsgTimeoutResponse { + const message = createBaseMsgTimeoutResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgTimeoutResponse): MsgTimeoutResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgTimeoutResponseAminoMsg): MsgTimeoutResponse { + return MsgTimeoutResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutResponse): MsgTimeoutResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutResponse", + value: MsgTimeoutResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutResponseProtoMsg): MsgTimeoutResponse { + return MsgTimeoutResponse.decode(message.value); + }, + toProto(message: MsgTimeoutResponse): Uint8Array { + return MsgTimeoutResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutResponse): MsgTimeoutResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", + value: MsgTimeoutResponse.encode(message).finish() + }; + } +}; +function createBaseMsgTimeoutOnClose(): MsgTimeoutOnClose { + return { + packet: Packet.fromPartial({}), + proofUnreceived: new Uint8Array(), + proofClose: new Uint8Array(), + proofHeight: Height.fromPartial({}), + nextSequenceRecv: BigInt(0), + signer: "" + }; +} +export const MsgTimeoutOnClose = { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + aminoType: "cosmos-sdk/MsgTimeoutOnClose", + encode(message: MsgTimeoutOnClose, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofUnreceived.length !== 0) { + writer.uint32(18).bytes(message.proofUnreceived); + } + if (message.proofClose.length !== 0) { + writer.uint32(26).bytes(message.proofClose); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.nextSequenceRecv !== BigInt(0)) { + writer.uint32(40).uint64(message.nextSequenceRecv); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutOnClose { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutOnClose(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofUnreceived = reader.bytes(); + break; + case 3: + message.proofClose = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.nextSequenceRecv = reader.uint64(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTimeoutOnClose { + const message = createBaseMsgTimeoutOnClose(); + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + message.proofClose = object.proofClose ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0); + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgTimeoutOnCloseAmino): MsgTimeoutOnClose { + const message = createBaseMsgTimeoutOnClose(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_unreceived !== undefined && object.proof_unreceived !== null) { + message.proofUnreceived = bytesFromBase64(object.proof_unreceived); + } + if (object.proof_close !== undefined && object.proof_close !== null) { + message.proofClose = bytesFromBase64(object.proof_close); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.next_sequence_recv !== undefined && object.next_sequence_recv !== null) { + message.nextSequenceRecv = BigInt(object.next_sequence_recv); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgTimeoutOnClose): MsgTimeoutOnCloseAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; + obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { + return MsgTimeoutOnClose.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutOnClose", + value: MsgTimeoutOnClose.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutOnCloseProtoMsg): MsgTimeoutOnClose { + return MsgTimeoutOnClose.decode(message.value); + }, + toProto(message: MsgTimeoutOnClose): Uint8Array { + return MsgTimeoutOnClose.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutOnClose): MsgTimeoutOnCloseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + value: MsgTimeoutOnClose.encode(message).finish() + }; + } +}; +function createBaseMsgTimeoutOnCloseResponse(): MsgTimeoutOnCloseResponse { + return { + result: 0 + }; +} +export const MsgTimeoutOnCloseResponse = { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", + aminoType: "cosmos-sdk/MsgTimeoutOnCloseResponse", + encode(message: MsgTimeoutOnCloseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutOnCloseResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutOnCloseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTimeoutOnCloseResponse { + const message = createBaseMsgTimeoutOnCloseResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgTimeoutOnCloseResponseAmino): MsgTimeoutOnCloseResponse { + const message = createBaseMsgTimeoutOnCloseResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgTimeoutOnCloseResponseAminoMsg): MsgTimeoutOnCloseResponse { + return MsgTimeoutOnCloseResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutOnCloseResponse", + value: MsgTimeoutOnCloseResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutOnCloseResponseProtoMsg): MsgTimeoutOnCloseResponse { + return MsgTimeoutOnCloseResponse.decode(message.value); + }, + toProto(message: MsgTimeoutOnCloseResponse): Uint8Array { + return MsgTimeoutOnCloseResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", + value: MsgTimeoutOnCloseResponse.encode(message).finish() + }; + } +}; +function createBaseMsgAcknowledgement(): MsgAcknowledgement { + return { + packet: Packet.fromPartial({}), + acknowledgement: new Uint8Array(), + proofAcked: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgAcknowledgement = { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + aminoType: "cosmos-sdk/MsgAcknowledgement", + encode(message: MsgAcknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.acknowledgement.length !== 0) { + writer.uint32(18).bytes(message.acknowledgement); + } + if (message.proofAcked.length !== 0) { + writer.uint32(26).bytes(message.proofAcked); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAcknowledgement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAcknowledgement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.acknowledgement = reader.bytes(); + break; + case 3: + message.proofAcked = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgAcknowledgement { + const message = createBaseMsgAcknowledgement(); + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + message.proofAcked = object.proofAcked ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgAcknowledgementAmino): MsgAcknowledgement { + const message = createBaseMsgAcknowledgement(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = bytesFromBase64(object.acknowledgement); + } + if (object.proof_acked !== undefined && object.proof_acked !== null) { + message.proofAcked = bytesFromBase64(object.proof_acked); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgAcknowledgement): MsgAcknowledgementAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; + obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { + return MsgAcknowledgement.fromAmino(object.value); + }, + toAminoMsg(message: MsgAcknowledgement): MsgAcknowledgementAminoMsg { + return { + type: "cosmos-sdk/MsgAcknowledgement", + value: MsgAcknowledgement.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAcknowledgementProtoMsg): MsgAcknowledgement { + return MsgAcknowledgement.decode(message.value); + }, + toProto(message: MsgAcknowledgement): Uint8Array { + return MsgAcknowledgement.encode(message).finish(); + }, + toProtoMsg(message: MsgAcknowledgement): MsgAcknowledgementProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + value: MsgAcknowledgement.encode(message).finish() + }; + } +}; +function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { + return { + result: 0 + }; +} +export const MsgAcknowledgementResponse = { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", + aminoType: "cosmos-sdk/MsgAcknowledgementResponse", + encode(message: MsgAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgAcknowledgementResponse { + const message = createBaseMsgAcknowledgementResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgAcknowledgementResponseAmino): MsgAcknowledgementResponse { + const message = createBaseMsgAcknowledgementResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgAcknowledgementResponse): MsgAcknowledgementResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgAcknowledgementResponseAminoMsg): MsgAcknowledgementResponse { + return MsgAcknowledgementResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgAcknowledgementResponse): MsgAcknowledgementResponseAminoMsg { + return { + type: "cosmos-sdk/MsgAcknowledgementResponse", + value: MsgAcknowledgementResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAcknowledgementResponseProtoMsg): MsgAcknowledgementResponse { + return MsgAcknowledgementResponse.decode(message.value); + }, + toProto(message: MsgAcknowledgementResponse): Uint8Array { + return MsgAcknowledgementResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAcknowledgementResponse): MsgAcknowledgementResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", + value: MsgAcknowledgementResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/client.ts b/util/inj-types/ibc/core/client/v1/client.ts new file mode 100644 index 00000000..7307e256 --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/client.ts @@ -0,0 +1,930 @@ +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** + * IdentifiedClientState defines a client state with an additional client + * identifier field. + */ +export interface IdentifiedClientState { + /** client identifier */ + clientId: string; + /** client state */ + clientState?: Any; +} +export interface IdentifiedClientStateProtoMsg { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState"; + value: Uint8Array; +} +/** + * IdentifiedClientState defines a client state with an additional client + * identifier field. + */ +export interface IdentifiedClientStateAmino { + /** client identifier */ + client_id?: string; + /** client state */ + client_state?: AnyAmino; +} +export interface IdentifiedClientStateAminoMsg { + type: "cosmos-sdk/IdentifiedClientState"; + value: IdentifiedClientStateAmino; +} +/** + * IdentifiedClientState defines a client state with an additional client + * identifier field. + */ +export interface IdentifiedClientStateSDKType { + client_id: string; + client_state?: AnySDKType; +} +/** + * ConsensusStateWithHeight defines a consensus state with an additional height + * field. + */ +export interface ConsensusStateWithHeight { + /** consensus state height */ + height: Height; + /** consensus state */ + consensusState?: Any; +} +export interface ConsensusStateWithHeightProtoMsg { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight"; + value: Uint8Array; +} +/** + * ConsensusStateWithHeight defines a consensus state with an additional height + * field. + */ +export interface ConsensusStateWithHeightAmino { + /** consensus state height */ + height?: HeightAmino; + /** consensus state */ + consensus_state?: AnyAmino; +} +export interface ConsensusStateWithHeightAminoMsg { + type: "cosmos-sdk/ConsensusStateWithHeight"; + value: ConsensusStateWithHeightAmino; +} +/** + * ConsensusStateWithHeight defines a consensus state with an additional height + * field. + */ +export interface ConsensusStateWithHeightSDKType { + height: HeightSDKType; + consensus_state?: AnySDKType; +} +/** + * ClientConsensusStates defines all the stored consensus states for a given + * client. + */ +export interface ClientConsensusStates { + /** client identifier */ + clientId: string; + /** consensus states and their heights associated with the client */ + consensusStates: ConsensusStateWithHeight[]; +} +export interface ClientConsensusStatesProtoMsg { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates"; + value: Uint8Array; +} +/** + * ClientConsensusStates defines all the stored consensus states for a given + * client. + */ +export interface ClientConsensusStatesAmino { + /** client identifier */ + client_id?: string; + /** consensus states and their heights associated with the client */ + consensus_states?: ConsensusStateWithHeightAmino[]; +} +export interface ClientConsensusStatesAminoMsg { + type: "cosmos-sdk/ClientConsensusStates"; + value: ClientConsensusStatesAmino; +} +/** + * ClientConsensusStates defines all the stored consensus states for a given + * client. + */ +export interface ClientConsensusStatesSDKType { + client_id: string; + consensus_states: ConsensusStateWithHeightSDKType[]; +} +/** + * ClientUpdateProposal is a governance proposal. If it passes, the substitute + * client's latest consensus state is copied over to the subject client. The proposal + * handler may fail if the subject and the substitute do not match in client and + * chain parameters (with exception to latest height, frozen height, and chain-id). + */ +export interface ClientUpdateProposal { + $typeUrl?: "/ibc.core.client.v1.ClientUpdateProposal"; + /** the title of the update proposal */ + title: string; + /** the description of the proposal */ + description: string; + /** the client identifier for the client to be updated if the proposal passes */ + subjectClientId: string; + /** + * the substitute client identifier for the client standing in for the subject + * client + */ + substituteClientId: string; +} +export interface ClientUpdateProposalProtoMsg { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal"; + value: Uint8Array; +} +/** + * ClientUpdateProposal is a governance proposal. If it passes, the substitute + * client's latest consensus state is copied over to the subject client. The proposal + * handler may fail if the subject and the substitute do not match in client and + * chain parameters (with exception to latest height, frozen height, and chain-id). + */ +export interface ClientUpdateProposalAmino { + /** the title of the update proposal */ + title?: string; + /** the description of the proposal */ + description?: string; + /** the client identifier for the client to be updated if the proposal passes */ + subject_client_id?: string; + /** + * the substitute client identifier for the client standing in for the subject + * client + */ + substitute_client_id?: string; +} +export interface ClientUpdateProposalAminoMsg { + type: "cosmos-sdk/ClientUpdateProposal"; + value: ClientUpdateProposalAmino; +} +/** + * ClientUpdateProposal is a governance proposal. If it passes, the substitute + * client's latest consensus state is copied over to the subject client. The proposal + * handler may fail if the subject and the substitute do not match in client and + * chain parameters (with exception to latest height, frozen height, and chain-id). + */ +export interface ClientUpdateProposalSDKType { + $typeUrl?: "/ibc.core.client.v1.ClientUpdateProposal"; + title: string; + description: string; + subject_client_id: string; + substitute_client_id: string; +} +/** + * UpgradeProposal is a gov Content type for initiating an IBC breaking + * upgrade. + */ +export interface UpgradeProposal { + $typeUrl?: "/ibc.core.client.v1.UpgradeProposal"; + title: string; + description: string; + plan: Plan; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades + */ + upgradedClientState?: Any; +} +export interface UpgradeProposalProtoMsg { + typeUrl: "/ibc.core.client.v1.UpgradeProposal"; + value: Uint8Array; +} +/** + * UpgradeProposal is a gov Content type for initiating an IBC breaking + * upgrade. + */ +export interface UpgradeProposalAmino { + title?: string; + description?: string; + plan?: PlanAmino; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades + */ + upgraded_client_state?: AnyAmino; +} +export interface UpgradeProposalAminoMsg { + type: "cosmos-sdk/UpgradeProposal"; + value: UpgradeProposalAmino; +} +/** + * UpgradeProposal is a gov Content type for initiating an IBC breaking + * upgrade. + */ +export interface UpgradeProposalSDKType { + $typeUrl?: "/ibc.core.client.v1.UpgradeProposal"; + title: string; + description: string; + plan: PlanSDKType; + upgraded_client_state?: AnySDKType; +} +/** + * Height is a monotonically increasing data type + * that can be compared against another Height for the purposes of updating and + * freezing clients + * + * Normally the RevisionHeight is incremented at each height while keeping + * RevisionNumber the same. However some consensus algorithms may choose to + * reset the height in certain conditions e.g. hard forks, state-machine + * breaking changes In these cases, the RevisionNumber is incremented so that + * height continues to be monitonically increasing even as the RevisionHeight + * gets reset + */ +export interface Height { + /** the revision that the client is currently on */ + revisionNumber: bigint; + /** the height within the given revision */ + revisionHeight: bigint; +} +export interface HeightProtoMsg { + typeUrl: "/ibc.core.client.v1.Height"; + value: Uint8Array; +} +/** + * Height is a monotonically increasing data type + * that can be compared against another Height for the purposes of updating and + * freezing clients + * + * Normally the RevisionHeight is incremented at each height while keeping + * RevisionNumber the same. However some consensus algorithms may choose to + * reset the height in certain conditions e.g. hard forks, state-machine + * breaking changes In these cases, the RevisionNumber is incremented so that + * height continues to be monitonically increasing even as the RevisionHeight + * gets reset + */ +export interface HeightAmino { + /** the revision that the client is currently on */ + revision_number?: string; + /** the height within the given revision */ + revision_height?: string; +} +export interface HeightAminoMsg { + type: "cosmos-sdk/Height"; + value: HeightAmino; +} +/** + * Height is a monotonically increasing data type + * that can be compared against another Height for the purposes of updating and + * freezing clients + * + * Normally the RevisionHeight is incremented at each height while keeping + * RevisionNumber the same. However some consensus algorithms may choose to + * reset the height in certain conditions e.g. hard forks, state-machine + * breaking changes In these cases, the RevisionNumber is incremented so that + * height continues to be monitonically increasing even as the RevisionHeight + * gets reset + */ +export interface HeightSDKType { + revision_number: bigint; + revision_height: bigint; +} +/** Params defines the set of IBC light client parameters. */ +export interface Params { + /** + * allowed_clients defines the list of allowed client state types which can be created + * and interacted with. If a client type is removed from the allowed clients list, usage + * of this client will be disabled until it is added again to the list. + */ + allowedClients: string[]; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.core.client.v1.Params"; + value: Uint8Array; +} +/** Params defines the set of IBC light client parameters. */ +export interface ParamsAmino { + /** + * allowed_clients defines the list of allowed client state types which can be created + * and interacted with. If a client type is removed from the allowed clients list, usage + * of this client will be disabled until it is added again to the list. + */ + allowed_clients?: string[]; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** Params defines the set of IBC light client parameters. */ +export interface ParamsSDKType { + allowed_clients: string[]; +} +function createBaseIdentifiedClientState(): IdentifiedClientState { + return { + clientId: "", + clientState: undefined + }; +} +export const IdentifiedClientState = { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState", + aminoType: "cosmos-sdk/IdentifiedClientState", + encode(message: IdentifiedClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IdentifiedClientState { + const message = createBaseIdentifiedClientState(); + message.clientId = object.clientId ?? ""; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + return message; + }, + fromAmino(object: IdentifiedClientStateAmino): IdentifiedClientState { + const message = createBaseIdentifiedClientState(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + return message; + }, + toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + return obj; + }, + fromAminoMsg(object: IdentifiedClientStateAminoMsg): IdentifiedClientState { + return IdentifiedClientState.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedClientState): IdentifiedClientStateAminoMsg { + return { + type: "cosmos-sdk/IdentifiedClientState", + value: IdentifiedClientState.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedClientStateProtoMsg): IdentifiedClientState { + return IdentifiedClientState.decode(message.value); + }, + toProto(message: IdentifiedClientState): Uint8Array { + return IdentifiedClientState.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedClientState): IdentifiedClientStateProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState", + value: IdentifiedClientState.encode(message).finish() + }; + } +}; +function createBaseConsensusStateWithHeight(): ConsensusStateWithHeight { + return { + height: Height.fromPartial({}), + consensusState: undefined + }; +} +export const ConsensusStateWithHeight = { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", + aminoType: "cosmos-sdk/ConsensusStateWithHeight", + encode(message: ConsensusStateWithHeight, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusStateWithHeight { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusStateWithHeight(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = Height.decode(reader, reader.uint32()); + break; + case 2: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusStateWithHeight { + const message = createBaseConsensusStateWithHeight(); + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + return message; + }, + fromAmino(object: ConsensusStateWithHeightAmino): ConsensusStateWithHeight { + const message = createBaseConsensusStateWithHeight(); + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + return message; + }, + toAmino(message: ConsensusStateWithHeight): ConsensusStateWithHeightAmino { + const obj: any = {}; + obj.height = message.height ? Height.toAmino(message.height) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateWithHeightAminoMsg): ConsensusStateWithHeight { + return ConsensusStateWithHeight.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusStateWithHeight): ConsensusStateWithHeightAminoMsg { + return { + type: "cosmos-sdk/ConsensusStateWithHeight", + value: ConsensusStateWithHeight.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateWithHeightProtoMsg): ConsensusStateWithHeight { + return ConsensusStateWithHeight.decode(message.value); + }, + toProto(message: ConsensusStateWithHeight): Uint8Array { + return ConsensusStateWithHeight.encode(message).finish(); + }, + toProtoMsg(message: ConsensusStateWithHeight): ConsensusStateWithHeightProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", + value: ConsensusStateWithHeight.encode(message).finish() + }; + } +}; +function createBaseClientConsensusStates(): ClientConsensusStates { + return { + clientId: "", + consensusStates: [] + }; +} +export const ClientConsensusStates = { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates", + aminoType: "cosmos-sdk/ClientConsensusStates", + encode(message: ClientConsensusStates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.consensusStates) { + ConsensusStateWithHeight.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientConsensusStates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientConsensusStates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.consensusStates.push(ConsensusStateWithHeight.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientConsensusStates { + const message = createBaseClientConsensusStates(); + message.clientId = object.clientId ?? ""; + message.consensusStates = object.consensusStates?.map(e => ConsensusStateWithHeight.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ClientConsensusStatesAmino): ClientConsensusStates { + const message = createBaseClientConsensusStates(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.consensusStates = object.consensus_states?.map(e => ConsensusStateWithHeight.fromAmino(e)) || []; + return message; + }, + toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.consensusStates) { + obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); + } else { + obj.consensus_states = message.consensusStates; + } + return obj; + }, + fromAminoMsg(object: ClientConsensusStatesAminoMsg): ClientConsensusStates { + return ClientConsensusStates.fromAmino(object.value); + }, + toAminoMsg(message: ClientConsensusStates): ClientConsensusStatesAminoMsg { + return { + type: "cosmos-sdk/ClientConsensusStates", + value: ClientConsensusStates.toAmino(message) + }; + }, + fromProtoMsg(message: ClientConsensusStatesProtoMsg): ClientConsensusStates { + return ClientConsensusStates.decode(message.value); + }, + toProto(message: ClientConsensusStates): Uint8Array { + return ClientConsensusStates.encode(message).finish(); + }, + toProtoMsg(message: ClientConsensusStates): ClientConsensusStatesProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates", + value: ClientConsensusStates.encode(message).finish() + }; + } +}; +function createBaseClientUpdateProposal(): ClientUpdateProposal { + return { + $typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + title: "", + description: "", + subjectClientId: "", + substituteClientId: "" + }; +} +export const ClientUpdateProposal = { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + aminoType: "cosmos-sdk/ClientUpdateProposal", + encode(message: ClientUpdateProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.subjectClientId !== "") { + writer.uint32(26).string(message.subjectClientId); + } + if (message.substituteClientId !== "") { + writer.uint32(34).string(message.substituteClientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientUpdateProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientUpdateProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.subjectClientId = reader.string(); + break; + case 4: + message.substituteClientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientUpdateProposal { + const message = createBaseClientUpdateProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.subjectClientId = object.subjectClientId ?? ""; + message.substituteClientId = object.substituteClientId ?? ""; + return message; + }, + fromAmino(object: ClientUpdateProposalAmino): ClientUpdateProposal { + const message = createBaseClientUpdateProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.subject_client_id !== undefined && object.subject_client_id !== null) { + message.subjectClientId = object.subject_client_id; + } + if (object.substitute_client_id !== undefined && object.substitute_client_id !== null) { + message.substituteClientId = object.substitute_client_id; + } + return message; + }, + toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; + return obj; + }, + fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { + return ClientUpdateProposal.fromAmino(object.value); + }, + toAminoMsg(message: ClientUpdateProposal): ClientUpdateProposalAminoMsg { + return { + type: "cosmos-sdk/ClientUpdateProposal", + value: ClientUpdateProposal.toAmino(message) + }; + }, + fromProtoMsg(message: ClientUpdateProposalProtoMsg): ClientUpdateProposal { + return ClientUpdateProposal.decode(message.value); + }, + toProto(message: ClientUpdateProposal): Uint8Array { + return ClientUpdateProposal.encode(message).finish(); + }, + toProtoMsg(message: ClientUpdateProposal): ClientUpdateProposalProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + value: ClientUpdateProposal.encode(message).finish() + }; + } +}; +function createBaseUpgradeProposal(): UpgradeProposal { + return { + $typeUrl: "/ibc.core.client.v1.UpgradeProposal", + title: "", + description: "", + plan: Plan.fromPartial({}), + upgradedClientState: undefined + }; +} +export const UpgradeProposal = { + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + aminoType: "cosmos-sdk/UpgradeProposal", + encode(message: UpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.plan = Plan.decode(reader, reader.uint32()); + break; + case 4: + message.upgradedClientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UpgradeProposal { + const message = createBaseUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; + return message; + }, + fromAmino(object: UpgradeProposalAmino): UpgradeProposal { + const message = createBaseUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + return message; + }, + toAmino(message: UpgradeProposal): UpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + return obj; + }, + fromAminoMsg(object: UpgradeProposalAminoMsg): UpgradeProposal { + return UpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: UpgradeProposal): UpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/UpgradeProposal", + value: UpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: UpgradeProposalProtoMsg): UpgradeProposal { + return UpgradeProposal.decode(message.value); + }, + toProto(message: UpgradeProposal): Uint8Array { + return UpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: UpgradeProposal): UpgradeProposalProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + value: UpgradeProposal.encode(message).finish() + }; + } +}; +function createBaseHeight(): Height { + return { + revisionNumber: BigInt(0), + revisionHeight: BigInt(0) + }; +} +export const Height = { + typeUrl: "/ibc.core.client.v1.Height", + aminoType: "cosmos-sdk/Height", + encode(message: Height, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.revisionNumber !== BigInt(0)) { + writer.uint32(8).uint64(message.revisionNumber); + } + if (message.revisionHeight !== BigInt(0)) { + writer.uint32(16).uint64(message.revisionHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Height { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeight(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revisionNumber = reader.uint64(); + break; + case 2: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Height { + const message = createBaseHeight(); + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: HeightAmino): Height { + return { + revisionNumber: BigInt(object.revision_number || "0"), + revisionHeight: BigInt(object.revision_height || "0") + }; + }, + toAmino(message: Height): HeightAmino { + const obj: any = {}; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: HeightAminoMsg): Height { + return Height.fromAmino(object.value); + }, + toAminoMsg(message: Height): HeightAminoMsg { + return { + type: "cosmos-sdk/Height", + value: Height.toAmino(message) + }; + }, + fromProtoMsg(message: HeightProtoMsg): Height { + return Height.decode(message.value); + }, + toProto(message: Height): Uint8Array { + return Height.encode(message).finish(); + }, + toProtoMsg(message: Height): HeightProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.Height", + value: Height.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + allowedClients: [] + }; +} +export const Params = { + typeUrl: "/ibc.core.client.v1.Params", + aminoType: "cosmos-sdk/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.allowedClients) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.allowedClients.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.allowedClients = object.allowedClients?.map(e => e) || []; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.allowedClients = object.allowed_clients?.map(e => e) || []; + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.allowedClients) { + obj.allowed_clients = message.allowedClients.map(e => e); + } else { + obj.allowed_clients = message.allowedClients; + } + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/genesis.ts b/util/inj-types/ibc/core/client/v1/genesis.ts new file mode 100644 index 00000000..34b2794d --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/genesis.ts @@ -0,0 +1,418 @@ +import { IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesAmino, ClientConsensusStatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** GenesisState defines the ibc client submodule's genesis state. */ +export interface GenesisState { + /** client states with their corresponding identifiers */ + clients: IdentifiedClientState[]; + /** consensus states from each client */ + clientsConsensus: ClientConsensusStates[]; + /** metadata from each client */ + clientsMetadata: IdentifiedGenesisMetadata[]; + params: Params; + /** create localhost on initialization */ + createLocalhost: boolean; + /** the sequence for the next generated client identifier */ + nextClientSequence: bigint; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.core.client.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the ibc client submodule's genesis state. */ +export interface GenesisStateAmino { + /** client states with their corresponding identifiers */ + clients?: IdentifiedClientStateAmino[]; + /** consensus states from each client */ + clients_consensus?: ClientConsensusStatesAmino[]; + /** metadata from each client */ + clients_metadata?: IdentifiedGenesisMetadataAmino[]; + params?: ParamsAmino; + /** create localhost on initialization */ + create_localhost?: boolean; + /** the sequence for the next generated client identifier */ + next_client_sequence?: string; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the ibc client submodule's genesis state. */ +export interface GenesisStateSDKType { + clients: IdentifiedClientStateSDKType[]; + clients_consensus: ClientConsensusStatesSDKType[]; + clients_metadata: IdentifiedGenesisMetadataSDKType[]; + params: ParamsSDKType; + create_localhost: boolean; + next_client_sequence: bigint; +} +/** + * GenesisMetadata defines the genesis type for metadata that clients may return + * with ExportMetadata + */ +export interface GenesisMetadata { + /** store key of metadata without clientID-prefix */ + key: Uint8Array; + /** metadata value */ + value: Uint8Array; +} +export interface GenesisMetadataProtoMsg { + typeUrl: "/ibc.core.client.v1.GenesisMetadata"; + value: Uint8Array; +} +/** + * GenesisMetadata defines the genesis type for metadata that clients may return + * with ExportMetadata + */ +export interface GenesisMetadataAmino { + /** store key of metadata without clientID-prefix */ + key?: string; + /** metadata value */ + value?: string; +} +export interface GenesisMetadataAminoMsg { + type: "cosmos-sdk/GenesisMetadata"; + value: GenesisMetadataAmino; +} +/** + * GenesisMetadata defines the genesis type for metadata that clients may return + * with ExportMetadata + */ +export interface GenesisMetadataSDKType { + key: Uint8Array; + value: Uint8Array; +} +/** + * IdentifiedGenesisMetadata has the client metadata with the corresponding + * client id. + */ +export interface IdentifiedGenesisMetadata { + clientId: string; + clientMetadata: GenesisMetadata[]; +} +export interface IdentifiedGenesisMetadataProtoMsg { + typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata"; + value: Uint8Array; +} +/** + * IdentifiedGenesisMetadata has the client metadata with the corresponding + * client id. + */ +export interface IdentifiedGenesisMetadataAmino { + client_id?: string; + client_metadata?: GenesisMetadataAmino[]; +} +export interface IdentifiedGenesisMetadataAminoMsg { + type: "cosmos-sdk/IdentifiedGenesisMetadata"; + value: IdentifiedGenesisMetadataAmino; +} +/** + * IdentifiedGenesisMetadata has the client metadata with the corresponding + * client id. + */ +export interface IdentifiedGenesisMetadataSDKType { + client_id: string; + client_metadata: GenesisMetadataSDKType[]; +} +function createBaseGenesisState(): GenesisState { + return { + clients: [], + clientsConsensus: [], + clientsMetadata: [], + params: Params.fromPartial({}), + createLocalhost: false, + nextClientSequence: BigInt(0) + }; +} +export const GenesisState = { + typeUrl: "/ibc.core.client.v1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.clients) { + IdentifiedClientState.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.clientsConsensus) { + ClientConsensusStates.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.clientsMetadata) { + IdentifiedGenesisMetadata.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + if (message.createLocalhost === true) { + writer.uint32(40).bool(message.createLocalhost); + } + if (message.nextClientSequence !== BigInt(0)) { + writer.uint32(48).uint64(message.nextClientSequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.clients.push(IdentifiedClientState.decode(reader, reader.uint32())); + break; + case 2: + message.clientsConsensus.push(ClientConsensusStates.decode(reader, reader.uint32())); + break; + case 3: + message.clientsMetadata.push(IdentifiedGenesisMetadata.decode(reader, reader.uint32())); + break; + case 4: + message.params = Params.decode(reader, reader.uint32()); + break; + case 5: + message.createLocalhost = reader.bool(); + break; + case 6: + message.nextClientSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.clients = object.clients?.map(e => IdentifiedClientState.fromPartial(e)) || []; + message.clientsConsensus = object.clientsConsensus?.map(e => ClientConsensusStates.fromPartial(e)) || []; + message.clientsMetadata = object.clientsMetadata?.map(e => IdentifiedGenesisMetadata.fromPartial(e)) || []; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.createLocalhost = object.createLocalhost ?? false; + message.nextClientSequence = object.nextClientSequence !== undefined && object.nextClientSequence !== null ? BigInt(object.nextClientSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.clients = object.clients?.map(e => IdentifiedClientState.fromAmino(e)) || []; + message.clientsConsensus = object.clients_consensus?.map(e => ClientConsensusStates.fromAmino(e)) || []; + message.clientsMetadata = object.clients_metadata?.map(e => IdentifiedGenesisMetadata.fromAmino(e)) || []; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + if (object.create_localhost !== undefined && object.create_localhost !== null) { + message.createLocalhost = object.create_localhost; + } + if (object.next_client_sequence !== undefined && object.next_client_sequence !== null) { + message.nextClientSequence = BigInt(object.next_client_sequence); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.clients) { + obj.clients = message.clients.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); + } else { + obj.clients = message.clients; + } + if (message.clientsConsensus) { + obj.clients_consensus = message.clientsConsensus.map(e => e ? ClientConsensusStates.toAmino(e) : undefined); + } else { + obj.clients_consensus = message.clientsConsensus; + } + if (message.clientsMetadata) { + obj.clients_metadata = message.clientsMetadata.map(e => e ? IdentifiedGenesisMetadata.toAmino(e) : undefined); + } else { + obj.clients_metadata = message.clientsMetadata; + } + obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; + obj.next_client_sequence = message.nextClientSequence !== BigInt(0) ? message.nextClientSequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; +function createBaseGenesisMetadata(): GenesisMetadata { + return { + key: new Uint8Array(), + value: new Uint8Array() + }; +} +export const GenesisMetadata = { + typeUrl: "/ibc.core.client.v1.GenesisMetadata", + aminoType: "cosmos-sdk/GenesisMetadata", + encode(message: GenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisMetadata(); + 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: DeepPartial): GenesisMetadata { + const message = createBaseGenesisMetadata(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromAmino(object: GenesisMetadataAmino): GenesisMetadata { + const message = createBaseGenesisMetadata(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: GenesisMetadata): GenesisMetadataAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisMetadataAminoMsg): GenesisMetadata { + return GenesisMetadata.fromAmino(object.value); + }, + toAminoMsg(message: GenesisMetadata): GenesisMetadataAminoMsg { + return { + type: "cosmos-sdk/GenesisMetadata", + value: GenesisMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisMetadataProtoMsg): GenesisMetadata { + return GenesisMetadata.decode(message.value); + }, + toProto(message: GenesisMetadata): Uint8Array { + return GenesisMetadata.encode(message).finish(); + }, + toProtoMsg(message: GenesisMetadata): GenesisMetadataProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.GenesisMetadata", + value: GenesisMetadata.encode(message).finish() + }; + } +}; +function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { + return { + clientId: "", + clientMetadata: [] + }; +} +export const IdentifiedGenesisMetadata = { + typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", + aminoType: "cosmos-sdk/IdentifiedGenesisMetadata", + encode(message: IdentifiedGenesisMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.clientMetadata) { + GenesisMetadata.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedGenesisMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedGenesisMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientMetadata.push(GenesisMetadata.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IdentifiedGenesisMetadata { + const message = createBaseIdentifiedGenesisMetadata(); + message.clientId = object.clientId ?? ""; + message.clientMetadata = object.clientMetadata?.map(e => GenesisMetadata.fromPartial(e)) || []; + return message; + }, + fromAmino(object: IdentifiedGenesisMetadataAmino): IdentifiedGenesisMetadata { + const message = createBaseIdentifiedGenesisMetadata(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.clientMetadata = object.client_metadata?.map(e => GenesisMetadata.fromAmino(e)) || []; + return message; + }, + toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.clientMetadata) { + obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); + } else { + obj.client_metadata = message.clientMetadata; + } + return obj; + }, + fromAminoMsg(object: IdentifiedGenesisMetadataAminoMsg): IdentifiedGenesisMetadata { + return IdentifiedGenesisMetadata.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAminoMsg { + return { + type: "cosmos-sdk/IdentifiedGenesisMetadata", + value: IdentifiedGenesisMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedGenesisMetadataProtoMsg): IdentifiedGenesisMetadata { + return IdentifiedGenesisMetadata.decode(message.value); + }, + toProto(message: IdentifiedGenesisMetadata): Uint8Array { + return IdentifiedGenesisMetadata.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", + value: IdentifiedGenesisMetadata.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/query.lcd.ts b/util/inj-types/ibc/core/client/v1/query.lcd.ts new file mode 100644 index 00000000..13293bd2 --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/query.lcd.ts @@ -0,0 +1,86 @@ +import { setPaginationParams } from "../../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryClientStateRequest, QueryClientStateResponseSDKType, QueryClientStatesRequest, QueryClientStatesResponseSDKType, QueryConsensusStateRequest, QueryConsensusStateResponseSDKType, QueryConsensusStatesRequest, QueryConsensusStatesResponseSDKType, QueryConsensusStateHeightsRequest, QueryConsensusStateHeightsResponseSDKType, QueryClientStatusRequest, QueryClientStatusResponseSDKType, QueryClientParamsRequest, QueryClientParamsResponseSDKType, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponseSDKType, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* ClientState queries an IBC light client. */ + clientState = async (params: QueryClientStateRequest): Promise => { + const endpoint = `ibc/core/client/v1/client_states/${params.clientId}`; + return await this.req.get(endpoint); + }; + /* ClientStates queries all the IBC light clients of a chain. */ + clientStates = async (params: QueryClientStatesRequest = { + pagination: undefined + }): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `ibc/core/client/v1/client_states`; + return await this.req.get(endpoint, options); + }; + /* ConsensusState queries a consensus state associated with a client state at + a given height. */ + consensusState = async (params: QueryConsensusStateRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.latestHeight !== "undefined") { + options.params.latest_height = params.latestHeight; + } + const endpoint = `ibc/core/client/v1/consensus_states/${params.clientId}/revision/${params.revisionNumber}/height/${params.revisionHeight}`; + return await this.req.get(endpoint, options); + }; + /* ConsensusStates queries all the consensus state associated with a given + client. */ + consensusStates = async (params: QueryConsensusStatesRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `ibc/core/client/v1/consensus_states/${params.clientId}`; + return await this.req.get(endpoint, options); + }; + /* ConsensusStateHeights queries the height of every consensus states associated with a given client. */ + consensusStateHeights = async (params: QueryConsensusStateHeightsRequest): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `ibc/core/client/v1/consensus_states/${params.clientId}/heights`; + return await this.req.get(endpoint, options); + }; + /* Status queries the status of an IBC client. */ + clientStatus = async (params: QueryClientStatusRequest): Promise => { + const endpoint = `ibc/core/client/v1/client_status/${params.clientId}`; + return await this.req.get(endpoint); + }; + /* ClientParams queries all parameters of the ibc client submodule. */ + clientParams = async (_params: QueryClientParamsRequest = {}): Promise => { + const endpoint = `ibc/core/client/v1/params`; + return await this.req.get(endpoint); + }; + /* UpgradedClientState queries an Upgraded IBC light client. */ + upgradedClientState = async (_params: QueryUpgradedClientStateRequest = {}): Promise => { + const endpoint = `ibc/core/client/v1/upgraded_client_states`; + return await this.req.get(endpoint); + }; + /* UpgradedConsensusState queries an Upgraded IBC consensus state. */ + upgradedConsensusState = async (_params: QueryUpgradedConsensusStateRequest = {}): Promise => { + const endpoint = `ibc/core/client/v1/upgraded_consensus_states`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/query.rpc.Query.ts b/util/inj-types/ibc/core/client/v1/query.rpc.Query.ts new file mode 100644 index 00000000..c54e204f --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/query.rpc.Query.ts @@ -0,0 +1,128 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryClientStateRequest, QueryClientStateResponse, QueryClientStatesRequest, QueryClientStatesResponse, QueryConsensusStateRequest, QueryConsensusStateResponse, QueryConsensusStatesRequest, QueryConsensusStatesResponse, QueryConsensusStateHeightsRequest, QueryConsensusStateHeightsResponse, QueryClientStatusRequest, QueryClientStatusResponse, QueryClientParamsRequest, QueryClientParamsResponse, QueryUpgradedClientStateRequest, QueryUpgradedClientStateResponse, QueryUpgradedConsensusStateRequest, QueryUpgradedConsensusStateResponse } from "./query"; +/** Query provides defines the gRPC querier service */ +export interface Query { + /** ClientState queries an IBC light client. */ + clientState(request: QueryClientStateRequest): Promise; + /** ClientStates queries all the IBC light clients of a chain. */ + clientStates(request?: QueryClientStatesRequest): Promise; + /** + * ConsensusState queries a consensus state associated with a client state at + * a given height. + */ + consensusState(request: QueryConsensusStateRequest): Promise; + /** + * ConsensusStates queries all the consensus state associated with a given + * client. + */ + consensusStates(request: QueryConsensusStatesRequest): Promise; + /** ConsensusStateHeights queries the height of every consensus states associated with a given client. */ + consensusStateHeights(request: QueryConsensusStateHeightsRequest): Promise; + /** Status queries the status of an IBC client. */ + clientStatus(request: QueryClientStatusRequest): Promise; + /** ClientParams queries all parameters of the ibc client submodule. */ + clientParams(request?: QueryClientParamsRequest): Promise; + /** UpgradedClientState queries an Upgraded IBC light client. */ + upgradedClientState(request?: QueryUpgradedClientStateRequest): Promise; + /** UpgradedConsensusState queries an Upgraded IBC consensus state. */ + upgradedConsensusState(request?: QueryUpgradedConsensusStateRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* ClientState queries an IBC light client. */ + clientState = async (request: QueryClientStateRequest): Promise => { + const data = QueryClientStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientState", data); + return promise.then(data => QueryClientStateResponse.decode(new BinaryReader(data))); + }; + /* ClientStates queries all the IBC light clients of a chain. */ + clientStates = async (request: QueryClientStatesRequest = { + pagination: undefined + }): Promise => { + const data = QueryClientStatesRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientStates", data); + return promise.then(data => QueryClientStatesResponse.decode(new BinaryReader(data))); + }; + /* ConsensusState queries a consensus state associated with a client state at + a given height. */ + consensusState = async (request: QueryConsensusStateRequest): Promise => { + const data = QueryConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ConsensusState", data); + return promise.then(data => QueryConsensusStateResponse.decode(new BinaryReader(data))); + }; + /* ConsensusStates queries all the consensus state associated with a given + client. */ + consensusStates = async (request: QueryConsensusStatesRequest): Promise => { + const data = QueryConsensusStatesRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ConsensusStates", data); + return promise.then(data => QueryConsensusStatesResponse.decode(new BinaryReader(data))); + }; + /* ConsensusStateHeights queries the height of every consensus states associated with a given client. */ + consensusStateHeights = async (request: QueryConsensusStateHeightsRequest): Promise => { + const data = QueryConsensusStateHeightsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ConsensusStateHeights", data); + return promise.then(data => QueryConsensusStateHeightsResponse.decode(new BinaryReader(data))); + }; + /* Status queries the status of an IBC client. */ + clientStatus = async (request: QueryClientStatusRequest): Promise => { + const data = QueryClientStatusRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientStatus", data); + return promise.then(data => QueryClientStatusResponse.decode(new BinaryReader(data))); + }; + /* ClientParams queries all parameters of the ibc client submodule. */ + clientParams = async (request: QueryClientParamsRequest = {}): Promise => { + const data = QueryClientParamsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "ClientParams", data); + return promise.then(data => QueryClientParamsResponse.decode(new BinaryReader(data))); + }; + /* UpgradedClientState queries an Upgraded IBC light client. */ + upgradedClientState = async (request: QueryUpgradedClientStateRequest = {}): Promise => { + const data = QueryUpgradedClientStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedClientState", data); + return promise.then(data => QueryUpgradedClientStateResponse.decode(new BinaryReader(data))); + }; + /* UpgradedConsensusState queries an Upgraded IBC consensus state. */ + upgradedConsensusState = async (request: QueryUpgradedConsensusStateRequest = {}): Promise => { + const data = QueryUpgradedConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Query", "UpgradedConsensusState", data); + return promise.then(data => QueryUpgradedConsensusStateResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + clientState(request: QueryClientStateRequest): Promise { + return queryService.clientState(request); + }, + clientStates(request?: QueryClientStatesRequest): Promise { + return queryService.clientStates(request); + }, + consensusState(request: QueryConsensusStateRequest): Promise { + return queryService.consensusState(request); + }, + consensusStates(request: QueryConsensusStatesRequest): Promise { + return queryService.consensusStates(request); + }, + consensusStateHeights(request: QueryConsensusStateHeightsRequest): Promise { + return queryService.consensusStateHeights(request); + }, + clientStatus(request: QueryClientStatusRequest): Promise { + return queryService.clientStatus(request); + }, + clientParams(request?: QueryClientParamsRequest): Promise { + return queryService.clientParams(request); + }, + upgradedClientState(request?: QueryUpgradedClientStateRequest): Promise { + return queryService.upgradedClientState(request); + }, + upgradedConsensusState(request?: QueryUpgradedConsensusStateRequest): Promise { + return queryService.upgradedConsensusState(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/query.ts b/util/inj-types/ibc/core/client/v1/query.ts new file mode 100644 index 00000000..9c08900c --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/query.ts @@ -0,0 +1,1980 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightAmino, ConsensusStateWithHeightSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * QueryClientStateRequest is the request type for the Query/ClientState RPC + * method + */ +export interface QueryClientStateRequest { + /** client state unique identifier */ + clientId: string; +} +export interface QueryClientStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStateRequest"; + value: Uint8Array; +} +/** + * QueryClientStateRequest is the request type for the Query/ClientState RPC + * method + */ +export interface QueryClientStateRequestAmino { + /** client state unique identifier */ + client_id?: string; +} +export interface QueryClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryClientStateRequest"; + value: QueryClientStateRequestAmino; +} +/** + * QueryClientStateRequest is the request type for the Query/ClientState RPC + * method + */ +export interface QueryClientStateRequestSDKType { + client_id: string; +} +/** + * QueryClientStateResponse is the response type for the Query/ClientState RPC + * method. Besides the client state, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryClientStateResponse { + /** client state associated with the request identifier */ + clientState?: Any; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryClientStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStateResponse"; + value: Uint8Array; +} +/** + * QueryClientStateResponse is the response type for the Query/ClientState RPC + * method. Besides the client state, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryClientStateResponseAmino { + /** client state associated with the request identifier */ + client_state?: AnyAmino; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryClientStateResponse"; + value: QueryClientStateResponseAmino; +} +/** + * QueryClientStateResponse is the response type for the Query/ClientState RPC + * method. Besides the client state, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryClientStateResponseSDKType { + client_state?: AnySDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryClientStatesRequest is the request type for the Query/ClientStates RPC + * method + */ +export interface QueryClientStatesRequest { + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryClientStatesRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest"; + value: Uint8Array; +} +/** + * QueryClientStatesRequest is the request type for the Query/ClientStates RPC + * method + */ +export interface QueryClientStatesRequestAmino { + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryClientStatesRequestAminoMsg { + type: "cosmos-sdk/QueryClientStatesRequest"; + value: QueryClientStatesRequestAmino; +} +/** + * QueryClientStatesRequest is the request type for the Query/ClientStates RPC + * method + */ +export interface QueryClientStatesRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * QueryClientStatesResponse is the response type for the Query/ClientStates RPC + * method. + */ +export interface QueryClientStatesResponse { + /** list of stored ClientStates of the chain. */ + clientStates: IdentifiedClientState[]; + /** pagination response */ + pagination?: PageResponse; +} +export interface QueryClientStatesResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse"; + value: Uint8Array; +} +/** + * QueryClientStatesResponse is the response type for the Query/ClientStates RPC + * method. + */ +export interface QueryClientStatesResponseAmino { + /** list of stored ClientStates of the chain. */ + client_states?: IdentifiedClientStateAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryClientStatesResponseAminoMsg { + type: "cosmos-sdk/QueryClientStatesResponse"; + value: QueryClientStatesResponseAmino; +} +/** + * QueryClientStatesResponse is the response type for the Query/ClientStates RPC + * method. + */ +export interface QueryClientStatesResponseSDKType { + client_states: IdentifiedClientStateSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryConsensusStateRequest is the request type for the Query/ConsensusState + * RPC method. Besides the consensus state, it includes a proof and the height + * from which the proof was retrieved. + */ +export interface QueryConsensusStateRequest { + /** client identifier */ + clientId: string; + /** consensus state revision number */ + revisionNumber: bigint; + /** consensus state revision height */ + revisionHeight: bigint; + /** + * latest_height overrrides the height field and queries the latest stored + * ConsensusState + */ + latestHeight?: boolean; +} +export interface QueryConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryConsensusStateRequest is the request type for the Query/ConsensusState + * RPC method. Besides the consensus state, it includes a proof and the height + * from which the proof was retrieved. + */ +export interface QueryConsensusStateRequestAmino { + /** client identifier */ + client_id?: string; + /** consensus state revision number */ + revision_number?: string; + /** consensus state revision height */ + revision_height?: string; + /** + * latest_height overrrides the height field and queries the latest stored + * ConsensusState + */ + latest_height?: boolean; +} +export interface QueryConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryConsensusStateRequest"; + value: QueryConsensusStateRequestAmino; +} +/** + * QueryConsensusStateRequest is the request type for the Query/ConsensusState + * RPC method. Besides the consensus state, it includes a proof and the height + * from which the proof was retrieved. + */ +export interface QueryConsensusStateRequestSDKType { + client_id: string; + revision_number: bigint; + revision_height: bigint; + latest_height?: boolean; +} +/** + * QueryConsensusStateResponse is the response type for the Query/ConsensusState + * RPC method + */ +export interface QueryConsensusStateResponse { + /** consensus state associated with the client identifier at the given height */ + consensusState?: Any; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse"; + value: Uint8Array; +} +/** + * QueryConsensusStateResponse is the response type for the Query/ConsensusState + * RPC method + */ +export interface QueryConsensusStateResponseAmino { + /** consensus state associated with the client identifier at the given height */ + consensus_state?: AnyAmino; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryConsensusStateResponse"; + value: QueryConsensusStateResponseAmino; +} +/** + * QueryConsensusStateResponse is the response type for the Query/ConsensusState + * RPC method + */ +export interface QueryConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates + * RPC method. + */ +export interface QueryConsensusStatesRequest { + /** client identifier */ + clientId: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryConsensusStatesRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest"; + value: Uint8Array; +} +/** + * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates + * RPC method. + */ +export interface QueryConsensusStatesRequestAmino { + /** client identifier */ + client_id?: string; + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryConsensusStatesRequestAminoMsg { + type: "cosmos-sdk/QueryConsensusStatesRequest"; + value: QueryConsensusStatesRequestAmino; +} +/** + * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates + * RPC method. + */ +export interface QueryConsensusStatesRequestSDKType { + client_id: string; + pagination?: PageRequestSDKType; +} +/** + * QueryConsensusStatesResponse is the response type for the + * Query/ConsensusStates RPC method + */ +export interface QueryConsensusStatesResponse { + /** consensus states associated with the identifier */ + consensusStates: ConsensusStateWithHeight[]; + /** pagination response */ + pagination?: PageResponse; +} +export interface QueryConsensusStatesResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse"; + value: Uint8Array; +} +/** + * QueryConsensusStatesResponse is the response type for the + * Query/ConsensusStates RPC method + */ +export interface QueryConsensusStatesResponseAmino { + /** consensus states associated with the identifier */ + consensus_states?: ConsensusStateWithHeightAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryConsensusStatesResponseAminoMsg { + type: "cosmos-sdk/QueryConsensusStatesResponse"; + value: QueryConsensusStatesResponseAmino; +} +/** + * QueryConsensusStatesResponse is the response type for the + * Query/ConsensusStates RPC method + */ +export interface QueryConsensusStatesResponseSDKType { + consensus_states: ConsensusStateWithHeightSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights + * RPC method. + */ +export interface QueryConsensusStateHeightsRequest { + /** client identifier */ + clientId: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryConsensusStateHeightsRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsRequest"; + value: Uint8Array; +} +/** + * QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights + * RPC method. + */ +export interface QueryConsensusStateHeightsRequestAmino { + /** client identifier */ + client_id?: string; + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryConsensusStateHeightsRequestAminoMsg { + type: "cosmos-sdk/QueryConsensusStateHeightsRequest"; + value: QueryConsensusStateHeightsRequestAmino; +} +/** + * QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights + * RPC method. + */ +export interface QueryConsensusStateHeightsRequestSDKType { + client_id: string; + pagination?: PageRequestSDKType; +} +/** + * QueryConsensusStateHeightsResponse is the response type for the + * Query/ConsensusStateHeights RPC method + */ +export interface QueryConsensusStateHeightsResponse { + /** consensus state heights */ + consensusStateHeights: Height[]; + /** pagination response */ + pagination?: PageResponse; +} +export interface QueryConsensusStateHeightsResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsResponse"; + value: Uint8Array; +} +/** + * QueryConsensusStateHeightsResponse is the response type for the + * Query/ConsensusStateHeights RPC method + */ +export interface QueryConsensusStateHeightsResponseAmino { + /** consensus state heights */ + consensus_state_heights?: HeightAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryConsensusStateHeightsResponseAminoMsg { + type: "cosmos-sdk/QueryConsensusStateHeightsResponse"; + value: QueryConsensusStateHeightsResponseAmino; +} +/** + * QueryConsensusStateHeightsResponse is the response type for the + * Query/ConsensusStateHeights RPC method + */ +export interface QueryConsensusStateHeightsResponseSDKType { + consensus_state_heights: HeightSDKType[]; + pagination?: PageResponseSDKType; +} +/** + * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC + * method + */ +export interface QueryClientStatusRequest { + /** client unique identifier */ + clientId: string; +} +export interface QueryClientStatusRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest"; + value: Uint8Array; +} +/** + * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC + * method + */ +export interface QueryClientStatusRequestAmino { + /** client unique identifier */ + client_id?: string; +} +export interface QueryClientStatusRequestAminoMsg { + type: "cosmos-sdk/QueryClientStatusRequest"; + value: QueryClientStatusRequestAmino; +} +/** + * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC + * method + */ +export interface QueryClientStatusRequestSDKType { + client_id: string; +} +/** + * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC + * method. It returns the current status of the IBC client. + */ +export interface QueryClientStatusResponse { + status: string; +} +export interface QueryClientStatusResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse"; + value: Uint8Array; +} +/** + * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC + * method. It returns the current status of the IBC client. + */ +export interface QueryClientStatusResponseAmino { + status?: string; +} +export interface QueryClientStatusResponseAminoMsg { + type: "cosmos-sdk/QueryClientStatusResponse"; + value: QueryClientStatusResponseAmino; +} +/** + * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC + * method. It returns the current status of the IBC client. + */ +export interface QueryClientStatusResponseSDKType { + status: string; +} +/** + * QueryClientParamsRequest is the request type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsRequest {} +export interface QueryClientParamsRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest"; + value: Uint8Array; +} +/** + * QueryClientParamsRequest is the request type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsRequestAmino {} +export interface QueryClientParamsRequestAminoMsg { + type: "cosmos-sdk/QueryClientParamsRequest"; + value: QueryClientParamsRequestAmino; +} +/** + * QueryClientParamsRequest is the request type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsRequestSDKType {} +/** + * QueryClientParamsResponse is the response type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryClientParamsResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse"; + value: Uint8Array; +} +/** + * QueryClientParamsResponse is the response type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsResponseAmino { + /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryClientParamsResponseAminoMsg { + type: "cosmos-sdk/QueryClientParamsResponse"; + value: QueryClientParamsResponseAmino; +} +/** + * QueryClientParamsResponse is the response type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsResponseSDKType { + params?: ParamsSDKType; +} +/** + * QueryUpgradedClientStateRequest is the request type for the + * Query/UpgradedClientState RPC method + */ +export interface QueryUpgradedClientStateRequest {} +export interface QueryUpgradedClientStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest"; + value: Uint8Array; +} +/** + * QueryUpgradedClientStateRequest is the request type for the + * Query/UpgradedClientState RPC method + */ +export interface QueryUpgradedClientStateRequestAmino {} +export interface QueryUpgradedClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedClientStateRequest"; + value: QueryUpgradedClientStateRequestAmino; +} +/** + * QueryUpgradedClientStateRequest is the request type for the + * Query/UpgradedClientState RPC method + */ +export interface QueryUpgradedClientStateRequestSDKType {} +/** + * QueryUpgradedClientStateResponse is the response type for the + * Query/UpgradedClientState RPC method. + */ +export interface QueryUpgradedClientStateResponse { + /** client state associated with the request identifier */ + upgradedClientState?: Any; +} +export interface QueryUpgradedClientStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse"; + value: Uint8Array; +} +/** + * QueryUpgradedClientStateResponse is the response type for the + * Query/UpgradedClientState RPC method. + */ +export interface QueryUpgradedClientStateResponseAmino { + /** client state associated with the request identifier */ + upgraded_client_state?: AnyAmino; +} +export interface QueryUpgradedClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedClientStateResponse"; + value: QueryUpgradedClientStateResponseAmino; +} +/** + * QueryUpgradedClientStateResponse is the response type for the + * Query/UpgradedClientState RPC method. + */ +export interface QueryUpgradedClientStateResponseSDKType { + upgraded_client_state?: AnySDKType; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the + * Query/UpgradedConsensusState RPC method + */ +export interface QueryUpgradedConsensusStateRequest {} +export interface QueryUpgradedConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the + * Query/UpgradedConsensusState RPC method + */ +export interface QueryUpgradedConsensusStateRequestAmino {} +export interface QueryUpgradedConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest"; + value: QueryUpgradedConsensusStateRequestAmino; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the + * Query/UpgradedConsensusState RPC method + */ +export interface QueryUpgradedConsensusStateRequestSDKType {} +/** + * QueryUpgradedConsensusStateResponse is the response type for the + * Query/UpgradedConsensusState RPC method. + */ +export interface QueryUpgradedConsensusStateResponse { + /** Consensus state associated with the request identifier */ + upgradedConsensusState?: Any; +} +export interface QueryUpgradedConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the + * Query/UpgradedConsensusState RPC method. + */ +export interface QueryUpgradedConsensusStateResponseAmino { + /** Consensus state associated with the request identifier */ + upgraded_consensus_state?: AnyAmino; +} +export interface QueryUpgradedConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse"; + value: QueryUpgradedConsensusStateResponseAmino; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the + * Query/UpgradedConsensusState RPC method. + */ +export interface QueryUpgradedConsensusStateResponseSDKType { + upgraded_consensus_state?: AnySDKType; +} +function createBaseQueryClientStateRequest(): QueryClientStateRequest { + return { + clientId: "" + }; +} +export const QueryClientStateRequest = { + typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", + aminoType: "cosmos-sdk/QueryClientStateRequest", + encode(message: QueryClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryClientStateRequest { + const message = createBaseQueryClientStateRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, + fromAmino(object: QueryClientStateRequestAmino): QueryClientStateRequest { + const message = createBaseQueryClientStateRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + return message; + }, + toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + return obj; + }, + fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { + return QueryClientStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStateRequest): QueryClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStateRequest", + value: QueryClientStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStateRequestProtoMsg): QueryClientStateRequest { + return QueryClientStateRequest.decode(message.value); + }, + toProto(message: QueryClientStateRequest): Uint8Array { + return QueryClientStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStateRequest): QueryClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", + value: QueryClientStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryClientStateResponse(): QueryClientStateResponse { + return { + clientState: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryClientStateResponse = { + typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", + aminoType: "cosmos-sdk/QueryClientStateResponse", + encode(message: QueryClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryClientStateResponse { + const message = createBaseQueryClientStateResponse(); + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryClientStateResponseAmino): QueryClientStateResponse { + const message = createBaseQueryClientStateResponse(); + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryClientStateResponse): QueryClientStateResponseAmino { + const obj: any = {}; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryClientStateResponseAminoMsg): QueryClientStateResponse { + return QueryClientStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStateResponse): QueryClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStateResponse", + value: QueryClientStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStateResponseProtoMsg): QueryClientStateResponse { + return QueryClientStateResponse.decode(message.value); + }, + toProto(message: QueryClientStateResponse): Uint8Array { + return QueryClientStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStateResponse): QueryClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", + value: QueryClientStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryClientStatesRequest(): QueryClientStatesRequest { + return { + pagination: undefined + }; +} +export const QueryClientStatesRequest = { + typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", + aminoType: "cosmos-sdk/QueryClientStatesRequest", + encode(message: QueryClientStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStatesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatesRequest(); + 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: DeepPartial): QueryClientStatesRequest { + const message = createBaseQueryClientStatesRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryClientStatesRequestAmino): QueryClientStatesRequest { + const message = createBaseQueryClientStatesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryClientStatesRequest): QueryClientStatesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClientStatesRequestAminoMsg): QueryClientStatesRequest { + return QueryClientStatesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStatesRequest): QueryClientStatesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatesRequest", + value: QueryClientStatesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStatesRequestProtoMsg): QueryClientStatesRequest { + return QueryClientStatesRequest.decode(message.value); + }, + toProto(message: QueryClientStatesRequest): Uint8Array { + return QueryClientStatesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStatesRequest): QueryClientStatesRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", + value: QueryClientStatesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryClientStatesResponse(): QueryClientStatesResponse { + return { + clientStates: [], + pagination: undefined + }; +} +export const QueryClientStatesResponse = { + typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", + aminoType: "cosmos-sdk/QueryClientStatesResponse", + encode(message: QueryClientStatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.clientStates) { + IdentifiedClientState.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientStates.push(IdentifiedClientState.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: DeepPartial): QueryClientStatesResponse { + const message = createBaseQueryClientStatesResponse(); + message.clientStates = object.clientStates?.map(e => IdentifiedClientState.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryClientStatesResponseAmino): QueryClientStatesResponse { + const message = createBaseQueryClientStatesResponse(); + message.clientStates = object.client_states?.map(e => IdentifiedClientState.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryClientStatesResponse): QueryClientStatesResponseAmino { + const obj: any = {}; + if (message.clientStates) { + obj.client_states = message.clientStates.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); + } else { + obj.client_states = message.clientStates; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClientStatesResponseAminoMsg): QueryClientStatesResponse { + return QueryClientStatesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStatesResponse): QueryClientStatesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatesResponse", + value: QueryClientStatesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStatesResponseProtoMsg): QueryClientStatesResponse { + return QueryClientStatesResponse.decode(message.value); + }, + toProto(message: QueryClientStatesResponse): Uint8Array { + return QueryClientStatesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStatesResponse): QueryClientStatesResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", + value: QueryClientStatesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { + return { + clientId: "", + revisionNumber: BigInt(0), + revisionHeight: BigInt(0), + latestHeight: false + }; +} +export const QueryConsensusStateRequest = { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", + aminoType: "cosmos-sdk/QueryConsensusStateRequest", + encode(message: QueryConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.revisionNumber !== BigInt(0)) { + writer.uint32(16).uint64(message.revisionNumber); + } + if (message.revisionHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.revisionHeight); + } + if (message.latestHeight === true) { + writer.uint32(32).bool(message.latestHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.revisionNumber = reader.uint64(); + break; + case 3: + message.revisionHeight = reader.uint64(); + break; + case 4: + message.latestHeight = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConsensusStateRequest { + const message = createBaseQueryConsensusStateRequest(); + message.clientId = object.clientId ?? ""; + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); + message.latestHeight = object.latestHeight ?? false; + return message; + }, + fromAmino(object: QueryConsensusStateRequestAmino): QueryConsensusStateRequest { + const message = createBaseQueryConsensusStateRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.revision_number !== undefined && object.revision_number !== null) { + message.revisionNumber = BigInt(object.revision_number); + } + if (object.revision_height !== undefined && object.revision_height !== null) { + message.revisionHeight = BigInt(object.revision_height); + } + if (object.latest_height !== undefined && object.latest_height !== null) { + message.latestHeight = object.latest_height; + } + return message; + }, + toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; + obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; + return obj; + }, + fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { + return QueryConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStateRequest): QueryConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateRequest", + value: QueryConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStateRequestProtoMsg): QueryConsensusStateRequest { + return QueryConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryConsensusStateRequest): Uint8Array { + return QueryConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStateRequest): QueryConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", + value: QueryConsensusStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConsensusStateResponse(): QueryConsensusStateResponse { + return { + consensusState: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryConsensusStateResponse = { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", + aminoType: "cosmos-sdk/QueryConsensusStateResponse", + encode(message: QueryConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConsensusStateResponse { + const message = createBaseQueryConsensusStateResponse(); + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryConsensusStateResponseAmino): QueryConsensusStateResponse { + const message = createBaseQueryConsensusStateResponse(); + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryConsensusStateResponse): QueryConsensusStateResponseAmino { + const obj: any = {}; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryConsensusStateResponseAminoMsg): QueryConsensusStateResponse { + return QueryConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStateResponse): QueryConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateResponse", + value: QueryConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStateResponseProtoMsg): QueryConsensusStateResponse { + return QueryConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryConsensusStateResponse): Uint8Array { + return QueryConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStateResponse): QueryConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", + value: QueryConsensusStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { + return { + clientId: "", + pagination: undefined + }; +} +export const QueryConsensusStatesRequest = { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", + aminoType: "cosmos-sdk/QueryConsensusStatesRequest", + encode(message: QueryConsensusStatesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStatesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConsensusStatesRequest { + const message = createBaseQueryConsensusStatesRequest(); + message.clientId = object.clientId ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryConsensusStatesRequestAmino): QueryConsensusStatesRequest { + const message = createBaseQueryConsensusStatesRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConsensusStatesRequestAminoMsg): QueryConsensusStatesRequest { + return QueryConsensusStatesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStatesRequest", + value: QueryConsensusStatesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStatesRequestProtoMsg): QueryConsensusStatesRequest { + return QueryConsensusStatesRequest.decode(message.value); + }, + toProto(message: QueryConsensusStatesRequest): Uint8Array { + return QueryConsensusStatesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", + value: QueryConsensusStatesRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse { + return { + consensusStates: [], + pagination: undefined + }; +} +export const QueryConsensusStatesResponse = { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", + aminoType: "cosmos-sdk/QueryConsensusStatesResponse", + encode(message: QueryConsensusStatesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.consensusStates) { + ConsensusStateWithHeight.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusStates.push(ConsensusStateWithHeight.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConsensusStatesResponse { + const message = createBaseQueryConsensusStatesResponse(); + message.consensusStates = object.consensusStates?.map(e => ConsensusStateWithHeight.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryConsensusStatesResponseAmino): QueryConsensusStatesResponse { + const message = createBaseQueryConsensusStatesResponse(); + message.consensusStates = object.consensus_states?.map(e => ConsensusStateWithHeight.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConsensusStatesResponse): QueryConsensusStatesResponseAmino { + const obj: any = {}; + if (message.consensusStates) { + obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); + } else { + obj.consensus_states = message.consensusStates; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConsensusStatesResponseAminoMsg): QueryConsensusStatesResponse { + return QueryConsensusStatesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStatesResponse): QueryConsensusStatesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStatesResponse", + value: QueryConsensusStatesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStatesResponseProtoMsg): QueryConsensusStatesResponse { + return QueryConsensusStatesResponse.decode(message.value); + }, + toProto(message: QueryConsensusStatesResponse): Uint8Array { + return QueryConsensusStatesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStatesResponse): QueryConsensusStatesResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", + value: QueryConsensusStatesResponse.encode(message).finish() + }; + } +}; +function createBaseQueryConsensusStateHeightsRequest(): QueryConsensusStateHeightsRequest { + return { + clientId: "", + pagination: undefined + }; +} +export const QueryConsensusStateHeightsRequest = { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsRequest", + aminoType: "cosmos-sdk/QueryConsensusStateHeightsRequest", + encode(message: QueryConsensusStateHeightsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStateHeightsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateHeightsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConsensusStateHeightsRequest { + const message = createBaseQueryConsensusStateHeightsRequest(); + message.clientId = object.clientId ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryConsensusStateHeightsRequestAmino): QueryConsensusStateHeightsRequest { + const message = createBaseQueryConsensusStateHeightsRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConsensusStateHeightsRequest): QueryConsensusStateHeightsRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConsensusStateHeightsRequestAminoMsg): QueryConsensusStateHeightsRequest { + return QueryConsensusStateHeightsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStateHeightsRequest): QueryConsensusStateHeightsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateHeightsRequest", + value: QueryConsensusStateHeightsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStateHeightsRequestProtoMsg): QueryConsensusStateHeightsRequest { + return QueryConsensusStateHeightsRequest.decode(message.value); + }, + toProto(message: QueryConsensusStateHeightsRequest): Uint8Array { + return QueryConsensusStateHeightsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStateHeightsRequest): QueryConsensusStateHeightsRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsRequest", + value: QueryConsensusStateHeightsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConsensusStateHeightsResponse(): QueryConsensusStateHeightsResponse { + return { + consensusStateHeights: [], + pagination: undefined + }; +} +export const QueryConsensusStateHeightsResponse = { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsResponse", + aminoType: "cosmos-sdk/QueryConsensusStateHeightsResponse", + encode(message: QueryConsensusStateHeightsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.consensusStateHeights) { + Height.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConsensusStateHeightsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStateHeightsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusStateHeights.push(Height.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: DeepPartial): QueryConsensusStateHeightsResponse { + const message = createBaseQueryConsensusStateHeightsResponse(); + message.consensusStateHeights = object.consensusStateHeights?.map(e => Height.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryConsensusStateHeightsResponseAmino): QueryConsensusStateHeightsResponse { + const message = createBaseQueryConsensusStateHeightsResponse(); + message.consensusStateHeights = object.consensus_state_heights?.map(e => Height.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConsensusStateHeightsResponse): QueryConsensusStateHeightsResponseAmino { + const obj: any = {}; + if (message.consensusStateHeights) { + obj.consensus_state_heights = message.consensusStateHeights.map(e => e ? Height.toAmino(e) : undefined); + } else { + obj.consensus_state_heights = message.consensusStateHeights; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConsensusStateHeightsResponseAminoMsg): QueryConsensusStateHeightsResponse { + return QueryConsensusStateHeightsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConsensusStateHeightsResponse): QueryConsensusStateHeightsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateHeightsResponse", + value: QueryConsensusStateHeightsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConsensusStateHeightsResponseProtoMsg): QueryConsensusStateHeightsResponse { + return QueryConsensusStateHeightsResponse.decode(message.value); + }, + toProto(message: QueryConsensusStateHeightsResponse): Uint8Array { + return QueryConsensusStateHeightsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConsensusStateHeightsResponse): QueryConsensusStateHeightsResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsResponse", + value: QueryConsensusStateHeightsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { + return { + clientId: "" + }; +} +export const QueryClientStatusRequest = { + typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", + aminoType: "cosmos-sdk/QueryClientStatusRequest", + encode(message: QueryClientStatusRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryClientStatusRequest { + const message = createBaseQueryClientStatusRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, + fromAmino(object: QueryClientStatusRequestAmino): QueryClientStatusRequest { + const message = createBaseQueryClientStatusRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + return message; + }, + toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + return obj; + }, + fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { + return QueryClientStatusRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStatusRequest): QueryClientStatusRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatusRequest", + value: QueryClientStatusRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStatusRequestProtoMsg): QueryClientStatusRequest { + return QueryClientStatusRequest.decode(message.value); + }, + toProto(message: QueryClientStatusRequest): Uint8Array { + return QueryClientStatusRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStatusRequest): QueryClientStatusRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", + value: QueryClientStatusRequest.encode(message).finish() + }; + } +}; +function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { + return { + status: "" + }; +} +export const QueryClientStatusResponse = { + typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", + aminoType: "cosmos-sdk/QueryClientStatusResponse", + encode(message: QueryClientStatusResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientStatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryClientStatusResponse { + const message = createBaseQueryClientStatusResponse(); + message.status = object.status ?? ""; + return message; + }, + fromAmino(object: QueryClientStatusResponseAmino): QueryClientStatusResponse { + const message = createBaseQueryClientStatusResponse(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + return message; + }, + toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { + const obj: any = {}; + obj.status = message.status === "" ? undefined : message.status; + return obj; + }, + fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { + return QueryClientStatusResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientStatusResponse): QueryClientStatusResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatusResponse", + value: QueryClientStatusResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientStatusResponseProtoMsg): QueryClientStatusResponse { + return QueryClientStatusResponse.decode(message.value); + }, + toProto(message: QueryClientStatusResponse): Uint8Array { + return QueryClientStatusResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientStatusResponse): QueryClientStatusResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", + value: QueryClientStatusResponse.encode(message).finish() + }; + } +}; +function createBaseQueryClientParamsRequest(): QueryClientParamsRequest { + return {}; +} +export const QueryClientParamsRequest = { + typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", + aminoType: "cosmos-sdk/QueryClientParamsRequest", + encode(_: QueryClientParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryClientParamsRequest { + const message = createBaseQueryClientParamsRequest(); + return message; + }, + fromAmino(_: QueryClientParamsRequestAmino): QueryClientParamsRequest { + const message = createBaseQueryClientParamsRequest(); + return message; + }, + toAmino(_: QueryClientParamsRequest): QueryClientParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryClientParamsRequestAminoMsg): QueryClientParamsRequest { + return QueryClientParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientParamsRequest): QueryClientParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientParamsRequest", + value: QueryClientParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientParamsRequestProtoMsg): QueryClientParamsRequest { + return QueryClientParamsRequest.decode(message.value); + }, + toProto(message: QueryClientParamsRequest): Uint8Array { + return QueryClientParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientParamsRequest): QueryClientParamsRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", + value: QueryClientParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryClientParamsResponse(): QueryClientParamsResponse { + return { + params: undefined + }; +} +export const QueryClientParamsResponse = { + typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", + aminoType: "cosmos-sdk/QueryClientParamsResponse", + encode(message: QueryClientParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientParamsResponse(); + 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: DeepPartial): QueryClientParamsResponse { + const message = createBaseQueryClientParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryClientParamsResponseAmino): QueryClientParamsResponse { + const message = createBaseQueryClientParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryClientParamsResponse): QueryClientParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryClientParamsResponseAminoMsg): QueryClientParamsResponse { + return QueryClientParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientParamsResponse): QueryClientParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientParamsResponse", + value: QueryClientParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientParamsResponseProtoMsg): QueryClientParamsResponse { + return QueryClientParamsResponse.decode(message.value); + }, + toProto(message: QueryClientParamsResponse): Uint8Array { + return QueryClientParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientParamsResponse): QueryClientParamsResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", + value: QueryClientParamsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRequest { + return {}; +} +export const QueryUpgradedClientStateRequest = { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", + aminoType: "cosmos-sdk/QueryUpgradedClientStateRequest", + encode(_: QueryUpgradedClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedClientStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryUpgradedClientStateRequest { + const message = createBaseQueryUpgradedClientStateRequest(); + return message; + }, + fromAmino(_: QueryUpgradedClientStateRequestAmino): QueryUpgradedClientStateRequest { + const message = createBaseQueryUpgradedClientStateRequest(); + return message; + }, + toAmino(_: QueryUpgradedClientStateRequest): QueryUpgradedClientStateRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryUpgradedClientStateRequestAminoMsg): QueryUpgradedClientStateRequest { + return QueryUpgradedClientStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedClientStateRequest): QueryUpgradedClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedClientStateRequest", + value: QueryUpgradedClientStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedClientStateRequestProtoMsg): QueryUpgradedClientStateRequest { + return QueryUpgradedClientStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedClientStateRequest): Uint8Array { + return QueryUpgradedClientStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedClientStateRequest): QueryUpgradedClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", + value: QueryUpgradedClientStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryUpgradedClientStateResponse(): QueryUpgradedClientStateResponse { + return { + upgradedClientState: undefined + }; +} +export const QueryUpgradedClientStateResponse = { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", + aminoType: "cosmos-sdk/QueryUpgradedClientStateResponse", + encode(message: QueryUpgradedClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedClientStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgradedClientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUpgradedClientStateResponse { + const message = createBaseQueryUpgradedClientStateResponse(); + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; + return message; + }, + fromAmino(object: QueryUpgradedClientStateResponseAmino): QueryUpgradedClientStateResponse { + const message = createBaseQueryUpgradedClientStateResponse(); + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + return message; + }, + toAmino(message: QueryUpgradedClientStateResponse): QueryUpgradedClientStateResponseAmino { + const obj: any = {}; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + return obj; + }, + fromAminoMsg(object: QueryUpgradedClientStateResponseAminoMsg): QueryUpgradedClientStateResponse { + return QueryUpgradedClientStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedClientStateResponse): QueryUpgradedClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedClientStateResponse", + value: QueryUpgradedClientStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedClientStateResponseProtoMsg): QueryUpgradedClientStateResponse { + return QueryUpgradedClientStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedClientStateResponse): Uint8Array { + return QueryUpgradedClientStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedClientStateResponse): QueryUpgradedClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", + value: QueryUpgradedClientStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return {}; +} +export const QueryUpgradedConsensusStateRequest = { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", + aminoType: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + encode(_: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + return message; + }, + fromAmino(_: QueryUpgradedConsensusStateRequestAmino): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + return message; + }, + toAmino(_: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedConsensusStateRequestProtoMsg): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateRequest): Uint8Array { + return QueryUpgradedConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: undefined + }; +} +export const QueryUpgradedConsensusStateResponse = { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", + aminoType: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.upgradedConsensusState !== undefined) { + Any.encode(message.upgradedConsensusState, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgradedConsensusState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgradedConsensusState = object.upgradedConsensusState !== undefined && object.upgradedConsensusState !== null ? Any.fromPartial(object.upgradedConsensusState) : undefined; + return message; + }, + fromAmino(object: QueryUpgradedConsensusStateResponseAmino): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + if (object.upgraded_consensus_state !== undefined && object.upgraded_consensus_state !== null) { + message.upgradedConsensusState = Any.fromAmino(object.upgraded_consensus_state); + } + return message; + }, + toAmino(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseAmino { + const obj: any = {}; + obj.upgraded_consensus_state = message.upgradedConsensusState ? Any.toAmino(message.upgradedConsensusState) : undefined; + return obj; + }, + fromAminoMsg(object: QueryUpgradedConsensusStateResponseAminoMsg): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUpgradedConsensusStateResponseProtoMsg): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateResponse): Uint8Array { + return QueryUpgradedConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUpgradedConsensusStateResponse): QueryUpgradedConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/tx.amino.ts b/util/inj-types/ibc/core/client/v1/tx.amino.ts new file mode 100644 index 00000000..a3cd3860 --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/tx.amino.ts @@ -0,0 +1,23 @@ +import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; +export const AminoConverter = { + "/ibc.core.client.v1.MsgCreateClient": { + aminoType: "cosmos-sdk/MsgCreateClient", + toAmino: MsgCreateClient.toAmino, + fromAmino: MsgCreateClient.fromAmino + }, + "/ibc.core.client.v1.MsgUpdateClient": { + aminoType: "cosmos-sdk/MsgUpdateClient", + toAmino: MsgUpdateClient.toAmino, + fromAmino: MsgUpdateClient.fromAmino + }, + "/ibc.core.client.v1.MsgUpgradeClient": { + aminoType: "cosmos-sdk/MsgUpgradeClient", + toAmino: MsgUpgradeClient.toAmino, + fromAmino: MsgUpgradeClient.fromAmino + }, + "/ibc.core.client.v1.MsgSubmitMisbehaviour": { + aminoType: "cosmos-sdk/MsgSubmitMisbehaviour", + toAmino: MsgSubmitMisbehaviour.toAmino, + fromAmino: MsgSubmitMisbehaviour.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/tx.registry.ts b/util/inj-types/ibc/core/client/v1/tx.registry.ts new file mode 100644 index 00000000..fe83153f --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/tx.registry.ts @@ -0,0 +1,89 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient], ["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient], ["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient], ["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + createClient(value: MsgCreateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.encode(value).finish() + }; + }, + updateClient(value: MsgUpdateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.encode(value).finish() + }; + }, + upgradeClient(value: MsgUpgradeClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.encode(value).finish() + }; + }, + submitMisbehaviour(value: MsgSubmitMisbehaviour) { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.encode(value).finish() + }; + } + }, + withTypeUrl: { + createClient(value: MsgCreateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value + }; + }, + updateClient(value: MsgUpdateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value + }; + }, + upgradeClient(value: MsgUpgradeClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value + }; + }, + submitMisbehaviour(value: MsgSubmitMisbehaviour) { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value + }; + } + }, + fromPartial: { + createClient(value: MsgCreateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.fromPartial(value) + }; + }, + updateClient(value: MsgUpdateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.fromPartial(value) + }; + }, + upgradeClient(value: MsgUpgradeClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.fromPartial(value) + }; + }, + submitMisbehaviour(value: MsgSubmitMisbehaviour) { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/tx.rpc.msg.ts b/util/inj-types/ibc/core/client/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..a8261d6c --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/tx.rpc.msg.ts @@ -0,0 +1,44 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgCreateClient, MsgCreateClientResponse, MsgUpdateClient, MsgUpdateClientResponse, MsgUpgradeClient, MsgUpgradeClientResponse, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourResponse } from "./tx"; +/** Msg defines the ibc/client Msg service. */ +export interface Msg { + /** CreateClient defines a rpc handler method for MsgCreateClient. */ + createClient(request: MsgCreateClient): Promise; + /** UpdateClient defines a rpc handler method for MsgUpdateClient. */ + updateClient(request: MsgUpdateClient): Promise; + /** UpgradeClient defines a rpc handler method for MsgUpgradeClient. */ + upgradeClient(request: MsgUpgradeClient): Promise; + /** SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. */ + submitMisbehaviour(request: MsgSubmitMisbehaviour): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* CreateClient defines a rpc handler method for MsgCreateClient. */ + createClient = async (request: MsgCreateClient): Promise => { + const data = MsgCreateClient.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "CreateClient", data); + return promise.then(data => MsgCreateClientResponse.decode(new BinaryReader(data))); + }; + /* UpdateClient defines a rpc handler method for MsgUpdateClient. */ + updateClient = async (request: MsgUpdateClient): Promise => { + const data = MsgUpdateClient.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpdateClient", data); + return promise.then(data => MsgUpdateClientResponse.decode(new BinaryReader(data))); + }; + /* UpgradeClient defines a rpc handler method for MsgUpgradeClient. */ + upgradeClient = async (request: MsgUpgradeClient): Promise => { + const data = MsgUpgradeClient.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "UpgradeClient", data); + return promise.then(data => MsgUpgradeClientResponse.decode(new BinaryReader(data))); + }; + /* SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. */ + submitMisbehaviour = async (request: MsgSubmitMisbehaviour): Promise => { + const data = MsgSubmitMisbehaviour.encode(request).finish(); + const promise = this.rpc.request("ibc.core.client.v1.Msg", "SubmitMisbehaviour", data); + return promise.then(data => MsgSubmitMisbehaviourResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/core/client/v1/tx.ts b/util/inj-types/ibc/core/client/v1/tx.ts new file mode 100644 index 00000000..9aec3956 --- /dev/null +++ b/util/inj-types/ibc/core/client/v1/tx.ts @@ -0,0 +1,902 @@ +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClient { + /** light client state */ + clientState?: Any; + /** + * consensus state associated with the client that corresponds to a given + * height. + */ + consensusState?: Any; + /** signer address */ + signer: string; +} +export interface MsgCreateClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgCreateClient"; + value: Uint8Array; +} +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClientAmino { + /** light client state */ + client_state?: AnyAmino; + /** + * consensus state associated with the client that corresponds to a given + * height. + */ + consensus_state?: AnyAmino; + /** signer address */ + signer?: string; +} +export interface MsgCreateClientAminoMsg { + type: "cosmos-sdk/MsgCreateClient"; + value: MsgCreateClientAmino; +} +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClientSDKType { + client_state?: AnySDKType; + consensus_state?: AnySDKType; + signer: string; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponse {} +export interface MsgCreateClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse"; + value: Uint8Array; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponseAmino {} +export interface MsgCreateClientResponseAminoMsg { + type: "cosmos-sdk/MsgCreateClientResponse"; + value: MsgCreateClientResponseAmino; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponseSDKType {} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given client message. + */ +export interface MsgUpdateClient { + /** client unique identifier */ + clientId: string; + /** client message to update the light client */ + clientMessage?: Any; + /** signer address */ + signer: string; +} +export interface MsgUpdateClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient"; + value: Uint8Array; +} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given client message. + */ +export interface MsgUpdateClientAmino { + /** client unique identifier */ + client_id?: string; + /** client message to update the light client */ + client_message?: AnyAmino; + /** signer address */ + signer?: string; +} +export interface MsgUpdateClientAminoMsg { + type: "cosmos-sdk/MsgUpdateClient"; + value: MsgUpdateClientAmino; +} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given client message. + */ +export interface MsgUpdateClientSDKType { + client_id: string; + client_message?: AnySDKType; + signer: string; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponse {} +export interface MsgUpdateClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse"; + value: Uint8Array; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponseAmino {} +export interface MsgUpdateClientResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateClientResponse"; + value: MsgUpdateClientResponseAmino; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponseSDKType {} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClient { + /** client unique identifier */ + clientId: string; + /** upgraded client state */ + clientState?: Any; + /** + * upgraded consensus state, only contains enough information to serve as a + * basis of trust in update logic + */ + consensusState?: Any; + /** proof that old chain committed to new client */ + proofUpgradeClient: Uint8Array; + /** proof that old chain committed to new consensus state */ + proofUpgradeConsensusState: Uint8Array; + /** signer address */ + signer: string; +} +export interface MsgUpgradeClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient"; + value: Uint8Array; +} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClientAmino { + /** client unique identifier */ + client_id?: string; + /** upgraded client state */ + client_state?: AnyAmino; + /** + * upgraded consensus state, only contains enough information to serve as a + * basis of trust in update logic + */ + consensus_state?: AnyAmino; + /** proof that old chain committed to new client */ + proof_upgrade_client?: string; + /** proof that old chain committed to new consensus state */ + proof_upgrade_consensus_state?: string; + /** signer address */ + signer?: string; +} +export interface MsgUpgradeClientAminoMsg { + type: "cosmos-sdk/MsgUpgradeClient"; + value: MsgUpgradeClientAmino; +} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClientSDKType { + client_id: string; + client_state?: AnySDKType; + consensus_state?: AnySDKType; + proof_upgrade_client: Uint8Array; + proof_upgrade_consensus_state: Uint8Array; + signer: string; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponse {} +export interface MsgUpgradeClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse"; + value: Uint8Array; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponseAmino {} +export interface MsgUpgradeClientResponseAminoMsg { + type: "cosmos-sdk/MsgUpgradeClientResponse"; + value: MsgUpgradeClientResponseAmino; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponseSDKType {} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + * Warning: DEPRECATED + */ +export interface MsgSubmitMisbehaviour { + /** client unique identifier */ + /** @deprecated */ + clientId: string; + /** misbehaviour used for freezing the light client */ + /** @deprecated */ + misbehaviour?: Any; + /** signer address */ + /** @deprecated */ + signer: string; +} +export interface MsgSubmitMisbehaviourProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour"; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + * Warning: DEPRECATED + */ +export interface MsgSubmitMisbehaviourAmino { + /** client unique identifier */ + /** @deprecated */ + client_id?: string; + /** misbehaviour used for freezing the light client */ + /** @deprecated */ + misbehaviour?: AnyAmino; + /** signer address */ + /** @deprecated */ + signer?: string; +} +export interface MsgSubmitMisbehaviourAminoMsg { + type: "cosmos-sdk/MsgSubmitMisbehaviour"; + value: MsgSubmitMisbehaviourAmino; +} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + * Warning: DEPRECATED + */ +export interface MsgSubmitMisbehaviourSDKType { + /** @deprecated */ + client_id: string; + /** @deprecated */ + misbehaviour?: AnySDKType; + /** @deprecated */ + signer: string; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponse {} +export interface MsgSubmitMisbehaviourResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse"; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponseAmino {} +export interface MsgSubmitMisbehaviourResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitMisbehaviourResponse"; + value: MsgSubmitMisbehaviourResponseAmino; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponseSDKType {} +function createBaseMsgCreateClient(): MsgCreateClient { + return { + clientState: undefined, + consensusState: undefined, + signer: "" + }; +} +export const MsgCreateClient = { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + aminoType: "cosmos-sdk/MsgCreateClient", + encode(message: MsgCreateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateClient { + const message = createBaseMsgCreateClient(); + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgCreateClientAmino): MsgCreateClient { + const message = createBaseMsgCreateClient(); + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgCreateClient): MsgCreateClientAmino { + const obj: any = {}; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { + return MsgCreateClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateClient): MsgCreateClientAminoMsg { + return { + type: "cosmos-sdk/MsgCreateClient", + value: MsgCreateClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateClientProtoMsg): MsgCreateClient { + return MsgCreateClient.decode(message.value); + }, + toProto(message: MsgCreateClient): Uint8Array { + return MsgCreateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateClient): MsgCreateClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.encode(message).finish() + }; + } +}; +function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { + return {}; +} +export const MsgCreateClientResponse = { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", + aminoType: "cosmos-sdk/MsgCreateClientResponse", + encode(_: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreateClientResponse { + const message = createBaseMsgCreateClientResponse(); + return message; + }, + fromAmino(_: MsgCreateClientResponseAmino): MsgCreateClientResponse { + const message = createBaseMsgCreateClientResponse(); + return message; + }, + toAmino(_: MsgCreateClientResponse): MsgCreateClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateClientResponseAminoMsg): MsgCreateClientResponse { + return MsgCreateClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateClientResponse): MsgCreateClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateClientResponse", + value: MsgCreateClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateClientResponseProtoMsg): MsgCreateClientResponse { + return MsgCreateClientResponse.decode(message.value); + }, + toProto(message: MsgCreateClientResponse): Uint8Array { + return MsgCreateClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateClientResponse): MsgCreateClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", + value: MsgCreateClientResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateClient(): MsgUpdateClient { + return { + clientId: "", + clientMessage: undefined, + signer: "" + }; +} +export const MsgUpdateClient = { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + aminoType: "cosmos-sdk/MsgUpdateClient", + encode(message: MsgUpdateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientMessage !== undefined) { + Any.encode(message.clientMessage, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientMessage = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateClient { + const message = createBaseMsgUpdateClient(); + message.clientId = object.clientId ?? ""; + message.clientMessage = object.clientMessage !== undefined && object.clientMessage !== null ? Any.fromPartial(object.clientMessage) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgUpdateClientAmino): MsgUpdateClient { + const message = createBaseMsgUpdateClient(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.client_message !== undefined && object.client_message !== null) { + message.clientMessage = Any.fromAmino(object.client_message); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.client_message = message.clientMessage ? Any.toAmino(message.clientMessage) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { + return MsgUpdateClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateClient): MsgUpdateClientAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateClient", + value: MsgUpdateClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateClientProtoMsg): MsgUpdateClient { + return MsgUpdateClient.decode(message.value); + }, + toProto(message: MsgUpdateClient): Uint8Array { + return MsgUpdateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateClient): MsgUpdateClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.encode(message).finish() + }; + } +}; +function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { + return {}; +} +export const MsgUpdateClientResponse = { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", + aminoType: "cosmos-sdk/MsgUpdateClientResponse", + encode(_: MsgUpdateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateClientResponse { + const message = createBaseMsgUpdateClientResponse(); + return message; + }, + fromAmino(_: MsgUpdateClientResponseAmino): MsgUpdateClientResponse { + const message = createBaseMsgUpdateClientResponse(); + return message; + }, + toAmino(_: MsgUpdateClientResponse): MsgUpdateClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateClientResponseAminoMsg): MsgUpdateClientResponse { + return MsgUpdateClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateClientResponse): MsgUpdateClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateClientResponse", + value: MsgUpdateClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateClientResponseProtoMsg): MsgUpdateClientResponse { + return MsgUpdateClientResponse.decode(message.value); + }, + toProto(message: MsgUpdateClientResponse): Uint8Array { + return MsgUpdateClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateClientResponse): MsgUpdateClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", + value: MsgUpdateClientResponse.encode(message).finish() + }; + } +}; +function createBaseMsgUpgradeClient(): MsgUpgradeClient { + return { + clientId: "", + clientState: undefined, + consensusState: undefined, + proofUpgradeClient: new Uint8Array(), + proofUpgradeConsensusState: new Uint8Array(), + signer: "" + }; +} +export const MsgUpgradeClient = { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + aminoType: "cosmos-sdk/MsgUpgradeClient", + encode(message: MsgUpgradeClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); + } + if (message.proofUpgradeClient.length !== 0) { + writer.uint32(34).bytes(message.proofUpgradeClient); + } + if (message.proofUpgradeConsensusState.length !== 0) { + writer.uint32(42).bytes(message.proofUpgradeConsensusState); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpgradeClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 3: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 4: + message.proofUpgradeClient = reader.bytes(); + break; + case 5: + message.proofUpgradeConsensusState = reader.bytes(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpgradeClient { + const message = createBaseMsgUpgradeClient(); + message.clientId = object.clientId ?? ""; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + message.proofUpgradeClient = object.proofUpgradeClient ?? new Uint8Array(); + message.proofUpgradeConsensusState = object.proofUpgradeConsensusState ?? new Uint8Array(); + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgUpgradeClientAmino): MsgUpgradeClient { + const message = createBaseMsgUpgradeClient(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.proof_upgrade_client !== undefined && object.proof_upgrade_client !== null) { + message.proofUpgradeClient = bytesFromBase64(object.proof_upgrade_client); + } + if (object.proof_upgrade_consensus_state !== undefined && object.proof_upgrade_consensus_state !== null) { + message.proofUpgradeConsensusState = bytesFromBase64(object.proof_upgrade_consensus_state); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; + obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { + return MsgUpgradeClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpgradeClient): MsgUpgradeClientAminoMsg { + return { + type: "cosmos-sdk/MsgUpgradeClient", + value: MsgUpgradeClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpgradeClientProtoMsg): MsgUpgradeClient { + return MsgUpgradeClient.decode(message.value); + }, + toProto(message: MsgUpgradeClient): Uint8Array { + return MsgUpgradeClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpgradeClient): MsgUpgradeClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.encode(message).finish() + }; + } +}; +function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { + return {}; +} +export const MsgUpgradeClientResponse = { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", + aminoType: "cosmos-sdk/MsgUpgradeClientResponse", + encode(_: MsgUpgradeClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpgradeClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpgradeClientResponse { + const message = createBaseMsgUpgradeClientResponse(); + return message; + }, + fromAmino(_: MsgUpgradeClientResponseAmino): MsgUpgradeClientResponse { + const message = createBaseMsgUpgradeClientResponse(); + return message; + }, + toAmino(_: MsgUpgradeClientResponse): MsgUpgradeClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpgradeClientResponseAminoMsg): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpgradeClientResponse): MsgUpgradeClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpgradeClientResponse", + value: MsgUpgradeClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpgradeClientResponseProtoMsg): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.decode(message.value); + }, + toProto(message: MsgUpgradeClientResponse): Uint8Array { + return MsgUpgradeClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpgradeClientResponse): MsgUpgradeClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", + value: MsgUpgradeClientResponse.encode(message).finish() + }; + } +}; +function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { + return { + clientId: "", + misbehaviour: undefined, + signer: "" + }; +} +export const MsgSubmitMisbehaviour = { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + aminoType: "cosmos-sdk/MsgSubmitMisbehaviour", + encode(message: MsgSubmitMisbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.misbehaviour !== undefined) { + Any.encode(message.misbehaviour, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitMisbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.misbehaviour = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitMisbehaviour { + const message = createBaseMsgSubmitMisbehaviour(); + message.clientId = object.clientId ?? ""; + message.misbehaviour = object.misbehaviour !== undefined && object.misbehaviour !== null ? Any.fromPartial(object.misbehaviour) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgSubmitMisbehaviourAmino): MsgSubmitMisbehaviour { + const message = createBaseMsgSubmitMisbehaviour(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.misbehaviour !== undefined && object.misbehaviour !== null) { + message.misbehaviour = Any.fromAmino(object.misbehaviour); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitMisbehaviourProtoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviour): Uint8Array { + return MsgSubmitMisbehaviour.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.encode(message).finish() + }; + } +}; +function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourResponse { + return {}; +} +export const MsgSubmitMisbehaviourResponse = { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", + aminoType: "cosmos-sdk/MsgSubmitMisbehaviourResponse", + encode(_: MsgSubmitMisbehaviourResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitMisbehaviourResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitMisbehaviourResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgSubmitMisbehaviourResponse { + const message = createBaseMsgSubmitMisbehaviourResponse(); + return message; + }, + fromAmino(_: MsgSubmitMisbehaviourResponseAmino): MsgSubmitMisbehaviourResponse { + const message = createBaseMsgSubmitMisbehaviourResponse(); + return message; + }, + toAmino(_: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSubmitMisbehaviourResponseAminoMsg): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitMisbehaviourResponse", + value: MsgSubmitMisbehaviourResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitMisbehaviourResponseProtoMsg): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviourResponse): Uint8Array { + return MsgSubmitMisbehaviourResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", + value: MsgSubmitMisbehaviourResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/commitment/v1/commitment.ts b/util/inj-types/ibc/core/commitment/v1/commitment.ts new file mode 100644 index 00000000..ad7e5a30 --- /dev/null +++ b/util/inj-types/ibc/core/commitment/v1/commitment.ts @@ -0,0 +1,418 @@ +import { CommitmentProof, CommitmentProofAmino, CommitmentProofSDKType } from "../../../../cosmos/ics23/v1/proofs"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * MerkleRoot defines a merkle root hash. + * In the Cosmos SDK, the AppHash of a block header becomes the root. + */ +export interface MerkleRoot { + hash: Uint8Array; +} +export interface MerkleRootProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot"; + value: Uint8Array; +} +/** + * MerkleRoot defines a merkle root hash. + * In the Cosmos SDK, the AppHash of a block header becomes the root. + */ +export interface MerkleRootAmino { + hash?: string; +} +export interface MerkleRootAminoMsg { + type: "cosmos-sdk/MerkleRoot"; + value: MerkleRootAmino; +} +/** + * MerkleRoot defines a merkle root hash. + * In the Cosmos SDK, the AppHash of a block header becomes the root. + */ +export interface MerkleRootSDKType { + hash: Uint8Array; +} +/** + * MerklePrefix is merkle path prefixed to the key. + * The constructed key from the Path and the key will be append(Path.KeyPath, + * append(Path.KeyPrefix, key...)) + */ +export interface MerklePrefix { + keyPrefix: Uint8Array; +} +export interface MerklePrefixProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix"; + value: Uint8Array; +} +/** + * MerklePrefix is merkle path prefixed to the key. + * The constructed key from the Path and the key will be append(Path.KeyPath, + * append(Path.KeyPrefix, key...)) + */ +export interface MerklePrefixAmino { + key_prefix?: string; +} +export interface MerklePrefixAminoMsg { + type: "cosmos-sdk/MerklePrefix"; + value: MerklePrefixAmino; +} +/** + * MerklePrefix is merkle path prefixed to the key. + * The constructed key from the Path and the key will be append(Path.KeyPath, + * append(Path.KeyPrefix, key...)) + */ +export interface MerklePrefixSDKType { + key_prefix: Uint8Array; +} +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * MerklePath is represented from root-to-leaf + */ +export interface MerklePath { + keyPath: string[]; +} +export interface MerklePathProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerklePath"; + value: Uint8Array; +} +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * MerklePath is represented from root-to-leaf + */ +export interface MerklePathAmino { + key_path?: string[]; +} +export interface MerklePathAminoMsg { + type: "cosmos-sdk/MerklePath"; + value: MerklePathAmino; +} +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * MerklePath is represented from root-to-leaf + */ +export interface MerklePathSDKType { + key_path: string[]; +} +/** + * MerkleProof is a wrapper type over a chain of CommitmentProofs. + * It demonstrates membership or non-membership for an element or set of + * elements, verifiable in conjunction with a known commitment root. Proofs + * should be succinct. + * MerkleProofs are ordered from leaf-to-root + */ +export interface MerkleProof { + proofs: CommitmentProof[]; +} +export interface MerkleProofProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerkleProof"; + value: Uint8Array; +} +/** + * MerkleProof is a wrapper type over a chain of CommitmentProofs. + * It demonstrates membership or non-membership for an element or set of + * elements, verifiable in conjunction with a known commitment root. Proofs + * should be succinct. + * MerkleProofs are ordered from leaf-to-root + */ +export interface MerkleProofAmino { + proofs?: CommitmentProofAmino[]; +} +export interface MerkleProofAminoMsg { + type: "cosmos-sdk/MerkleProof"; + value: MerkleProofAmino; +} +/** + * MerkleProof is a wrapper type over a chain of CommitmentProofs. + * It demonstrates membership or non-membership for an element or set of + * elements, verifiable in conjunction with a known commitment root. Proofs + * should be succinct. + * MerkleProofs are ordered from leaf-to-root + */ +export interface MerkleProofSDKType { + proofs: CommitmentProofSDKType[]; +} +function createBaseMerkleRoot(): MerkleRoot { + return { + hash: new Uint8Array() + }; +} +export const MerkleRoot = { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot", + aminoType: "cosmos-sdk/MerkleRoot", + encode(message: MerkleRoot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerkleRoot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerkleRoot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MerkleRoot { + const message = createBaseMerkleRoot(); + message.hash = object.hash ?? new Uint8Array(); + return message; + }, + fromAmino(object: MerkleRootAmino): MerkleRoot { + const message = createBaseMerkleRoot(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: MerkleRoot): MerkleRootAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: MerkleRootAminoMsg): MerkleRoot { + return MerkleRoot.fromAmino(object.value); + }, + toAminoMsg(message: MerkleRoot): MerkleRootAminoMsg { + return { + type: "cosmos-sdk/MerkleRoot", + value: MerkleRoot.toAmino(message) + }; + }, + fromProtoMsg(message: MerkleRootProtoMsg): MerkleRoot { + return MerkleRoot.decode(message.value); + }, + toProto(message: MerkleRoot): Uint8Array { + return MerkleRoot.encode(message).finish(); + }, + toProtoMsg(message: MerkleRoot): MerkleRootProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot", + value: MerkleRoot.encode(message).finish() + }; + } +}; +function createBaseMerklePrefix(): MerklePrefix { + return { + keyPrefix: new Uint8Array() + }; +} +export const MerklePrefix = { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix", + aminoType: "cosmos-sdk/MerklePrefix", + encode(message: MerklePrefix, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.keyPrefix.length !== 0) { + writer.uint32(10).bytes(message.keyPrefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerklePrefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePrefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPrefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MerklePrefix { + const message = createBaseMerklePrefix(); + message.keyPrefix = object.keyPrefix ?? new Uint8Array(); + return message; + }, + fromAmino(object: MerklePrefixAmino): MerklePrefix { + const message = createBaseMerklePrefix(); + if (object.key_prefix !== undefined && object.key_prefix !== null) { + message.keyPrefix = bytesFromBase64(object.key_prefix); + } + return message; + }, + toAmino(message: MerklePrefix): MerklePrefixAmino { + const obj: any = {}; + obj.key_prefix = message.keyPrefix ? base64FromBytes(message.keyPrefix) : undefined; + return obj; + }, + fromAminoMsg(object: MerklePrefixAminoMsg): MerklePrefix { + return MerklePrefix.fromAmino(object.value); + }, + toAminoMsg(message: MerklePrefix): MerklePrefixAminoMsg { + return { + type: "cosmos-sdk/MerklePrefix", + value: MerklePrefix.toAmino(message) + }; + }, + fromProtoMsg(message: MerklePrefixProtoMsg): MerklePrefix { + return MerklePrefix.decode(message.value); + }, + toProto(message: MerklePrefix): Uint8Array { + return MerklePrefix.encode(message).finish(); + }, + toProtoMsg(message: MerklePrefix): MerklePrefixProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix", + value: MerklePrefix.encode(message).finish() + }; + } +}; +function createBaseMerklePath(): MerklePath { + return { + keyPath: [] + }; +} +export const MerklePath = { + typeUrl: "/ibc.core.commitment.v1.MerklePath", + aminoType: "cosmos-sdk/MerklePath", + encode(message: MerklePath, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.keyPath) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerklePath { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePath(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPath.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MerklePath { + const message = createBaseMerklePath(); + message.keyPath = object.keyPath?.map(e => e) || []; + return message; + }, + fromAmino(object: MerklePathAmino): MerklePath { + const message = createBaseMerklePath(); + message.keyPath = object.key_path?.map(e => e) || []; + return message; + }, + toAmino(message: MerklePath): MerklePathAmino { + const obj: any = {}; + if (message.keyPath) { + obj.key_path = message.keyPath.map(e => e); + } else { + obj.key_path = message.keyPath; + } + return obj; + }, + fromAminoMsg(object: MerklePathAminoMsg): MerklePath { + return MerklePath.fromAmino(object.value); + }, + toAminoMsg(message: MerklePath): MerklePathAminoMsg { + return { + type: "cosmos-sdk/MerklePath", + value: MerklePath.toAmino(message) + }; + }, + fromProtoMsg(message: MerklePathProtoMsg): MerklePath { + return MerklePath.decode(message.value); + }, + toProto(message: MerklePath): Uint8Array { + return MerklePath.encode(message).finish(); + }, + toProtoMsg(message: MerklePath): MerklePathProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerklePath", + value: MerklePath.encode(message).finish() + }; + } +}; +function createBaseMerkleProof(): MerkleProof { + return { + proofs: [] + }; +} +export const MerkleProof = { + typeUrl: "/ibc.core.commitment.v1.MerkleProof", + aminoType: "cosmos-sdk/MerkleProof", + encode(message: MerkleProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.proofs) { + CommitmentProof.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerkleProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerkleProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proofs.push(CommitmentProof.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MerkleProof { + const message = createBaseMerkleProof(); + message.proofs = object.proofs?.map(e => CommitmentProof.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MerkleProofAmino): MerkleProof { + const message = createBaseMerkleProof(); + message.proofs = object.proofs?.map(e => CommitmentProof.fromAmino(e)) || []; + return message; + }, + toAmino(message: MerkleProof): MerkleProofAmino { + const obj: any = {}; + if (message.proofs) { + obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e) : undefined); + } else { + obj.proofs = message.proofs; + } + return obj; + }, + fromAminoMsg(object: MerkleProofAminoMsg): MerkleProof { + return MerkleProof.fromAmino(object.value); + }, + toAminoMsg(message: MerkleProof): MerkleProofAminoMsg { + return { + type: "cosmos-sdk/MerkleProof", + value: MerkleProof.toAmino(message) + }; + }, + fromProtoMsg(message: MerkleProofProtoMsg): MerkleProof { + return MerkleProof.decode(message.value); + }, + toProto(message: MerkleProof): Uint8Array { + return MerkleProof.encode(message).finish(); + }, + toProtoMsg(message: MerkleProof): MerkleProofProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerkleProof", + value: MerkleProof.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/connection.ts b/util/inj-types/ibc/core/connection/v1/connection.ts new file mode 100644 index 00000000..e5ad82e9 --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/connection.ts @@ -0,0 +1,1006 @@ +import { MerklePrefix, MerklePrefixAmino, MerklePrefixSDKType } from "../../commitment/v1/commitment"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** + * State defines if a connection is in one of the following states: + * INIT, TRYOPEN, OPEN or UNINITIALIZED. + */ +export enum State { + /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ + STATE_UNINITIALIZED_UNSPECIFIED = 0, + /** STATE_INIT - A connection end has just started the opening handshake. */ + STATE_INIT = 1, + /** + * STATE_TRYOPEN - A connection end has acknowledged the handshake step on the counterparty + * chain. + */ + STATE_TRYOPEN = 2, + /** STATE_OPEN - A connection end has completed the handshake. */ + STATE_OPEN = 3, + UNRECOGNIZED = -1, +} +export const StateSDKType = State; +export const StateAmino = State; +export function stateFromJSON(object: any): State { + switch (object) { + case 0: + case "STATE_UNINITIALIZED_UNSPECIFIED": + return State.STATE_UNINITIALIZED_UNSPECIFIED; + case 1: + case "STATE_INIT": + return State.STATE_INIT; + case 2: + case "STATE_TRYOPEN": + return State.STATE_TRYOPEN; + case 3: + case "STATE_OPEN": + return State.STATE_OPEN; + case -1: + case "UNRECOGNIZED": + default: + return State.UNRECOGNIZED; + } +} +export function stateToJSON(object: State): string { + switch (object) { + case State.STATE_UNINITIALIZED_UNSPECIFIED: + return "STATE_UNINITIALIZED_UNSPECIFIED"; + case State.STATE_INIT: + return "STATE_INIT"; + case State.STATE_TRYOPEN: + return "STATE_TRYOPEN"; + case State.STATE_OPEN: + return "STATE_OPEN"; + case State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * ConnectionEnd defines a stateful object on a chain connected to another + * separate one. + * NOTE: there must only be 2 defined ConnectionEnds to establish + * a connection between two chains. + */ +export interface ConnectionEnd { + /** client associated with this connection. */ + clientId: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection. + */ + versions: Version[]; + /** current state of the connection end. */ + state: State; + /** counterparty chain associated with this connection. */ + counterparty: Counterparty; + /** + * delay period that must pass before a consensus state can be used for + * packet-verification NOTE: delay period logic is only implemented by some + * clients. + */ + delayPeriod: bigint; +} +export interface ConnectionEndProtoMsg { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd"; + value: Uint8Array; +} +/** + * ConnectionEnd defines a stateful object on a chain connected to another + * separate one. + * NOTE: there must only be 2 defined ConnectionEnds to establish + * a connection between two chains. + */ +export interface ConnectionEndAmino { + /** client associated with this connection. */ + client_id?: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection. + */ + versions?: VersionAmino[]; + /** current state of the connection end. */ + state?: State; + /** counterparty chain associated with this connection. */ + counterparty?: CounterpartyAmino; + /** + * delay period that must pass before a consensus state can be used for + * packet-verification NOTE: delay period logic is only implemented by some + * clients. + */ + delay_period?: string; +} +export interface ConnectionEndAminoMsg { + type: "cosmos-sdk/ConnectionEnd"; + value: ConnectionEndAmino; +} +/** + * ConnectionEnd defines a stateful object on a chain connected to another + * separate one. + * NOTE: there must only be 2 defined ConnectionEnds to establish + * a connection between two chains. + */ +export interface ConnectionEndSDKType { + client_id: string; + versions: VersionSDKType[]; + state: State; + counterparty: CounterpartySDKType; + delay_period: bigint; +} +/** + * IdentifiedConnection defines a connection with additional connection + * identifier field. + */ +export interface IdentifiedConnection { + /** connection identifier. */ + id: string; + /** client associated with this connection. */ + clientId: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection + */ + versions: Version[]; + /** current state of the connection end. */ + state: State; + /** counterparty chain associated with this connection. */ + counterparty: Counterparty; + /** delay period associated with this connection. */ + delayPeriod: bigint; +} +export interface IdentifiedConnectionProtoMsg { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection"; + value: Uint8Array; +} +/** + * IdentifiedConnection defines a connection with additional connection + * identifier field. + */ +export interface IdentifiedConnectionAmino { + /** connection identifier. */ + id?: string; + /** client associated with this connection. */ + client_id?: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection + */ + versions?: VersionAmino[]; + /** current state of the connection end. */ + state?: State; + /** counterparty chain associated with this connection. */ + counterparty?: CounterpartyAmino; + /** delay period associated with this connection. */ + delay_period?: string; +} +export interface IdentifiedConnectionAminoMsg { + type: "cosmos-sdk/IdentifiedConnection"; + value: IdentifiedConnectionAmino; +} +/** + * IdentifiedConnection defines a connection with additional connection + * identifier field. + */ +export interface IdentifiedConnectionSDKType { + id: string; + client_id: string; + versions: VersionSDKType[]; + state: State; + counterparty: CounterpartySDKType; + delay_period: bigint; +} +/** Counterparty defines the counterparty chain associated with a connection end. */ +export interface Counterparty { + /** + * identifies the client on the counterparty chain associated with a given + * connection. + */ + clientId: string; + /** + * identifies the connection end on the counterparty chain associated with a + * given connection. + */ + connectionId: string; + /** commitment merkle prefix of the counterparty chain. */ + prefix: MerklePrefix; +} +export interface CounterpartyProtoMsg { + typeUrl: "/ibc.core.connection.v1.Counterparty"; + value: Uint8Array; +} +/** Counterparty defines the counterparty chain associated with a connection end. */ +export interface CounterpartyAmino { + /** + * identifies the client on the counterparty chain associated with a given + * connection. + */ + client_id?: string; + /** + * identifies the connection end on the counterparty chain associated with a + * given connection. + */ + connection_id?: string; + /** commitment merkle prefix of the counterparty chain. */ + prefix?: MerklePrefixAmino; +} +export interface CounterpartyAminoMsg { + type: "cosmos-sdk/Counterparty"; + value: CounterpartyAmino; +} +/** Counterparty defines the counterparty chain associated with a connection end. */ +export interface CounterpartySDKType { + client_id: string; + connection_id: string; + prefix: MerklePrefixSDKType; +} +/** ClientPaths define all the connection paths for a client state. */ +export interface ClientPaths { + /** list of connection paths */ + paths: string[]; +} +export interface ClientPathsProtoMsg { + typeUrl: "/ibc.core.connection.v1.ClientPaths"; + value: Uint8Array; +} +/** ClientPaths define all the connection paths for a client state. */ +export interface ClientPathsAmino { + /** list of connection paths */ + paths?: string[]; +} +export interface ClientPathsAminoMsg { + type: "cosmos-sdk/ClientPaths"; + value: ClientPathsAmino; +} +/** ClientPaths define all the connection paths for a client state. */ +export interface ClientPathsSDKType { + paths: string[]; +} +/** ConnectionPaths define all the connection paths for a given client state. */ +export interface ConnectionPaths { + /** client state unique identifier */ + clientId: string; + /** list of connection paths */ + paths: string[]; +} +export interface ConnectionPathsProtoMsg { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths"; + value: Uint8Array; +} +/** ConnectionPaths define all the connection paths for a given client state. */ +export interface ConnectionPathsAmino { + /** client state unique identifier */ + client_id?: string; + /** list of connection paths */ + paths?: string[]; +} +export interface ConnectionPathsAminoMsg { + type: "cosmos-sdk/ConnectionPaths"; + value: ConnectionPathsAmino; +} +/** ConnectionPaths define all the connection paths for a given client state. */ +export interface ConnectionPathsSDKType { + client_id: string; + paths: string[]; +} +/** + * Version defines the versioning scheme used to negotiate the IBC verison in + * the connection handshake. + */ +export interface Version { + /** unique version identifier */ + identifier: string; + /** list of features compatible with the specified identifier */ + features: string[]; +} +export interface VersionProtoMsg { + typeUrl: "/ibc.core.connection.v1.Version"; + value: Uint8Array; +} +/** + * Version defines the versioning scheme used to negotiate the IBC verison in + * the connection handshake. + */ +export interface VersionAmino { + /** unique version identifier */ + identifier?: string; + /** list of features compatible with the specified identifier */ + features?: string[]; +} +export interface VersionAminoMsg { + type: "cosmos-sdk/Version"; + value: VersionAmino; +} +/** + * Version defines the versioning scheme used to negotiate the IBC verison in + * the connection handshake. + */ +export interface VersionSDKType { + identifier: string; + features: string[]; +} +/** Params defines the set of Connection parameters. */ +export interface Params { + /** + * maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the + * largest amount of time that the chain might reasonably take to produce the next block under normal operating + * conditions. A safe choice is 3-5x the expected time per block. + */ + maxExpectedTimePerBlock: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.core.connection.v1.Params"; + value: Uint8Array; +} +/** Params defines the set of Connection parameters. */ +export interface ParamsAmino { + /** + * maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the + * largest amount of time that the chain might reasonably take to produce the next block under normal operating + * conditions. A safe choice is 3-5x the expected time per block. + */ + max_expected_time_per_block?: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** Params defines the set of Connection parameters. */ +export interface ParamsSDKType { + max_expected_time_per_block: bigint; +} +function createBaseConnectionEnd(): ConnectionEnd { + return { + clientId: "", + versions: [], + state: 0, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0) + }; +} +export const ConnectionEnd = { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd", + aminoType: "cosmos-sdk/ConnectionEnd", + encode(message: ConnectionEnd, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.versions) { + Version.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(24).int32(message.state); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(40).uint64(message.delayPeriod); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionEnd { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionEnd(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.versions.push(Version.decode(reader, reader.uint32())); + break; + case 3: + message.state = (reader.int32() as any); + break; + case 4: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delayPeriod = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConnectionEnd { + const message = createBaseConnectionEnd(); + message.clientId = object.clientId ?? ""; + message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; + message.state = object.state ?? 0; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConnectionEndAmino): ConnectionEnd { + const message = createBaseConnectionEnd(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; + if (object.state !== undefined && object.state !== null) { + message.state = object.state; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + return message; + }, + toAmino(message: ConnectionEnd): ConnectionEndAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.versions) { + obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.versions = message.versions; + } + obj.state = message.state === 0 ? undefined : message.state; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { + return ConnectionEnd.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionEnd): ConnectionEndAminoMsg { + return { + type: "cosmos-sdk/ConnectionEnd", + value: ConnectionEnd.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionEndProtoMsg): ConnectionEnd { + return ConnectionEnd.decode(message.value); + }, + toProto(message: ConnectionEnd): Uint8Array { + return ConnectionEnd.encode(message).finish(); + }, + toProtoMsg(message: ConnectionEnd): ConnectionEndProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd", + value: ConnectionEnd.encode(message).finish() + }; + } +}; +function createBaseIdentifiedConnection(): IdentifiedConnection { + return { + id: "", + clientId: "", + versions: [], + state: 0, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0) + }; +} +export const IdentifiedConnection = { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", + aminoType: "cosmos-sdk/IdentifiedConnection", + encode(message: IdentifiedConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + for (const v of message.versions) { + Version.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(32).int32(message.state); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(42).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(48).uint64(message.delayPeriod); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedConnection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedConnection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.versions.push(Version.decode(reader, reader.uint32())); + break; + case 4: + message.state = (reader.int32() as any); + break; + case 5: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 6: + message.delayPeriod = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IdentifiedConnection { + const message = createBaseIdentifiedConnection(); + message.id = object.id ?? ""; + message.clientId = object.clientId ?? ""; + message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; + message.state = object.state ?? 0; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + return message; + }, + fromAmino(object: IdentifiedConnectionAmino): IdentifiedConnection { + const message = createBaseIdentifiedConnection(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; + if (object.state !== undefined && object.state !== null) { + message.state = object.state; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + return message; + }, + toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { + const obj: any = {}; + obj.id = message.id === "" ? undefined : message.id; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.versions) { + obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.versions = message.versions; + } + obj.state = message.state === 0 ? undefined : message.state; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; + return obj; + }, + fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { + return IdentifiedConnection.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedConnection): IdentifiedConnectionAminoMsg { + return { + type: "cosmos-sdk/IdentifiedConnection", + value: IdentifiedConnection.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedConnectionProtoMsg): IdentifiedConnection { + return IdentifiedConnection.decode(message.value); + }, + toProto(message: IdentifiedConnection): Uint8Array { + return IdentifiedConnection.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedConnection): IdentifiedConnectionProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", + value: IdentifiedConnection.encode(message).finish() + }; + } +}; +function createBaseCounterparty(): Counterparty { + return { + clientId: "", + connectionId: "", + prefix: MerklePrefix.fromPartial({}) + }; +} +export const Counterparty = { + typeUrl: "/ibc.core.connection.v1.Counterparty", + aminoType: "cosmos-sdk/Counterparty", + encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.prefix !== undefined) { + MerklePrefix.encode(message.prefix, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Counterparty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterparty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + case 3: + message.prefix = MerklePrefix.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Counterparty { + const message = createBaseCounterparty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.prefix = object.prefix !== undefined && object.prefix !== null ? MerklePrefix.fromPartial(object.prefix) : undefined; + return message; + }, + fromAmino(object: CounterpartyAmino): Counterparty { + const message = createBaseCounterparty(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = MerklePrefix.fromAmino(object.prefix); + } + return message; + }, + toAmino(message: Counterparty): CounterpartyAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; + return obj; + }, + fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { + return Counterparty.fromAmino(object.value); + }, + toAminoMsg(message: Counterparty): CounterpartyAminoMsg { + return { + type: "cosmos-sdk/Counterparty", + value: Counterparty.toAmino(message) + }; + }, + fromProtoMsg(message: CounterpartyProtoMsg): Counterparty { + return Counterparty.decode(message.value); + }, + toProto(message: Counterparty): Uint8Array { + return Counterparty.encode(message).finish(); + }, + toProtoMsg(message: Counterparty): CounterpartyProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Counterparty", + value: Counterparty.encode(message).finish() + }; + } +}; +function createBaseClientPaths(): ClientPaths { + return { + paths: [] + }; +} +export const ClientPaths = { + typeUrl: "/ibc.core.connection.v1.ClientPaths", + aminoType: "cosmos-sdk/ClientPaths", + encode(message: ClientPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.paths) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientPaths { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientPaths { + const message = createBaseClientPaths(); + message.paths = object.paths?.map(e => e) || []; + return message; + }, + fromAmino(object: ClientPathsAmino): ClientPaths { + const message = createBaseClientPaths(); + message.paths = object.paths?.map(e => e) || []; + return message; + }, + toAmino(message: ClientPaths): ClientPathsAmino { + const obj: any = {}; + if (message.paths) { + obj.paths = message.paths.map(e => e); + } else { + obj.paths = message.paths; + } + return obj; + }, + fromAminoMsg(object: ClientPathsAminoMsg): ClientPaths { + return ClientPaths.fromAmino(object.value); + }, + toAminoMsg(message: ClientPaths): ClientPathsAminoMsg { + return { + type: "cosmos-sdk/ClientPaths", + value: ClientPaths.toAmino(message) + }; + }, + fromProtoMsg(message: ClientPathsProtoMsg): ClientPaths { + return ClientPaths.decode(message.value); + }, + toProto(message: ClientPaths): Uint8Array { + return ClientPaths.encode(message).finish(); + }, + toProtoMsg(message: ClientPaths): ClientPathsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ClientPaths", + value: ClientPaths.encode(message).finish() + }; + } +}; +function createBaseConnectionPaths(): ConnectionPaths { + return { + clientId: "", + paths: [] + }; +} +export const ConnectionPaths = { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths", + aminoType: "cosmos-sdk/ConnectionPaths", + encode(message: ConnectionPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.paths) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionPaths { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConnectionPaths { + const message = createBaseConnectionPaths(); + message.clientId = object.clientId ?? ""; + message.paths = object.paths?.map(e => e) || []; + return message; + }, + fromAmino(object: ConnectionPathsAmino): ConnectionPaths { + const message = createBaseConnectionPaths(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.paths = object.paths?.map(e => e) || []; + return message; + }, + toAmino(message: ConnectionPaths): ConnectionPathsAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.paths) { + obj.paths = message.paths.map(e => e); + } else { + obj.paths = message.paths; + } + return obj; + }, + fromAminoMsg(object: ConnectionPathsAminoMsg): ConnectionPaths { + return ConnectionPaths.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionPaths): ConnectionPathsAminoMsg { + return { + type: "cosmos-sdk/ConnectionPaths", + value: ConnectionPaths.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionPathsProtoMsg): ConnectionPaths { + return ConnectionPaths.decode(message.value); + }, + toProto(message: ConnectionPaths): Uint8Array { + return ConnectionPaths.encode(message).finish(); + }, + toProtoMsg(message: ConnectionPaths): ConnectionPathsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths", + value: ConnectionPaths.encode(message).finish() + }; + } +}; +function createBaseVersion(): Version { + return { + identifier: "", + features: [] + }; +} +export const Version = { + typeUrl: "/ibc.core.connection.v1.Version", + aminoType: "cosmos-sdk/Version", + encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + for (const v of message.features) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Version { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + case 2: + message.features.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Version { + const message = createBaseVersion(); + message.identifier = object.identifier ?? ""; + message.features = object.features?.map(e => e) || []; + return message; + }, + fromAmino(object: VersionAmino): Version { + const message = createBaseVersion(); + if (object.identifier !== undefined && object.identifier !== null) { + message.identifier = object.identifier; + } + message.features = object.features?.map(e => e) || []; + return message; + }, + toAmino(message: Version): VersionAmino { + const obj: any = {}; + obj.identifier = message.identifier === "" ? undefined : message.identifier; + if (message.features) { + obj.features = message.features.map(e => e); + } else { + obj.features = message.features; + } + return obj; + }, + fromAminoMsg(object: VersionAminoMsg): Version { + return Version.fromAmino(object.value); + }, + toAminoMsg(message: Version): VersionAminoMsg { + return { + type: "cosmos-sdk/Version", + value: Version.toAmino(message) + }; + }, + fromProtoMsg(message: VersionProtoMsg): Version { + return Version.decode(message.value); + }, + toProto(message: Version): Uint8Array { + return Version.encode(message).finish(); + }, + toProtoMsg(message: Version): VersionProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Version", + value: Version.encode(message).finish() + }; + } +}; +function createBaseParams(): Params { + return { + maxExpectedTimePerBlock: BigInt(0) + }; +} +export const Params = { + typeUrl: "/ibc.core.connection.v1.Params", + aminoType: "cosmos-sdk/Params", + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxExpectedTimePerBlock !== BigInt(0)) { + writer.uint32(8).uint64(message.maxExpectedTimePerBlock); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.maxExpectedTimePerBlock = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.maxExpectedTimePerBlock = object.maxExpectedTimePerBlock !== undefined && object.maxExpectedTimePerBlock !== null ? BigInt(object.maxExpectedTimePerBlock.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.max_expected_time_per_block !== undefined && object.max_expected_time_per_block !== null) { + message.maxExpectedTimePerBlock = BigInt(object.max_expected_time_per_block); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock !== BigInt(0) ? message.maxExpectedTimePerBlock.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Params", + value: Params.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/genesis.ts b/util/inj-types/ibc/core/connection/v1/genesis.ts new file mode 100644 index 00000000..c95bd8e6 --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/genesis.ts @@ -0,0 +1,144 @@ +import { IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsAmino, ConnectionPathsSDKType, Params, ParamsAmino, ParamsSDKType } from "./connection"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** GenesisState defines the ibc connection submodule's genesis state. */ +export interface GenesisState { + connections: IdentifiedConnection[]; + clientConnectionPaths: ConnectionPaths[]; + /** the sequence for the next generated connection identifier */ + nextConnectionSequence: bigint; + params: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.core.connection.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the ibc connection submodule's genesis state. */ +export interface GenesisStateAmino { + connections?: IdentifiedConnectionAmino[]; + client_connection_paths?: ConnectionPathsAmino[]; + /** the sequence for the next generated connection identifier */ + next_connection_sequence?: string; + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +/** GenesisState defines the ibc connection submodule's genesis state. */ +export interface GenesisStateSDKType { + connections: IdentifiedConnectionSDKType[]; + client_connection_paths: ConnectionPathsSDKType[]; + next_connection_sequence: bigint; + params: ParamsSDKType; +} +function createBaseGenesisState(): GenesisState { + return { + connections: [], + clientConnectionPaths: [], + nextConnectionSequence: BigInt(0), + params: Params.fromPartial({}) + }; +} +export const GenesisState = { + typeUrl: "/ibc.core.connection.v1.GenesisState", + aminoType: "cosmos-sdk/GenesisState", + encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.connections) { + IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.clientConnectionPaths) { + ConnectionPaths.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.nextConnectionSequence !== BigInt(0)) { + writer.uint32(24).uint64(message.nextConnectionSequence); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(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.connections.push(IdentifiedConnection.decode(reader, reader.uint32())); + break; + case 2: + message.clientConnectionPaths.push(ConnectionPaths.decode(reader, reader.uint32())); + break; + case 3: + message.nextConnectionSequence = reader.uint64(); + break; + case 4: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + message.connections = object.connections?.map(e => IdentifiedConnection.fromPartial(e)) || []; + message.clientConnectionPaths = object.clientConnectionPaths?.map(e => ConnectionPaths.fromPartial(e)) || []; + message.nextConnectionSequence = object.nextConnectionSequence !== undefined && object.nextConnectionSequence !== null ? BigInt(object.nextConnectionSequence.toString()) : BigInt(0); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + const message = createBaseGenesisState(); + message.connections = object.connections?.map(e => IdentifiedConnection.fromAmino(e)) || []; + message.clientConnectionPaths = object.client_connection_paths?.map(e => ConnectionPaths.fromAmino(e)) || []; + if (object.next_connection_sequence !== undefined && object.next_connection_sequence !== null) { + message.nextConnectionSequence = BigInt(object.next_connection_sequence); + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.connections) { + obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); + } else { + obj.connections = message.connections; + } + if (message.clientConnectionPaths) { + obj.client_connection_paths = message.clientConnectionPaths.map(e => e ? ConnectionPaths.toAmino(e) : undefined); + } else { + obj.client_connection_paths = message.clientConnectionPaths; + } + obj.next_connection_sequence = message.nextConnectionSequence !== BigInt(0) ? message.nextConnectionSequence.toString() : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message) + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.GenesisState", + value: GenesisState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/query.lcd.ts b/util/inj-types/ibc/core/connection/v1/query.lcd.ts new file mode 100644 index 00000000..12ece638 --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/query.lcd.ts @@ -0,0 +1,54 @@ +import { setPaginationParams } from "../../../../helpers"; +import { LCDClient } from "@cosmology/lcd"; +import { QueryConnectionRequest, QueryConnectionResponseSDKType, QueryConnectionsRequest, QueryConnectionsResponseSDKType, QueryClientConnectionsRequest, QueryClientConnectionsResponseSDKType, QueryConnectionClientStateRequest, QueryConnectionClientStateResponseSDKType, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateResponseSDKType, QueryConnectionParamsRequest, QueryConnectionParamsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + } + /* Connection queries an IBC connection end. */ + connection = async (params: QueryConnectionRequest): Promise => { + const endpoint = `ibc/core/connection/v1/connections/${params.connectionId}`; + return await this.req.get(endpoint); + }; + /* Connections queries all the IBC connections of a chain. */ + connections = async (params: QueryConnectionsRequest = { + pagination: undefined + }): Promise => { + const options: any = { + params: {} + }; + if (typeof params?.pagination !== "undefined") { + setPaginationParams(options, params.pagination); + } + const endpoint = `ibc/core/connection/v1/connections`; + return await this.req.get(endpoint, options); + }; + /* ClientConnections queries the connection paths associated with a client + state. */ + clientConnections = async (params: QueryClientConnectionsRequest): Promise => { + const endpoint = `ibc/core/connection/v1/client_connections/${params.clientId}`; + return await this.req.get(endpoint); + }; + /* ConnectionClientState queries the client state associated with the + connection. */ + connectionClientState = async (params: QueryConnectionClientStateRequest): Promise => { + const endpoint = `ibc/core/connection/v1/connections/${params.connectionId}/client_state`; + return await this.req.get(endpoint); + }; + /* ConnectionConsensusState queries the consensus state associated with the + connection. */ + connectionConsensusState = async (params: QueryConnectionConsensusStateRequest): Promise => { + const endpoint = `ibc/core/connection/v1/connections/${params.connectionId}/consensus_state/revision/${params.revisionNumber}/height/${params.revisionHeight}`; + return await this.req.get(endpoint); + }; + /* ConnectionParams queries all parameters of the ibc connection submodule. */ + connectionParams = async (_params: QueryConnectionParamsRequest = {}): Promise => { + const endpoint = `ibc/core/connection/v1/params`; + return await this.req.get(endpoint); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/query.rpc.Query.ts b/util/inj-types/ibc/core/connection/v1/query.rpc.Query.ts new file mode 100644 index 00000000..bebf763a --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/query.rpc.Query.ts @@ -0,0 +1,99 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryConnectionRequest, QueryConnectionResponse, QueryConnectionsRequest, QueryConnectionsResponse, QueryClientConnectionsRequest, QueryClientConnectionsResponse, QueryConnectionClientStateRequest, QueryConnectionClientStateResponse, QueryConnectionConsensusStateRequest, QueryConnectionConsensusStateResponse, QueryConnectionParamsRequest, QueryConnectionParamsResponse } from "./query"; +/** Query provides defines the gRPC querier service */ +export interface Query { + /** Connection queries an IBC connection end. */ + connection(request: QueryConnectionRequest): Promise; + /** Connections queries all the IBC connections of a chain. */ + connections(request?: QueryConnectionsRequest): Promise; + /** + * ClientConnections queries the connection paths associated with a client + * state. + */ + clientConnections(request: QueryClientConnectionsRequest): Promise; + /** + * ConnectionClientState queries the client state associated with the + * connection. + */ + connectionClientState(request: QueryConnectionClientStateRequest): Promise; + /** + * ConnectionConsensusState queries the consensus state associated with the + * connection. + */ + connectionConsensusState(request: QueryConnectionConsensusStateRequest): Promise; + /** ConnectionParams queries all parameters of the ibc connection submodule. */ + connectionParams(request?: QueryConnectionParamsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* Connection queries an IBC connection end. */ + connection = async (request: QueryConnectionRequest): Promise => { + const data = QueryConnectionRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "Connection", data); + return promise.then(data => QueryConnectionResponse.decode(new BinaryReader(data))); + }; + /* Connections queries all the IBC connections of a chain. */ + connections = async (request: QueryConnectionsRequest = { + pagination: undefined + }): Promise => { + const data = QueryConnectionsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "Connections", data); + return promise.then(data => QueryConnectionsResponse.decode(new BinaryReader(data))); + }; + /* ClientConnections queries the connection paths associated with a client + state. */ + clientConnections = async (request: QueryClientConnectionsRequest): Promise => { + const data = QueryClientConnectionsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "ClientConnections", data); + return promise.then(data => QueryClientConnectionsResponse.decode(new BinaryReader(data))); + }; + /* ConnectionClientState queries the client state associated with the + connection. */ + connectionClientState = async (request: QueryConnectionClientStateRequest): Promise => { + const data = QueryConnectionClientStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "ConnectionClientState", data); + return promise.then(data => QueryConnectionClientStateResponse.decode(new BinaryReader(data))); + }; + /* ConnectionConsensusState queries the consensus state associated with the + connection. */ + connectionConsensusState = async (request: QueryConnectionConsensusStateRequest): Promise => { + const data = QueryConnectionConsensusStateRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "ConnectionConsensusState", data); + return promise.then(data => QueryConnectionConsensusStateResponse.decode(new BinaryReader(data))); + }; + /* ConnectionParams queries all parameters of the ibc connection submodule. */ + connectionParams = async (request: QueryConnectionParamsRequest = {}): Promise => { + const data = QueryConnectionParamsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Query", "ConnectionParams", data); + return promise.then(data => QueryConnectionParamsResponse.decode(new BinaryReader(data))); + }; +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + connection(request: QueryConnectionRequest): Promise { + return queryService.connection(request); + }, + connections(request?: QueryConnectionsRequest): Promise { + return queryService.connections(request); + }, + clientConnections(request: QueryClientConnectionsRequest): Promise { + return queryService.clientConnections(request); + }, + connectionClientState(request: QueryConnectionClientStateRequest): Promise { + return queryService.connectionClientState(request); + }, + connectionConsensusState(request: QueryConnectionConsensusStateRequest): Promise { + return queryService.connectionConsensusState(request); + }, + connectionParams(request?: QueryConnectionParamsRequest): Promise { + return queryService.connectionParams(request); + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/query.ts b/util/inj-types/ibc/core/connection/v1/query.ts new file mode 100644 index 00000000..7997d334 --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/query.ts @@ -0,0 +1,1401 @@ +import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; +import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType, IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType } from "./connection"; +import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, Params, ParamsAmino, ParamsSDKType } from "../../client/v1/client"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * QueryConnectionRequest is the request type for the Query/Connection RPC + * method + */ +export interface QueryConnectionRequest { + /** connection unique identifier */ + connectionId: string; +} +export interface QueryConnectionRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest"; + value: Uint8Array; +} +/** + * QueryConnectionRequest is the request type for the Query/Connection RPC + * method + */ +export interface QueryConnectionRequestAmino { + /** connection unique identifier */ + connection_id?: string; +} +export interface QueryConnectionRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionRequest"; + value: QueryConnectionRequestAmino; +} +/** + * QueryConnectionRequest is the request type for the Query/Connection RPC + * method + */ +export interface QueryConnectionRequestSDKType { + connection_id: string; +} +/** + * QueryConnectionResponse is the response type for the Query/Connection RPC + * method. Besides the connection end, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryConnectionResponse { + /** connection associated with the request identifier */ + connection?: ConnectionEnd; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryConnectionResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse"; + value: Uint8Array; +} +/** + * QueryConnectionResponse is the response type for the Query/Connection RPC + * method. Besides the connection end, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryConnectionResponseAmino { + /** connection associated with the request identifier */ + connection?: ConnectionEndAmino; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryConnectionResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionResponse"; + value: QueryConnectionResponseAmino; +} +/** + * QueryConnectionResponse is the response type for the Query/Connection RPC + * method. Besides the connection end, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryConnectionResponseSDKType { + connection?: ConnectionEndSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryConnectionsRequest is the request type for the Query/Connections RPC + * method + */ +export interface QueryConnectionsRequest { + pagination?: PageRequest; +} +export interface QueryConnectionsRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest"; + value: Uint8Array; +} +/** + * QueryConnectionsRequest is the request type for the Query/Connections RPC + * method + */ +export interface QueryConnectionsRequestAmino { + pagination?: PageRequestAmino; +} +export interface QueryConnectionsRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionsRequest"; + value: QueryConnectionsRequestAmino; +} +/** + * QueryConnectionsRequest is the request type for the Query/Connections RPC + * method + */ +export interface QueryConnectionsRequestSDKType { + pagination?: PageRequestSDKType; +} +/** + * QueryConnectionsResponse is the response type for the Query/Connections RPC + * method. + */ +export interface QueryConnectionsResponse { + /** list of stored connections of the chain. */ + connections: IdentifiedConnection[]; + /** pagination response */ + pagination?: PageResponse; + /** query block height */ + height: Height; +} +export interface QueryConnectionsResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse"; + value: Uint8Array; +} +/** + * QueryConnectionsResponse is the response type for the Query/Connections RPC + * method. + */ +export interface QueryConnectionsResponseAmino { + /** list of stored connections of the chain. */ + connections?: IdentifiedConnectionAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; + /** query block height */ + height?: HeightAmino; +} +export interface QueryConnectionsResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionsResponse"; + value: QueryConnectionsResponseAmino; +} +/** + * QueryConnectionsResponse is the response type for the Query/Connections RPC + * method. + */ +export interface QueryConnectionsResponseSDKType { + connections: IdentifiedConnectionSDKType[]; + pagination?: PageResponseSDKType; + height: HeightSDKType; +} +/** + * QueryClientConnectionsRequest is the request type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsRequest { + /** client identifier associated with a connection */ + clientId: string; +} +export interface QueryClientConnectionsRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest"; + value: Uint8Array; +} +/** + * QueryClientConnectionsRequest is the request type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsRequestAmino { + /** client identifier associated with a connection */ + client_id?: string; +} +export interface QueryClientConnectionsRequestAminoMsg { + type: "cosmos-sdk/QueryClientConnectionsRequest"; + value: QueryClientConnectionsRequestAmino; +} +/** + * QueryClientConnectionsRequest is the request type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsRequestSDKType { + client_id: string; +} +/** + * QueryClientConnectionsResponse is the response type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsResponse { + /** slice of all the connection paths associated with a client. */ + connectionPaths: string[]; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was generated */ + proofHeight: Height; +} +export interface QueryClientConnectionsResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse"; + value: Uint8Array; +} +/** + * QueryClientConnectionsResponse is the response type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsResponseAmino { + /** slice of all the connection paths associated with a client. */ + connection_paths?: string[]; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was generated */ + proof_height?: HeightAmino; +} +export interface QueryClientConnectionsResponseAminoMsg { + type: "cosmos-sdk/QueryClientConnectionsResponse"; + value: QueryClientConnectionsResponseAmino; +} +/** + * QueryClientConnectionsResponse is the response type for the + * Query/ClientConnections RPC method + */ +export interface QueryClientConnectionsResponseSDKType { + connection_paths: string[]; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryConnectionClientStateRequest is the request type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateRequest { + /** connection identifier */ + connectionId: string; +} +export interface QueryConnectionClientStateRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest"; + value: Uint8Array; +} +/** + * QueryConnectionClientStateRequest is the request type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateRequestAmino { + /** connection identifier */ + connection_id?: string; +} +export interface QueryConnectionClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionClientStateRequest"; + value: QueryConnectionClientStateRequestAmino; +} +/** + * QueryConnectionClientStateRequest is the request type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateRequestSDKType { + connection_id: string; +} +/** + * QueryConnectionClientStateResponse is the response type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateResponse { + /** client state associated with the channel */ + identifiedClientState?: IdentifiedClientState; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryConnectionClientStateResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse"; + value: Uint8Array; +} +/** + * QueryConnectionClientStateResponse is the response type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateResponseAmino { + /** client state associated with the channel */ + identified_client_state?: IdentifiedClientStateAmino; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryConnectionClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionClientStateResponse"; + value: QueryConnectionClientStateResponseAmino; +} +/** + * QueryConnectionClientStateResponse is the response type for the + * Query/ConnectionClientState RPC method + */ +export interface QueryConnectionClientStateResponseSDKType { + identified_client_state?: IdentifiedClientStateSDKType; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** + * QueryConnectionConsensusStateRequest is the request type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateRequest { + /** connection identifier */ + connectionId: string; + revisionNumber: bigint; + revisionHeight: bigint; +} +export interface QueryConnectionConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryConnectionConsensusStateRequest is the request type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateRequestAmino { + /** connection identifier */ + connection_id?: string; + revision_number?: string; + revision_height?: string; +} +export interface QueryConnectionConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionConsensusStateRequest"; + value: QueryConnectionConsensusStateRequestAmino; +} +/** + * QueryConnectionConsensusStateRequest is the request type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateRequestSDKType { + connection_id: string; + revision_number: bigint; + revision_height: bigint; +} +/** + * QueryConnectionConsensusStateResponse is the response type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateResponse { + /** consensus state associated with the channel */ + consensusState?: Any; + /** client ID associated with the consensus state */ + clientId: string; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proofHeight: Height; +} +export interface QueryConnectionConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse"; + value: Uint8Array; +} +/** + * QueryConnectionConsensusStateResponse is the response type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateResponseAmino { + /** consensus state associated with the channel */ + consensus_state?: AnyAmino; + /** client ID associated with the consensus state */ + client_id?: string; + /** merkle proof of existence */ + proof?: string; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryConnectionConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionConsensusStateResponse"; + value: QueryConnectionConsensusStateResponseAmino; +} +/** + * QueryConnectionConsensusStateResponse is the response type for the + * Query/ConnectionConsensusState RPC method + */ +export interface QueryConnectionConsensusStateResponseSDKType { + consensus_state?: AnySDKType; + client_id: string; + proof: Uint8Array; + proof_height: HeightSDKType; +} +/** QueryConnectionParamsRequest is the request type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsRequest {} +export interface QueryConnectionParamsRequestProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsRequest"; + value: Uint8Array; +} +/** QueryConnectionParamsRequest is the request type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsRequestAmino {} +export interface QueryConnectionParamsRequestAminoMsg { + type: "cosmos-sdk/QueryConnectionParamsRequest"; + value: QueryConnectionParamsRequestAmino; +} +/** QueryConnectionParamsRequest is the request type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsRequestSDKType {} +/** QueryConnectionParamsResponse is the response type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} +export interface QueryConnectionParamsResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsResponse"; + value: Uint8Array; +} +/** QueryConnectionParamsResponse is the response type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsResponseAmino { + /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryConnectionParamsResponseAminoMsg { + type: "cosmos-sdk/QueryConnectionParamsResponse"; + value: QueryConnectionParamsResponseAmino; +} +/** QueryConnectionParamsResponse is the response type for the Query/ConnectionParams RPC method. */ +export interface QueryConnectionParamsResponseSDKType { + params?: ParamsSDKType; +} +function createBaseQueryConnectionRequest(): QueryConnectionRequest { + return { + connectionId: "" + }; +} +export const QueryConnectionRequest = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", + aminoType: "cosmos-sdk/QueryConnectionRequest", + encode(message: QueryConnectionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionRequest { + const message = createBaseQueryConnectionRequest(); + message.connectionId = object.connectionId ?? ""; + return message; + }, + fromAmino(object: QueryConnectionRequestAmino): QueryConnectionRequest { + const message = createBaseQueryConnectionRequest(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + return message; + }, + toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + return obj; + }, + fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { + return QueryConnectionRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionRequest): QueryConnectionRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionRequest", + value: QueryConnectionRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionRequestProtoMsg): QueryConnectionRequest { + return QueryConnectionRequest.decode(message.value); + }, + toProto(message: QueryConnectionRequest): Uint8Array { + return QueryConnectionRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionRequest): QueryConnectionRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionRequest", + value: QueryConnectionRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionResponse(): QueryConnectionResponse { + return { + connection: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryConnectionResponse = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", + aminoType: "cosmos-sdk/QueryConnectionResponse", + encode(message: QueryConnectionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connection !== undefined) { + ConnectionEnd.encode(message.connection, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection = ConnectionEnd.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionResponse { + const message = createBaseQueryConnectionResponse(); + message.connection = object.connection !== undefined && object.connection !== null ? ConnectionEnd.fromPartial(object.connection) : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryConnectionResponseAmino): QueryConnectionResponse { + const message = createBaseQueryConnectionResponse(); + if (object.connection !== undefined && object.connection !== null) { + message.connection = ConnectionEnd.fromAmino(object.connection); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryConnectionResponse): QueryConnectionResponseAmino { + const obj: any = {}; + obj.connection = message.connection ? ConnectionEnd.toAmino(message.connection) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionResponseAminoMsg): QueryConnectionResponse { + return QueryConnectionResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionResponse): QueryConnectionResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionResponse", + value: QueryConnectionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionResponseProtoMsg): QueryConnectionResponse { + return QueryConnectionResponse.decode(message.value); + }, + toProto(message: QueryConnectionResponse): Uint8Array { + return QueryConnectionResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionResponse): QueryConnectionResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionResponse", + value: QueryConnectionResponse.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionsRequest(): QueryConnectionsRequest { + return { + pagination: undefined + }; +} +export const QueryConnectionsRequest = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest", + aminoType: "cosmos-sdk/QueryConnectionsRequest", + encode(message: QueryConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionsRequest(); + 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: DeepPartial): QueryConnectionsRequest { + const message = createBaseQueryConnectionsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryConnectionsRequestAmino): QueryConnectionsRequest { + const message = createBaseQueryConnectionsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryConnectionsRequest): QueryConnectionsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConnectionsRequestAminoMsg): QueryConnectionsRequest { + return QueryConnectionsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionsRequest): QueryConnectionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionsRequest", + value: QueryConnectionsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionsRequestProtoMsg): QueryConnectionsRequest { + return QueryConnectionsRequest.decode(message.value); + }, + toProto(message: QueryConnectionsRequest): Uint8Array { + return QueryConnectionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionsRequest): QueryConnectionsRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsRequest", + value: QueryConnectionsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionsResponse(): QueryConnectionsResponse { + return { + connections: [], + pagination: undefined, + height: Height.fromPartial({}) + }; +} +export const QueryConnectionsResponse = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", + aminoType: "cosmos-sdk/QueryConnectionsResponse", + encode(message: QueryConnectionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.connections) { + IdentifiedConnection.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connections.push(IdentifiedConnection.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionsResponse { + const message = createBaseQueryConnectionsResponse(); + message.connections = object.connections?.map(e => IdentifiedConnection.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + return message; + }, + fromAmino(object: QueryConnectionsResponseAmino): QueryConnectionsResponse { + const message = createBaseQueryConnectionsResponse(); + message.connections = object.connections?.map(e => IdentifiedConnection.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + return message; + }, + toAmino(message: QueryConnectionsResponse): QueryConnectionsResponseAmino { + const obj: any = {}; + if (message.connections) { + obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); + } else { + obj.connections = message.connections; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.height = message.height ? Height.toAmino(message.height) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionsResponseAminoMsg): QueryConnectionsResponse { + return QueryConnectionsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionsResponse): QueryConnectionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionsResponse", + value: QueryConnectionsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionsResponseProtoMsg): QueryConnectionsResponse { + return QueryConnectionsResponse.decode(message.value); + }, + toProto(message: QueryConnectionsResponse): Uint8Array { + return QueryConnectionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionsResponse): QueryConnectionsResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionsResponse", + value: QueryConnectionsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryClientConnectionsRequest(): QueryClientConnectionsRequest { + return { + clientId: "" + }; +} +export const QueryClientConnectionsRequest = { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", + aminoType: "cosmos-sdk/QueryClientConnectionsRequest", + encode(message: QueryClientConnectionsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientConnectionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientConnectionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryClientConnectionsRequest { + const message = createBaseQueryClientConnectionsRequest(); + message.clientId = object.clientId ?? ""; + return message; + }, + fromAmino(object: QueryClientConnectionsRequestAmino): QueryClientConnectionsRequest { + const message = createBaseQueryClientConnectionsRequest(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + return message; + }, + toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + return obj; + }, + fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { + return QueryClientConnectionsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientConnectionsRequest", + value: QueryClientConnectionsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientConnectionsRequestProtoMsg): QueryClientConnectionsRequest { + return QueryClientConnectionsRequest.decode(message.value); + }, + toProto(message: QueryClientConnectionsRequest): Uint8Array { + return QueryClientConnectionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsRequest", + value: QueryClientConnectionsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryClientConnectionsResponse(): QueryClientConnectionsResponse { + return { + connectionPaths: [], + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryClientConnectionsResponse = { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", + aminoType: "cosmos-sdk/QueryClientConnectionsResponse", + encode(message: QueryClientConnectionsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.connectionPaths) { + writer.uint32(10).string(v!); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryClientConnectionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClientConnectionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionPaths.push(reader.string()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryClientConnectionsResponse { + const message = createBaseQueryClientConnectionsResponse(); + message.connectionPaths = object.connectionPaths?.map(e => e) || []; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryClientConnectionsResponseAmino): QueryClientConnectionsResponse { + const message = createBaseQueryClientConnectionsResponse(); + message.connectionPaths = object.connection_paths?.map(e => e) || []; + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryClientConnectionsResponse): QueryClientConnectionsResponseAmino { + const obj: any = {}; + if (message.connectionPaths) { + obj.connection_paths = message.connectionPaths.map(e => e); + } else { + obj.connection_paths = message.connectionPaths; + } + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryClientConnectionsResponseAminoMsg): QueryClientConnectionsResponse { + return QueryClientConnectionsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryClientConnectionsResponse): QueryClientConnectionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientConnectionsResponse", + value: QueryClientConnectionsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryClientConnectionsResponseProtoMsg): QueryClientConnectionsResponse { + return QueryClientConnectionsResponse.decode(message.value); + }, + toProto(message: QueryClientConnectionsResponse): Uint8Array { + return QueryClientConnectionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryClientConnectionsResponse): QueryClientConnectionsResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryClientConnectionsResponse", + value: QueryClientConnectionsResponse.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionClientStateRequest(): QueryConnectionClientStateRequest { + return { + connectionId: "" + }; +} +export const QueryConnectionClientStateRequest = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", + aminoType: "cosmos-sdk/QueryConnectionClientStateRequest", + encode(message: QueryConnectionClientStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionClientStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionClientStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionClientStateRequest { + const message = createBaseQueryConnectionClientStateRequest(); + message.connectionId = object.connectionId ?? ""; + return message; + }, + fromAmino(object: QueryConnectionClientStateRequestAmino): QueryConnectionClientStateRequest { + const message = createBaseQueryConnectionClientStateRequest(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + return message; + }, + toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + return obj; + }, + fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { + return QueryConnectionClientStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionClientStateRequest", + value: QueryConnectionClientStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionClientStateRequestProtoMsg): QueryConnectionClientStateRequest { + return QueryConnectionClientStateRequest.decode(message.value); + }, + toProto(message: QueryConnectionClientStateRequest): Uint8Array { + return QueryConnectionClientStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateRequest", + value: QueryConnectionClientStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionClientStateResponse(): QueryConnectionClientStateResponse { + return { + identifiedClientState: undefined, + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryConnectionClientStateResponse = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", + aminoType: "cosmos-sdk/QueryConnectionClientStateResponse", + encode(message: QueryConnectionClientStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.identifiedClientState !== undefined) { + IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionClientStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionClientStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifiedClientState = IdentifiedClientState.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionClientStateResponse { + const message = createBaseQueryConnectionClientStateResponse(); + message.identifiedClientState = object.identifiedClientState !== undefined && object.identifiedClientState !== null ? IdentifiedClientState.fromPartial(object.identifiedClientState) : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryConnectionClientStateResponseAmino): QueryConnectionClientStateResponse { + const message = createBaseQueryConnectionClientStateResponse(); + if (object.identified_client_state !== undefined && object.identified_client_state !== null) { + message.identifiedClientState = IdentifiedClientState.fromAmino(object.identified_client_state); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryConnectionClientStateResponse): QueryConnectionClientStateResponseAmino { + const obj: any = {}; + obj.identified_client_state = message.identifiedClientState ? IdentifiedClientState.toAmino(message.identifiedClientState) : undefined; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionClientStateResponseAminoMsg): QueryConnectionClientStateResponse { + return QueryConnectionClientStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionClientStateResponse): QueryConnectionClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionClientStateResponse", + value: QueryConnectionClientStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionClientStateResponseProtoMsg): QueryConnectionClientStateResponse { + return QueryConnectionClientStateResponse.decode(message.value); + }, + toProto(message: QueryConnectionClientStateResponse): Uint8Array { + return QueryConnectionClientStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionClientStateResponse): QueryConnectionClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionClientStateResponse", + value: QueryConnectionClientStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionConsensusStateRequest(): QueryConnectionConsensusStateRequest { + return { + connectionId: "", + revisionNumber: BigInt(0), + revisionHeight: BigInt(0) + }; +} +export const QueryConnectionConsensusStateRequest = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", + aminoType: "cosmos-sdk/QueryConnectionConsensusStateRequest", + encode(message: QueryConnectionConsensusStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.revisionNumber !== BigInt(0)) { + writer.uint32(16).uint64(message.revisionNumber); + } + if (message.revisionHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.revisionHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.revisionNumber = reader.uint64(); + break; + case 3: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionConsensusStateRequest { + const message = createBaseQueryConnectionConsensusStateRequest(); + message.connectionId = object.connectionId ?? ""; + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryConnectionConsensusStateRequestAmino): QueryConnectionConsensusStateRequest { + const message = createBaseQueryConnectionConsensusStateRequest(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.revision_number !== undefined && object.revision_number !== null) { + message.revisionNumber = BigInt(object.revision_number); + } + if (object.revision_height !== undefined && object.revision_height !== null) { + message.revisionHeight = BigInt(object.revision_height); + } + return message; + }, + toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { + return QueryConnectionConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionConsensusStateRequest", + value: QueryConnectionConsensusStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionConsensusStateRequestProtoMsg): QueryConnectionConsensusStateRequest { + return QueryConnectionConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryConnectionConsensusStateRequest): Uint8Array { + return QueryConnectionConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest", + value: QueryConnectionConsensusStateRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionConsensusStateResponse(): QueryConnectionConsensusStateResponse { + return { + consensusState: undefined, + clientId: "", + proof: new Uint8Array(), + proofHeight: Height.fromPartial({}) + }; +} +export const QueryConnectionConsensusStateResponse = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", + aminoType: "cosmos-sdk/QueryConnectionConsensusStateResponse", + encode(message: QueryConnectionConsensusStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryConnectionConsensusStateResponse { + const message = createBaseQueryConnectionConsensusStateResponse(); + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + message.clientId = object.clientId ?? ""; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + return message; + }, + fromAmino(object: QueryConnectionConsensusStateResponseAmino): QueryConnectionConsensusStateResponse { + const message = createBaseQueryConnectionConsensusStateResponse(); + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = bytesFromBase64(object.proof); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + return message; + }, + toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { + const obj: any = {}; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionConsensusStateResponseAminoMsg): QueryConnectionConsensusStateResponse { + return QueryConnectionConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionConsensusStateResponse", + value: QueryConnectionConsensusStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionConsensusStateResponseProtoMsg): QueryConnectionConsensusStateResponse { + return QueryConnectionConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryConnectionConsensusStateResponse): Uint8Array { + return QueryConnectionConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse", + value: QueryConnectionConsensusStateResponse.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionParamsRequest(): QueryConnectionParamsRequest { + return {}; +} +export const QueryConnectionParamsRequest = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsRequest", + aminoType: "cosmos-sdk/QueryConnectionParamsRequest", + encode(_: QueryConnectionParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryConnectionParamsRequest { + const message = createBaseQueryConnectionParamsRequest(); + return message; + }, + fromAmino(_: QueryConnectionParamsRequestAmino): QueryConnectionParamsRequest { + const message = createBaseQueryConnectionParamsRequest(); + return message; + }, + toAmino(_: QueryConnectionParamsRequest): QueryConnectionParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryConnectionParamsRequestAminoMsg): QueryConnectionParamsRequest { + return QueryConnectionParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionParamsRequest): QueryConnectionParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionParamsRequest", + value: QueryConnectionParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionParamsRequestProtoMsg): QueryConnectionParamsRequest { + return QueryConnectionParamsRequest.decode(message.value); + }, + toProto(message: QueryConnectionParamsRequest): Uint8Array { + return QueryConnectionParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionParamsRequest): QueryConnectionParamsRequestProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsRequest", + value: QueryConnectionParamsRequest.encode(message).finish() + }; + } +}; +function createBaseQueryConnectionParamsResponse(): QueryConnectionParamsResponse { + return { + params: undefined + }; +} +export const QueryConnectionParamsResponse = { + typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsResponse", + aminoType: "cosmos-sdk/QueryConnectionParamsResponse", + encode(message: QueryConnectionParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryConnectionParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConnectionParamsResponse(); + 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: DeepPartial): QueryConnectionParamsResponse { + const message = createBaseQueryConnectionParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryConnectionParamsResponseAmino): QueryConnectionParamsResponse { + const message = createBaseQueryConnectionParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryConnectionParamsResponse): QueryConnectionParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryConnectionParamsResponseAminoMsg): QueryConnectionParamsResponse { + return QueryConnectionParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryConnectionParamsResponse): QueryConnectionParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConnectionParamsResponse", + value: QueryConnectionParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryConnectionParamsResponseProtoMsg): QueryConnectionParamsResponse { + return QueryConnectionParamsResponse.decode(message.value); + }, + toProto(message: QueryConnectionParamsResponse): Uint8Array { + return QueryConnectionParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryConnectionParamsResponse): QueryConnectionParamsResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.QueryConnectionParamsResponse", + value: QueryConnectionParamsResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/tx.amino.ts b/util/inj-types/ibc/core/connection/v1/tx.amino.ts new file mode 100644 index 00000000..1ad57704 --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/tx.amino.ts @@ -0,0 +1,23 @@ +import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm } from "./tx"; +export const AminoConverter = { + "/ibc.core.connection.v1.MsgConnectionOpenInit": { + aminoType: "cosmos-sdk/MsgConnectionOpenInit", + toAmino: MsgConnectionOpenInit.toAmino, + fromAmino: MsgConnectionOpenInit.fromAmino + }, + "/ibc.core.connection.v1.MsgConnectionOpenTry": { + aminoType: "cosmos-sdk/MsgConnectionOpenTry", + toAmino: MsgConnectionOpenTry.toAmino, + fromAmino: MsgConnectionOpenTry.fromAmino + }, + "/ibc.core.connection.v1.MsgConnectionOpenAck": { + aminoType: "cosmos-sdk/MsgConnectionOpenAck", + toAmino: MsgConnectionOpenAck.toAmino, + fromAmino: MsgConnectionOpenAck.fromAmino + }, + "/ibc.core.connection.v1.MsgConnectionOpenConfirm": { + aminoType: "cosmos-sdk/MsgConnectionOpenConfirm", + toAmino: MsgConnectionOpenConfirm.toAmino, + fromAmino: MsgConnectionOpenConfirm.fromAmino + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/tx.registry.ts b/util/inj-types/ibc/core/connection/v1/tx.registry.ts new file mode 100644 index 00000000..ea9df730 --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/tx.registry.ts @@ -0,0 +1,89 @@ +//@ts-nocheck +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + connectionOpenInit(value: MsgConnectionOpenInit) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + value: MsgConnectionOpenInit.encode(value).finish() + }; + }, + connectionOpenTry(value: MsgConnectionOpenTry) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + value: MsgConnectionOpenTry.encode(value).finish() + }; + }, + connectionOpenAck(value: MsgConnectionOpenAck) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + value: MsgConnectionOpenAck.encode(value).finish() + }; + }, + connectionOpenConfirm(value: MsgConnectionOpenConfirm) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + value: MsgConnectionOpenConfirm.encode(value).finish() + }; + } + }, + withTypeUrl: { + connectionOpenInit(value: MsgConnectionOpenInit) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + value + }; + }, + connectionOpenTry(value: MsgConnectionOpenTry) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + value + }; + }, + connectionOpenAck(value: MsgConnectionOpenAck) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + value + }; + }, + connectionOpenConfirm(value: MsgConnectionOpenConfirm) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + value + }; + } + }, + fromPartial: { + connectionOpenInit(value: MsgConnectionOpenInit) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + value: MsgConnectionOpenInit.fromPartial(value) + }; + }, + connectionOpenTry(value: MsgConnectionOpenTry) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + value: MsgConnectionOpenTry.fromPartial(value) + }; + }, + connectionOpenAck(value: MsgConnectionOpenAck) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + value: MsgConnectionOpenAck.fromPartial(value) + }; + }, + connectionOpenConfirm(value: MsgConnectionOpenConfirm) { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + value: MsgConnectionOpenConfirm.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/tx.rpc.msg.ts b/util/inj-types/ibc/core/connection/v1/tx.rpc.msg.ts new file mode 100644 index 00000000..229c3e6b --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/tx.rpc.msg.ts @@ -0,0 +1,48 @@ +import { Rpc } from "../../../../helpers"; +import { BinaryReader } from "../../../../binary"; +import { MsgConnectionOpenInit, MsgConnectionOpenInitResponse, MsgConnectionOpenTry, MsgConnectionOpenTryResponse, MsgConnectionOpenAck, MsgConnectionOpenAckResponse, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmResponse } from "./tx"; +/** Msg defines the ibc/connection Msg service. */ +export interface Msg { + /** ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. */ + connectionOpenInit(request: MsgConnectionOpenInit): Promise; + /** ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. */ + connectionOpenTry(request: MsgConnectionOpenTry): Promise; + /** ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. */ + connectionOpenAck(request: MsgConnectionOpenAck): Promise; + /** + * ConnectionOpenConfirm defines a rpc handler method for + * MsgConnectionOpenConfirm. + */ + connectionOpenConfirm(request: MsgConnectionOpenConfirm): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + /* ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. */ + connectionOpenInit = async (request: MsgConnectionOpenInit): Promise => { + const data = MsgConnectionOpenInit.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenInit", data); + return promise.then(data => MsgConnectionOpenInitResponse.decode(new BinaryReader(data))); + }; + /* ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. */ + connectionOpenTry = async (request: MsgConnectionOpenTry): Promise => { + const data = MsgConnectionOpenTry.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenTry", data); + return promise.then(data => MsgConnectionOpenTryResponse.decode(new BinaryReader(data))); + }; + /* ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. */ + connectionOpenAck = async (request: MsgConnectionOpenAck): Promise => { + const data = MsgConnectionOpenAck.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenAck", data); + return promise.then(data => MsgConnectionOpenAckResponse.decode(new BinaryReader(data))); + }; + /* ConnectionOpenConfirm defines a rpc handler method for + MsgConnectionOpenConfirm. */ + connectionOpenConfirm = async (request: MsgConnectionOpenConfirm): Promise => { + const data = MsgConnectionOpenConfirm.encode(request).finish(); + const promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenConfirm", data); + return promise.then(data => MsgConnectionOpenConfirmResponse.decode(new BinaryReader(data))); + }; +} \ No newline at end of file diff --git a/util/inj-types/ibc/core/connection/v1/tx.ts b/util/inj-types/ibc/core/connection/v1/tx.ts new file mode 100644 index 00000000..96fa7bd4 --- /dev/null +++ b/util/inj-types/ibc/core/connection/v1/tx.ts @@ -0,0 +1,1175 @@ +import { Counterparty, CounterpartyAmino, CounterpartySDKType, Version, VersionAmino, VersionSDKType } from "./connection"; +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * MsgConnectionOpenInit defines the msg sent by an account on Chain A to + * initialize a connection with Chain B. + */ +export interface MsgConnectionOpenInit { + clientId: string; + counterparty: Counterparty; + version?: Version; + delayPeriod: bigint; + signer: string; +} +export interface MsgConnectionOpenInitProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit"; + value: Uint8Array; +} +/** + * MsgConnectionOpenInit defines the msg sent by an account on Chain A to + * initialize a connection with Chain B. + */ +export interface MsgConnectionOpenInitAmino { + client_id?: string; + counterparty?: CounterpartyAmino; + version?: VersionAmino; + delay_period?: string; + signer?: string; +} +export interface MsgConnectionOpenInitAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenInit"; + value: MsgConnectionOpenInitAmino; +} +/** + * MsgConnectionOpenInit defines the msg sent by an account on Chain A to + * initialize a connection with Chain B. + */ +export interface MsgConnectionOpenInitSDKType { + client_id: string; + counterparty: CounterpartySDKType; + version?: VersionSDKType; + delay_period: bigint; + signer: string; +} +/** + * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + * type. + */ +export interface MsgConnectionOpenInitResponse {} +export interface MsgConnectionOpenInitResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse"; + value: Uint8Array; +} +/** + * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + * type. + */ +export interface MsgConnectionOpenInitResponseAmino {} +export interface MsgConnectionOpenInitResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenInitResponse"; + value: MsgConnectionOpenInitResponseAmino; +} +/** + * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + * type. + */ +export interface MsgConnectionOpenInitResponseSDKType {} +/** + * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + * connection on Chain B. + */ +export interface MsgConnectionOpenTry { + clientId: string; + /** Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. */ + /** @deprecated */ + previousConnectionId: string; + clientState?: Any; + counterparty: Counterparty; + delayPeriod: bigint; + counterpartyVersions: Version[]; + proofHeight: Height; + /** + * proof of the initialization the connection on Chain A: `UNITIALIZED -> + * INIT` + */ + proofInit: Uint8Array; + /** proof of client state included in message */ + proofClient: Uint8Array; + /** proof of client consensus state */ + proofConsensus: Uint8Array; + consensusHeight: Height; + signer: string; + /** optional proof data for host state machines that are unable to introspect their own consensus state */ + hostConsensusStateProof: Uint8Array; +} +export interface MsgConnectionOpenTryProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry"; + value: Uint8Array; +} +/** + * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + * connection on Chain B. + */ +export interface MsgConnectionOpenTryAmino { + client_id?: string; + /** Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. */ + /** @deprecated */ + previous_connection_id?: string; + client_state?: AnyAmino; + counterparty?: CounterpartyAmino; + delay_period?: string; + counterparty_versions?: VersionAmino[]; + proof_height?: HeightAmino; + /** + * proof of the initialization the connection on Chain A: `UNITIALIZED -> + * INIT` + */ + proof_init?: string; + /** proof of client state included in message */ + proof_client?: string; + /** proof of client consensus state */ + proof_consensus?: string; + consensus_height?: HeightAmino; + signer?: string; + /** optional proof data for host state machines that are unable to introspect their own consensus state */ + host_consensus_state_proof?: string; +} +export interface MsgConnectionOpenTryAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenTry"; + value: MsgConnectionOpenTryAmino; +} +/** + * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + * connection on Chain B. + */ +export interface MsgConnectionOpenTrySDKType { + client_id: string; + /** @deprecated */ + previous_connection_id: string; + client_state?: AnySDKType; + counterparty: CounterpartySDKType; + delay_period: bigint; + counterparty_versions: VersionSDKType[]; + proof_height: HeightSDKType; + proof_init: Uint8Array; + proof_client: Uint8Array; + proof_consensus: Uint8Array; + consensus_height: HeightSDKType; + signer: string; + host_consensus_state_proof: Uint8Array; +} +/** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ +export interface MsgConnectionOpenTryResponse {} +export interface MsgConnectionOpenTryResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse"; + value: Uint8Array; +} +/** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ +export interface MsgConnectionOpenTryResponseAmino {} +export interface MsgConnectionOpenTryResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenTryResponse"; + value: MsgConnectionOpenTryResponseAmino; +} +/** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ +export interface MsgConnectionOpenTryResponseSDKType {} +/** + * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + * acknowledge the change of connection state to TRYOPEN on Chain B. + */ +export interface MsgConnectionOpenAck { + connectionId: string; + counterpartyConnectionId: string; + version?: Version; + clientState?: Any; + proofHeight: Height; + /** + * proof of the initialization the connection on Chain B: `UNITIALIZED -> + * TRYOPEN` + */ + proofTry: Uint8Array; + /** proof of client state included in message */ + proofClient: Uint8Array; + /** proof of client consensus state */ + proofConsensus: Uint8Array; + consensusHeight: Height; + signer: string; + /** optional proof data for host state machines that are unable to introspect their own consensus state */ + hostConsensusStateProof: Uint8Array; +} +export interface MsgConnectionOpenAckProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck"; + value: Uint8Array; +} +/** + * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + * acknowledge the change of connection state to TRYOPEN on Chain B. + */ +export interface MsgConnectionOpenAckAmino { + connection_id?: string; + counterparty_connection_id?: string; + version?: VersionAmino; + client_state?: AnyAmino; + proof_height?: HeightAmino; + /** + * proof of the initialization the connection on Chain B: `UNITIALIZED -> + * TRYOPEN` + */ + proof_try?: string; + /** proof of client state included in message */ + proof_client?: string; + /** proof of client consensus state */ + proof_consensus?: string; + consensus_height?: HeightAmino; + signer?: string; + /** optional proof data for host state machines that are unable to introspect their own consensus state */ + host_consensus_state_proof?: string; +} +export interface MsgConnectionOpenAckAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenAck"; + value: MsgConnectionOpenAckAmino; +} +/** + * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + * acknowledge the change of connection state to TRYOPEN on Chain B. + */ +export interface MsgConnectionOpenAckSDKType { + connection_id: string; + counterparty_connection_id: string; + version?: VersionSDKType; + client_state?: AnySDKType; + proof_height: HeightSDKType; + proof_try: Uint8Array; + proof_client: Uint8Array; + proof_consensus: Uint8Array; + consensus_height: HeightSDKType; + signer: string; + host_consensus_state_proof: Uint8Array; +} +/** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ +export interface MsgConnectionOpenAckResponse {} +export interface MsgConnectionOpenAckResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse"; + value: Uint8Array; +} +/** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ +export interface MsgConnectionOpenAckResponseAmino {} +export interface MsgConnectionOpenAckResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenAckResponse"; + value: MsgConnectionOpenAckResponseAmino; +} +/** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ +export interface MsgConnectionOpenAckResponseSDKType {} +/** + * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of connection state to OPEN on Chain A. + */ +export interface MsgConnectionOpenConfirm { + connectionId: string; + /** proof for the change of the connection state on Chain A: `INIT -> OPEN` */ + proofAck: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgConnectionOpenConfirmProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm"; + value: Uint8Array; +} +/** + * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of connection state to OPEN on Chain A. + */ +export interface MsgConnectionOpenConfirmAmino { + connection_id?: string; + /** proof for the change of the connection state on Chain A: `INIT -> OPEN` */ + proof_ack?: string; + proof_height?: HeightAmino; + signer?: string; +} +export interface MsgConnectionOpenConfirmAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenConfirm"; + value: MsgConnectionOpenConfirmAmino; +} +/** + * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of connection state to OPEN on Chain A. + */ +export interface MsgConnectionOpenConfirmSDKType { + connection_id: string; + proof_ack: Uint8Array; + proof_height: HeightSDKType; + signer: string; +} +/** + * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + * response type. + */ +export interface MsgConnectionOpenConfirmResponse {} +export interface MsgConnectionOpenConfirmResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse"; + value: Uint8Array; +} +/** + * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + * response type. + */ +export interface MsgConnectionOpenConfirmResponseAmino {} +export interface MsgConnectionOpenConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenConfirmResponse"; + value: MsgConnectionOpenConfirmResponseAmino; +} +/** + * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + * response type. + */ +export interface MsgConnectionOpenConfirmResponseSDKType {} +function createBaseMsgConnectionOpenInit(): MsgConnectionOpenInit { + return { + clientId: "", + counterparty: Counterparty.fromPartial({}), + version: undefined, + delayPeriod: BigInt(0), + signer: "" + }; +} +export const MsgConnectionOpenInit = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + aminoType: "cosmos-sdk/MsgConnectionOpenInit", + encode(message: MsgConnectionOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(18).fork()).ldelim(); + } + if (message.version !== undefined) { + Version.encode(message.version, writer.uint32(26).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(32).uint64(message.delayPeriod); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 3: + message.version = Version.decode(reader, reader.uint32()); + break; + case 4: + message.delayPeriod = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgConnectionOpenInit { + const message = createBaseMsgConnectionOpenInit(); + message.clientId = object.clientId ?? ""; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgConnectionOpenInitAmino): MsgConnectionOpenInit { + const message = createBaseMsgConnectionOpenInit(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.version !== undefined && object.version !== null) { + message.version = Version.fromAmino(object.version); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.version = message.version ? Version.toAmino(message.version) : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { + return MsgConnectionOpenInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenInit): MsgConnectionOpenInitAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenInit", + value: MsgConnectionOpenInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenInitProtoMsg): MsgConnectionOpenInit { + return MsgConnectionOpenInit.decode(message.value); + }, + toProto(message: MsgConnectionOpenInit): Uint8Array { + return MsgConnectionOpenInit.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenInit): MsgConnectionOpenInitProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + value: MsgConnectionOpenInit.encode(message).finish() + }; + } +}; +function createBaseMsgConnectionOpenInitResponse(): MsgConnectionOpenInitResponse { + return {}; +} +export const MsgConnectionOpenInitResponse = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", + aminoType: "cosmos-sdk/MsgConnectionOpenInitResponse", + encode(_: MsgConnectionOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgConnectionOpenInitResponse { + const message = createBaseMsgConnectionOpenInitResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenInitResponseAmino): MsgConnectionOpenInitResponse { + const message = createBaseMsgConnectionOpenInitResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenInitResponseAminoMsg): MsgConnectionOpenInitResponse { + return MsgConnectionOpenInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenInitResponse", + value: MsgConnectionOpenInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenInitResponseProtoMsg): MsgConnectionOpenInitResponse { + return MsgConnectionOpenInitResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenInitResponse): Uint8Array { + return MsgConnectionOpenInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", + value: MsgConnectionOpenInitResponse.encode(message).finish() + }; + } +}; +function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { + return { + clientId: "", + previousConnectionId: "", + clientState: undefined, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0), + counterpartyVersions: [], + proofHeight: Height.fromPartial({}), + proofInit: new Uint8Array(), + proofClient: new Uint8Array(), + proofConsensus: new Uint8Array(), + consensusHeight: Height.fromPartial({}), + signer: "", + hostConsensusStateProof: new Uint8Array() + }; +} +export const MsgConnectionOpenTry = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + aminoType: "cosmos-sdk/MsgConnectionOpenTry", + encode(message: MsgConnectionOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.previousConnectionId !== "") { + writer.uint32(18).string(message.previousConnectionId); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(26).fork()).ldelim(); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(40).uint64(message.delayPeriod); + } + for (const v of message.counterpartyVersions) { + Version.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(58).fork()).ldelim(); + } + if (message.proofInit.length !== 0) { + writer.uint32(66).bytes(message.proofInit); + } + if (message.proofClient.length !== 0) { + writer.uint32(74).bytes(message.proofClient); + } + if (message.proofConsensus.length !== 0) { + writer.uint32(82).bytes(message.proofConsensus); + } + if (message.consensusHeight !== undefined) { + Height.encode(message.consensusHeight, writer.uint32(90).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(98).string(message.signer); + } + if (message.hostConsensusStateProof.length !== 0) { + writer.uint32(106).bytes(message.hostConsensusStateProof); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenTry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.previousConnectionId = reader.string(); + break; + case 3: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 4: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delayPeriod = reader.uint64(); + break; + case 6: + message.counterpartyVersions.push(Version.decode(reader, reader.uint32())); + break; + case 7: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 8: + message.proofInit = reader.bytes(); + break; + case 9: + message.proofClient = reader.bytes(); + break; + case 10: + message.proofConsensus = reader.bytes(); + break; + case 11: + message.consensusHeight = Height.decode(reader, reader.uint32()); + break; + case 12: + message.signer = reader.string(); + break; + case 13: + message.hostConsensusStateProof = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgConnectionOpenTry { + const message = createBaseMsgConnectionOpenTry(); + message.clientId = object.clientId ?? ""; + message.previousConnectionId = object.previousConnectionId ?? ""; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + message.counterpartyVersions = object.counterpartyVersions?.map(e => Version.fromPartial(e)) || []; + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofClient = object.proofClient ?? new Uint8Array(); + message.proofConsensus = object.proofConsensus ?? new Uint8Array(); + message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; + message.signer = object.signer ?? ""; + message.hostConsensusStateProof = object.hostConsensusStateProof ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgConnectionOpenTryAmino): MsgConnectionOpenTry { + const message = createBaseMsgConnectionOpenTry(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.previous_connection_id !== undefined && object.previous_connection_id !== null) { + message.previousConnectionId = object.previous_connection_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + message.counterpartyVersions = object.counterparty_versions?.map(e => Version.fromAmino(e)) || []; + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_client !== undefined && object.proof_client !== null) { + message.proofClient = bytesFromBase64(object.proof_client); + } + if (object.proof_consensus !== undefined && object.proof_consensus !== null) { + message.proofConsensus = bytesFromBase64(object.proof_consensus); + } + if (object.consensus_height !== undefined && object.consensus_height !== null) { + message.consensusHeight = Height.fromAmino(object.consensus_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.host_consensus_state_proof !== undefined && object.host_consensus_state_proof !== null) { + message.hostConsensusStateProof = bytesFromBase64(object.host_consensus_state_proof); + } + return message; + }, + toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; + if (message.counterpartyVersions) { + obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.counterparty_versions = message.counterpartyVersions; + } + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; + obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; + obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.host_consensus_state_proof = message.hostConsensusStateProof ? base64FromBytes(message.hostConsensusStateProof) : undefined; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { + return MsgConnectionOpenTry.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenTry): MsgConnectionOpenTryAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenTry", + value: MsgConnectionOpenTry.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenTryProtoMsg): MsgConnectionOpenTry { + return MsgConnectionOpenTry.decode(message.value); + }, + toProto(message: MsgConnectionOpenTry): Uint8Array { + return MsgConnectionOpenTry.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenTry): MsgConnectionOpenTryProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + value: MsgConnectionOpenTry.encode(message).finish() + }; + } +}; +function createBaseMsgConnectionOpenTryResponse(): MsgConnectionOpenTryResponse { + return {}; +} +export const MsgConnectionOpenTryResponse = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", + aminoType: "cosmos-sdk/MsgConnectionOpenTryResponse", + encode(_: MsgConnectionOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenTryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgConnectionOpenTryResponse { + const message = createBaseMsgConnectionOpenTryResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenTryResponseAmino): MsgConnectionOpenTryResponse { + const message = createBaseMsgConnectionOpenTryResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenTryResponseAminoMsg): MsgConnectionOpenTryResponse { + return MsgConnectionOpenTryResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenTryResponse", + value: MsgConnectionOpenTryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenTryResponseProtoMsg): MsgConnectionOpenTryResponse { + return MsgConnectionOpenTryResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenTryResponse): Uint8Array { + return MsgConnectionOpenTryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", + value: MsgConnectionOpenTryResponse.encode(message).finish() + }; + } +}; +function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { + return { + connectionId: "", + counterpartyConnectionId: "", + version: undefined, + clientState: undefined, + proofHeight: Height.fromPartial({}), + proofTry: new Uint8Array(), + proofClient: new Uint8Array(), + proofConsensus: new Uint8Array(), + consensusHeight: Height.fromPartial({}), + signer: "", + hostConsensusStateProof: new Uint8Array() + }; +} +export const MsgConnectionOpenAck = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + aminoType: "cosmos-sdk/MsgConnectionOpenAck", + encode(message: MsgConnectionOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.counterpartyConnectionId !== "") { + writer.uint32(18).string(message.counterpartyConnectionId); + } + if (message.version !== undefined) { + Version.encode(message.version, writer.uint32(26).fork()).ldelim(); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(34).fork()).ldelim(); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(42).fork()).ldelim(); + } + if (message.proofTry.length !== 0) { + writer.uint32(50).bytes(message.proofTry); + } + if (message.proofClient.length !== 0) { + writer.uint32(58).bytes(message.proofClient); + } + if (message.proofConsensus.length !== 0) { + writer.uint32(66).bytes(message.proofConsensus); + } + if (message.consensusHeight !== undefined) { + Height.encode(message.consensusHeight, writer.uint32(74).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(82).string(message.signer); + } + if (message.hostConsensusStateProof.length !== 0) { + writer.uint32(90).bytes(message.hostConsensusStateProof); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.counterpartyConnectionId = reader.string(); + break; + case 3: + message.version = Version.decode(reader, reader.uint32()); + break; + case 4: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 5: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 6: + message.proofTry = reader.bytes(); + break; + case 7: + message.proofClient = reader.bytes(); + break; + case 8: + message.proofConsensus = reader.bytes(); + break; + case 9: + message.consensusHeight = Height.decode(reader, reader.uint32()); + break; + case 10: + message.signer = reader.string(); + break; + case 11: + message.hostConsensusStateProof = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgConnectionOpenAck { + const message = createBaseMsgConnectionOpenAck(); + message.connectionId = object.connectionId ?? ""; + message.counterpartyConnectionId = object.counterpartyConnectionId ?? ""; + message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.proofTry = object.proofTry ?? new Uint8Array(); + message.proofClient = object.proofClient ?? new Uint8Array(); + message.proofConsensus = object.proofConsensus ?? new Uint8Array(); + message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; + message.signer = object.signer ?? ""; + message.hostConsensusStateProof = object.hostConsensusStateProof ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgConnectionOpenAckAmino): MsgConnectionOpenAck { + const message = createBaseMsgConnectionOpenAck(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.counterparty_connection_id !== undefined && object.counterparty_connection_id !== null) { + message.counterpartyConnectionId = object.counterparty_connection_id; + } + if (object.version !== undefined && object.version !== null) { + message.version = Version.fromAmino(object.version); + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.proof_try !== undefined && object.proof_try !== null) { + message.proofTry = bytesFromBase64(object.proof_try); + } + if (object.proof_client !== undefined && object.proof_client !== null) { + message.proofClient = bytesFromBase64(object.proof_client); + } + if (object.proof_consensus !== undefined && object.proof_consensus !== null) { + message.proofConsensus = bytesFromBase64(object.proof_consensus); + } + if (object.consensus_height !== undefined && object.consensus_height !== null) { + message.consensusHeight = Height.fromAmino(object.consensus_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.host_consensus_state_proof !== undefined && object.host_consensus_state_proof !== null) { + message.hostConsensusStateProof = bytesFromBase64(object.host_consensus_state_proof); + } + return message; + }, + toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; + obj.version = message.version ? Version.toAmino(message.version) : undefined; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; + obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; + obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; + obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.host_consensus_state_proof = message.hostConsensusStateProof ? base64FromBytes(message.hostConsensusStateProof) : undefined; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { + return MsgConnectionOpenAck.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenAck): MsgConnectionOpenAckAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenAck", + value: MsgConnectionOpenAck.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenAckProtoMsg): MsgConnectionOpenAck { + return MsgConnectionOpenAck.decode(message.value); + }, + toProto(message: MsgConnectionOpenAck): Uint8Array { + return MsgConnectionOpenAck.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenAck): MsgConnectionOpenAckProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + value: MsgConnectionOpenAck.encode(message).finish() + }; + } +}; +function createBaseMsgConnectionOpenAckResponse(): MsgConnectionOpenAckResponse { + return {}; +} +export const MsgConnectionOpenAckResponse = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", + aminoType: "cosmos-sdk/MsgConnectionOpenAckResponse", + encode(_: MsgConnectionOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenAckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgConnectionOpenAckResponse { + const message = createBaseMsgConnectionOpenAckResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenAckResponseAmino): MsgConnectionOpenAckResponse { + const message = createBaseMsgConnectionOpenAckResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenAckResponseAminoMsg): MsgConnectionOpenAckResponse { + return MsgConnectionOpenAckResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenAckResponse", + value: MsgConnectionOpenAckResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenAckResponseProtoMsg): MsgConnectionOpenAckResponse { + return MsgConnectionOpenAckResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenAckResponse): Uint8Array { + return MsgConnectionOpenAckResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", + value: MsgConnectionOpenAckResponse.encode(message).finish() + }; + } +}; +function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { + return { + connectionId: "", + proofAck: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgConnectionOpenConfirm = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + aminoType: "cosmos-sdk/MsgConnectionOpenConfirm", + encode(message: MsgConnectionOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.proofAck.length !== 0) { + writer.uint32(18).bytes(message.proofAck); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.proofAck = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgConnectionOpenConfirm { + const message = createBaseMsgConnectionOpenConfirm(); + message.connectionId = object.connectionId ?? ""; + message.proofAck = object.proofAck ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgConnectionOpenConfirmAmino): MsgConnectionOpenConfirm { + const message = createBaseMsgConnectionOpenConfirm(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.proof_ack !== undefined && object.proof_ack !== null) { + message.proofAck = bytesFromBase64(object.proof_ack); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { + return MsgConnectionOpenConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenConfirm", + value: MsgConnectionOpenConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenConfirmProtoMsg): MsgConnectionOpenConfirm { + return MsgConnectionOpenConfirm.decode(message.value); + }, + toProto(message: MsgConnectionOpenConfirm): Uint8Array { + return MsgConnectionOpenConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + value: MsgConnectionOpenConfirm.encode(message).finish() + }; + } +}; +function createBaseMsgConnectionOpenConfirmResponse(): MsgConnectionOpenConfirmResponse { + return {}; +} +export const MsgConnectionOpenConfirmResponse = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", + aminoType: "cosmos-sdk/MsgConnectionOpenConfirmResponse", + encode(_: MsgConnectionOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgConnectionOpenConfirmResponse { + const message = createBaseMsgConnectionOpenConfirmResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenConfirmResponseAmino): MsgConnectionOpenConfirmResponse { + const message = createBaseMsgConnectionOpenConfirmResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenConfirmResponseAminoMsg): MsgConnectionOpenConfirmResponse { + return MsgConnectionOpenConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenConfirmResponse", + value: MsgConnectionOpenConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenConfirmResponseProtoMsg): MsgConnectionOpenConfirmResponse { + return MsgConnectionOpenConfirmResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenConfirmResponse): Uint8Array { + return MsgConnectionOpenConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", + value: MsgConnectionOpenConfirmResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/lightclients/localhost/v2/localhost.ts b/util/inj-types/ibc/lightclients/localhost/v2/localhost.ts new file mode 100644 index 00000000..2b22b927 --- /dev/null +++ b/util/inj-types/ibc/lightclients/localhost/v2/localhost.ts @@ -0,0 +1,95 @@ +import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +/** ClientState defines the 09-localhost client state */ +export interface ClientState { + /** the latest block height */ + latestHeight: Height; +} +export interface ClientStateProtoMsg { + typeUrl: "/ibc.lightclients.localhost.v2.ClientState"; + value: Uint8Array; +} +/** ClientState defines the 09-localhost client state */ +export interface ClientStateAmino { + /** the latest block height */ + latest_height?: HeightAmino; +} +export interface ClientStateAminoMsg { + type: "cosmos-sdk/ClientState"; + value: ClientStateAmino; +} +/** ClientState defines the 09-localhost client state */ +export interface ClientStateSDKType { + latest_height: HeightSDKType; +} +function createBaseClientState(): ClientState { + return { + latestHeight: Height.fromPartial({}) + }; +} +export const ClientState = { + typeUrl: "/ibc.lightclients.localhost.v2.ClientState", + aminoType: "cosmos-sdk/ClientState", + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.latestHeight !== undefined) { + Height.encode(message.latestHeight, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.latestHeight = Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientState { + const message = createBaseClientState(); + message.latestHeight = object.latestHeight !== undefined && object.latestHeight !== null ? Height.fromPartial(object.latestHeight) : undefined; + return message; + }, + fromAmino(object: ClientStateAmino): ClientState { + const message = createBaseClientState(); + if (object.latest_height !== undefined && object.latest_height !== null) { + message.latestHeight = Height.fromAmino(object.latest_height); + } + return message; + }, + toAmino(message: ClientState): ClientStateAmino { + const obj: any = {}; + obj.latest_height = message.latestHeight ? Height.toAmino(message.latestHeight) : {}; + return obj; + }, + fromAminoMsg(object: ClientStateAminoMsg): ClientState { + return ClientState.fromAmino(object.value); + }, + toAminoMsg(message: ClientState): ClientStateAminoMsg { + return { + type: "cosmos-sdk/ClientState", + value: ClientState.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.localhost.v2.ClientState", + value: ClientState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/lightclients/solomachine/v2/solomachine.ts b/util/inj-types/ibc/lightclients/solomachine/v2/solomachine.ts new file mode 100644 index 00000000..d59035e9 --- /dev/null +++ b/util/inj-types/ibc/lightclients/solomachine/v2/solomachine.ts @@ -0,0 +1,2104 @@ +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; +import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * DataType defines the type of solo machine proof being created. This is done + * to preserve uniqueness of different data sign byte encodings. + */ +export enum DataType { + /** DATA_TYPE_UNINITIALIZED_UNSPECIFIED - Default State */ + DATA_TYPE_UNINITIALIZED_UNSPECIFIED = 0, + /** DATA_TYPE_CLIENT_STATE - Data type for client state verification */ + DATA_TYPE_CLIENT_STATE = 1, + /** DATA_TYPE_CONSENSUS_STATE - Data type for consensus state verification */ + DATA_TYPE_CONSENSUS_STATE = 2, + /** DATA_TYPE_CONNECTION_STATE - Data type for connection state verification */ + DATA_TYPE_CONNECTION_STATE = 3, + /** DATA_TYPE_CHANNEL_STATE - Data type for channel state verification */ + DATA_TYPE_CHANNEL_STATE = 4, + /** DATA_TYPE_PACKET_COMMITMENT - Data type for packet commitment verification */ + DATA_TYPE_PACKET_COMMITMENT = 5, + /** DATA_TYPE_PACKET_ACKNOWLEDGEMENT - Data type for packet acknowledgement verification */ + DATA_TYPE_PACKET_ACKNOWLEDGEMENT = 6, + /** DATA_TYPE_PACKET_RECEIPT_ABSENCE - Data type for packet receipt absence verification */ + DATA_TYPE_PACKET_RECEIPT_ABSENCE = 7, + /** DATA_TYPE_NEXT_SEQUENCE_RECV - Data type for next sequence recv verification */ + DATA_TYPE_NEXT_SEQUENCE_RECV = 8, + /** DATA_TYPE_HEADER - Data type for header verification */ + DATA_TYPE_HEADER = 9, + UNRECOGNIZED = -1, +} +export const DataTypeSDKType = DataType; +export const DataTypeAmino = DataType; +export function dataTypeFromJSON(object: any): DataType { + switch (object) { + case 0: + case "DATA_TYPE_UNINITIALIZED_UNSPECIFIED": + return DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED; + case 1: + case "DATA_TYPE_CLIENT_STATE": + return DataType.DATA_TYPE_CLIENT_STATE; + case 2: + case "DATA_TYPE_CONSENSUS_STATE": + return DataType.DATA_TYPE_CONSENSUS_STATE; + case 3: + case "DATA_TYPE_CONNECTION_STATE": + return DataType.DATA_TYPE_CONNECTION_STATE; + case 4: + case "DATA_TYPE_CHANNEL_STATE": + return DataType.DATA_TYPE_CHANNEL_STATE; + case 5: + case "DATA_TYPE_PACKET_COMMITMENT": + return DataType.DATA_TYPE_PACKET_COMMITMENT; + case 6: + case "DATA_TYPE_PACKET_ACKNOWLEDGEMENT": + return DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT; + case 7: + case "DATA_TYPE_PACKET_RECEIPT_ABSENCE": + return DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE; + case 8: + case "DATA_TYPE_NEXT_SEQUENCE_RECV": + return DataType.DATA_TYPE_NEXT_SEQUENCE_RECV; + case 9: + case "DATA_TYPE_HEADER": + return DataType.DATA_TYPE_HEADER; + case -1: + case "UNRECOGNIZED": + default: + return DataType.UNRECOGNIZED; + } +} +export function dataTypeToJSON(object: DataType): string { + switch (object) { + case DataType.DATA_TYPE_UNINITIALIZED_UNSPECIFIED: + return "DATA_TYPE_UNINITIALIZED_UNSPECIFIED"; + case DataType.DATA_TYPE_CLIENT_STATE: + return "DATA_TYPE_CLIENT_STATE"; + case DataType.DATA_TYPE_CONSENSUS_STATE: + return "DATA_TYPE_CONSENSUS_STATE"; + case DataType.DATA_TYPE_CONNECTION_STATE: + return "DATA_TYPE_CONNECTION_STATE"; + case DataType.DATA_TYPE_CHANNEL_STATE: + return "DATA_TYPE_CHANNEL_STATE"; + case DataType.DATA_TYPE_PACKET_COMMITMENT: + return "DATA_TYPE_PACKET_COMMITMENT"; + case DataType.DATA_TYPE_PACKET_ACKNOWLEDGEMENT: + return "DATA_TYPE_PACKET_ACKNOWLEDGEMENT"; + case DataType.DATA_TYPE_PACKET_RECEIPT_ABSENCE: + return "DATA_TYPE_PACKET_RECEIPT_ABSENCE"; + case DataType.DATA_TYPE_NEXT_SEQUENCE_RECV: + return "DATA_TYPE_NEXT_SEQUENCE_RECV"; + case DataType.DATA_TYPE_HEADER: + return "DATA_TYPE_HEADER"; + case DataType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientState { + /** latest sequence of the client state */ + sequence: bigint; + /** frozen sequence of the solo machine */ + isFrozen: boolean; + consensusState?: ConsensusState; + /** + * when set to true, will allow governance to update a solo machine client. + * The client will be unfrozen if it is frozen. + */ + allowUpdateAfterProposal: boolean; +} +export interface ClientStateProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientState"; + value: Uint8Array; +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientStateAmino { + /** latest sequence of the client state */ + sequence?: string; + /** frozen sequence of the solo machine */ + is_frozen?: boolean; + consensus_state?: ConsensusStateAmino; + /** + * when set to true, will allow governance to update a solo machine client. + * The client will be unfrozen if it is frozen. + */ + allow_update_after_proposal?: boolean; +} +export interface ClientStateAminoMsg { + type: "cosmos-sdk/ClientState"; + value: ClientStateAmino; +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientStateSDKType { + sequence: bigint; + is_frozen: boolean; + consensus_state?: ConsensusStateSDKType; + allow_update_after_proposal: boolean; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusState { + /** public key of the solo machine */ + publicKey?: Any; + /** + * diversifier allows the same public key to be re-used across different solo + * machine clients (potentially on different chains) without being considered + * misbehaviour. + */ + diversifier: string; + timestamp: bigint; +} +export interface ConsensusStateProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState"; + value: Uint8Array; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusStateAmino { + /** public key of the solo machine */ + public_key?: AnyAmino; + /** + * diversifier allows the same public key to be re-used across different solo + * machine clients (potentially on different chains) without being considered + * misbehaviour. + */ + diversifier?: string; + timestamp?: string; +} +export interface ConsensusStateAminoMsg { + type: "cosmos-sdk/ConsensusState"; + value: ConsensusStateAmino; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusStateSDKType { + public_key?: AnySDKType; + diversifier: string; + timestamp: bigint; +} +/** Header defines a solo machine consensus header */ +export interface Header { + /** sequence to update solo machine public key at */ + sequence: bigint; + timestamp: bigint; + signature: Uint8Array; + newPublicKey?: Any; + newDiversifier: string; +} +export interface HeaderProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.Header"; + value: Uint8Array; +} +/** Header defines a solo machine consensus header */ +export interface HeaderAmino { + /** sequence to update solo machine public key at */ + sequence?: string; + timestamp?: string; + signature?: string; + new_public_key?: AnyAmino; + new_diversifier?: string; +} +export interface HeaderAminoMsg { + type: "cosmos-sdk/Header"; + value: HeaderAmino; +} +/** Header defines a solo machine consensus header */ +export interface HeaderSDKType { + sequence: bigint; + timestamp: bigint; + signature: Uint8Array; + new_public_key?: AnySDKType; + new_diversifier: string; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface Misbehaviour { + clientId: string; + sequence: bigint; + signatureOne?: SignatureAndData; + signatureTwo?: SignatureAndData; +} +export interface MisbehaviourProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour"; + value: Uint8Array; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface MisbehaviourAmino { + client_id?: string; + sequence?: string; + signature_one?: SignatureAndDataAmino; + signature_two?: SignatureAndDataAmino; +} +export interface MisbehaviourAminoMsg { + type: "cosmos-sdk/Misbehaviour"; + value: MisbehaviourAmino; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface MisbehaviourSDKType { + client_id: string; + sequence: bigint; + signature_one?: SignatureAndDataSDKType; + signature_two?: SignatureAndDataSDKType; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndData { + signature: Uint8Array; + dataType: DataType; + data: Uint8Array; + timestamp: bigint; +} +export interface SignatureAndDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData"; + value: Uint8Array; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndDataAmino { + signature?: string; + data_type?: DataType; + data?: string; + timestamp?: string; +} +export interface SignatureAndDataAminoMsg { + type: "cosmos-sdk/SignatureAndData"; + value: SignatureAndDataAmino; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndDataSDKType { + signature: Uint8Array; + data_type: DataType; + data: Uint8Array; + timestamp: bigint; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureData { + signatureData: Uint8Array; + timestamp: bigint; +} +export interface TimestampedSignatureDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData"; + value: Uint8Array; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureDataAmino { + signature_data?: string; + timestamp?: string; +} +export interface TimestampedSignatureDataAminoMsg { + type: "cosmos-sdk/TimestampedSignatureData"; + value: TimestampedSignatureDataAmino; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureDataSDKType { + signature_data: Uint8Array; + timestamp: bigint; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytes { + sequence: bigint; + timestamp: bigint; + diversifier: string; + /** type of the data used */ + dataType: DataType; + /** marshaled data */ + data: Uint8Array; +} +export interface SignBytesProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes"; + value: Uint8Array; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytesAmino { + sequence?: string; + timestamp?: string; + diversifier?: string; + /** type of the data used */ + data_type?: DataType; + /** marshaled data */ + data?: string; +} +export interface SignBytesAminoMsg { + type: "cosmos-sdk/SignBytes"; + value: SignBytesAmino; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytesSDKType { + sequence: bigint; + timestamp: bigint; + diversifier: string; + data_type: DataType; + data: Uint8Array; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderData { + /** header public key */ + newPubKey?: Any; + /** header diversifier */ + newDiversifier: string; +} +export interface HeaderDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData"; + value: Uint8Array; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderDataAmino { + /** header public key */ + new_pub_key?: AnyAmino; + /** header diversifier */ + new_diversifier?: string; +} +export interface HeaderDataAminoMsg { + type: "cosmos-sdk/HeaderData"; + value: HeaderDataAmino; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderDataSDKType { + new_pub_key?: AnySDKType; + new_diversifier: string; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateData { + path: Uint8Array; + clientState?: Any; +} +export interface ClientStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData"; + value: Uint8Array; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateDataAmino { + path?: string; + client_state?: AnyAmino; +} +export interface ClientStateDataAminoMsg { + type: "cosmos-sdk/ClientStateData"; + value: ClientStateDataAmino; +} +/** ClientStateData returns the SignBytes data for client state verification. */ +export interface ClientStateDataSDKType { + path: Uint8Array; + client_state?: AnySDKType; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateData { + path: Uint8Array; + consensusState?: Any; +} +export interface ConsensusStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData"; + value: Uint8Array; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateDataAmino { + path?: string; + consensus_state?: AnyAmino; +} +export interface ConsensusStateDataAminoMsg { + type: "cosmos-sdk/ConsensusStateData"; + value: ConsensusStateDataAmino; +} +/** + * ConsensusStateData returns the SignBytes data for consensus state + * verification. + */ +export interface ConsensusStateDataSDKType { + path: Uint8Array; + consensus_state?: AnySDKType; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateData { + path: Uint8Array; + connection?: ConnectionEnd; +} +export interface ConnectionStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData"; + value: Uint8Array; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateDataAmino { + path?: string; + connection?: ConnectionEndAmino; +} +export interface ConnectionStateDataAminoMsg { + type: "cosmos-sdk/ConnectionStateData"; + value: ConnectionStateDataAmino; +} +/** + * ConnectionStateData returns the SignBytes data for connection state + * verification. + */ +export interface ConnectionStateDataSDKType { + path: Uint8Array; + connection?: ConnectionEndSDKType; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateData { + path: Uint8Array; + channel?: Channel; +} +export interface ChannelStateDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData"; + value: Uint8Array; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateDataAmino { + path?: string; + channel?: ChannelAmino; +} +export interface ChannelStateDataAminoMsg { + type: "cosmos-sdk/ChannelStateData"; + value: ChannelStateDataAmino; +} +/** + * ChannelStateData returns the SignBytes data for channel state + * verification. + */ +export interface ChannelStateDataSDKType { + path: Uint8Array; + channel?: ChannelSDKType; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentData { + path: Uint8Array; + commitment: Uint8Array; +} +export interface PacketCommitmentDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData"; + value: Uint8Array; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentDataAmino { + path?: string; + commitment?: string; +} +export interface PacketCommitmentDataAminoMsg { + type: "cosmos-sdk/PacketCommitmentData"; + value: PacketCommitmentDataAmino; +} +/** + * PacketCommitmentData returns the SignBytes data for packet commitment + * verification. + */ +export interface PacketCommitmentDataSDKType { + path: Uint8Array; + commitment: Uint8Array; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementData { + path: Uint8Array; + acknowledgement: Uint8Array; +} +export interface PacketAcknowledgementDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData"; + value: Uint8Array; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementDataAmino { + path?: string; + acknowledgement?: string; +} +export interface PacketAcknowledgementDataAminoMsg { + type: "cosmos-sdk/PacketAcknowledgementData"; + value: PacketAcknowledgementDataAmino; +} +/** + * PacketAcknowledgementData returns the SignBytes data for acknowledgement + * verification. + */ +export interface PacketAcknowledgementDataSDKType { + path: Uint8Array; + acknowledgement: Uint8Array; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceData { + path: Uint8Array; +} +export interface PacketReceiptAbsenceDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData"; + value: Uint8Array; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceDataAmino { + path?: string; +} +export interface PacketReceiptAbsenceDataAminoMsg { + type: "cosmos-sdk/PacketReceiptAbsenceData"; + value: PacketReceiptAbsenceDataAmino; +} +/** + * PacketReceiptAbsenceData returns the SignBytes data for + * packet receipt absence verification. + */ +export interface PacketReceiptAbsenceDataSDKType { + path: Uint8Array; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvData { + path: Uint8Array; + nextSeqRecv: bigint; +} +export interface NextSequenceRecvDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData"; + value: Uint8Array; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvDataAmino { + path?: string; + next_seq_recv?: string; +} +export interface NextSequenceRecvDataAminoMsg { + type: "cosmos-sdk/NextSequenceRecvData"; + value: NextSequenceRecvDataAmino; +} +/** + * NextSequenceRecvData returns the SignBytes data for verification of the next + * sequence to be received. + */ +export interface NextSequenceRecvDataSDKType { + path: Uint8Array; + next_seq_recv: bigint; +} +function createBaseClientState(): ClientState { + return { + sequence: BigInt(0), + isFrozen: false, + consensusState: undefined, + allowUpdateAfterProposal: false + }; +} +export const ClientState = { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", + aminoType: "cosmos-sdk/ClientState", + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.isFrozen === true) { + writer.uint32(16).bool(message.isFrozen); + } + if (message.consensusState !== undefined) { + ConsensusState.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); + } + if (message.allowUpdateAfterProposal === true) { + writer.uint32(32).bool(message.allowUpdateAfterProposal); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.isFrozen = reader.bool(); + break; + case 3: + message.consensusState = ConsensusState.decode(reader, reader.uint32()); + break; + case 4: + message.allowUpdateAfterProposal = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientState { + const message = createBaseClientState(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.isFrozen = object.isFrozen ?? false; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? ConsensusState.fromPartial(object.consensusState) : undefined; + message.allowUpdateAfterProposal = object.allowUpdateAfterProposal ?? false; + return message; + }, + fromAmino(object: ClientStateAmino): ClientState { + const message = createBaseClientState(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.is_frozen !== undefined && object.is_frozen !== null) { + message.isFrozen = object.is_frozen; + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = ConsensusState.fromAmino(object.consensus_state); + } + if (object.allow_update_after_proposal !== undefined && object.allow_update_after_proposal !== null) { + message.allowUpdateAfterProposal = object.allow_update_after_proposal; + } + return message; + }, + toAmino(message: ClientState): ClientStateAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; + obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; + return obj; + }, + fromAminoMsg(object: ClientStateAminoMsg): ClientState { + return ClientState.fromAmino(object.value); + }, + toAminoMsg(message: ClientState): ClientStateAminoMsg { + return { + type: "cosmos-sdk/ClientState", + value: ClientState.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientState", + value: ClientState.encode(message).finish() + }; + } +}; +function createBaseConsensusState(): ConsensusState { + return { + publicKey: undefined, + diversifier: "", + timestamp: BigInt(0) + }; +} +export const ConsensusState = { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState", + aminoType: "cosmos-sdk/ConsensusState", + encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.diversifier !== "") { + writer.uint32(18).string(message.diversifier); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(24).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.diversifier = reader.string(); + break; + case 3: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusState { + const message = createBaseConsensusState(); + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + message.diversifier = object.diversifier ?? ""; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConsensusStateAmino): ConsensusState { + const message = createBaseConsensusState(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.diversifier !== undefined && object.diversifier !== null) { + message.diversifier = object.diversifier; + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: ConsensusState): ConsensusStateAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { + return ConsensusState.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusState): ConsensusStateAminoMsg { + return { + type: "cosmos-sdk/ConsensusState", + value: ConsensusState.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusState", + value: ConsensusState.encode(message).finish() + }; + } +}; +function createBaseHeader(): Header { + return { + sequence: BigInt(0), + timestamp: BigInt(0), + signature: new Uint8Array(), + newPublicKey: undefined, + newDiversifier: "" + }; +} +export const Header = { + typeUrl: "/ibc.lightclients.solomachine.v2.Header", + aminoType: "cosmos-sdk/Header", + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + if (message.signature.length !== 0) { + writer.uint32(26).bytes(message.signature); + } + if (message.newPublicKey !== undefined) { + Any.encode(message.newPublicKey, writer.uint32(34).fork()).ldelim(); + } + if (message.newDiversifier !== "") { + writer.uint32(42).string(message.newDiversifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.signature = reader.bytes(); + break; + case 4: + message.newPublicKey = Any.decode(reader, reader.uint32()); + break; + case 5: + message.newDiversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial
): Header { + const message = createBaseHeader(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + message.signature = object.signature ?? new Uint8Array(); + message.newPublicKey = object.newPublicKey !== undefined && object.newPublicKey !== null ? Any.fromPartial(object.newPublicKey) : undefined; + message.newDiversifier = object.newDiversifier ?? ""; + return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.new_public_key !== undefined && object.new_public_key !== null) { + message.newPublicKey = Any.fromAmino(object.new_public_key); + } + if (object.new_diversifier !== undefined && object.new_diversifier !== null) { + message.newDiversifier = object.new_diversifier; + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + toAminoMsg(message: Header): HeaderAminoMsg { + return { + type: "cosmos-sdk/Header", + value: Header.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.Header", + value: Header.encode(message).finish() + }; + } +}; +function createBaseMisbehaviour(): Misbehaviour { + return { + clientId: "", + sequence: BigInt(0), + signatureOne: undefined, + signatureTwo: undefined + }; +} +export const Misbehaviour = { + typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", + aminoType: "cosmos-sdk/Misbehaviour", + encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(16).uint64(message.sequence); + } + if (message.signatureOne !== undefined) { + SignatureAndData.encode(message.signatureOne, writer.uint32(26).fork()).ldelim(); + } + if (message.signatureTwo !== undefined) { + SignatureAndData.encode(message.signatureTwo, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.sequence = reader.uint64(); + break; + case 3: + message.signatureOne = SignatureAndData.decode(reader, reader.uint32()); + break; + case 4: + message.signatureTwo = SignatureAndData.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Misbehaviour { + const message = createBaseMisbehaviour(); + message.clientId = object.clientId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.signatureOne = object.signatureOne !== undefined && object.signatureOne !== null ? SignatureAndData.fromPartial(object.signatureOne) : undefined; + message.signatureTwo = object.signatureTwo !== undefined && object.signatureTwo !== null ? SignatureAndData.fromPartial(object.signatureTwo) : undefined; + return message; + }, + fromAmino(object: MisbehaviourAmino): Misbehaviour { + const message = createBaseMisbehaviour(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.signature_one !== undefined && object.signature_one !== null) { + message.signatureOne = SignatureAndData.fromAmino(object.signature_one); + } + if (object.signature_two !== undefined && object.signature_two !== null) { + message.signatureTwo = SignatureAndData.fromAmino(object.signature_two); + } + return message; + }, + toAmino(message: Misbehaviour): MisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; + obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviourAminoMsg): Misbehaviour { + return Misbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: Misbehaviour): MisbehaviourAminoMsg { + return { + type: "cosmos-sdk/Misbehaviour", + value: Misbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.Misbehaviour", + value: Misbehaviour.encode(message).finish() + }; + } +}; +function createBaseSignatureAndData(): SignatureAndData { + return { + signature: new Uint8Array(), + dataType: 0, + data: new Uint8Array(), + timestamp: BigInt(0) + }; +} +export const SignatureAndData = { + typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData", + aminoType: "cosmos-sdk/SignatureAndData", + encode(message: SignatureAndData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signature.length !== 0) { + writer.uint32(10).bytes(message.signature); + } + if (message.dataType !== 0) { + writer.uint32(16).int32(message.dataType); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(32).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureAndData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureAndData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signature = reader.bytes(); + break; + case 2: + message.dataType = (reader.int32() as any); + break; + case 3: + message.data = reader.bytes(); + break; + case 4: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureAndData { + const message = createBaseSignatureAndData(); + message.signature = object.signature ?? new Uint8Array(); + message.dataType = object.dataType ?? 0; + message.data = object.data ?? new Uint8Array(); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignatureAndDataAmino): SignatureAndData { + const message = createBaseSignatureAndData(); + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.data_type !== undefined && object.data_type !== null) { + message.dataType = object.data_type; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: SignatureAndData): SignatureAndDataAmino { + const obj: any = {}; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { + return SignatureAndData.fromAmino(object.value); + }, + toAminoMsg(message: SignatureAndData): SignatureAndDataAminoMsg { + return { + type: "cosmos-sdk/SignatureAndData", + value: SignatureAndData.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureAndDataProtoMsg): SignatureAndData { + return SignatureAndData.decode(message.value); + }, + toProto(message: SignatureAndData): Uint8Array { + return SignatureAndData.encode(message).finish(); + }, + toProtoMsg(message: SignatureAndData): SignatureAndDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.SignatureAndData", + value: SignatureAndData.encode(message).finish() + }; + } +}; +function createBaseTimestampedSignatureData(): TimestampedSignatureData { + return { + signatureData: new Uint8Array(), + timestamp: BigInt(0) + }; +} +export const TimestampedSignatureData = { + typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData", + aminoType: "cosmos-sdk/TimestampedSignatureData", + encode(message: TimestampedSignatureData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signatureData.length !== 0) { + writer.uint32(10).bytes(message.signatureData); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TimestampedSignatureData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestampedSignatureData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatureData = reader.bytes(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TimestampedSignatureData { + const message = createBaseTimestampedSignatureData(); + message.signatureData = object.signatureData ?? new Uint8Array(); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: TimestampedSignatureDataAmino): TimestampedSignatureData { + const message = createBaseTimestampedSignatureData(); + if (object.signature_data !== undefined && object.signature_data !== null) { + message.signatureData = bytesFromBase64(object.signature_data); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { + const obj: any = {}; + obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { + return TimestampedSignatureData.fromAmino(object.value); + }, + toAminoMsg(message: TimestampedSignatureData): TimestampedSignatureDataAminoMsg { + return { + type: "cosmos-sdk/TimestampedSignatureData", + value: TimestampedSignatureData.toAmino(message) + }; + }, + fromProtoMsg(message: TimestampedSignatureDataProtoMsg): TimestampedSignatureData { + return TimestampedSignatureData.decode(message.value); + }, + toProto(message: TimestampedSignatureData): Uint8Array { + return TimestampedSignatureData.encode(message).finish(); + }, + toProtoMsg(message: TimestampedSignatureData): TimestampedSignatureDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.TimestampedSignatureData", + value: TimestampedSignatureData.encode(message).finish() + }; + } +}; +function createBaseSignBytes(): SignBytes { + return { + sequence: BigInt(0), + timestamp: BigInt(0), + diversifier: "", + dataType: 0, + data: new Uint8Array() + }; +} +export const SignBytes = { + typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", + aminoType: "cosmos-sdk/SignBytes", + encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + if (message.diversifier !== "") { + writer.uint32(26).string(message.diversifier); + } + if (message.dataType !== 0) { + writer.uint32(32).int32(message.dataType); + } + if (message.data.length !== 0) { + writer.uint32(42).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignBytes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignBytes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.diversifier = reader.string(); + break; + case 4: + message.dataType = (reader.int32() as any); + break; + case 5: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignBytes { + const message = createBaseSignBytes(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + message.diversifier = object.diversifier ?? ""; + message.dataType = object.dataType ?? 0; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: SignBytesAmino): SignBytes { + const message = createBaseSignBytes(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + if (object.diversifier !== undefined && object.diversifier !== null) { + message.diversifier = object.diversifier; + } + if (object.data_type !== undefined && object.data_type !== null) { + message.dataType = object.data_type; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: SignBytes): SignBytesAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: SignBytesAminoMsg): SignBytes { + return SignBytes.fromAmino(object.value); + }, + toAminoMsg(message: SignBytes): SignBytesAminoMsg { + return { + type: "cosmos-sdk/SignBytes", + value: SignBytes.toAmino(message) + }; + }, + fromProtoMsg(message: SignBytesProtoMsg): SignBytes { + return SignBytes.decode(message.value); + }, + toProto(message: SignBytes): Uint8Array { + return SignBytes.encode(message).finish(); + }, + toProtoMsg(message: SignBytes): SignBytesProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.SignBytes", + value: SignBytes.encode(message).finish() + }; + } +}; +function createBaseHeaderData(): HeaderData { + return { + newPubKey: undefined, + newDiversifier: "" + }; +} +export const HeaderData = { + typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData", + aminoType: "cosmos-sdk/HeaderData", + encode(message: HeaderData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.newPubKey !== undefined) { + Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.newDiversifier !== "") { + writer.uint32(18).string(message.newDiversifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HeaderData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeaderData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.newPubKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.newDiversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HeaderData { + const message = createBaseHeaderData(); + message.newPubKey = object.newPubKey !== undefined && object.newPubKey !== null ? Any.fromPartial(object.newPubKey) : undefined; + message.newDiversifier = object.newDiversifier ?? ""; + return message; + }, + fromAmino(object: HeaderDataAmino): HeaderData { + const message = createBaseHeaderData(); + if (object.new_pub_key !== undefined && object.new_pub_key !== null) { + message.newPubKey = Any.fromAmino(object.new_pub_key); + } + if (object.new_diversifier !== undefined && object.new_diversifier !== null) { + message.newDiversifier = object.new_diversifier; + } + return message; + }, + toAmino(message: HeaderData): HeaderDataAmino { + const obj: any = {}; + obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; + return obj; + }, + fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { + return HeaderData.fromAmino(object.value); + }, + toAminoMsg(message: HeaderData): HeaderDataAminoMsg { + return { + type: "cosmos-sdk/HeaderData", + value: HeaderData.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderDataProtoMsg): HeaderData { + return HeaderData.decode(message.value); + }, + toProto(message: HeaderData): Uint8Array { + return HeaderData.encode(message).finish(); + }, + toProtoMsg(message: HeaderData): HeaderDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.HeaderData", + value: HeaderData.encode(message).finish() + }; + } +}; +function createBaseClientStateData(): ClientStateData { + return { + path: new Uint8Array(), + clientState: undefined + }; +} +export const ClientStateData = { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData", + aminoType: "cosmos-sdk/ClientStateData", + encode(message: ClientStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.clientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientStateData { + const message = createBaseClientStateData(); + message.path = object.path ?? new Uint8Array(); + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + return message; + }, + fromAmino(object: ClientStateDataAmino): ClientStateData { + const message = createBaseClientStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + return message; + }, + toAmino(message: ClientStateData): ClientStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + return obj; + }, + fromAminoMsg(object: ClientStateDataAminoMsg): ClientStateData { + return ClientStateData.fromAmino(object.value); + }, + toAminoMsg(message: ClientStateData): ClientStateDataAminoMsg { + return { + type: "cosmos-sdk/ClientStateData", + value: ClientStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateDataProtoMsg): ClientStateData { + return ClientStateData.decode(message.value); + }, + toProto(message: ClientStateData): Uint8Array { + return ClientStateData.encode(message).finish(); + }, + toProtoMsg(message: ClientStateData): ClientStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ClientStateData", + value: ClientStateData.encode(message).finish() + }; + } +}; +function createBaseConsensusStateData(): ConsensusStateData { + return { + path: new Uint8Array(), + consensusState: undefined + }; +} +export const ConsensusStateData = { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData", + aminoType: "cosmos-sdk/ConsensusStateData", + encode(message: ConsensusStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusStateData { + const message = createBaseConsensusStateData(); + message.path = object.path ?? new Uint8Array(); + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + return message; + }, + fromAmino(object: ConsensusStateDataAmino): ConsensusStateData { + const message = createBaseConsensusStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + return message; + }, + toAmino(message: ConsensusStateData): ConsensusStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateDataAminoMsg): ConsensusStateData { + return ConsensusStateData.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusStateData): ConsensusStateDataAminoMsg { + return { + type: "cosmos-sdk/ConsensusStateData", + value: ConsensusStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateDataProtoMsg): ConsensusStateData { + return ConsensusStateData.decode(message.value); + }, + toProto(message: ConsensusStateData): Uint8Array { + return ConsensusStateData.encode(message).finish(); + }, + toProtoMsg(message: ConsensusStateData): ConsensusStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ConsensusStateData", + value: ConsensusStateData.encode(message).finish() + }; + } +}; +function createBaseConnectionStateData(): ConnectionStateData { + return { + path: new Uint8Array(), + connection: undefined + }; +} +export const ConnectionStateData = { + typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData", + aminoType: "cosmos-sdk/ConnectionStateData", + encode(message: ConnectionStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.connection !== undefined) { + ConnectionEnd.encode(message.connection, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.connection = ConnectionEnd.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConnectionStateData { + const message = createBaseConnectionStateData(); + message.path = object.path ?? new Uint8Array(); + message.connection = object.connection !== undefined && object.connection !== null ? ConnectionEnd.fromPartial(object.connection) : undefined; + return message; + }, + fromAmino(object: ConnectionStateDataAmino): ConnectionStateData { + const message = createBaseConnectionStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.connection !== undefined && object.connection !== null) { + message.connection = ConnectionEnd.fromAmino(object.connection); + } + return message; + }, + toAmino(message: ConnectionStateData): ConnectionStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.connection = message.connection ? ConnectionEnd.toAmino(message.connection) : undefined; + return obj; + }, + fromAminoMsg(object: ConnectionStateDataAminoMsg): ConnectionStateData { + return ConnectionStateData.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionStateData): ConnectionStateDataAminoMsg { + return { + type: "cosmos-sdk/ConnectionStateData", + value: ConnectionStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionStateDataProtoMsg): ConnectionStateData { + return ConnectionStateData.decode(message.value); + }, + toProto(message: ConnectionStateData): Uint8Array { + return ConnectionStateData.encode(message).finish(); + }, + toProtoMsg(message: ConnectionStateData): ConnectionStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ConnectionStateData", + value: ConnectionStateData.encode(message).finish() + }; + } +}; +function createBaseChannelStateData(): ChannelStateData { + return { + path: new Uint8Array(), + channel: undefined + }; +} +export const ChannelStateData = { + typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData", + aminoType: "cosmos-sdk/ChannelStateData", + encode(message: ChannelStateData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ChannelStateData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChannelStateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.channel = Channel.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ChannelStateData { + const message = createBaseChannelStateData(); + message.path = object.path ?? new Uint8Array(); + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; + return message; + }, + fromAmino(object: ChannelStateDataAmino): ChannelStateData { + const message = createBaseChannelStateData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + return message; + }, + toAmino(message: ChannelStateData): ChannelStateDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + return obj; + }, + fromAminoMsg(object: ChannelStateDataAminoMsg): ChannelStateData { + return ChannelStateData.fromAmino(object.value); + }, + toAminoMsg(message: ChannelStateData): ChannelStateDataAminoMsg { + return { + type: "cosmos-sdk/ChannelStateData", + value: ChannelStateData.toAmino(message) + }; + }, + fromProtoMsg(message: ChannelStateDataProtoMsg): ChannelStateData { + return ChannelStateData.decode(message.value); + }, + toProto(message: ChannelStateData): Uint8Array { + return ChannelStateData.encode(message).finish(); + }, + toProtoMsg(message: ChannelStateData): ChannelStateDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.ChannelStateData", + value: ChannelStateData.encode(message).finish() + }; + } +}; +function createBasePacketCommitmentData(): PacketCommitmentData { + return { + path: new Uint8Array(), + commitment: new Uint8Array() + }; +} +export const PacketCommitmentData = { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData", + aminoType: "cosmos-sdk/PacketCommitmentData", + encode(message: PacketCommitmentData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.commitment.length !== 0) { + writer.uint32(18).bytes(message.commitment); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketCommitmentData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketCommitmentData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.commitment = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketCommitmentData { + const message = createBasePacketCommitmentData(); + message.path = object.path ?? new Uint8Array(); + message.commitment = object.commitment ?? new Uint8Array(); + return message; + }, + fromAmino(object: PacketCommitmentDataAmino): PacketCommitmentData { + const message = createBasePacketCommitmentData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.commitment !== undefined && object.commitment !== null) { + message.commitment = bytesFromBase64(object.commitment); + } + return message; + }, + toAmino(message: PacketCommitmentData): PacketCommitmentDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.commitment = message.commitment ? base64FromBytes(message.commitment) : undefined; + return obj; + }, + fromAminoMsg(object: PacketCommitmentDataAminoMsg): PacketCommitmentData { + return PacketCommitmentData.fromAmino(object.value); + }, + toAminoMsg(message: PacketCommitmentData): PacketCommitmentDataAminoMsg { + return { + type: "cosmos-sdk/PacketCommitmentData", + value: PacketCommitmentData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketCommitmentDataProtoMsg): PacketCommitmentData { + return PacketCommitmentData.decode(message.value); + }, + toProto(message: PacketCommitmentData): Uint8Array { + return PacketCommitmentData.encode(message).finish(); + }, + toProtoMsg(message: PacketCommitmentData): PacketCommitmentDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketCommitmentData", + value: PacketCommitmentData.encode(message).finish() + }; + } +}; +function createBasePacketAcknowledgementData(): PacketAcknowledgementData { + return { + path: new Uint8Array(), + acknowledgement: new Uint8Array() + }; +} +export const PacketAcknowledgementData = { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData", + aminoType: "cosmos-sdk/PacketAcknowledgementData", + encode(message: PacketAcknowledgementData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.acknowledgement.length !== 0) { + writer.uint32(18).bytes(message.acknowledgement); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketAcknowledgementData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketAcknowledgementData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.acknowledgement = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketAcknowledgementData { + const message = createBasePacketAcknowledgementData(); + message.path = object.path ?? new Uint8Array(); + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + return message; + }, + fromAmino(object: PacketAcknowledgementDataAmino): PacketAcknowledgementData { + const message = createBasePacketAcknowledgementData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = bytesFromBase64(object.acknowledgement); + } + return message; + }, + toAmino(message: PacketAcknowledgementData): PacketAcknowledgementDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; + return obj; + }, + fromAminoMsg(object: PacketAcknowledgementDataAminoMsg): PacketAcknowledgementData { + return PacketAcknowledgementData.fromAmino(object.value); + }, + toAminoMsg(message: PacketAcknowledgementData): PacketAcknowledgementDataAminoMsg { + return { + type: "cosmos-sdk/PacketAcknowledgementData", + value: PacketAcknowledgementData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketAcknowledgementDataProtoMsg): PacketAcknowledgementData { + return PacketAcknowledgementData.decode(message.value); + }, + toProto(message: PacketAcknowledgementData): Uint8Array { + return PacketAcknowledgementData.encode(message).finish(); + }, + toProtoMsg(message: PacketAcknowledgementData): PacketAcknowledgementDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData", + value: PacketAcknowledgementData.encode(message).finish() + }; + } +}; +function createBasePacketReceiptAbsenceData(): PacketReceiptAbsenceData { + return { + path: new Uint8Array() + }; +} +export const PacketReceiptAbsenceData = { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData", + aminoType: "cosmos-sdk/PacketReceiptAbsenceData", + encode(message: PacketReceiptAbsenceData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketReceiptAbsenceData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketReceiptAbsenceData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketReceiptAbsenceData { + const message = createBasePacketReceiptAbsenceData(); + message.path = object.path ?? new Uint8Array(); + return message; + }, + fromAmino(object: PacketReceiptAbsenceDataAmino): PacketReceiptAbsenceData { + const message = createBasePacketReceiptAbsenceData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + return message; + }, + toAmino(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + return obj; + }, + fromAminoMsg(object: PacketReceiptAbsenceDataAminoMsg): PacketReceiptAbsenceData { + return PacketReceiptAbsenceData.fromAmino(object.value); + }, + toAminoMsg(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataAminoMsg { + return { + type: "cosmos-sdk/PacketReceiptAbsenceData", + value: PacketReceiptAbsenceData.toAmino(message) + }; + }, + fromProtoMsg(message: PacketReceiptAbsenceDataProtoMsg): PacketReceiptAbsenceData { + return PacketReceiptAbsenceData.decode(message.value); + }, + toProto(message: PacketReceiptAbsenceData): Uint8Array { + return PacketReceiptAbsenceData.encode(message).finish(); + }, + toProtoMsg(message: PacketReceiptAbsenceData): PacketReceiptAbsenceDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData", + value: PacketReceiptAbsenceData.encode(message).finish() + }; + } +}; +function createBaseNextSequenceRecvData(): NextSequenceRecvData { + return { + path: new Uint8Array(), + nextSeqRecv: BigInt(0) + }; +} +export const NextSequenceRecvData = { + typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData", + aminoType: "cosmos-sdk/NextSequenceRecvData", + encode(message: NextSequenceRecvData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.path.length !== 0) { + writer.uint32(10).bytes(message.path); + } + if (message.nextSeqRecv !== BigInt(0)) { + writer.uint32(16).uint64(message.nextSeqRecv); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): NextSequenceRecvData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNextSequenceRecvData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.nextSeqRecv = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): NextSequenceRecvData { + const message = createBaseNextSequenceRecvData(); + message.path = object.path ?? new Uint8Array(); + message.nextSeqRecv = object.nextSeqRecv !== undefined && object.nextSeqRecv !== null ? BigInt(object.nextSeqRecv.toString()) : BigInt(0); + return message; + }, + fromAmino(object: NextSequenceRecvDataAmino): NextSequenceRecvData { + const message = createBaseNextSequenceRecvData(); + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.next_seq_recv !== undefined && object.next_seq_recv !== null) { + message.nextSeqRecv = BigInt(object.next_seq_recv); + } + return message; + }, + toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { + const obj: any = {}; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; + return obj; + }, + fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { + return NextSequenceRecvData.fromAmino(object.value); + }, + toAminoMsg(message: NextSequenceRecvData): NextSequenceRecvDataAminoMsg { + return { + type: "cosmos-sdk/NextSequenceRecvData", + value: NextSequenceRecvData.toAmino(message) + }; + }, + fromProtoMsg(message: NextSequenceRecvDataProtoMsg): NextSequenceRecvData { + return NextSequenceRecvData.decode(message.value); + }, + toProto(message: NextSequenceRecvData): Uint8Array { + return NextSequenceRecvData.encode(message).finish(); + }, + toProtoMsg(message: NextSequenceRecvData): NextSequenceRecvDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v2.NextSequenceRecvData", + value: NextSequenceRecvData.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/lightclients/solomachine/v3/solomachine.ts b/util/inj-types/ibc/lightclients/solomachine/v3/solomachine.ts new file mode 100644 index 00000000..9630ca9d --- /dev/null +++ b/util/inj-types/ibc/lightclients/solomachine/v3/solomachine.ts @@ -0,0 +1,1071 @@ +import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientState { + /** latest sequence of the client state */ + sequence: bigint; + /** frozen sequence of the solo machine */ + isFrozen: boolean; + consensusState?: ConsensusState; +} +export interface ClientStateProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v3.ClientState"; + value: Uint8Array; +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientStateAmino { + /** latest sequence of the client state */ + sequence?: string; + /** frozen sequence of the solo machine */ + is_frozen?: boolean; + consensus_state?: ConsensusStateAmino; +} +export interface ClientStateAminoMsg { + type: "cosmos-sdk/ClientState"; + value: ClientStateAmino; +} +/** + * ClientState defines a solo machine client that tracks the current consensus + * state and if the client is frozen. + */ +export interface ClientStateSDKType { + sequence: bigint; + is_frozen: boolean; + consensus_state?: ConsensusStateSDKType; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusState { + /** public key of the solo machine */ + publicKey?: Any; + /** + * diversifier allows the same public key to be re-used across different solo + * machine clients (potentially on different chains) without being considered + * misbehaviour. + */ + diversifier: string; + timestamp: bigint; +} +export interface ConsensusStateProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v3.ConsensusState"; + value: Uint8Array; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusStateAmino { + /** public key of the solo machine */ + public_key?: AnyAmino; + /** + * diversifier allows the same public key to be re-used across different solo + * machine clients (potentially on different chains) without being considered + * misbehaviour. + */ + diversifier?: string; + timestamp?: string; +} +export interface ConsensusStateAminoMsg { + type: "cosmos-sdk/ConsensusState"; + value: ConsensusStateAmino; +} +/** + * ConsensusState defines a solo machine consensus state. The sequence of a + * consensus state is contained in the "height" key used in storing the + * consensus state. + */ +export interface ConsensusStateSDKType { + public_key?: AnySDKType; + diversifier: string; + timestamp: bigint; +} +/** Header defines a solo machine consensus header */ +export interface Header { + timestamp: bigint; + signature: Uint8Array; + newPublicKey?: Any; + newDiversifier: string; +} +export interface HeaderProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v3.Header"; + value: Uint8Array; +} +/** Header defines a solo machine consensus header */ +export interface HeaderAmino { + timestamp?: string; + signature?: string; + new_public_key?: AnyAmino; + new_diversifier?: string; +} +export interface HeaderAminoMsg { + type: "cosmos-sdk/Header"; + value: HeaderAmino; +} +/** Header defines a solo machine consensus header */ +export interface HeaderSDKType { + timestamp: bigint; + signature: Uint8Array; + new_public_key?: AnySDKType; + new_diversifier: string; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface Misbehaviour { + sequence: bigint; + signatureOne?: SignatureAndData; + signatureTwo?: SignatureAndData; +} +export interface MisbehaviourProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v3.Misbehaviour"; + value: Uint8Array; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface MisbehaviourAmino { + sequence?: string; + signature_one?: SignatureAndDataAmino; + signature_two?: SignatureAndDataAmino; +} +export interface MisbehaviourAminoMsg { + type: "cosmos-sdk/Misbehaviour"; + value: MisbehaviourAmino; +} +/** + * Misbehaviour defines misbehaviour for a solo machine which consists + * of a sequence and two signatures over different messages at that sequence. + */ +export interface MisbehaviourSDKType { + sequence: bigint; + signature_one?: SignatureAndDataSDKType; + signature_two?: SignatureAndDataSDKType; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndData { + signature: Uint8Array; + path: Uint8Array; + data: Uint8Array; + timestamp: bigint; +} +export interface SignatureAndDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v3.SignatureAndData"; + value: Uint8Array; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndDataAmino { + signature?: string; + path?: string; + data?: string; + timestamp?: string; +} +export interface SignatureAndDataAminoMsg { + type: "cosmos-sdk/SignatureAndData"; + value: SignatureAndDataAmino; +} +/** + * SignatureAndData contains a signature and the data signed over to create that + * signature. + */ +export interface SignatureAndDataSDKType { + signature: Uint8Array; + path: Uint8Array; + data: Uint8Array; + timestamp: bigint; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureData { + signatureData: Uint8Array; + timestamp: bigint; +} +export interface TimestampedSignatureDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v3.TimestampedSignatureData"; + value: Uint8Array; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureDataAmino { + signature_data?: string; + timestamp?: string; +} +export interface TimestampedSignatureDataAminoMsg { + type: "cosmos-sdk/TimestampedSignatureData"; + value: TimestampedSignatureDataAmino; +} +/** + * TimestampedSignatureData contains the signature data and the timestamp of the + * signature. + */ +export interface TimestampedSignatureDataSDKType { + signature_data: Uint8Array; + timestamp: bigint; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytes { + /** the sequence number */ + sequence: bigint; + /** the proof timestamp */ + timestamp: bigint; + /** the public key diversifier */ + diversifier: string; + /** the standardised path bytes */ + path: Uint8Array; + /** the marshaled data bytes */ + data: Uint8Array; +} +export interface SignBytesProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v3.SignBytes"; + value: Uint8Array; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytesAmino { + /** the sequence number */ + sequence?: string; + /** the proof timestamp */ + timestamp?: string; + /** the public key diversifier */ + diversifier?: string; + /** the standardised path bytes */ + path?: string; + /** the marshaled data bytes */ + data?: string; +} +export interface SignBytesAminoMsg { + type: "cosmos-sdk/SignBytes"; + value: SignBytesAmino; +} +/** SignBytes defines the signed bytes used for signature verification. */ +export interface SignBytesSDKType { + sequence: bigint; + timestamp: bigint; + diversifier: string; + path: Uint8Array; + data: Uint8Array; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderData { + /** header public key */ + newPubKey?: Any; + /** header diversifier */ + newDiversifier: string; +} +export interface HeaderDataProtoMsg { + typeUrl: "/ibc.lightclients.solomachine.v3.HeaderData"; + value: Uint8Array; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderDataAmino { + /** header public key */ + new_pub_key?: AnyAmino; + /** header diversifier */ + new_diversifier?: string; +} +export interface HeaderDataAminoMsg { + type: "cosmos-sdk/HeaderData"; + value: HeaderDataAmino; +} +/** HeaderData returns the SignBytes data for update verification. */ +export interface HeaderDataSDKType { + new_pub_key?: AnySDKType; + new_diversifier: string; +} +function createBaseClientState(): ClientState { + return { + sequence: BigInt(0), + isFrozen: false, + consensusState: undefined + }; +} +export const ClientState = { + typeUrl: "/ibc.lightclients.solomachine.v3.ClientState", + aminoType: "cosmos-sdk/ClientState", + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.isFrozen === true) { + writer.uint32(16).bool(message.isFrozen); + } + if (message.consensusState !== undefined) { + ConsensusState.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.isFrozen = reader.bool(); + break; + case 3: + message.consensusState = ConsensusState.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientState { + const message = createBaseClientState(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.isFrozen = object.isFrozen ?? false; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? ConsensusState.fromPartial(object.consensusState) : undefined; + return message; + }, + fromAmino(object: ClientStateAmino): ClientState { + const message = createBaseClientState(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.is_frozen !== undefined && object.is_frozen !== null) { + message.isFrozen = object.is_frozen; + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = ConsensusState.fromAmino(object.consensus_state); + } + return message; + }, + toAmino(message: ClientState): ClientStateAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; + obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; + return obj; + }, + fromAminoMsg(object: ClientStateAminoMsg): ClientState { + return ClientState.fromAmino(object.value); + }, + toAminoMsg(message: ClientState): ClientStateAminoMsg { + return { + type: "cosmos-sdk/ClientState", + value: ClientState.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v3.ClientState", + value: ClientState.encode(message).finish() + }; + } +}; +function createBaseConsensusState(): ConsensusState { + return { + publicKey: undefined, + diversifier: "", + timestamp: BigInt(0) + }; +} +export const ConsensusState = { + typeUrl: "/ibc.lightclients.solomachine.v3.ConsensusState", + aminoType: "cosmos-sdk/ConsensusState", + encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.diversifier !== "") { + writer.uint32(18).string(message.diversifier); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(24).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.diversifier = reader.string(); + break; + case 3: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusState { + const message = createBaseConsensusState(); + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + message.diversifier = object.diversifier ?? ""; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConsensusStateAmino): ConsensusState { + const message = createBaseConsensusState(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.diversifier !== undefined && object.diversifier !== null) { + message.diversifier = object.diversifier; + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: ConsensusState): ConsensusStateAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { + return ConsensusState.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusState): ConsensusStateAminoMsg { + return { + type: "cosmos-sdk/ConsensusState", + value: ConsensusState.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v3.ConsensusState", + value: ConsensusState.encode(message).finish() + }; + } +}; +function createBaseHeader(): Header { + return { + timestamp: BigInt(0), + signature: new Uint8Array(), + newPublicKey: undefined, + newDiversifier: "" + }; +} +export const Header = { + typeUrl: "/ibc.lightclients.solomachine.v3.Header", + aminoType: "cosmos-sdk/Header", + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.timestamp !== BigInt(0)) { + writer.uint32(8).uint64(message.timestamp); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + if (message.newPublicKey !== undefined) { + Any.encode(message.newPublicKey, writer.uint32(26).fork()).ldelim(); + } + if (message.newDiversifier !== "") { + writer.uint32(34).string(message.newDiversifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.timestamp = reader.uint64(); + break; + case 2: + message.signature = reader.bytes(); + break; + case 3: + message.newPublicKey = Any.decode(reader, reader.uint32()); + break; + case 4: + message.newDiversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial
): Header { + const message = createBaseHeader(); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + message.signature = object.signature ?? new Uint8Array(); + message.newPublicKey = object.newPublicKey !== undefined && object.newPublicKey !== null ? Any.fromPartial(object.newPublicKey) : undefined; + message.newDiversifier = object.newDiversifier ?? ""; + return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.new_public_key !== undefined && object.new_public_key !== null) { + message.newPublicKey = Any.fromAmino(object.new_public_key); + } + if (object.new_diversifier !== undefined && object.new_diversifier !== null) { + message.newDiversifier = object.new_diversifier; + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + toAminoMsg(message: Header): HeaderAminoMsg { + return { + type: "cosmos-sdk/Header", + value: Header.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v3.Header", + value: Header.encode(message).finish() + }; + } +}; +function createBaseMisbehaviour(): Misbehaviour { + return { + sequence: BigInt(0), + signatureOne: undefined, + signatureTwo: undefined + }; +} +export const Misbehaviour = { + typeUrl: "/ibc.lightclients.solomachine.v3.Misbehaviour", + aminoType: "cosmos-sdk/Misbehaviour", + encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.signatureOne !== undefined) { + SignatureAndData.encode(message.signatureOne, writer.uint32(18).fork()).ldelim(); + } + if (message.signatureTwo !== undefined) { + SignatureAndData.encode(message.signatureTwo, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.signatureOne = SignatureAndData.decode(reader, reader.uint32()); + break; + case 3: + message.signatureTwo = SignatureAndData.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Misbehaviour { + const message = createBaseMisbehaviour(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.signatureOne = object.signatureOne !== undefined && object.signatureOne !== null ? SignatureAndData.fromPartial(object.signatureOne) : undefined; + message.signatureTwo = object.signatureTwo !== undefined && object.signatureTwo !== null ? SignatureAndData.fromPartial(object.signatureTwo) : undefined; + return message; + }, + fromAmino(object: MisbehaviourAmino): Misbehaviour { + const message = createBaseMisbehaviour(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.signature_one !== undefined && object.signature_one !== null) { + message.signatureOne = SignatureAndData.fromAmino(object.signature_one); + } + if (object.signature_two !== undefined && object.signature_two !== null) { + message.signatureTwo = SignatureAndData.fromAmino(object.signature_two); + } + return message; + }, + toAmino(message: Misbehaviour): MisbehaviourAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; + obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviourAminoMsg): Misbehaviour { + return Misbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: Misbehaviour): MisbehaviourAminoMsg { + return { + type: "cosmos-sdk/Misbehaviour", + value: Misbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v3.Misbehaviour", + value: Misbehaviour.encode(message).finish() + }; + } +}; +function createBaseSignatureAndData(): SignatureAndData { + return { + signature: new Uint8Array(), + path: new Uint8Array(), + data: new Uint8Array(), + timestamp: BigInt(0) + }; +} +export const SignatureAndData = { + typeUrl: "/ibc.lightclients.solomachine.v3.SignatureAndData", + aminoType: "cosmos-sdk/SignatureAndData", + encode(message: SignatureAndData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signature.length !== 0) { + writer.uint32(10).bytes(message.signature); + } + if (message.path.length !== 0) { + writer.uint32(18).bytes(message.path); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(32).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureAndData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureAndData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signature = reader.bytes(); + break; + case 2: + message.path = reader.bytes(); + break; + case 3: + message.data = reader.bytes(); + break; + case 4: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureAndData { + const message = createBaseSignatureAndData(); + message.signature = object.signature ?? new Uint8Array(); + message.path = object.path ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignatureAndDataAmino): SignatureAndData { + const message = createBaseSignatureAndData(); + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: SignatureAndData): SignatureAndDataAmino { + const obj: any = {}; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { + return SignatureAndData.fromAmino(object.value); + }, + toAminoMsg(message: SignatureAndData): SignatureAndDataAminoMsg { + return { + type: "cosmos-sdk/SignatureAndData", + value: SignatureAndData.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureAndDataProtoMsg): SignatureAndData { + return SignatureAndData.decode(message.value); + }, + toProto(message: SignatureAndData): Uint8Array { + return SignatureAndData.encode(message).finish(); + }, + toProtoMsg(message: SignatureAndData): SignatureAndDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v3.SignatureAndData", + value: SignatureAndData.encode(message).finish() + }; + } +}; +function createBaseTimestampedSignatureData(): TimestampedSignatureData { + return { + signatureData: new Uint8Array(), + timestamp: BigInt(0) + }; +} +export const TimestampedSignatureData = { + typeUrl: "/ibc.lightclients.solomachine.v3.TimestampedSignatureData", + aminoType: "cosmos-sdk/TimestampedSignatureData", + encode(message: TimestampedSignatureData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signatureData.length !== 0) { + writer.uint32(10).bytes(message.signatureData); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TimestampedSignatureData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestampedSignatureData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatureData = reader.bytes(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TimestampedSignatureData { + const message = createBaseTimestampedSignatureData(); + message.signatureData = object.signatureData ?? new Uint8Array(); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: TimestampedSignatureDataAmino): TimestampedSignatureData { + const message = createBaseTimestampedSignatureData(); + if (object.signature_data !== undefined && object.signature_data !== null) { + message.signatureData = bytesFromBase64(object.signature_data); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { + const obj: any = {}; + obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + return obj; + }, + fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { + return TimestampedSignatureData.fromAmino(object.value); + }, + toAminoMsg(message: TimestampedSignatureData): TimestampedSignatureDataAminoMsg { + return { + type: "cosmos-sdk/TimestampedSignatureData", + value: TimestampedSignatureData.toAmino(message) + }; + }, + fromProtoMsg(message: TimestampedSignatureDataProtoMsg): TimestampedSignatureData { + return TimestampedSignatureData.decode(message.value); + }, + toProto(message: TimestampedSignatureData): Uint8Array { + return TimestampedSignatureData.encode(message).finish(); + }, + toProtoMsg(message: TimestampedSignatureData): TimestampedSignatureDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v3.TimestampedSignatureData", + value: TimestampedSignatureData.encode(message).finish() + }; + } +}; +function createBaseSignBytes(): SignBytes { + return { + sequence: BigInt(0), + timestamp: BigInt(0), + diversifier: "", + path: new Uint8Array(), + data: new Uint8Array() + }; +} +export const SignBytes = { + typeUrl: "/ibc.lightclients.solomachine.v3.SignBytes", + aminoType: "cosmos-sdk/SignBytes", + encode(message: SignBytes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + if (message.diversifier !== "") { + writer.uint32(26).string(message.diversifier); + } + if (message.path.length !== 0) { + writer.uint32(34).bytes(message.path); + } + if (message.data.length !== 0) { + writer.uint32(42).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignBytes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignBytes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.diversifier = reader.string(); + break; + case 4: + message.path = reader.bytes(); + break; + case 5: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignBytes { + const message = createBaseSignBytes(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + message.diversifier = object.diversifier ?? ""; + message.path = object.path ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: SignBytesAmino): SignBytes { + const message = createBaseSignBytes(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + if (object.diversifier !== undefined && object.diversifier !== null) { + message.diversifier = object.diversifier; + } + if (object.path !== undefined && object.path !== null) { + message.path = bytesFromBase64(object.path); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: SignBytes): SignBytesAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.path = message.path ? base64FromBytes(message.path) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: SignBytesAminoMsg): SignBytes { + return SignBytes.fromAmino(object.value); + }, + toAminoMsg(message: SignBytes): SignBytesAminoMsg { + return { + type: "cosmos-sdk/SignBytes", + value: SignBytes.toAmino(message) + }; + }, + fromProtoMsg(message: SignBytesProtoMsg): SignBytes { + return SignBytes.decode(message.value); + }, + toProto(message: SignBytes): Uint8Array { + return SignBytes.encode(message).finish(); + }, + toProtoMsg(message: SignBytes): SignBytesProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v3.SignBytes", + value: SignBytes.encode(message).finish() + }; + } +}; +function createBaseHeaderData(): HeaderData { + return { + newPubKey: undefined, + newDiversifier: "" + }; +} +export const HeaderData = { + typeUrl: "/ibc.lightclients.solomachine.v3.HeaderData", + aminoType: "cosmos-sdk/HeaderData", + encode(message: HeaderData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.newPubKey !== undefined) { + Any.encode(message.newPubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.newDiversifier !== "") { + writer.uint32(18).string(message.newDiversifier); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HeaderData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeaderData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.newPubKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.newDiversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HeaderData { + const message = createBaseHeaderData(); + message.newPubKey = object.newPubKey !== undefined && object.newPubKey !== null ? Any.fromPartial(object.newPubKey) : undefined; + message.newDiversifier = object.newDiversifier ?? ""; + return message; + }, + fromAmino(object: HeaderDataAmino): HeaderData { + const message = createBaseHeaderData(); + if (object.new_pub_key !== undefined && object.new_pub_key !== null) { + message.newPubKey = Any.fromAmino(object.new_pub_key); + } + if (object.new_diversifier !== undefined && object.new_diversifier !== null) { + message.newDiversifier = object.new_diversifier; + } + return message; + }, + toAmino(message: HeaderData): HeaderDataAmino { + const obj: any = {}; + obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; + return obj; + }, + fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { + return HeaderData.fromAmino(object.value); + }, + toAminoMsg(message: HeaderData): HeaderDataAminoMsg { + return { + type: "cosmos-sdk/HeaderData", + value: HeaderData.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderDataProtoMsg): HeaderData { + return HeaderData.decode(message.value); + }, + toProto(message: HeaderData): Uint8Array { + return HeaderData.encode(message).finish(); + }, + toProtoMsg(message: HeaderData): HeaderDataProtoMsg { + return { + typeUrl: "/ibc.lightclients.solomachine.v3.HeaderData", + value: HeaderData.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/lightclients/tendermint/v1/tendermint.ts b/util/inj-types/ibc/lightclients/tendermint/v1/tendermint.ts new file mode 100644 index 00000000..fb03e806 --- /dev/null +++ b/util/inj-types/ibc/lightclients/tendermint/v1/tendermint.ts @@ -0,0 +1,860 @@ +import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; +import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; +import { ProofSpec, ProofSpecAmino, ProofSpecSDKType } from "../../../../cosmos/ics23/v1/proofs"; +import { Timestamp } from "../../../../google/protobuf/timestamp"; +import { MerkleRoot, MerkleRootAmino, MerkleRootSDKType } from "../../../core/commitment/v1/commitment"; +import { SignedHeader, SignedHeaderAmino, SignedHeaderSDKType } from "../../../../tendermint/types/types"; +import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +/** + * ClientState from Tendermint tracks the current validator set, latest height, + * and a possible frozen height. + */ +export interface ClientState { + chainId: string; + trustLevel: Fraction; + /** + * duration of the period since the LastestTimestamp during which the + * submitted headers are valid for upgrade + */ + trustingPeriod: Duration; + /** duration of the staking unbonding period */ + unbondingPeriod: Duration; + /** defines how much new (untrusted) header's Time can drift into the future. */ + maxClockDrift: Duration; + /** Block height when the client was frozen due to a misbehaviour */ + frozenHeight: Height; + /** Latest height the client was updated to */ + latestHeight: Height; + /** Proof specifications used in verifying counterparty state */ + proofSpecs: ProofSpec[]; + /** + * Path at which next upgraded client will be committed. + * Each element corresponds to the key for a single CommitmentProof in the + * chained proof. NOTE: ClientState must stored under + * `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored + * under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using + * the default upgrade module, upgrade_path should be []string{"upgrade", + * "upgradedIBCState"}` + */ + upgradePath: string[]; + /** allow_update_after_expiry is deprecated */ + /** @deprecated */ + allowUpdateAfterExpiry: boolean; + /** allow_update_after_misbehaviour is deprecated */ + /** @deprecated */ + allowUpdateAfterMisbehaviour: boolean; +} +export interface ClientStateProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.ClientState"; + value: Uint8Array; +} +/** + * ClientState from Tendermint tracks the current validator set, latest height, + * and a possible frozen height. + */ +export interface ClientStateAmino { + chain_id?: string; + trust_level?: FractionAmino; + /** + * duration of the period since the LastestTimestamp during which the + * submitted headers are valid for upgrade + */ + trusting_period?: DurationAmino; + /** duration of the staking unbonding period */ + unbonding_period?: DurationAmino; + /** defines how much new (untrusted) header's Time can drift into the future. */ + max_clock_drift?: DurationAmino; + /** Block height when the client was frozen due to a misbehaviour */ + frozen_height?: HeightAmino; + /** Latest height the client was updated to */ + latest_height?: HeightAmino; + /** Proof specifications used in verifying counterparty state */ + proof_specs?: ProofSpecAmino[]; + /** + * Path at which next upgraded client will be committed. + * Each element corresponds to the key for a single CommitmentProof in the + * chained proof. NOTE: ClientState must stored under + * `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored + * under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using + * the default upgrade module, upgrade_path should be []string{"upgrade", + * "upgradedIBCState"}` + */ + upgrade_path?: string[]; + /** allow_update_after_expiry is deprecated */ + /** @deprecated */ + allow_update_after_expiry?: boolean; + /** allow_update_after_misbehaviour is deprecated */ + /** @deprecated */ + allow_update_after_misbehaviour?: boolean; +} +export interface ClientStateAminoMsg { + type: "cosmos-sdk/ClientState"; + value: ClientStateAmino; +} +/** + * ClientState from Tendermint tracks the current validator set, latest height, + * and a possible frozen height. + */ +export interface ClientStateSDKType { + chain_id: string; + trust_level: FractionSDKType; + trusting_period: DurationSDKType; + unbonding_period: DurationSDKType; + max_clock_drift: DurationSDKType; + frozen_height: HeightSDKType; + latest_height: HeightSDKType; + proof_specs: ProofSpecSDKType[]; + upgrade_path: string[]; + /** @deprecated */ + allow_update_after_expiry: boolean; + /** @deprecated */ + allow_update_after_misbehaviour: boolean; +} +/** ConsensusState defines the consensus state from Tendermint. */ +export interface ConsensusState { + /** + * timestamp that corresponds to the block height in which the ConsensusState + * was stored. + */ + timestamp: Date; + /** commitment root (i.e app hash) */ + root: MerkleRoot; + nextValidatorsHash: Uint8Array; +} +export interface ConsensusStateProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState"; + value: Uint8Array; +} +/** ConsensusState defines the consensus state from Tendermint. */ +export interface ConsensusStateAmino { + /** + * timestamp that corresponds to the block height in which the ConsensusState + * was stored. + */ + timestamp?: string; + /** commitment root (i.e app hash) */ + root?: MerkleRootAmino; + next_validators_hash?: string; +} +export interface ConsensusStateAminoMsg { + type: "cosmos-sdk/ConsensusState"; + value: ConsensusStateAmino; +} +/** ConsensusState defines the consensus state from Tendermint. */ +export interface ConsensusStateSDKType { + timestamp: Date; + root: MerkleRootSDKType; + next_validators_hash: Uint8Array; +} +/** + * Misbehaviour is a wrapper over two conflicting Headers + * that implements Misbehaviour interface expected by ICS-02 + */ +export interface Misbehaviour { + /** ClientID is deprecated */ + /** @deprecated */ + clientId: string; + header1?: Header; + header2?: Header; +} +export interface MisbehaviourProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour"; + value: Uint8Array; +} +/** + * Misbehaviour is a wrapper over two conflicting Headers + * that implements Misbehaviour interface expected by ICS-02 + */ +export interface MisbehaviourAmino { + /** ClientID is deprecated */ + /** @deprecated */ + client_id?: string; + header_1?: HeaderAmino; + header_2?: HeaderAmino; +} +export interface MisbehaviourAminoMsg { + type: "cosmos-sdk/Misbehaviour"; + value: MisbehaviourAmino; +} +/** + * Misbehaviour is a wrapper over two conflicting Headers + * that implements Misbehaviour interface expected by ICS-02 + */ +export interface MisbehaviourSDKType { + /** @deprecated */ + client_id: string; + header_1?: HeaderSDKType; + header_2?: HeaderSDKType; +} +/** + * Header defines the Tendermint client consensus Header. + * It encapsulates all the information necessary to update from a trusted + * Tendermint ConsensusState. The inclusion of TrustedHeight and + * TrustedValidators allows this update to process correctly, so long as the + * ConsensusState for the TrustedHeight exists, this removes race conditions + * among relayers The SignedHeader and ValidatorSet are the new untrusted update + * fields for the client. The TrustedHeight is the height of a stored + * ConsensusState on the client that will be used to verify the new untrusted + * header. The Trusted ConsensusState must be within the unbonding period of + * current time in order to correctly verify, and the TrustedValidators must + * hash to TrustedConsensusState.NextValidatorsHash since that is the last + * trusted validator set at the TrustedHeight. + */ +export interface Header { + signedHeader?: SignedHeader; + validatorSet?: ValidatorSet; + trustedHeight: Height; + trustedValidators?: ValidatorSet; +} +export interface HeaderProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.Header"; + value: Uint8Array; +} +/** + * Header defines the Tendermint client consensus Header. + * It encapsulates all the information necessary to update from a trusted + * Tendermint ConsensusState. The inclusion of TrustedHeight and + * TrustedValidators allows this update to process correctly, so long as the + * ConsensusState for the TrustedHeight exists, this removes race conditions + * among relayers The SignedHeader and ValidatorSet are the new untrusted update + * fields for the client. The TrustedHeight is the height of a stored + * ConsensusState on the client that will be used to verify the new untrusted + * header. The Trusted ConsensusState must be within the unbonding period of + * current time in order to correctly verify, and the TrustedValidators must + * hash to TrustedConsensusState.NextValidatorsHash since that is the last + * trusted validator set at the TrustedHeight. + */ +export interface HeaderAmino { + signed_header?: SignedHeaderAmino; + validator_set?: ValidatorSetAmino; + trusted_height?: HeightAmino; + trusted_validators?: ValidatorSetAmino; +} +export interface HeaderAminoMsg { + type: "cosmos-sdk/Header"; + value: HeaderAmino; +} +/** + * Header defines the Tendermint client consensus Header. + * It encapsulates all the information necessary to update from a trusted + * Tendermint ConsensusState. The inclusion of TrustedHeight and + * TrustedValidators allows this update to process correctly, so long as the + * ConsensusState for the TrustedHeight exists, this removes race conditions + * among relayers The SignedHeader and ValidatorSet are the new untrusted update + * fields for the client. The TrustedHeight is the height of a stored + * ConsensusState on the client that will be used to verify the new untrusted + * header. The Trusted ConsensusState must be within the unbonding period of + * current time in order to correctly verify, and the TrustedValidators must + * hash to TrustedConsensusState.NextValidatorsHash since that is the last + * trusted validator set at the TrustedHeight. + */ +export interface HeaderSDKType { + signed_header?: SignedHeaderSDKType; + validator_set?: ValidatorSetSDKType; + trusted_height: HeightSDKType; + trusted_validators?: ValidatorSetSDKType; +} +/** + * Fraction defines the protobuf message type for tmmath.Fraction that only + * supports positive values. + */ +export interface Fraction { + numerator: bigint; + denominator: bigint; +} +export interface FractionProtoMsg { + typeUrl: "/ibc.lightclients.tendermint.v1.Fraction"; + value: Uint8Array; +} +/** + * Fraction defines the protobuf message type for tmmath.Fraction that only + * supports positive values. + */ +export interface FractionAmino { + numerator?: string; + denominator?: string; +} +export interface FractionAminoMsg { + type: "cosmos-sdk/Fraction"; + value: FractionAmino; +} +/** + * Fraction defines the protobuf message type for tmmath.Fraction that only + * supports positive values. + */ +export interface FractionSDKType { + numerator: bigint; + denominator: bigint; +} +function createBaseClientState(): ClientState { + return { + chainId: "", + trustLevel: Fraction.fromPartial({}), + trustingPeriod: Duration.fromPartial({}), + unbondingPeriod: Duration.fromPartial({}), + maxClockDrift: Duration.fromPartial({}), + frozenHeight: Height.fromPartial({}), + latestHeight: Height.fromPartial({}), + proofSpecs: [], + upgradePath: [], + allowUpdateAfterExpiry: false, + allowUpdateAfterMisbehaviour: false + }; +} +export const ClientState = { + typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", + aminoType: "cosmos-sdk/ClientState", + encode(message: ClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.chainId !== "") { + writer.uint32(10).string(message.chainId); + } + if (message.trustLevel !== undefined) { + Fraction.encode(message.trustLevel, writer.uint32(18).fork()).ldelim(); + } + if (message.trustingPeriod !== undefined) { + Duration.encode(message.trustingPeriod, writer.uint32(26).fork()).ldelim(); + } + if (message.unbondingPeriod !== undefined) { + Duration.encode(message.unbondingPeriod, writer.uint32(34).fork()).ldelim(); + } + if (message.maxClockDrift !== undefined) { + Duration.encode(message.maxClockDrift, writer.uint32(42).fork()).ldelim(); + } + if (message.frozenHeight !== undefined) { + Height.encode(message.frozenHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.latestHeight !== undefined) { + Height.encode(message.latestHeight, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.proofSpecs) { + ProofSpec.encode(v!, writer.uint32(66).fork()).ldelim(); + } + for (const v of message.upgradePath) { + writer.uint32(74).string(v!); + } + if (message.allowUpdateAfterExpiry === true) { + writer.uint32(80).bool(message.allowUpdateAfterExpiry); + } + if (message.allowUpdateAfterMisbehaviour === true) { + writer.uint32(88).bool(message.allowUpdateAfterMisbehaviour); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chainId = reader.string(); + break; + case 2: + message.trustLevel = Fraction.decode(reader, reader.uint32()); + break; + case 3: + message.trustingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.unbondingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 5: + message.maxClockDrift = Duration.decode(reader, reader.uint32()); + break; + case 6: + message.frozenHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.latestHeight = Height.decode(reader, reader.uint32()); + break; + case 8: + message.proofSpecs.push(ProofSpec.decode(reader, reader.uint32())); + break; + case 9: + message.upgradePath.push(reader.string()); + break; + case 10: + message.allowUpdateAfterExpiry = reader.bool(); + break; + case 11: + message.allowUpdateAfterMisbehaviour = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientState { + const message = createBaseClientState(); + message.chainId = object.chainId ?? ""; + message.trustLevel = object.trustLevel !== undefined && object.trustLevel !== null ? Fraction.fromPartial(object.trustLevel) : undefined; + message.trustingPeriod = object.trustingPeriod !== undefined && object.trustingPeriod !== null ? Duration.fromPartial(object.trustingPeriod) : undefined; + message.unbondingPeriod = object.unbondingPeriod !== undefined && object.unbondingPeriod !== null ? Duration.fromPartial(object.unbondingPeriod) : undefined; + message.maxClockDrift = object.maxClockDrift !== undefined && object.maxClockDrift !== null ? Duration.fromPartial(object.maxClockDrift) : undefined; + message.frozenHeight = object.frozenHeight !== undefined && object.frozenHeight !== null ? Height.fromPartial(object.frozenHeight) : undefined; + message.latestHeight = object.latestHeight !== undefined && object.latestHeight !== null ? Height.fromPartial(object.latestHeight) : undefined; + message.proofSpecs = object.proofSpecs?.map(e => ProofSpec.fromPartial(e)) || []; + message.upgradePath = object.upgradePath?.map(e => e) || []; + message.allowUpdateAfterExpiry = object.allowUpdateAfterExpiry ?? false; + message.allowUpdateAfterMisbehaviour = object.allowUpdateAfterMisbehaviour ?? false; + return message; + }, + fromAmino(object: ClientStateAmino): ClientState { + const message = createBaseClientState(); + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.trust_level !== undefined && object.trust_level !== null) { + message.trustLevel = Fraction.fromAmino(object.trust_level); + } + if (object.trusting_period !== undefined && object.trusting_period !== null) { + message.trustingPeriod = Duration.fromAmino(object.trusting_period); + } + if (object.unbonding_period !== undefined && object.unbonding_period !== null) { + message.unbondingPeriod = Duration.fromAmino(object.unbonding_period); + } + if (object.max_clock_drift !== undefined && object.max_clock_drift !== null) { + message.maxClockDrift = Duration.fromAmino(object.max_clock_drift); + } + if (object.frozen_height !== undefined && object.frozen_height !== null) { + message.frozenHeight = Height.fromAmino(object.frozen_height); + } + if (object.latest_height !== undefined && object.latest_height !== null) { + message.latestHeight = Height.fromAmino(object.latest_height); + } + message.proofSpecs = object.proof_specs?.map(e => ProofSpec.fromAmino(e)) || []; + message.upgradePath = object.upgrade_path?.map(e => e) || []; + if (object.allow_update_after_expiry !== undefined && object.allow_update_after_expiry !== null) { + message.allowUpdateAfterExpiry = object.allow_update_after_expiry; + } + if (object.allow_update_after_misbehaviour !== undefined && object.allow_update_after_misbehaviour !== null) { + message.allowUpdateAfterMisbehaviour = object.allow_update_after_misbehaviour; + } + return message; + }, + toAmino(message: ClientState): ClientStateAmino { + const obj: any = {}; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; + obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; + obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; + obj.max_clock_drift = message.maxClockDrift ? Duration.toAmino(message.maxClockDrift) : undefined; + obj.frozen_height = message.frozenHeight ? Height.toAmino(message.frozenHeight) : {}; + obj.latest_height = message.latestHeight ? Height.toAmino(message.latestHeight) : {}; + if (message.proofSpecs) { + obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); + } else { + obj.proof_specs = message.proofSpecs; + } + if (message.upgradePath) { + obj.upgrade_path = message.upgradePath.map(e => e); + } else { + obj.upgrade_path = message.upgradePath; + } + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; + return obj; + }, + fromAminoMsg(object: ClientStateAminoMsg): ClientState { + return ClientState.fromAmino(object.value); + }, + toAminoMsg(message: ClientState): ClientStateAminoMsg { + return { + type: "cosmos-sdk/ClientState", + value: ClientState.toAmino(message) + }; + }, + fromProtoMsg(message: ClientStateProtoMsg): ClientState { + return ClientState.decode(message.value); + }, + toProto(message: ClientState): Uint8Array { + return ClientState.encode(message).finish(); + }, + toProtoMsg(message: ClientState): ClientStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.ClientState", + value: ClientState.encode(message).finish() + }; + } +}; +function createBaseConsensusState(): ConsensusState { + return { + timestamp: new Date(), + root: MerkleRoot.fromPartial({}), + nextValidatorsHash: new Uint8Array() + }; +} +export const ConsensusState = { + typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState", + aminoType: "cosmos-sdk/ConsensusState", + encode(message: ConsensusState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).ldelim(); + } + if (message.root !== undefined) { + MerkleRoot.encode(message.root, writer.uint32(18).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(26).bytes(message.nextValidatorsHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 2: + message.root = MerkleRoot.decode(reader, reader.uint32()); + break; + case 3: + message.nextValidatorsHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusState { + const message = createBaseConsensusState(); + message.timestamp = object.timestamp ?? undefined; + message.root = object.root !== undefined && object.root !== null ? MerkleRoot.fromPartial(object.root) : undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: ConsensusStateAmino): ConsensusState { + const message = createBaseConsensusState(); + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.root !== undefined && object.root !== null) { + message.root = MerkleRoot.fromAmino(object.root); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + return message; + }, + toAmino(message: ConsensusState): ConsensusStateAmino { + const obj: any = {}; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.root = message.root ? MerkleRoot.toAmino(message.root) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { + return ConsensusState.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusState): ConsensusStateAminoMsg { + return { + type: "cosmos-sdk/ConsensusState", + value: ConsensusState.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateProtoMsg): ConsensusState { + return ConsensusState.decode(message.value); + }, + toProto(message: ConsensusState): Uint8Array { + return ConsensusState.encode(message).finish(); + }, + toProtoMsg(message: ConsensusState): ConsensusStateProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.ConsensusState", + value: ConsensusState.encode(message).finish() + }; + } +}; +function createBaseMisbehaviour(): Misbehaviour { + return { + clientId: "", + header1: undefined, + header2: undefined + }; +} +export const Misbehaviour = { + typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", + aminoType: "cosmos-sdk/Misbehaviour", + encode(message: Misbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.header1 !== undefined) { + Header.encode(message.header1, writer.uint32(18).fork()).ldelim(); + } + if (message.header2 !== undefined) { + Header.encode(message.header2, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Misbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.header1 = Header.decode(reader, reader.uint32()); + break; + case 3: + message.header2 = Header.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Misbehaviour { + const message = createBaseMisbehaviour(); + message.clientId = object.clientId ?? ""; + message.header1 = object.header1 !== undefined && object.header1 !== null ? Header.fromPartial(object.header1) : undefined; + message.header2 = object.header2 !== undefined && object.header2 !== null ? Header.fromPartial(object.header2) : undefined; + return message; + }, + fromAmino(object: MisbehaviourAmino): Misbehaviour { + const message = createBaseMisbehaviour(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.header_1 !== undefined && object.header_1 !== null) { + message.header1 = Header.fromAmino(object.header_1); + } + if (object.header_2 !== undefined && object.header_2 !== null) { + message.header2 = Header.fromAmino(object.header_2); + } + return message; + }, + toAmino(message: Misbehaviour): MisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; + obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviourAminoMsg): Misbehaviour { + return Misbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: Misbehaviour): MisbehaviourAminoMsg { + return { + type: "cosmos-sdk/Misbehaviour", + value: Misbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MisbehaviourProtoMsg): Misbehaviour { + return Misbehaviour.decode(message.value); + }, + toProto(message: Misbehaviour): Uint8Array { + return Misbehaviour.encode(message).finish(); + }, + toProtoMsg(message: Misbehaviour): MisbehaviourProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.Misbehaviour", + value: Misbehaviour.encode(message).finish() + }; + } +}; +function createBaseHeader(): Header { + return { + signedHeader: undefined, + validatorSet: undefined, + trustedHeight: Height.fromPartial({}), + trustedValidators: undefined + }; +} +export const Header = { + typeUrl: "/ibc.lightclients.tendermint.v1.Header", + aminoType: "cosmos-sdk/Header", + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); + } + if (message.trustedHeight !== undefined) { + Height.encode(message.trustedHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.trustedValidators !== undefined) { + ValidatorSet.encode(message.trustedValidators, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + break; + case 3: + message.trustedHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.trustedValidators = ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial
): Header { + const message = createBaseHeader(); + message.signedHeader = object.signedHeader !== undefined && object.signedHeader !== null ? SignedHeader.fromPartial(object.signedHeader) : undefined; + message.validatorSet = object.validatorSet !== undefined && object.validatorSet !== null ? ValidatorSet.fromPartial(object.validatorSet) : undefined; + message.trustedHeight = object.trustedHeight !== undefined && object.trustedHeight !== null ? Height.fromPartial(object.trustedHeight) : undefined; + message.trustedValidators = object.trustedValidators !== undefined && object.trustedValidators !== null ? ValidatorSet.fromPartial(object.trustedValidators) : undefined; + return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.signed_header !== undefined && object.signed_header !== null) { + message.signedHeader = SignedHeader.fromAmino(object.signed_header); + } + if (object.validator_set !== undefined && object.validator_set !== null) { + message.validatorSet = ValidatorSet.fromAmino(object.validator_set); + } + if (object.trusted_height !== undefined && object.trusted_height !== null) { + message.trustedHeight = Height.fromAmino(object.trusted_height); + } + if (object.trusted_validators !== undefined && object.trusted_validators !== null) { + message.trustedValidators = ValidatorSet.fromAmino(object.trusted_validators); + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.signed_header = message.signedHeader ? SignedHeader.toAmino(message.signedHeader) : undefined; + obj.validator_set = message.validatorSet ? ValidatorSet.toAmino(message.validatorSet) : undefined; + obj.trusted_height = message.trustedHeight ? Height.toAmino(message.trustedHeight) : {}; + obj.trusted_validators = message.trustedValidators ? ValidatorSet.toAmino(message.trustedValidators) : undefined; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + toAminoMsg(message: Header): HeaderAminoMsg { + return { + type: "cosmos-sdk/Header", + value: Header.toAmino(message) + }; + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.Header", + value: Header.encode(message).finish() + }; + } +}; +function createBaseFraction(): Fraction { + return { + numerator: BigInt(0), + denominator: BigInt(0) + }; +} +export const Fraction = { + typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", + aminoType: "cosmos-sdk/Fraction", + encode(message: Fraction, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.numerator !== BigInt(0)) { + writer.uint32(8).uint64(message.numerator); + } + if (message.denominator !== BigInt(0)) { + writer.uint32(16).uint64(message.denominator); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Fraction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFraction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.numerator = reader.uint64(); + break; + case 2: + message.denominator = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Fraction { + const message = createBaseFraction(); + message.numerator = object.numerator !== undefined && object.numerator !== null ? BigInt(object.numerator.toString()) : BigInt(0); + message.denominator = object.denominator !== undefined && object.denominator !== null ? BigInt(object.denominator.toString()) : BigInt(0); + return message; + }, + fromAmino(object: FractionAmino): Fraction { + const message = createBaseFraction(); + if (object.numerator !== undefined && object.numerator !== null) { + message.numerator = BigInt(object.numerator); + } + if (object.denominator !== undefined && object.denominator !== null) { + message.denominator = BigInt(object.denominator); + } + return message; + }, + toAmino(message: Fraction): FractionAmino { + const obj: any = {}; + obj.numerator = message.numerator !== BigInt(0) ? message.numerator.toString() : undefined; + obj.denominator = message.denominator !== BigInt(0) ? message.denominator.toString() : undefined; + return obj; + }, + fromAminoMsg(object: FractionAminoMsg): Fraction { + return Fraction.fromAmino(object.value); + }, + toAminoMsg(message: Fraction): FractionAminoMsg { + return { + type: "cosmos-sdk/Fraction", + value: Fraction.toAmino(message) + }; + }, + fromProtoMsg(message: FractionProtoMsg): Fraction { + return Fraction.decode(message.value); + }, + toProto(message: Fraction): Uint8Array { + return Fraction.encode(message).finish(); + }, + toProtoMsg(message: Fraction): FractionProtoMsg { + return { + typeUrl: "/ibc.lightclients.tendermint.v1.Fraction", + value: Fraction.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/ibc/rpc.query.ts b/util/inj-types/ibc/rpc.query.ts new file mode 100644 index 00000000..9f232d85 --- /dev/null +++ b/util/inj-types/ibc/rpc.query.ts @@ -0,0 +1,90 @@ +import { connectComet, HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import { QueryClient } from "@cosmjs/stargate"; +export const createRPCQueryClient = async ({ + rpcEndpoint +}: { + rpcEndpoint: string | HttpEndpoint; +}) => { + const tmClient = await connectComet(rpcEndpoint); + const client = new QueryClient(tmClient); + return { + cosmos: { + auth: { + v1beta1: (await import("../cosmos/auth/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + authz: { + v1beta1: (await import("../cosmos/authz/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + bank: { + v1beta1: (await import("../cosmos/bank/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + base: { + node: { + v1beta1: (await import("../cosmos/base/node/v1beta1/query.rpc.Service")).createRpcQueryExtension(client) + } + }, + consensus: { + v1: (await import("../cosmos/consensus/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + distribution: { + v1beta1: (await import("../cosmos/distribution/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + feegrant: { + v1beta1: (await import("../cosmos/feegrant/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + gov: { + v1: (await import("../cosmos/gov/v1/query.rpc.Query")).createRpcQueryExtension(client), + v1beta1: (await import("../cosmos/gov/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + group: { + v1: (await import("../cosmos/group/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + mint: { + v1beta1: (await import("../cosmos/mint/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + orm: { + query: { + v1alpha1: (await import("../cosmos/orm/query/v1alpha1/query.rpc.Query")).createRpcQueryExtension(client) + } + }, + params: { + v1beta1: (await import("../cosmos/params/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + staking: { + v1beta1: (await import("../cosmos/staking/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + }, + tx: { + v1beta1: (await import("../cosmos/tx/v1beta1/service.rpc.Service")).createRpcQueryExtension(client) + }, + upgrade: { + v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client) + } + }, + ibc: { + applications: { + interchain_accounts: { + controller: { + v1: (await import("./applications/interchain_accounts/controller/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + host: { + v1: (await import("./applications/interchain_accounts/host/v1/query.rpc.Query")).createRpcQueryExtension(client) + } + }, + transfer: { + v1: (await import("./applications/transfer/v1/query.rpc.Query")).createRpcQueryExtension(client) + } + }, + core: { + channel: { + v1: (await import("./core/channel/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + client: { + v1: (await import("./core/client/v1/query.rpc.Query")).createRpcQueryExtension(client) + }, + connection: { + v1: (await import("./core/connection/v1/query.rpc.Query")).createRpcQueryExtension(client) + } + } + } + }; +}; \ No newline at end of file diff --git a/util/inj-types/ibc/rpc.tx.ts b/util/inj-types/ibc/rpc.tx.ts new file mode 100644 index 00000000..b0b4a23d --- /dev/null +++ b/util/inj-types/ibc/rpc.tx.ts @@ -0,0 +1,69 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + cosmos: { + auth: { + v1beta1: new (await import("../cosmos/auth/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + authz: { + v1beta1: new (await import("../cosmos/authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + bank: { + v1beta1: new (await import("../cosmos/bank/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + consensus: { + v1: new (await import("../cosmos/consensus/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + distribution: { + v1beta1: new (await import("../cosmos/distribution/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + feegrant: { + v1beta1: new (await import("../cosmos/feegrant/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + gov: { + v1: new (await import("../cosmos/gov/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v1beta1: new (await import("../cosmos/gov/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + group: { + v1: new (await import("../cosmos/group/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + mint: { + v1beta1: new (await import("../cosmos/mint/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + staking: { + v1beta1: new (await import("../cosmos/staking/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + upgrade: { + v1beta1: new (await import("../cosmos/upgrade/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + vesting: { + v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + } + }, + ibc: { + applications: { + interchain_accounts: { + controller: { + v1: new (await import("./applications/interchain_accounts/controller/v1/tx.rpc.msg")).MsgClientImpl(rpc) + } + }, + transfer: { + v1: new (await import("./applications/transfer/v1/tx.rpc.msg")).MsgClientImpl(rpc) + } + }, + core: { + channel: { + v1: new (await import("./core/channel/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + client: { + v1: new (await import("./core/client/v1/tx.rpc.msg")).MsgClientImpl(rpc) + }, + connection: { + v1: new (await import("./core/connection/v1/tx.rpc.msg")).MsgClientImpl(rpc) + } + } + } +}); \ No newline at end of file diff --git a/util/inj-types/index.ts b/util/inj-types/index.ts new file mode 100644 index 00000000..a90ba99a --- /dev/null +++ b/util/inj-types/index.ts @@ -0,0 +1,20 @@ +/** + * This file and any referenced files were automatically generated by @cosmology/telescope@1.5.0 + * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain + * and run the transpile command or yarn proto command to regenerate this bundle. + */ + +export * from "./amino/bundle"; +export * from "./cosmos_proto/bundle"; +export * from "./cosmos/bundle"; +export * from "./cosmos/client"; +export * from "./cosmwasm/bundle"; +export * from "./cosmwasm/client"; +export * from "./gogoproto/bundle"; +export * from "./ibc/bundle"; +export * from "./ibc/client"; +export * from "./tendermint/bundle"; +export * from "./google/bundle"; +export * from "./varint"; +export * from "./utf8"; +export * from "./binary"; \ No newline at end of file diff --git a/util/inj-types/tendermint/abci/types.ts b/util/inj-types/tendermint/abci/types.ts new file mode 100644 index 00000000..271897d8 --- /dev/null +++ b/util/inj-types/tendermint/abci/types.ts @@ -0,0 +1,5873 @@ +import { Timestamp } from "../../google/protobuf/timestamp"; +import { ConsensusParams, ConsensusParamsAmino, ConsensusParamsSDKType } from "../types/params"; +import { Header, HeaderAmino, HeaderSDKType } from "../types/types"; +import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "../crypto/proof"; +import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; +export enum CheckTxType { + NEW = 0, + RECHECK = 1, + UNRECOGNIZED = -1, +} +export const CheckTxTypeSDKType = CheckTxType; +export const CheckTxTypeAmino = CheckTxType; +export function checkTxTypeFromJSON(object: any): CheckTxType { + switch (object) { + case 0: + case "NEW": + return CheckTxType.NEW; + case 1: + case "RECHECK": + return CheckTxType.RECHECK; + case -1: + case "UNRECOGNIZED": + default: + return CheckTxType.UNRECOGNIZED; + } +} +export function checkTxTypeToJSON(object: CheckTxType): string { + switch (object) { + case CheckTxType.NEW: + return "NEW"; + case CheckTxType.RECHECK: + return "RECHECK"; + case CheckTxType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum ResponseOfferSnapshot_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Snapshot accepted, apply chunks */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** REJECT - Reject this specific snapshot, try others */ + REJECT = 3, + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + REJECT_FORMAT = 4, + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + REJECT_SENDER = 5, + UNRECOGNIZED = -1, +} +export const ResponseOfferSnapshot_ResultSDKType = ResponseOfferSnapshot_Result; +export const ResponseOfferSnapshot_ResultAmino = ResponseOfferSnapshot_Result; +export function responseOfferSnapshot_ResultFromJSON(object: any): ResponseOfferSnapshot_Result { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseOfferSnapshot_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseOfferSnapshot_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseOfferSnapshot_Result.ABORT; + case 3: + case "REJECT": + return ResponseOfferSnapshot_Result.REJECT; + case 4: + case "REJECT_FORMAT": + return ResponseOfferSnapshot_Result.REJECT_FORMAT; + case 5: + case "REJECT_SENDER": + return ResponseOfferSnapshot_Result.REJECT_SENDER; + case -1: + case "UNRECOGNIZED": + default: + return ResponseOfferSnapshot_Result.UNRECOGNIZED; + } +} +export function responseOfferSnapshot_ResultToJSON(object: ResponseOfferSnapshot_Result): string { + switch (object) { + case ResponseOfferSnapshot_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseOfferSnapshot_Result.ACCEPT: + return "ACCEPT"; + case ResponseOfferSnapshot_Result.ABORT: + return "ABORT"; + case ResponseOfferSnapshot_Result.REJECT: + return "REJECT"; + case ResponseOfferSnapshot_Result.REJECT_FORMAT: + return "REJECT_FORMAT"; + case ResponseOfferSnapshot_Result.REJECT_SENDER: + return "REJECT_SENDER"; + case ResponseOfferSnapshot_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum ResponseApplySnapshotChunk_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Chunk successfully accepted */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** RETRY - Retry chunk (combine with refetch and reject) */ + RETRY = 3, + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + RETRY_SNAPSHOT = 4, + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + REJECT_SNAPSHOT = 5, + UNRECOGNIZED = -1, +} +export const ResponseApplySnapshotChunk_ResultSDKType = ResponseApplySnapshotChunk_Result; +export const ResponseApplySnapshotChunk_ResultAmino = ResponseApplySnapshotChunk_Result; +export function responseApplySnapshotChunk_ResultFromJSON(object: any): ResponseApplySnapshotChunk_Result { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseApplySnapshotChunk_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseApplySnapshotChunk_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseApplySnapshotChunk_Result.ABORT; + case 3: + case "RETRY": + return ResponseApplySnapshotChunk_Result.RETRY; + case 4: + case "RETRY_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT; + case 5: + case "REJECT_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseApplySnapshotChunk_Result.UNRECOGNIZED; + } +} +export function responseApplySnapshotChunk_ResultToJSON(object: ResponseApplySnapshotChunk_Result): string { + switch (object) { + case ResponseApplySnapshotChunk_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseApplySnapshotChunk_Result.ACCEPT: + return "ACCEPT"; + case ResponseApplySnapshotChunk_Result.ABORT: + return "ABORT"; + case ResponseApplySnapshotChunk_Result.RETRY: + return "RETRY"; + case ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT: + return "RETRY_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT: + return "REJECT_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} +export const ResponseProcessProposal_ProposalStatusSDKType = ResponseProcessProposal_ProposalStatus; +export const ResponseProcessProposal_ProposalStatusAmino = ResponseProcessProposal_ProposalStatus; +export function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} +export function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} +export const MisbehaviorTypeSDKType = MisbehaviorType; +export const MisbehaviorTypeAmino = MisbehaviorType; +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export interface Request { + echo?: RequestEcho; + flush?: RequestFlush; + info?: RequestInfo; + initChain?: RequestInitChain; + query?: RequestQuery; + beginBlock?: RequestBeginBlock; + checkTx?: RequestCheckTx; + deliverTx?: RequestDeliverTx; + endBlock?: RequestEndBlock; + commit?: RequestCommit; + listSnapshots?: RequestListSnapshots; + offerSnapshot?: RequestOfferSnapshot; + loadSnapshotChunk?: RequestLoadSnapshotChunk; + applySnapshotChunk?: RequestApplySnapshotChunk; + prepareProposal?: RequestPrepareProposal; + processProposal?: RequestProcessProposal; +} +export interface RequestProtoMsg { + typeUrl: "/tendermint.abci.Request"; + value: Uint8Array; +} +export interface RequestAmino { + echo?: RequestEchoAmino; + flush?: RequestFlushAmino; + info?: RequestInfoAmino; + init_chain?: RequestInitChainAmino; + query?: RequestQueryAmino; + begin_block?: RequestBeginBlockAmino; + check_tx?: RequestCheckTxAmino; + deliver_tx?: RequestDeliverTxAmino; + end_block?: RequestEndBlockAmino; + commit?: RequestCommitAmino; + list_snapshots?: RequestListSnapshotsAmino; + offer_snapshot?: RequestOfferSnapshotAmino; + load_snapshot_chunk?: RequestLoadSnapshotChunkAmino; + apply_snapshot_chunk?: RequestApplySnapshotChunkAmino; + prepare_proposal?: RequestPrepareProposalAmino; + process_proposal?: RequestProcessProposalAmino; +} +export interface RequestAminoMsg { + type: "/tendermint.abci.Request"; + value: RequestAmino; +} +export interface RequestSDKType { + echo?: RequestEchoSDKType; + flush?: RequestFlushSDKType; + info?: RequestInfoSDKType; + init_chain?: RequestInitChainSDKType; + query?: RequestQuerySDKType; + begin_block?: RequestBeginBlockSDKType; + check_tx?: RequestCheckTxSDKType; + deliver_tx?: RequestDeliverTxSDKType; + end_block?: RequestEndBlockSDKType; + commit?: RequestCommitSDKType; + list_snapshots?: RequestListSnapshotsSDKType; + offer_snapshot?: RequestOfferSnapshotSDKType; + load_snapshot_chunk?: RequestLoadSnapshotChunkSDKType; + apply_snapshot_chunk?: RequestApplySnapshotChunkSDKType; + prepare_proposal?: RequestPrepareProposalSDKType; + process_proposal?: RequestProcessProposalSDKType; +} +export interface RequestEcho { + message: string; +} +export interface RequestEchoProtoMsg { + typeUrl: "/tendermint.abci.RequestEcho"; + value: Uint8Array; +} +export interface RequestEchoAmino { + message?: string; +} +export interface RequestEchoAminoMsg { + type: "/tendermint.abci.RequestEcho"; + value: RequestEchoAmino; +} +export interface RequestEchoSDKType { + message: string; +} +export interface RequestFlush {} +export interface RequestFlushProtoMsg { + typeUrl: "/tendermint.abci.RequestFlush"; + value: Uint8Array; +} +export interface RequestFlushAmino {} +export interface RequestFlushAminoMsg { + type: "/tendermint.abci.RequestFlush"; + value: RequestFlushAmino; +} +export interface RequestFlushSDKType {} +export interface RequestInfo { + version: string; + blockVersion: bigint; + p2pVersion: bigint; + abciVersion: string; +} +export interface RequestInfoProtoMsg { + typeUrl: "/tendermint.abci.RequestInfo"; + value: Uint8Array; +} +export interface RequestInfoAmino { + version?: string; + block_version?: string; + p2p_version?: string; + abci_version?: string; +} +export interface RequestInfoAminoMsg { + type: "/tendermint.abci.RequestInfo"; + value: RequestInfoAmino; +} +export interface RequestInfoSDKType { + version: string; + block_version: bigint; + p2p_version: bigint; + abci_version: string; +} +export interface RequestInitChain { + time: Date; + chainId: string; + consensusParams?: ConsensusParams; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: bigint; +} +export interface RequestInitChainProtoMsg { + typeUrl: "/tendermint.abci.RequestInitChain"; + value: Uint8Array; +} +export interface RequestInitChainAmino { + time?: string; + chain_id?: string; + consensus_params?: ConsensusParamsAmino; + validators?: ValidatorUpdateAmino[]; + app_state_bytes?: string; + initial_height?: string; +} +export interface RequestInitChainAminoMsg { + type: "/tendermint.abci.RequestInitChain"; + value: RequestInitChainAmino; +} +export interface RequestInitChainSDKType { + time: Date; + chain_id: string; + consensus_params?: ConsensusParamsSDKType; + validators: ValidatorUpdateSDKType[]; + app_state_bytes: Uint8Array; + initial_height: bigint; +} +export interface RequestQuery { + data: Uint8Array; + path: string; + height: bigint; + prove: boolean; +} +export interface RequestQueryProtoMsg { + typeUrl: "/tendermint.abci.RequestQuery"; + value: Uint8Array; +} +export interface RequestQueryAmino { + data?: string; + path?: string; + height?: string; + prove?: boolean; +} +export interface RequestQueryAminoMsg { + type: "/tendermint.abci.RequestQuery"; + value: RequestQueryAmino; +} +export interface RequestQuerySDKType { + data: Uint8Array; + path: string; + height: bigint; + prove: boolean; +} +export interface RequestBeginBlock { + hash: Uint8Array; + header: Header; + lastCommitInfo: CommitInfo; + byzantineValidators: Misbehavior[]; +} +export interface RequestBeginBlockProtoMsg { + typeUrl: "/tendermint.abci.RequestBeginBlock"; + value: Uint8Array; +} +export interface RequestBeginBlockAmino { + hash?: string; + header?: HeaderAmino; + last_commit_info?: CommitInfoAmino; + byzantine_validators?: MisbehaviorAmino[]; +} +export interface RequestBeginBlockAminoMsg { + type: "/tendermint.abci.RequestBeginBlock"; + value: RequestBeginBlockAmino; +} +export interface RequestBeginBlockSDKType { + hash: Uint8Array; + header: HeaderSDKType; + last_commit_info: CommitInfoSDKType; + byzantine_validators: MisbehaviorSDKType[]; +} +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} +export interface RequestCheckTxProtoMsg { + typeUrl: "/tendermint.abci.RequestCheckTx"; + value: Uint8Array; +} +export interface RequestCheckTxAmino { + tx?: string; + type?: CheckTxType; +} +export interface RequestCheckTxAminoMsg { + type: "/tendermint.abci.RequestCheckTx"; + value: RequestCheckTxAmino; +} +export interface RequestCheckTxSDKType { + tx: Uint8Array; + type: CheckTxType; +} +export interface RequestDeliverTx { + tx: Uint8Array; +} +export interface RequestDeliverTxProtoMsg { + typeUrl: "/tendermint.abci.RequestDeliverTx"; + value: Uint8Array; +} +export interface RequestDeliverTxAmino { + tx?: string; +} +export interface RequestDeliverTxAminoMsg { + type: "/tendermint.abci.RequestDeliverTx"; + value: RequestDeliverTxAmino; +} +export interface RequestDeliverTxSDKType { + tx: Uint8Array; +} +export interface RequestEndBlock { + height: bigint; +} +export interface RequestEndBlockProtoMsg { + typeUrl: "/tendermint.abci.RequestEndBlock"; + value: Uint8Array; +} +export interface RequestEndBlockAmino { + height?: string; +} +export interface RequestEndBlockAminoMsg { + type: "/tendermint.abci.RequestEndBlock"; + value: RequestEndBlockAmino; +} +export interface RequestEndBlockSDKType { + height: bigint; +} +export interface RequestCommit {} +export interface RequestCommitProtoMsg { + typeUrl: "/tendermint.abci.RequestCommit"; + value: Uint8Array; +} +export interface RequestCommitAmino {} +export interface RequestCommitAminoMsg { + type: "/tendermint.abci.RequestCommit"; + value: RequestCommitAmino; +} +export interface RequestCommitSDKType {} +/** lists available snapshots */ +export interface RequestListSnapshots {} +export interface RequestListSnapshotsProtoMsg { + typeUrl: "/tendermint.abci.RequestListSnapshots"; + value: Uint8Array; +} +/** lists available snapshots */ +export interface RequestListSnapshotsAmino {} +export interface RequestListSnapshotsAminoMsg { + type: "/tendermint.abci.RequestListSnapshots"; + value: RequestListSnapshotsAmino; +} +/** lists available snapshots */ +export interface RequestListSnapshotsSDKType {} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot?: Snapshot; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} +export interface RequestOfferSnapshotProtoMsg { + typeUrl: "/tendermint.abci.RequestOfferSnapshot"; + value: Uint8Array; +} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshotAmino { + /** snapshot offered by peers */ + snapshot?: SnapshotAmino; + /** light client-verified app hash for snapshot height */ + app_hash?: string; +} +export interface RequestOfferSnapshotAminoMsg { + type: "/tendermint.abci.RequestOfferSnapshot"; + value: RequestOfferSnapshotAmino; +} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshotSDKType { + snapshot?: SnapshotSDKType; + app_hash: Uint8Array; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: bigint; + format: number; + chunk: number; +} +export interface RequestLoadSnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk"; + value: Uint8Array; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunkAmino { + height?: string; + format?: number; + chunk?: number; +} +export interface RequestLoadSnapshotChunkAminoMsg { + type: "/tendermint.abci.RequestLoadSnapshotChunk"; + value: RequestLoadSnapshotChunkAmino; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunkSDKType { + height: bigint; + format: number; + chunk: number; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} +export interface RequestApplySnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk"; + value: Uint8Array; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunkAmino { + index?: number; + chunk?: string; + sender?: string; +} +export interface RequestApplySnapshotChunkAminoMsg { + type: "/tendermint.abci.RequestApplySnapshotChunk"; + value: RequestApplySnapshotChunkAmino; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunkSDKType { + index: number; + chunk: Uint8Array; + sender: string; +} +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: bigint; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo; + misbehavior: Misbehavior[]; + height: bigint; + time: Date; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} +export interface RequestPrepareProposalProtoMsg { + typeUrl: "/tendermint.abci.RequestPrepareProposal"; + value: Uint8Array; +} +export interface RequestPrepareProposalAmino { + /** the modified transactions cannot exceed this size. */ + max_tx_bytes?: string; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs?: string[]; + local_last_commit?: ExtendedCommitInfoAmino; + misbehavior?: MisbehaviorAmino[]; + height?: string; + time?: string; + next_validators_hash?: string; + /** address of the public key of the validator proposing the block. */ + proposer_address?: string; +} +export interface RequestPrepareProposalAminoMsg { + type: "/tendermint.abci.RequestPrepareProposal"; + value: RequestPrepareProposalAmino; +} +export interface RequestPrepareProposalSDKType { + max_tx_bytes: bigint; + txs: Uint8Array[]; + local_last_commit: ExtendedCommitInfoSDKType; + misbehavior: MisbehaviorSDKType[]; + height: bigint; + time: Date; + next_validators_hash: Uint8Array; + proposer_address: Uint8Array; +} +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: bigint; + time: Date; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface RequestProcessProposalProtoMsg { + typeUrl: "/tendermint.abci.RequestProcessProposal"; + value: Uint8Array; +} +export interface RequestProcessProposalAmino { + txs?: string[]; + proposed_last_commit?: CommitInfoAmino; + misbehavior?: MisbehaviorAmino[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash?: string; + height?: string; + time?: string; + next_validators_hash?: string; + /** address of the public key of the original proposer of the block. */ + proposer_address?: string; +} +export interface RequestProcessProposalAminoMsg { + type: "/tendermint.abci.RequestProcessProposal"; + value: RequestProcessProposalAmino; +} +export interface RequestProcessProposalSDKType { + txs: Uint8Array[]; + proposed_last_commit: CommitInfoSDKType; + misbehavior: MisbehaviorSDKType[]; + hash: Uint8Array; + height: bigint; + time: Date; + next_validators_hash: Uint8Array; + proposer_address: Uint8Array; +} +export interface Response { + exception?: ResponseException; + echo?: ResponseEcho; + flush?: ResponseFlush; + info?: ResponseInfo; + initChain?: ResponseInitChain; + query?: ResponseQuery; + beginBlock?: ResponseBeginBlock; + checkTx?: ResponseCheckTx; + deliverTx?: ResponseDeliverTx; + endBlock?: ResponseEndBlock; + commit?: ResponseCommit; + listSnapshots?: ResponseListSnapshots; + offerSnapshot?: ResponseOfferSnapshot; + loadSnapshotChunk?: ResponseLoadSnapshotChunk; + applySnapshotChunk?: ResponseApplySnapshotChunk; + prepareProposal?: ResponsePrepareProposal; + processProposal?: ResponseProcessProposal; +} +export interface ResponseProtoMsg { + typeUrl: "/tendermint.abci.Response"; + value: Uint8Array; +} +export interface ResponseAmino { + exception?: ResponseExceptionAmino; + echo?: ResponseEchoAmino; + flush?: ResponseFlushAmino; + info?: ResponseInfoAmino; + init_chain?: ResponseInitChainAmino; + query?: ResponseQueryAmino; + begin_block?: ResponseBeginBlockAmino; + check_tx?: ResponseCheckTxAmino; + deliver_tx?: ResponseDeliverTxAmino; + end_block?: ResponseEndBlockAmino; + commit?: ResponseCommitAmino; + list_snapshots?: ResponseListSnapshotsAmino; + offer_snapshot?: ResponseOfferSnapshotAmino; + load_snapshot_chunk?: ResponseLoadSnapshotChunkAmino; + apply_snapshot_chunk?: ResponseApplySnapshotChunkAmino; + prepare_proposal?: ResponsePrepareProposalAmino; + process_proposal?: ResponseProcessProposalAmino; +} +export interface ResponseAminoMsg { + type: "/tendermint.abci.Response"; + value: ResponseAmino; +} +export interface ResponseSDKType { + exception?: ResponseExceptionSDKType; + echo?: ResponseEchoSDKType; + flush?: ResponseFlushSDKType; + info?: ResponseInfoSDKType; + init_chain?: ResponseInitChainSDKType; + query?: ResponseQuerySDKType; + begin_block?: ResponseBeginBlockSDKType; + check_tx?: ResponseCheckTxSDKType; + deliver_tx?: ResponseDeliverTxSDKType; + end_block?: ResponseEndBlockSDKType; + commit?: ResponseCommitSDKType; + list_snapshots?: ResponseListSnapshotsSDKType; + offer_snapshot?: ResponseOfferSnapshotSDKType; + load_snapshot_chunk?: ResponseLoadSnapshotChunkSDKType; + apply_snapshot_chunk?: ResponseApplySnapshotChunkSDKType; + prepare_proposal?: ResponsePrepareProposalSDKType; + process_proposal?: ResponseProcessProposalSDKType; +} +/** nondeterministic */ +export interface ResponseException { + error: string; +} +export interface ResponseExceptionProtoMsg { + typeUrl: "/tendermint.abci.ResponseException"; + value: Uint8Array; +} +/** nondeterministic */ +export interface ResponseExceptionAmino { + error?: string; +} +export interface ResponseExceptionAminoMsg { + type: "/tendermint.abci.ResponseException"; + value: ResponseExceptionAmino; +} +/** nondeterministic */ +export interface ResponseExceptionSDKType { + error: string; +} +export interface ResponseEcho { + message: string; +} +export interface ResponseEchoProtoMsg { + typeUrl: "/tendermint.abci.ResponseEcho"; + value: Uint8Array; +} +export interface ResponseEchoAmino { + message?: string; +} +export interface ResponseEchoAminoMsg { + type: "/tendermint.abci.ResponseEcho"; + value: ResponseEchoAmino; +} +export interface ResponseEchoSDKType { + message: string; +} +export interface ResponseFlush {} +export interface ResponseFlushProtoMsg { + typeUrl: "/tendermint.abci.ResponseFlush"; + value: Uint8Array; +} +export interface ResponseFlushAmino {} +export interface ResponseFlushAminoMsg { + type: "/tendermint.abci.ResponseFlush"; + value: ResponseFlushAmino; +} +export interface ResponseFlushSDKType {} +export interface ResponseInfo { + data: string; + version: string; + appVersion: bigint; + lastBlockHeight: bigint; + lastBlockAppHash: Uint8Array; +} +export interface ResponseInfoProtoMsg { + typeUrl: "/tendermint.abci.ResponseInfo"; + value: Uint8Array; +} +export interface ResponseInfoAmino { + data?: string; + version?: string; + app_version?: string; + last_block_height?: string; + last_block_app_hash?: string; +} +export interface ResponseInfoAminoMsg { + type: "/tendermint.abci.ResponseInfo"; + value: ResponseInfoAmino; +} +export interface ResponseInfoSDKType { + data: string; + version: string; + app_version: bigint; + last_block_height: bigint; + last_block_app_hash: Uint8Array; +} +export interface ResponseInitChain { + consensusParams?: ConsensusParams; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} +export interface ResponseInitChainProtoMsg { + typeUrl: "/tendermint.abci.ResponseInitChain"; + value: Uint8Array; +} +export interface ResponseInitChainAmino { + consensus_params?: ConsensusParamsAmino; + validators?: ValidatorUpdateAmino[]; + app_hash?: string; +} +export interface ResponseInitChainAminoMsg { + type: "/tendermint.abci.ResponseInitChain"; + value: ResponseInitChainAmino; +} +export interface ResponseInitChainSDKType { + consensus_params?: ConsensusParamsSDKType; + validators: ValidatorUpdateSDKType[]; + app_hash: Uint8Array; +} +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: bigint; + key: Uint8Array; + value: Uint8Array; + proofOps?: ProofOps; + height: bigint; + codespace: string; +} +export interface ResponseQueryProtoMsg { + typeUrl: "/tendermint.abci.ResponseQuery"; + value: Uint8Array; +} +export interface ResponseQueryAmino { + code?: number; + /** bytes data = 2; // use "value" instead. */ + log?: string; + /** nondeterministic */ + info?: string; + index?: string; + key?: string; + value?: string; + proof_ops?: ProofOpsAmino; + height?: string; + codespace?: string; +} +export interface ResponseQueryAminoMsg { + type: "/tendermint.abci.ResponseQuery"; + value: ResponseQueryAmino; +} +export interface ResponseQuerySDKType { + code: number; + log: string; + info: string; + index: bigint; + key: Uint8Array; + value: Uint8Array; + proof_ops?: ProofOpsSDKType; + height: bigint; + codespace: string; +} +export interface ResponseBeginBlock { + events: Event[]; +} +export interface ResponseBeginBlockProtoMsg { + typeUrl: "/tendermint.abci.ResponseBeginBlock"; + value: Uint8Array; +} +export interface ResponseBeginBlockAmino { + events?: EventAmino[]; +} +export interface ResponseBeginBlockAminoMsg { + type: "/tendermint.abci.ResponseBeginBlock"; + value: ResponseBeginBlockAmino; +} +export interface ResponseBeginBlockSDKType { + events: EventSDKType[]; +} +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: bigint; + gasUsed: bigint; + events: Event[]; + codespace: string; + sender: string; + priority: bigint; + /** + * mempool_error is set by CometBFT. + * ABCI applictions creating a ResponseCheckTX should not set mempool_error. + */ + mempoolError: string; +} +export interface ResponseCheckTxProtoMsg { + typeUrl: "/tendermint.abci.ResponseCheckTx"; + value: Uint8Array; +} +export interface ResponseCheckTxAmino { + code?: number; + data?: string; + /** nondeterministic */ + log?: string; + /** nondeterministic */ + info?: string; + gas_wanted?: string; + gas_used?: string; + events?: EventAmino[]; + codespace?: string; + sender?: string; + priority?: string; + /** + * mempool_error is set by CometBFT. + * ABCI applictions creating a ResponseCheckTX should not set mempool_error. + */ + mempool_error?: string; +} +export interface ResponseCheckTxAminoMsg { + type: "/tendermint.abci.ResponseCheckTx"; + value: ResponseCheckTxAmino; +} +export interface ResponseCheckTxSDKType { + code: number; + data: Uint8Array; + log: string; + info: string; + gas_wanted: bigint; + gas_used: bigint; + events: EventSDKType[]; + codespace: string; + sender: string; + priority: bigint; + mempool_error: string; +} +export interface ResponseDeliverTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: bigint; + gasUsed: bigint; + events: Event[]; + codespace: string; +} +export interface ResponseDeliverTxProtoMsg { + typeUrl: "/tendermint.abci.ResponseDeliverTx"; + value: Uint8Array; +} +export interface ResponseDeliverTxAmino { + code?: number; + data?: string; + /** nondeterministic */ + log?: string; + /** nondeterministic */ + info?: string; + gas_wanted?: string; + gas_used?: string; + events?: EventAmino[]; + codespace?: string; +} +export interface ResponseDeliverTxAminoMsg { + type: "/tendermint.abci.ResponseDeliverTx"; + value: ResponseDeliverTxAmino; +} +export interface ResponseDeliverTxSDKType { + code: number; + data: Uint8Array; + log: string; + info: string; + gas_wanted: bigint; + gas_used: bigint; + events: EventSDKType[]; + codespace: string; +} +export interface ResponseEndBlock { + validatorUpdates: ValidatorUpdate[]; + consensusParamUpdates?: ConsensusParams; + events: Event[]; +} +export interface ResponseEndBlockProtoMsg { + typeUrl: "/tendermint.abci.ResponseEndBlock"; + value: Uint8Array; +} +export interface ResponseEndBlockAmino { + validator_updates?: ValidatorUpdateAmino[]; + consensus_param_updates?: ConsensusParamsAmino; + events?: EventAmino[]; +} +export interface ResponseEndBlockAminoMsg { + type: "/tendermint.abci.ResponseEndBlock"; + value: ResponseEndBlockAmino; +} +export interface ResponseEndBlockSDKType { + validator_updates: ValidatorUpdateSDKType[]; + consensus_param_updates?: ConsensusParamsSDKType; + events: EventSDKType[]; +} +export interface ResponseCommit { + /** reserve 1 */ + data: Uint8Array; + retainHeight: bigint; +} +export interface ResponseCommitProtoMsg { + typeUrl: "/tendermint.abci.ResponseCommit"; + value: Uint8Array; +} +export interface ResponseCommitAmino { + /** reserve 1 */ + data?: string; + retain_height?: string; +} +export interface ResponseCommitAminoMsg { + type: "/tendermint.abci.ResponseCommit"; + value: ResponseCommitAmino; +} +export interface ResponseCommitSDKType { + data: Uint8Array; + retain_height: bigint; +} +export interface ResponseListSnapshots { + snapshots: Snapshot[]; +} +export interface ResponseListSnapshotsProtoMsg { + typeUrl: "/tendermint.abci.ResponseListSnapshots"; + value: Uint8Array; +} +export interface ResponseListSnapshotsAmino { + snapshots?: SnapshotAmino[]; +} +export interface ResponseListSnapshotsAminoMsg { + type: "/tendermint.abci.ResponseListSnapshots"; + value: ResponseListSnapshotsAmino; +} +export interface ResponseListSnapshotsSDKType { + snapshots: SnapshotSDKType[]; +} +export interface ResponseOfferSnapshot { + result: ResponseOfferSnapshot_Result; +} +export interface ResponseOfferSnapshotProtoMsg { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot"; + value: Uint8Array; +} +export interface ResponseOfferSnapshotAmino { + result?: ResponseOfferSnapshot_Result; +} +export interface ResponseOfferSnapshotAminoMsg { + type: "/tendermint.abci.ResponseOfferSnapshot"; + value: ResponseOfferSnapshotAmino; +} +export interface ResponseOfferSnapshotSDKType { + result: ResponseOfferSnapshot_Result; +} +export interface ResponseLoadSnapshotChunk { + chunk: Uint8Array; +} +export interface ResponseLoadSnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk"; + value: Uint8Array; +} +export interface ResponseLoadSnapshotChunkAmino { + chunk?: string; +} +export interface ResponseLoadSnapshotChunkAminoMsg { + type: "/tendermint.abci.ResponseLoadSnapshotChunk"; + value: ResponseLoadSnapshotChunkAmino; +} +export interface ResponseLoadSnapshotChunkSDKType { + chunk: Uint8Array; +} +export interface ResponseApplySnapshotChunk { + result: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: string[]; +} +export interface ResponseApplySnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk"; + value: Uint8Array; +} +export interface ResponseApplySnapshotChunkAmino { + result?: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetch_chunks?: number[]; + /** Chunk senders to reject and ban */ + reject_senders?: string[]; +} +export interface ResponseApplySnapshotChunkAminoMsg { + type: "/tendermint.abci.ResponseApplySnapshotChunk"; + value: ResponseApplySnapshotChunkAmino; +} +export interface ResponseApplySnapshotChunkSDKType { + result: ResponseApplySnapshotChunk_Result; + refetch_chunks: number[]; + reject_senders: string[]; +} +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} +export interface ResponsePrepareProposalProtoMsg { + typeUrl: "/tendermint.abci.ResponsePrepareProposal"; + value: Uint8Array; +} +export interface ResponsePrepareProposalAmino { + txs?: string[]; +} +export interface ResponsePrepareProposalAminoMsg { + type: "/tendermint.abci.ResponsePrepareProposal"; + value: ResponsePrepareProposalAmino; +} +export interface ResponsePrepareProposalSDKType { + txs: Uint8Array[]; +} +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} +export interface ResponseProcessProposalProtoMsg { + typeUrl: "/tendermint.abci.ResponseProcessProposal"; + value: Uint8Array; +} +export interface ResponseProcessProposalAmino { + status?: ResponseProcessProposal_ProposalStatus; +} +export interface ResponseProcessProposalAminoMsg { + type: "/tendermint.abci.ResponseProcessProposal"; + value: ResponseProcessProposalAmino; +} +export interface ResponseProcessProposalSDKType { + status: ResponseProcessProposal_ProposalStatus; +} +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} +export interface CommitInfoProtoMsg { + typeUrl: "/tendermint.abci.CommitInfo"; + value: Uint8Array; +} +export interface CommitInfoAmino { + round?: number; + votes?: VoteInfoAmino[]; +} +export interface CommitInfoAminoMsg { + type: "/tendermint.abci.CommitInfo"; + value: CommitInfoAmino; +} +export interface CommitInfoSDKType { + round: number; + votes: VoteInfoSDKType[]; +} +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} +export interface ExtendedCommitInfoProtoMsg { + typeUrl: "/tendermint.abci.ExtendedCommitInfo"; + value: Uint8Array; +} +export interface ExtendedCommitInfoAmino { + /** The round at which the block proposer decided in the previous height. */ + round?: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes?: ExtendedVoteInfoAmino[]; +} +export interface ExtendedCommitInfoAminoMsg { + type: "/tendermint.abci.ExtendedCommitInfo"; + value: ExtendedCommitInfoAmino; +} +export interface ExtendedCommitInfoSDKType { + round: number; + votes: ExtendedVoteInfoSDKType[]; +} +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} +export interface EventProtoMsg { + typeUrl: "/tendermint.abci.Event"; + value: Uint8Array; +} +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface EventAmino { + type?: string; + attributes?: EventAttributeAmino[]; +} +export interface EventAminoMsg { + type: "/tendermint.abci.Event"; + value: EventAmino; +} +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface EventSDKType { + type: string; + attributes: EventAttributeSDKType[]; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} +export interface EventAttributeProtoMsg { + typeUrl: "/tendermint.abci.EventAttribute"; + value: Uint8Array; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttributeAmino { + key?: string; + value?: string; + /** nondeterministic */ + index?: boolean; +} +export interface EventAttributeAminoMsg { + type: "/tendermint.abci.EventAttribute"; + value: EventAttributeAmino; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttributeSDKType { + key: string; + value: string; + index: boolean; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: bigint; + index: number; + tx: Uint8Array; + result: ResponseDeliverTx; +} +export interface TxResultProtoMsg { + typeUrl: "/tendermint.abci.TxResult"; + value: Uint8Array; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResultAmino { + height?: string; + index?: number; + tx?: string; + result?: ResponseDeliverTxAmino; +} +export interface TxResultAminoMsg { + type: "/tendermint.abci.TxResult"; + value: TxResultAmino; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResultSDKType { + height: bigint; + index: number; + tx: Uint8Array; + result: ResponseDeliverTxSDKType; +} +/** Validator */ +export interface Validator { + /** + * The first 20 bytes of SHA256(public key) + * PubKey pub_key = 2 [(gogoproto.nullable)=false]; + */ + address: Uint8Array; + /** The voting power */ + power: bigint; +} +export interface ValidatorProtoMsg { + typeUrl: "/tendermint.abci.Validator"; + value: Uint8Array; +} +/** Validator */ +export interface ValidatorAmino { + /** + * The first 20 bytes of SHA256(public key) + * PubKey pub_key = 2 [(gogoproto.nullable)=false]; + */ + address?: string; + /** The voting power */ + power?: string; +} +export interface ValidatorAminoMsg { + type: "/tendermint.abci.Validator"; + value: ValidatorAmino; +} +/** Validator */ +export interface ValidatorSDKType { + address: Uint8Array; + power: bigint; +} +/** ValidatorUpdate */ +export interface ValidatorUpdate { + pubKey: PublicKey; + power: bigint; +} +export interface ValidatorUpdateProtoMsg { + typeUrl: "/tendermint.abci.ValidatorUpdate"; + value: Uint8Array; +} +/** ValidatorUpdate */ +export interface ValidatorUpdateAmino { + pub_key?: PublicKeyAmino; + power?: string; +} +export interface ValidatorUpdateAminoMsg { + type: "/tendermint.abci.ValidatorUpdate"; + value: ValidatorUpdateAmino; +} +/** ValidatorUpdate */ +export interface ValidatorUpdateSDKType { + pub_key: PublicKeySDKType; + power: bigint; +} +/** VoteInfo */ +export interface VoteInfo { + validator: Validator; + signedLastBlock: boolean; +} +export interface VoteInfoProtoMsg { + typeUrl: "/tendermint.abci.VoteInfo"; + value: Uint8Array; +} +/** VoteInfo */ +export interface VoteInfoAmino { + validator?: ValidatorAmino; + signed_last_block?: boolean; +} +export interface VoteInfoAminoMsg { + type: "/tendermint.abci.VoteInfo"; + value: VoteInfoAmino; +} +/** VoteInfo */ +export interface VoteInfoSDKType { + validator: ValidatorSDKType; + signed_last_block: boolean; +} +export interface ExtendedVoteInfo { + validator: Validator; + signedLastBlock: boolean; + /** Reserved for future use */ + voteExtension: Uint8Array; +} +export interface ExtendedVoteInfoProtoMsg { + typeUrl: "/tendermint.abci.ExtendedVoteInfo"; + value: Uint8Array; +} +export interface ExtendedVoteInfoAmino { + validator?: ValidatorAmino; + signed_last_block?: boolean; + /** Reserved for future use */ + vote_extension?: string; +} +export interface ExtendedVoteInfoAminoMsg { + type: "/tendermint.abci.ExtendedVoteInfo"; + value: ExtendedVoteInfoAmino; +} +export interface ExtendedVoteInfoSDKType { + validator: ValidatorSDKType; + signed_last_block: boolean; + vote_extension: Uint8Array; +} +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: Validator; + /** The height when the offense occurred */ + height: bigint; + /** The corresponding time where the offense occurred */ + time: Date; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: bigint; +} +export interface MisbehaviorProtoMsg { + typeUrl: "/tendermint.abci.Misbehavior"; + value: Uint8Array; +} +export interface MisbehaviorAmino { + type?: MisbehaviorType; + /** The offending validator */ + validator?: ValidatorAmino; + /** The height when the offense occurred */ + height?: string; + /** The corresponding time where the offense occurred */ + time?: string; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + total_voting_power?: string; +} +export interface MisbehaviorAminoMsg { + type: "/tendermint.abci.Misbehavior"; + value: MisbehaviorAmino; +} +export interface MisbehaviorSDKType { + type: MisbehaviorType; + validator: ValidatorSDKType; + height: bigint; + time: Date; + total_voting_power: bigint; +} +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: bigint; + /** The application-specific snapshot format */ + format: number; + /** Number of chunks in the snapshot */ + chunks: number; + /** Arbitrary snapshot hash, equal only if identical */ + hash: Uint8Array; + /** Arbitrary application metadata */ + metadata: Uint8Array; +} +export interface SnapshotProtoMsg { + typeUrl: "/tendermint.abci.Snapshot"; + value: Uint8Array; +} +export interface SnapshotAmino { + /** The height at which the snapshot was taken */ + height?: string; + /** The application-specific snapshot format */ + format?: number; + /** Number of chunks in the snapshot */ + chunks?: number; + /** Arbitrary snapshot hash, equal only if identical */ + hash?: string; + /** Arbitrary application metadata */ + metadata?: string; +} +export interface SnapshotAminoMsg { + type: "/tendermint.abci.Snapshot"; + value: SnapshotAmino; +} +export interface SnapshotSDKType { + height: bigint; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Uint8Array; +} +function createBaseRequest(): Request { + return { + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + beginBlock: undefined, + checkTx: undefined, + deliverTx: undefined, + endBlock: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined + }; +} +export const Request = { + typeUrl: "/tendermint.abci.Request", + encode(message: Request, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).ldelim(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim(); + } + if (message.initChain !== undefined) { + RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).ldelim(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + RequestBeginBlock.encode(message.beginBlock, writer.uint32(58).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + RequestDeliverTx.encode(message.deliverTx, writer.uint32(74).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + RequestEndBlock.encode(message.endBlock, writer.uint32(82).fork()).ldelim(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).ldelim(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.echo = RequestEcho.decode(reader, reader.uint32()); + break; + case 2: + message.flush = RequestFlush.decode(reader, reader.uint32()); + break; + case 3: + message.info = RequestInfo.decode(reader, reader.uint32()); + break; + case 5: + message.initChain = RequestInitChain.decode(reader, reader.uint32()); + break; + case 6: + message.query = RequestQuery.decode(reader, reader.uint32()); + break; + case 7: + message.beginBlock = RequestBeginBlock.decode(reader, reader.uint32()); + break; + case 8: + message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); + break; + case 9: + message.deliverTx = RequestDeliverTx.decode(reader, reader.uint32()); + break; + case 10: + message.endBlock = RequestEndBlock.decode(reader, reader.uint32()); + break; + case 11: + message.commit = RequestCommit.decode(reader, reader.uint32()); + break; + case 12: + message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); + break; + case 13: + message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + break; + case 14: + message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 15: + message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + break; + case 16: + message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); + break; + case 17: + message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Request { + const message = createBaseRequest(); + message.echo = object.echo !== undefined && object.echo !== null ? RequestEcho.fromPartial(object.echo) : undefined; + message.flush = object.flush !== undefined && object.flush !== null ? RequestFlush.fromPartial(object.flush) : undefined; + message.info = object.info !== undefined && object.info !== null ? RequestInfo.fromPartial(object.info) : undefined; + message.initChain = object.initChain !== undefined && object.initChain !== null ? RequestInitChain.fromPartial(object.initChain) : undefined; + message.query = object.query !== undefined && object.query !== null ? RequestQuery.fromPartial(object.query) : undefined; + message.beginBlock = object.beginBlock !== undefined && object.beginBlock !== null ? RequestBeginBlock.fromPartial(object.beginBlock) : undefined; + message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? RequestCheckTx.fromPartial(object.checkTx) : undefined; + message.deliverTx = object.deliverTx !== undefined && object.deliverTx !== null ? RequestDeliverTx.fromPartial(object.deliverTx) : undefined; + message.endBlock = object.endBlock !== undefined && object.endBlock !== null ? RequestEndBlock.fromPartial(object.endBlock) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? RequestCommit.fromPartial(object.commit) : undefined; + message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? RequestListSnapshots.fromPartial(object.listSnapshots) : undefined; + message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; + message.loadSnapshotChunk = object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) : undefined; + message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; + message.prepareProposal = object.prepareProposal !== undefined && object.prepareProposal !== null ? RequestPrepareProposal.fromPartial(object.prepareProposal) : undefined; + message.processProposal = object.processProposal !== undefined && object.processProposal !== null ? RequestProcessProposal.fromPartial(object.processProposal) : undefined; + return message; + }, + fromAmino(object: RequestAmino): Request { + const message = createBaseRequest(); + if (object.echo !== undefined && object.echo !== null) { + message.echo = RequestEcho.fromAmino(object.echo); + } + if (object.flush !== undefined && object.flush !== null) { + message.flush = RequestFlush.fromAmino(object.flush); + } + if (object.info !== undefined && object.info !== null) { + message.info = RequestInfo.fromAmino(object.info); + } + if (object.init_chain !== undefined && object.init_chain !== null) { + message.initChain = RequestInitChain.fromAmino(object.init_chain); + } + if (object.query !== undefined && object.query !== null) { + message.query = RequestQuery.fromAmino(object.query); + } + if (object.begin_block !== undefined && object.begin_block !== null) { + message.beginBlock = RequestBeginBlock.fromAmino(object.begin_block); + } + if (object.check_tx !== undefined && object.check_tx !== null) { + message.checkTx = RequestCheckTx.fromAmino(object.check_tx); + } + if (object.deliver_tx !== undefined && object.deliver_tx !== null) { + message.deliverTx = RequestDeliverTx.fromAmino(object.deliver_tx); + } + if (object.end_block !== undefined && object.end_block !== null) { + message.endBlock = RequestEndBlock.fromAmino(object.end_block); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = RequestCommit.fromAmino(object.commit); + } + if (object.list_snapshots !== undefined && object.list_snapshots !== null) { + message.listSnapshots = RequestListSnapshots.fromAmino(object.list_snapshots); + } + if (object.offer_snapshot !== undefined && object.offer_snapshot !== null) { + message.offerSnapshot = RequestOfferSnapshot.fromAmino(object.offer_snapshot); + } + if (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) { + message.loadSnapshotChunk = RequestLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk); + } + if (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) { + message.applySnapshotChunk = RequestApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk); + } + if (object.prepare_proposal !== undefined && object.prepare_proposal !== null) { + message.prepareProposal = RequestPrepareProposal.fromAmino(object.prepare_proposal); + } + if (object.process_proposal !== undefined && object.process_proposal !== null) { + message.processProposal = RequestProcessProposal.fromAmino(object.process_proposal); + } + return message; + }, + toAmino(message: Request): RequestAmino { + const obj: any = {}; + obj.echo = message.echo ? RequestEcho.toAmino(message.echo) : undefined; + obj.flush = message.flush ? RequestFlush.toAmino(message.flush) : undefined; + obj.info = message.info ? RequestInfo.toAmino(message.info) : undefined; + obj.init_chain = message.initChain ? RequestInitChain.toAmino(message.initChain) : undefined; + obj.query = message.query ? RequestQuery.toAmino(message.query) : undefined; + obj.begin_block = message.beginBlock ? RequestBeginBlock.toAmino(message.beginBlock) : undefined; + obj.check_tx = message.checkTx ? RequestCheckTx.toAmino(message.checkTx) : undefined; + obj.deliver_tx = message.deliverTx ? RequestDeliverTx.toAmino(message.deliverTx) : undefined; + obj.end_block = message.endBlock ? RequestEndBlock.toAmino(message.endBlock) : undefined; + obj.commit = message.commit ? RequestCommit.toAmino(message.commit) : undefined; + obj.list_snapshots = message.listSnapshots ? RequestListSnapshots.toAmino(message.listSnapshots) : undefined; + obj.offer_snapshot = message.offerSnapshot ? RequestOfferSnapshot.toAmino(message.offerSnapshot) : undefined; + obj.load_snapshot_chunk = message.loadSnapshotChunk ? RequestLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) : undefined; + obj.apply_snapshot_chunk = message.applySnapshotChunk ? RequestApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; + obj.prepare_proposal = message.prepareProposal ? RequestPrepareProposal.toAmino(message.prepareProposal) : undefined; + obj.process_proposal = message.processProposal ? RequestProcessProposal.toAmino(message.processProposal) : undefined; + return obj; + }, + fromAminoMsg(object: RequestAminoMsg): Request { + return Request.fromAmino(object.value); + }, + fromProtoMsg(message: RequestProtoMsg): Request { + return Request.decode(message.value); + }, + toProto(message: Request): Uint8Array { + return Request.encode(message).finish(); + }, + toProtoMsg(message: Request): RequestProtoMsg { + return { + typeUrl: "/tendermint.abci.Request", + value: Request.encode(message).finish() + }; + } +}; +function createBaseRequestEcho(): RequestEcho { + return { + message: "" + }; +} +export const RequestEcho = { + typeUrl: "/tendermint.abci.RequestEcho", + encode(message: RequestEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, + fromAmino(object: RequestEchoAmino): RequestEcho { + const message = createBaseRequestEcho(); + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } + return message; + }, + toAmino(message: RequestEcho): RequestEchoAmino { + const obj: any = {}; + obj.message = message.message === "" ? undefined : message.message; + return obj; + }, + fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { + return RequestEcho.fromAmino(object.value); + }, + fromProtoMsg(message: RequestEchoProtoMsg): RequestEcho { + return RequestEcho.decode(message.value); + }, + toProto(message: RequestEcho): Uint8Array { + return RequestEcho.encode(message).finish(); + }, + toProtoMsg(message: RequestEcho): RequestEchoProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestEcho", + value: RequestEcho.encode(message).finish() + }; + } +}; +function createBaseRequestFlush(): RequestFlush { + return {}; +} +export const RequestFlush = { + typeUrl: "/tendermint.abci.RequestFlush", + encode(_: RequestFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, + fromAmino(_: RequestFlushAmino): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, + toAmino(_: RequestFlush): RequestFlushAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestFlushAminoMsg): RequestFlush { + return RequestFlush.fromAmino(object.value); + }, + fromProtoMsg(message: RequestFlushProtoMsg): RequestFlush { + return RequestFlush.decode(message.value); + }, + toProto(message: RequestFlush): Uint8Array { + return RequestFlush.encode(message).finish(); + }, + toProtoMsg(message: RequestFlush): RequestFlushProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestFlush", + value: RequestFlush.encode(message).finish() + }; + } +}; +function createBaseRequestInfo(): RequestInfo { + return { + version: "", + blockVersion: BigInt(0), + p2pVersion: BigInt(0), + abciVersion: "" + }; +} +export const RequestInfo = { + typeUrl: "/tendermint.abci.RequestInfo", + encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== BigInt(0)) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== BigInt(0)) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.blockVersion = reader.uint64(); + break; + case 3: + message.p2pVersion = reader.uint64(); + break; + case 4: + message.abciVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion !== undefined && object.blockVersion !== null ? BigInt(object.blockVersion.toString()) : BigInt(0); + message.p2pVersion = object.p2pVersion !== undefined && object.p2pVersion !== null ? BigInt(object.p2pVersion.toString()) : BigInt(0); + message.abciVersion = object.abciVersion ?? ""; + return message; + }, + fromAmino(object: RequestInfoAmino): RequestInfo { + const message = createBaseRequestInfo(); + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.block_version !== undefined && object.block_version !== null) { + message.blockVersion = BigInt(object.block_version); + } + if (object.p2p_version !== undefined && object.p2p_version !== null) { + message.p2pVersion = BigInt(object.p2p_version); + } + if (object.abci_version !== undefined && object.abci_version !== null) { + message.abciVersion = object.abci_version; + } + return message; + }, + toAmino(message: RequestInfo): RequestInfoAmino { + const obj: any = {}; + obj.version = message.version === "" ? undefined : message.version; + obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion.toString() : undefined; + obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion.toString() : undefined; + obj.abci_version = message.abciVersion === "" ? undefined : message.abciVersion; + return obj; + }, + fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { + return RequestInfo.fromAmino(object.value); + }, + fromProtoMsg(message: RequestInfoProtoMsg): RequestInfo { + return RequestInfo.decode(message.value); + }, + toProto(message: RequestInfo): Uint8Array { + return RequestInfo.encode(message).finish(); + }, + toProtoMsg(message: RequestInfo): RequestInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestInfo", + value: RequestInfo.encode(message).finish() + }; + } +}; +function createBaseRequestInitChain(): RequestInitChain { + return { + time: new Date(), + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(), + initialHeight: BigInt(0) + }; +} +export const RequestInitChain = { + typeUrl: "/tendermint.abci.RequestInitChain", + encode(message: RequestInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== BigInt(0)) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 2: + message.chainId = reader.string(); + break; + case 3: + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + break; + case 4: + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 5: + message.appStateBytes = reader.bytes(); + break; + case 6: + message.initialHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; + message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(); + message.initialHeight = object.initialHeight !== undefined && object.initialHeight !== null ? BigInt(object.initialHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: RequestInitChainAmino): RequestInitChain { + const message = createBaseRequestInitChain(); + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.consensus_params !== undefined && object.consensus_params !== null) { + message.consensusParams = ConsensusParams.fromAmino(object.consensus_params); + } + message.validators = object.validators?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.app_state_bytes !== undefined && object.app_state_bytes !== null) { + message.appStateBytes = bytesFromBase64(object.app_state_bytes); + } + if (object.initial_height !== undefined && object.initial_height !== null) { + message.initialHeight = BigInt(object.initial_height); + } + return message; + }, + toAmino(message: RequestInitChain): RequestInitChainAmino { + const obj: any = {}; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; + if (message.validators) { + obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { + return RequestInitChain.fromAmino(object.value); + }, + fromProtoMsg(message: RequestInitChainProtoMsg): RequestInitChain { + return RequestInitChain.decode(message.value); + }, + toProto(message: RequestInitChain): Uint8Array { + return RequestInitChain.encode(message).finish(); + }, + toProtoMsg(message: RequestInitChain): RequestInitChainProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestInitChain", + value: RequestInitChain.encode(message).finish() + }; + } +}; +function createBaseRequestQuery(): RequestQuery { + return { + data: new Uint8Array(), + path: "", + height: BigInt(0), + prove: false + }; +} +export const RequestQuery = { + typeUrl: "/tendermint.abci.RequestQuery", + encode(message: RequestQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.prove === true) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + case 2: + message.path = reader.string(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(); + message.path = object.path ?? ""; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.prove = object.prove ?? false; + return message; + }, + fromAmino(object: RequestQueryAmino): RequestQuery { + const message = createBaseRequestQuery(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.prove !== undefined && object.prove !== null) { + message.prove = object.prove; + } + return message; + }, + toAmino(message: RequestQuery): RequestQueryAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.path = message.path === "" ? undefined : message.path; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.prove = message.prove === false ? undefined : message.prove; + return obj; + }, + fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { + return RequestQuery.fromAmino(object.value); + }, + fromProtoMsg(message: RequestQueryProtoMsg): RequestQuery { + return RequestQuery.decode(message.value); + }, + toProto(message: RequestQuery): Uint8Array { + return RequestQuery.encode(message).finish(); + }, + toProtoMsg(message: RequestQuery): RequestQueryProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestQuery", + value: RequestQuery.encode(message).finish() + }; + } +}; +function createBaseRequestBeginBlock(): RequestBeginBlock { + return { + hash: new Uint8Array(), + header: Header.fromPartial({}), + lastCommitInfo: CommitInfo.fromPartial({}), + byzantineValidators: [] + }; +} +export const RequestBeginBlock = { + typeUrl: "/tendermint.abci.RequestBeginBlock", + encode(message: RequestBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(18).fork()).ldelim(); + } + if (message.lastCommitInfo !== undefined) { + CommitInfo.encode(message.lastCommitInfo, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.byzantineValidators) { + Misbehavior.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestBeginBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.header = Header.decode(reader, reader.uint32()); + break; + case 3: + message.lastCommitInfo = CommitInfo.decode(reader, reader.uint32()); + break; + case 4: + message.byzantineValidators.push(Misbehavior.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestBeginBlock { + const message = createBaseRequestBeginBlock(); + message.hash = object.hash ?? new Uint8Array(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.lastCommitInfo = object.lastCommitInfo !== undefined && object.lastCommitInfo !== null ? CommitInfo.fromPartial(object.lastCommitInfo) : undefined; + message.byzantineValidators = object.byzantineValidators?.map(e => Misbehavior.fromPartial(e)) || []; + return message; + }, + fromAmino(object: RequestBeginBlockAmino): RequestBeginBlock { + const message = createBaseRequestBeginBlock(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.last_commit_info !== undefined && object.last_commit_info !== null) { + message.lastCommitInfo = CommitInfo.fromAmino(object.last_commit_info); + } + message.byzantineValidators = object.byzantine_validators?.map(e => Misbehavior.fromAmino(e)) || []; + return message; + }, + toAmino(message: RequestBeginBlock): RequestBeginBlockAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.last_commit_info = message.lastCommitInfo ? CommitInfo.toAmino(message.lastCommitInfo) : undefined; + if (message.byzantineValidators) { + obj.byzantine_validators = message.byzantineValidators.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.byzantine_validators = message.byzantineValidators; + } + return obj; + }, + fromAminoMsg(object: RequestBeginBlockAminoMsg): RequestBeginBlock { + return RequestBeginBlock.fromAmino(object.value); + }, + fromProtoMsg(message: RequestBeginBlockProtoMsg): RequestBeginBlock { + return RequestBeginBlock.decode(message.value); + }, + toProto(message: RequestBeginBlock): Uint8Array { + return RequestBeginBlock.encode(message).finish(); + }, + toProtoMsg(message: RequestBeginBlock): RequestBeginBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestBeginBlock", + value: RequestBeginBlock.encode(message).finish() + }; + } +}; +function createBaseRequestCheckTx(): RequestCheckTx { + return { + tx: new Uint8Array(), + type: 0 + }; +} +export const RequestCheckTx = { + typeUrl: "/tendermint.abci.RequestCheckTx", + encode(message: RequestCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + case 2: + message.type = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(); + message.type = object.type ?? 0; + return message; + }, + fromAmino(object: RequestCheckTxAmino): RequestCheckTx { + const message = createBaseRequestCheckTx(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + return message; + }, + toAmino(message: RequestCheckTx): RequestCheckTxAmino { + const obj: any = {}; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + obj.type = message.type === 0 ? undefined : message.type; + return obj; + }, + fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { + return RequestCheckTx.fromAmino(object.value); + }, + fromProtoMsg(message: RequestCheckTxProtoMsg): RequestCheckTx { + return RequestCheckTx.decode(message.value); + }, + toProto(message: RequestCheckTx): Uint8Array { + return RequestCheckTx.encode(message).finish(); + }, + toProtoMsg(message: RequestCheckTx): RequestCheckTxProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestCheckTx", + value: RequestCheckTx.encode(message).finish() + }; + } +}; +function createBaseRequestDeliverTx(): RequestDeliverTx { + return { + tx: new Uint8Array() + }; +} +export const RequestDeliverTx = { + typeUrl: "/tendermint.abci.RequestDeliverTx", + encode(message: RequestDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestDeliverTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestDeliverTx { + const message = createBaseRequestDeliverTx(); + message.tx = object.tx ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestDeliverTxAmino): RequestDeliverTx { + const message = createBaseRequestDeliverTx(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + return message; + }, + toAmino(message: RequestDeliverTx): RequestDeliverTxAmino { + const obj: any = {}; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: RequestDeliverTxAminoMsg): RequestDeliverTx { + return RequestDeliverTx.fromAmino(object.value); + }, + fromProtoMsg(message: RequestDeliverTxProtoMsg): RequestDeliverTx { + return RequestDeliverTx.decode(message.value); + }, + toProto(message: RequestDeliverTx): Uint8Array { + return RequestDeliverTx.encode(message).finish(); + }, + toProtoMsg(message: RequestDeliverTx): RequestDeliverTxProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestDeliverTx", + value: RequestDeliverTx.encode(message).finish() + }; + } +}; +function createBaseRequestEndBlock(): RequestEndBlock { + return { + height: BigInt(0) + }; +} +export const RequestEndBlock = { + typeUrl: "/tendermint.abci.RequestEndBlock", + encode(message: RequestEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestEndBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestEndBlock { + const message = createBaseRequestEndBlock(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: RequestEndBlockAmino): RequestEndBlock { + const message = createBaseRequestEndBlock(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: RequestEndBlock): RequestEndBlockAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { + return RequestEndBlock.fromAmino(object.value); + }, + fromProtoMsg(message: RequestEndBlockProtoMsg): RequestEndBlock { + return RequestEndBlock.decode(message.value); + }, + toProto(message: RequestEndBlock): Uint8Array { + return RequestEndBlock.encode(message).finish(); + }, + toProtoMsg(message: RequestEndBlock): RequestEndBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestEndBlock", + value: RequestEndBlock.encode(message).finish() + }; + } +}; +function createBaseRequestCommit(): RequestCommit { + return {}; +} +export const RequestCommit = { + typeUrl: "/tendermint.abci.RequestCommit", + encode(_: RequestCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, + fromAmino(_: RequestCommitAmino): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, + toAmino(_: RequestCommit): RequestCommitAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestCommitAminoMsg): RequestCommit { + return RequestCommit.fromAmino(object.value); + }, + fromProtoMsg(message: RequestCommitProtoMsg): RequestCommit { + return RequestCommit.decode(message.value); + }, + toProto(message: RequestCommit): Uint8Array { + return RequestCommit.encode(message).finish(); + }, + toProtoMsg(message: RequestCommit): RequestCommitProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestCommit", + value: RequestCommit.encode(message).finish() + }; + } +}; +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} +export const RequestListSnapshots = { + typeUrl: "/tendermint.abci.RequestListSnapshots", + encode(_: RequestListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, + fromAmino(_: RequestListSnapshotsAmino): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, + toAmino(_: RequestListSnapshots): RequestListSnapshotsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestListSnapshotsAminoMsg): RequestListSnapshots { + return RequestListSnapshots.fromAmino(object.value); + }, + fromProtoMsg(message: RequestListSnapshotsProtoMsg): RequestListSnapshots { + return RequestListSnapshots.decode(message.value); + }, + toProto(message: RequestListSnapshots): Uint8Array { + return RequestListSnapshots.encode(message).finish(); + }, + toProtoMsg(message: RequestListSnapshots): RequestListSnapshotsProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestListSnapshots", + value: RequestListSnapshots.encode(message).finish() + }; + } +}; +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { + snapshot: undefined, + appHash: new Uint8Array() + }; +} +export const RequestOfferSnapshot = { + typeUrl: "/tendermint.abci.RequestOfferSnapshot", + encode(message: RequestOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.snapshot = Snapshot.decode(reader, reader.uint32()); + break; + case 2: + message.appHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = object.snapshot !== undefined && object.snapshot !== null ? Snapshot.fromPartial(object.snapshot) : undefined; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestOfferSnapshotAmino): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + if (object.snapshot !== undefined && object.snapshot !== null) { + message.snapshot = Snapshot.fromAmino(object.snapshot); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + return message; + }, + toAmino(message: RequestOfferSnapshot): RequestOfferSnapshotAmino { + const obj: any = {}; + obj.snapshot = message.snapshot ? Snapshot.toAmino(message.snapshot) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + return obj; + }, + fromAminoMsg(object: RequestOfferSnapshotAminoMsg): RequestOfferSnapshot { + return RequestOfferSnapshot.fromAmino(object.value); + }, + fromProtoMsg(message: RequestOfferSnapshotProtoMsg): RequestOfferSnapshot { + return RequestOfferSnapshot.decode(message.value); + }, + toProto(message: RequestOfferSnapshot): Uint8Array { + return RequestOfferSnapshot.encode(message).finish(); + }, + toProtoMsg(message: RequestOfferSnapshot): RequestOfferSnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestOfferSnapshot", + value: RequestOfferSnapshot.encode(message).finish() + }; + } +}; +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { + height: BigInt(0), + format: 0, + chunk: 0 + }; +} +export const RequestLoadSnapshotChunk = { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunk !== 0) { + writer.uint32(24).uint32(message.chunk); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunk = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestLoadSnapshotChunk { + const message = createBaseRequestLoadSnapshotChunk(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.format = object.format ?? 0; + message.chunk = object.chunk ?? 0; + return message; + }, + fromAmino(object: RequestLoadSnapshotChunkAmino): RequestLoadSnapshotChunk { + const message = createBaseRequestLoadSnapshotChunk(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = object.chunk; + } + return message; + }, + toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunk = message.chunk === 0 ? undefined : message.chunk; + return obj; + }, + fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: RequestLoadSnapshotChunkProtoMsg): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.decode(message.value); + }, + toProto(message: RequestLoadSnapshotChunk): Uint8Array { + return RequestLoadSnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + value: RequestLoadSnapshotChunk.encode(message).finish() + }; + } +}; +function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { + return { + index: 0, + chunk: new Uint8Array(), + sender: "" + }; +} +export const RequestApplySnapshotChunk = { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.chunk = reader.bytes(); + break; + case 3: + message.sender = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(); + message.sender = object.sender ?? ""; + return message; + }, + fromAmino(object: RequestApplySnapshotChunkAmino): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = bytesFromBase64(object.chunk); + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + return message; + }, + toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { + const obj: any = {}; + obj.index = message.index === 0 ? undefined : message.index; + obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; + obj.sender = message.sender === "" ? undefined : message.sender; + return obj; + }, + fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: RequestApplySnapshotChunkProtoMsg): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.decode(message.value); + }, + toProto(message: RequestApplySnapshotChunk): Uint8Array { + return RequestApplySnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + value: RequestApplySnapshotChunk.encode(message).finish() + }; + } +}; +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + maxTxBytes: BigInt(0), + txs: [], + localLastCommit: ExtendedCommitInfo.fromPartial({}), + misbehavior: [], + height: BigInt(0), + time: new Date(), + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const RequestPrepareProposal = { + typeUrl: "/tendermint.abci.RequestPrepareProposal", + encode(message: RequestPrepareProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxTxBytes !== BigInt(0)) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxTxBytes = reader.int64(); + break; + case 2: + message.txs.push(reader.bytes()); + break; + case 3: + message.localLastCommit = ExtendedCommitInfo.decode(reader, reader.uint32()); + break; + case 4: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 5: + message.height = reader.int64(); + break; + case 6: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes !== undefined && object.maxTxBytes !== null ? BigInt(object.maxTxBytes.toString()) : BigInt(0); + message.txs = object.txs?.map(e => e) || []; + message.localLastCommit = object.localLastCommit !== undefined && object.localLastCommit !== null ? ExtendedCommitInfo.fromPartial(object.localLastCommit) : undefined; + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromPartial(e)) || []; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestPrepareProposalAmino): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + if (object.max_tx_bytes !== undefined && object.max_tx_bytes !== null) { + message.maxTxBytes = BigInt(object.max_tx_bytes); + } + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + if (object.local_last_commit !== undefined && object.local_last_commit !== null) { + message.localLastCommit = ExtendedCommitInfo.fromAmino(object.local_last_commit); + } + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromAmino(e)) || []; + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: RequestPrepareProposal): RequestPrepareProposalAmino { + const obj: any = {}; + obj.max_tx_bytes = message.maxTxBytes !== BigInt(0) ? message.maxTxBytes.toString() : undefined; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + obj.local_last_commit = message.localLastCommit ? ExtendedCommitInfo.toAmino(message.localLastCommit) : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.misbehavior = message.misbehavior; + } + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: RequestPrepareProposalAminoMsg): RequestPrepareProposal { + return RequestPrepareProposal.fromAmino(object.value); + }, + fromProtoMsg(message: RequestPrepareProposalProtoMsg): RequestPrepareProposal { + return RequestPrepareProposal.decode(message.value); + }, + toProto(message: RequestPrepareProposal): Uint8Array { + return RequestPrepareProposal.encode(message).finish(); + }, + toProtoMsg(message: RequestPrepareProposal): RequestPrepareProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestPrepareProposal", + value: RequestPrepareProposal.encode(message).finish() + }; + } +}; +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposedLastCommit: CommitInfo.fromPartial({}), + misbehavior: [], + hash: new Uint8Array(), + height: BigInt(0), + time: new Date(), + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const RequestProcessProposal = { + typeUrl: "/tendermint.abci.RequestProcessProposal", + encode(message: RequestProcessProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== BigInt(0)) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + case 2: + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + break; + case 3: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.height = reader.int64(); + break; + case 6: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map(e => e) || []; + message.proposedLastCommit = object.proposedLastCommit !== undefined && object.proposedLastCommit !== null ? CommitInfo.fromPartial(object.proposedLastCommit) : undefined; + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestProcessProposalAmino): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + if (object.proposed_last_commit !== undefined && object.proposed_last_commit !== null) { + message.proposedLastCommit = CommitInfo.fromAmino(object.proposed_last_commit); + } + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromAmino(e)) || []; + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: RequestProcessProposal): RequestProcessProposalAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + obj.proposed_last_commit = message.proposedLastCommit ? CommitInfo.toAmino(message.proposedLastCommit) : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.misbehavior = message.misbehavior; + } + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: RequestProcessProposalAminoMsg): RequestProcessProposal { + return RequestProcessProposal.fromAmino(object.value); + }, + fromProtoMsg(message: RequestProcessProposalProtoMsg): RequestProcessProposal { + return RequestProcessProposal.decode(message.value); + }, + toProto(message: RequestProcessProposal): Uint8Array { + return RequestProcessProposal.encode(message).finish(); + }, + toProtoMsg(message: RequestProcessProposal): RequestProcessProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestProcessProposal", + value: RequestProcessProposal.encode(message).finish() + }; + } +}; +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + beginBlock: undefined, + checkTx: undefined, + deliverTx: undefined, + endBlock: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined + }; +} +export const Response = { + typeUrl: "/tendermint.abci.Response", + encode(message: Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).ldelim(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).ldelim(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); + } + if (message.initChain !== undefined) { + ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).ldelim(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + ResponseBeginBlock.encode(message.beginBlock, writer.uint32(66).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + ResponseDeliverTx.encode(message.deliverTx, writer.uint32(82).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + ResponseEndBlock.encode(message.endBlock, writer.uint32(90).fork()).ldelim(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).ldelim(); + } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).ldelim(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exception = ResponseException.decode(reader, reader.uint32()); + break; + case 2: + message.echo = ResponseEcho.decode(reader, reader.uint32()); + break; + case 3: + message.flush = ResponseFlush.decode(reader, reader.uint32()); + break; + case 4: + message.info = ResponseInfo.decode(reader, reader.uint32()); + break; + case 6: + message.initChain = ResponseInitChain.decode(reader, reader.uint32()); + break; + case 7: + message.query = ResponseQuery.decode(reader, reader.uint32()); + break; + case 8: + message.beginBlock = ResponseBeginBlock.decode(reader, reader.uint32()); + break; + case 9: + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + break; + case 10: + message.deliverTx = ResponseDeliverTx.decode(reader, reader.uint32()); + break; + case 11: + message.endBlock = ResponseEndBlock.decode(reader, reader.uint32()); + break; + case 12: + message.commit = ResponseCommit.decode(reader, reader.uint32()); + break; + case 13: + message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + break; + case 14: + message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + break; + case 15: + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 16: + message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + break; + case 17: + message.prepareProposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + break; + case 18: + message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Response { + const message = createBaseResponse(); + message.exception = object.exception !== undefined && object.exception !== null ? ResponseException.fromPartial(object.exception) : undefined; + message.echo = object.echo !== undefined && object.echo !== null ? ResponseEcho.fromPartial(object.echo) : undefined; + message.flush = object.flush !== undefined && object.flush !== null ? ResponseFlush.fromPartial(object.flush) : undefined; + message.info = object.info !== undefined && object.info !== null ? ResponseInfo.fromPartial(object.info) : undefined; + message.initChain = object.initChain !== undefined && object.initChain !== null ? ResponseInitChain.fromPartial(object.initChain) : undefined; + message.query = object.query !== undefined && object.query !== null ? ResponseQuery.fromPartial(object.query) : undefined; + message.beginBlock = object.beginBlock !== undefined && object.beginBlock !== null ? ResponseBeginBlock.fromPartial(object.beginBlock) : undefined; + message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? ResponseCheckTx.fromPartial(object.checkTx) : undefined; + message.deliverTx = object.deliverTx !== undefined && object.deliverTx !== null ? ResponseDeliverTx.fromPartial(object.deliverTx) : undefined; + message.endBlock = object.endBlock !== undefined && object.endBlock !== null ? ResponseEndBlock.fromPartial(object.endBlock) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? ResponseCommit.fromPartial(object.commit) : undefined; + message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? ResponseListSnapshots.fromPartial(object.listSnapshots) : undefined; + message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; + message.loadSnapshotChunk = object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) : undefined; + message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; + message.prepareProposal = object.prepareProposal !== undefined && object.prepareProposal !== null ? ResponsePrepareProposal.fromPartial(object.prepareProposal) : undefined; + message.processProposal = object.processProposal !== undefined && object.processProposal !== null ? ResponseProcessProposal.fromPartial(object.processProposal) : undefined; + return message; + }, + fromAmino(object: ResponseAmino): Response { + const message = createBaseResponse(); + if (object.exception !== undefined && object.exception !== null) { + message.exception = ResponseException.fromAmino(object.exception); + } + if (object.echo !== undefined && object.echo !== null) { + message.echo = ResponseEcho.fromAmino(object.echo); + } + if (object.flush !== undefined && object.flush !== null) { + message.flush = ResponseFlush.fromAmino(object.flush); + } + if (object.info !== undefined && object.info !== null) { + message.info = ResponseInfo.fromAmino(object.info); + } + if (object.init_chain !== undefined && object.init_chain !== null) { + message.initChain = ResponseInitChain.fromAmino(object.init_chain); + } + if (object.query !== undefined && object.query !== null) { + message.query = ResponseQuery.fromAmino(object.query); + } + if (object.begin_block !== undefined && object.begin_block !== null) { + message.beginBlock = ResponseBeginBlock.fromAmino(object.begin_block); + } + if (object.check_tx !== undefined && object.check_tx !== null) { + message.checkTx = ResponseCheckTx.fromAmino(object.check_tx); + } + if (object.deliver_tx !== undefined && object.deliver_tx !== null) { + message.deliverTx = ResponseDeliverTx.fromAmino(object.deliver_tx); + } + if (object.end_block !== undefined && object.end_block !== null) { + message.endBlock = ResponseEndBlock.fromAmino(object.end_block); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = ResponseCommit.fromAmino(object.commit); + } + if (object.list_snapshots !== undefined && object.list_snapshots !== null) { + message.listSnapshots = ResponseListSnapshots.fromAmino(object.list_snapshots); + } + if (object.offer_snapshot !== undefined && object.offer_snapshot !== null) { + message.offerSnapshot = ResponseOfferSnapshot.fromAmino(object.offer_snapshot); + } + if (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) { + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk); + } + if (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) { + message.applySnapshotChunk = ResponseApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk); + } + if (object.prepare_proposal !== undefined && object.prepare_proposal !== null) { + message.prepareProposal = ResponsePrepareProposal.fromAmino(object.prepare_proposal); + } + if (object.process_proposal !== undefined && object.process_proposal !== null) { + message.processProposal = ResponseProcessProposal.fromAmino(object.process_proposal); + } + return message; + }, + toAmino(message: Response): ResponseAmino { + const obj: any = {}; + obj.exception = message.exception ? ResponseException.toAmino(message.exception) : undefined; + obj.echo = message.echo ? ResponseEcho.toAmino(message.echo) : undefined; + obj.flush = message.flush ? ResponseFlush.toAmino(message.flush) : undefined; + obj.info = message.info ? ResponseInfo.toAmino(message.info) : undefined; + obj.init_chain = message.initChain ? ResponseInitChain.toAmino(message.initChain) : undefined; + obj.query = message.query ? ResponseQuery.toAmino(message.query) : undefined; + obj.begin_block = message.beginBlock ? ResponseBeginBlock.toAmino(message.beginBlock) : undefined; + obj.check_tx = message.checkTx ? ResponseCheckTx.toAmino(message.checkTx) : undefined; + obj.deliver_tx = message.deliverTx ? ResponseDeliverTx.toAmino(message.deliverTx) : undefined; + obj.end_block = message.endBlock ? ResponseEndBlock.toAmino(message.endBlock) : undefined; + obj.commit = message.commit ? ResponseCommit.toAmino(message.commit) : undefined; + obj.list_snapshots = message.listSnapshots ? ResponseListSnapshots.toAmino(message.listSnapshots) : undefined; + obj.offer_snapshot = message.offerSnapshot ? ResponseOfferSnapshot.toAmino(message.offerSnapshot) : undefined; + obj.load_snapshot_chunk = message.loadSnapshotChunk ? ResponseLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) : undefined; + obj.apply_snapshot_chunk = message.applySnapshotChunk ? ResponseApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; + obj.prepare_proposal = message.prepareProposal ? ResponsePrepareProposal.toAmino(message.prepareProposal) : undefined; + obj.process_proposal = message.processProposal ? ResponseProcessProposal.toAmino(message.processProposal) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseAminoMsg): Response { + return Response.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseProtoMsg): Response { + return Response.decode(message.value); + }, + toProto(message: Response): Uint8Array { + return Response.encode(message).finish(); + }, + toProtoMsg(message: Response): ResponseProtoMsg { + return { + typeUrl: "/tendermint.abci.Response", + value: Response.encode(message).finish() + }; + } +}; +function createBaseResponseException(): ResponseException { + return { + error: "" + }; +} +export const ResponseException = { + typeUrl: "/tendermint.abci.ResponseException", + encode(message: ResponseException, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.error = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, + fromAmino(object: ResponseExceptionAmino): ResponseException { + const message = createBaseResponseException(); + if (object.error !== undefined && object.error !== null) { + message.error = object.error; + } + return message; + }, + toAmino(message: ResponseException): ResponseExceptionAmino { + const obj: any = {}; + obj.error = message.error === "" ? undefined : message.error; + return obj; + }, + fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { + return ResponseException.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseExceptionProtoMsg): ResponseException { + return ResponseException.decode(message.value); + }, + toProto(message: ResponseException): Uint8Array { + return ResponseException.encode(message).finish(); + }, + toProtoMsg(message: ResponseException): ResponseExceptionProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseException", + value: ResponseException.encode(message).finish() + }; + } +}; +function createBaseResponseEcho(): ResponseEcho { + return { + message: "" + }; +} +export const ResponseEcho = { + typeUrl: "/tendermint.abci.ResponseEcho", + encode(message: ResponseEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, + fromAmino(object: ResponseEchoAmino): ResponseEcho { + const message = createBaseResponseEcho(); + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } + return message; + }, + toAmino(message: ResponseEcho): ResponseEchoAmino { + const obj: any = {}; + obj.message = message.message === "" ? undefined : message.message; + return obj; + }, + fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { + return ResponseEcho.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseEchoProtoMsg): ResponseEcho { + return ResponseEcho.decode(message.value); + }, + toProto(message: ResponseEcho): Uint8Array { + return ResponseEcho.encode(message).finish(); + }, + toProtoMsg(message: ResponseEcho): ResponseEchoProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseEcho", + value: ResponseEcho.encode(message).finish() + }; + } +}; +function createBaseResponseFlush(): ResponseFlush { + return {}; +} +export const ResponseFlush = { + typeUrl: "/tendermint.abci.ResponseFlush", + encode(_: ResponseFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, + fromAmino(_: ResponseFlushAmino): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, + toAmino(_: ResponseFlush): ResponseFlushAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ResponseFlushAminoMsg): ResponseFlush { + return ResponseFlush.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseFlushProtoMsg): ResponseFlush { + return ResponseFlush.decode(message.value); + }, + toProto(message: ResponseFlush): Uint8Array { + return ResponseFlush.encode(message).finish(); + }, + toProtoMsg(message: ResponseFlush): ResponseFlushProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseFlush", + value: ResponseFlush.encode(message).finish() + }; + } +}; +function createBaseResponseInfo(): ResponseInfo { + return { + data: "", + version: "", + appVersion: BigInt(0), + lastBlockHeight: BigInt(0), + lastBlockAppHash: new Uint8Array() + }; +} +export const ResponseInfo = { + typeUrl: "/tendermint.abci.ResponseInfo", + encode(message: ResponseInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== BigInt(0)) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== BigInt(0)) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + case 3: + message.appVersion = reader.uint64(); + break; + case 4: + message.lastBlockHeight = reader.int64(); + break; + case 5: + message.lastBlockAppHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion !== undefined && object.appVersion !== null ? BigInt(object.appVersion.toString()) : BigInt(0); + message.lastBlockHeight = object.lastBlockHeight !== undefined && object.lastBlockHeight !== null ? BigInt(object.lastBlockHeight.toString()) : BigInt(0); + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseInfoAmino): ResponseInfo { + const message = createBaseResponseInfo(); + if (object.data !== undefined && object.data !== null) { + message.data = object.data; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.app_version !== undefined && object.app_version !== null) { + message.appVersion = BigInt(object.app_version); + } + if (object.last_block_height !== undefined && object.last_block_height !== null) { + message.lastBlockHeight = BigInt(object.last_block_height); + } + if (object.last_block_app_hash !== undefined && object.last_block_app_hash !== null) { + message.lastBlockAppHash = bytesFromBase64(object.last_block_app_hash); + } + return message; + }, + toAmino(message: ResponseInfo): ResponseInfoAmino { + const obj: any = {}; + obj.data = message.data === "" ? undefined : message.data; + obj.version = message.version === "" ? undefined : message.version; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight.toString() : undefined; + obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseInfoAminoMsg): ResponseInfo { + return ResponseInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseInfoProtoMsg): ResponseInfo { + return ResponseInfo.decode(message.value); + }, + toProto(message: ResponseInfo): Uint8Array { + return ResponseInfo.encode(message).finish(); + }, + toProtoMsg(message: ResponseInfo): ResponseInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseInfo", + value: ResponseInfo.encode(message).finish() + }; + } +}; +function createBaseResponseInitChain(): ResponseInitChain { + return { + consensusParams: undefined, + validators: [], + appHash: new Uint8Array() + }; +} +export const ResponseInitChain = { + typeUrl: "/tendermint.abci.ResponseInitChain", + encode(message: ResponseInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + break; + case 2: + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 3: + message.appHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; + message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseInitChainAmino): ResponseInitChain { + const message = createBaseResponseInitChain(); + if (object.consensus_params !== undefined && object.consensus_params !== null) { + message.consensusParams = ConsensusParams.fromAmino(object.consensus_params); + } + message.validators = object.validators?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + return message; + }, + toAmino(message: ResponseInitChain): ResponseInitChainAmino { + const obj: any = {}; + obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; + if (message.validators) { + obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseInitChainAminoMsg): ResponseInitChain { + return ResponseInitChain.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseInitChainProtoMsg): ResponseInitChain { + return ResponseInitChain.decode(message.value); + }, + toProto(message: ResponseInitChain): Uint8Array { + return ResponseInitChain.encode(message).finish(); + }, + toProtoMsg(message: ResponseInitChain): ResponseInitChainProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseInitChain", + value: ResponseInitChain.encode(message).finish() + }; + } +}; +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: BigInt(0), + key: new Uint8Array(), + value: new Uint8Array(), + proofOps: undefined, + height: BigInt(0), + codespace: "" + }; +} +export const ResponseQuery = { + typeUrl: "/tendermint.abci.ResponseQuery", + encode(message: ResponseQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== BigInt(0)) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.index = reader.int64(); + break; + case 6: + message.key = reader.bytes(); + break; + case 7: + message.value = reader.bytes(); + break; + case 8: + message.proofOps = ProofOps.decode(reader, reader.uint32()); + break; + case 9: + message.height = reader.int64(); + break; + case 10: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseQuery { + const message = createBaseResponseQuery(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.proofOps = object.proofOps !== undefined && object.proofOps !== null ? ProofOps.fromPartial(object.proofOps) : undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.codespace = object.codespace ?? ""; + return message; + }, + fromAmino(object: ResponseQueryAmino): ResponseQuery { + const message = createBaseResponseQuery(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.proof_ops !== undefined && object.proof_ops !== null) { + message.proofOps = ProofOps.fromAmino(object.proof_ops); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ResponseQuery): ResponseQueryAmino { + const obj: any = {}; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { + return ResponseQuery.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseQueryProtoMsg): ResponseQuery { + return ResponseQuery.decode(message.value); + }, + toProto(message: ResponseQuery): Uint8Array { + return ResponseQuery.encode(message).finish(); + }, + toProtoMsg(message: ResponseQuery): ResponseQueryProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseQuery", + value: ResponseQuery.encode(message).finish() + }; + } +}; +function createBaseResponseBeginBlock(): ResponseBeginBlock { + return { + events: [] + }; +} +export const ResponseBeginBlock = { + typeUrl: "/tendermint.abci.ResponseBeginBlock", + encode(message: ResponseBeginBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseBeginBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.events.push(Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseBeginBlock { + const message = createBaseResponseBeginBlock(); + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ResponseBeginBlockAmino): ResponseBeginBlock { + const message = createBaseResponseBeginBlock(); + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + return message; + }, + toAmino(message: ResponseBeginBlock): ResponseBeginBlockAmino { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + return obj; + }, + fromAminoMsg(object: ResponseBeginBlockAminoMsg): ResponseBeginBlock { + return ResponseBeginBlock.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseBeginBlockProtoMsg): ResponseBeginBlock { + return ResponseBeginBlock.decode(message.value); + }, + toProto(message: ResponseBeginBlock): Uint8Array { + return ResponseBeginBlock.encode(message).finish(); + }, + toProtoMsg(message: ResponseBeginBlock): ResponseBeginBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseBeginBlock", + value: ResponseBeginBlock.encode(message).finish() + }; + } +}; +function createBaseResponseCheckTx(): ResponseCheckTx { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: BigInt(0), + gasUsed: BigInt(0), + events: [], + codespace: "", + sender: "", + priority: BigInt(0), + mempoolError: "" + }; +} +export const ResponseCheckTx = { + typeUrl: "/tendermint.abci.ResponseCheckTx", + encode(message: ResponseCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== BigInt(0)) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + if (message.sender !== "") { + writer.uint32(74).string(message.sender); + } + if (message.priority !== BigInt(0)) { + writer.uint32(80).int64(message.priority); + } + if (message.mempoolError !== "") { + writer.uint32(90).string(message.mempoolError); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gasWanted = reader.int64(); + break; + case 6: + message.gasUsed = reader.int64(); + break; + case 7: + message.events.push(Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + case 9: + message.sender = reader.string(); + break; + case 10: + message.priority = reader.int64(); + break; + case 11: + message.mempoolError = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + message.sender = object.sender ?? ""; + message.priority = object.priority !== undefined && object.priority !== null ? BigInt(object.priority.toString()) : BigInt(0); + message.mempoolError = object.mempoolError ?? ""; + return message; + }, + fromAmino(object: ResponseCheckTxAmino): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.priority !== undefined && object.priority !== null) { + message.priority = BigInt(object.priority); + } + if (object.mempool_error !== undefined && object.mempool_error !== null) { + message.mempoolError = object.mempool_error; + } + return message; + }, + toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { + const obj: any = {}; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.priority = message.priority !== BigInt(0) ? message.priority.toString() : undefined; + obj.mempool_error = message.mempoolError === "" ? undefined : message.mempoolError; + return obj; + }, + fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { + return ResponseCheckTx.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseCheckTxProtoMsg): ResponseCheckTx { + return ResponseCheckTx.decode(message.value); + }, + toProto(message: ResponseCheckTx): Uint8Array { + return ResponseCheckTx.encode(message).finish(); + }, + toProtoMsg(message: ResponseCheckTx): ResponseCheckTxProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseCheckTx", + value: ResponseCheckTx.encode(message).finish() + }; + } +}; +function createBaseResponseDeliverTx(): ResponseDeliverTx { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: BigInt(0), + gasUsed: BigInt(0), + events: [], + codespace: "" + }; +} +export const ResponseDeliverTx = { + typeUrl: "/tendermint.abci.ResponseDeliverTx", + encode(message: ResponseDeliverTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== BigInt(0)) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseDeliverTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gasWanted = reader.int64(); + break; + case 6: + message.gasUsed = reader.int64(); + break; + case 7: + message.events.push(Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseDeliverTx { + const message = createBaseResponseDeliverTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, + fromAmino(object: ResponseDeliverTxAmino): ResponseDeliverTx { + const message = createBaseResponseDeliverTx(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { + const obj: any = {}; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + obj.codespace = message.codespace === "" ? undefined : message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { + return ResponseDeliverTx.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseDeliverTxProtoMsg): ResponseDeliverTx { + return ResponseDeliverTx.decode(message.value); + }, + toProto(message: ResponseDeliverTx): Uint8Array { + return ResponseDeliverTx.encode(message).finish(); + }, + toProtoMsg(message: ResponseDeliverTx): ResponseDeliverTxProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseDeliverTx", + value: ResponseDeliverTx.encode(message).finish() + }; + } +}; +function createBaseResponseEndBlock(): ResponseEndBlock { + return { + validatorUpdates: [], + consensusParamUpdates: undefined, + events: [] + }; +} +export const ResponseEndBlock = { + typeUrl: "/tendermint.abci.ResponseEndBlock", + encode(message: ResponseEndBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEndBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 2: + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + break; + case 3: + message.events.push(Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseEndBlock { + const message = createBaseResponseEndBlock(); + message.validatorUpdates = object.validatorUpdates?.map(e => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null ? ConsensusParams.fromPartial(object.consensusParamUpdates) : undefined; + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ResponseEndBlockAmino): ResponseEndBlock { + const message = createBaseResponseEndBlock(); + message.validatorUpdates = object.validator_updates?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.consensus_param_updates !== undefined && object.consensus_param_updates !== null) { + message.consensusParamUpdates = ConsensusParams.fromAmino(object.consensus_param_updates); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + return message; + }, + toAmino(message: ResponseEndBlock): ResponseEndBlockAmino { + const obj: any = {}; + if (message.validatorUpdates) { + obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validator_updates = message.validatorUpdates; + } + obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + return obj; + }, + fromAminoMsg(object: ResponseEndBlockAminoMsg): ResponseEndBlock { + return ResponseEndBlock.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseEndBlockProtoMsg): ResponseEndBlock { + return ResponseEndBlock.decode(message.value); + }, + toProto(message: ResponseEndBlock): Uint8Array { + return ResponseEndBlock.encode(message).finish(); + }, + toProtoMsg(message: ResponseEndBlock): ResponseEndBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseEndBlock", + value: ResponseEndBlock.encode(message).finish() + }; + } +}; +function createBaseResponseCommit(): ResponseCommit { + return { + data: new Uint8Array(), + retainHeight: BigInt(0) + }; +} +export const ResponseCommit = { + typeUrl: "/tendermint.abci.ResponseCommit", + encode(message: ResponseCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.retainHeight !== BigInt(0)) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.data = reader.bytes(); + break; + case 3: + message.retainHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseCommit { + const message = createBaseResponseCommit(); + message.data = object.data ?? new Uint8Array(); + message.retainHeight = object.retainHeight !== undefined && object.retainHeight !== null ? BigInt(object.retainHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ResponseCommitAmino): ResponseCommit { + const message = createBaseResponseCommit(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.retain_height !== undefined && object.retain_height !== null) { + message.retainHeight = BigInt(object.retain_height); + } + return message; + }, + toAmino(message: ResponseCommit): ResponseCommitAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { + return ResponseCommit.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseCommitProtoMsg): ResponseCommit { + return ResponseCommit.decode(message.value); + }, + toProto(message: ResponseCommit): Uint8Array { + return ResponseCommit.encode(message).finish(); + }, + toProtoMsg(message: ResponseCommit): ResponseCommitProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseCommit", + value: ResponseCommit.encode(message).finish() + }; + } +}; +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { + snapshots: [] + }; +} +export const ResponseListSnapshots = { + typeUrl: "/tendermint.abci.ResponseListSnapshots", + encode(message: ResponseListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseListSnapshots { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map(e => Snapshot.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ResponseListSnapshotsAmino): ResponseListSnapshots { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map(e => Snapshot.fromAmino(e)) || []; + return message; + }, + toAmino(message: ResponseListSnapshots): ResponseListSnapshotsAmino { + const obj: any = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e) : undefined); + } else { + obj.snapshots = message.snapshots; + } + return obj; + }, + fromAminoMsg(object: ResponseListSnapshotsAminoMsg): ResponseListSnapshots { + return ResponseListSnapshots.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseListSnapshotsProtoMsg): ResponseListSnapshots { + return ResponseListSnapshots.decode(message.value); + }, + toProto(message: ResponseListSnapshots): Uint8Array { + return ResponseListSnapshots.encode(message).finish(); + }, + toProtoMsg(message: ResponseListSnapshots): ResponseListSnapshotsProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseListSnapshots", + value: ResponseListSnapshots.encode(message).finish() + }; + } +}; +function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { + return { + result: 0 + }; +} +export const ResponseOfferSnapshot = { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseOfferSnapshotProtoMsg): ResponseOfferSnapshot { + return ResponseOfferSnapshot.decode(message.value); + }, + toProto(message: ResponseOfferSnapshot): Uint8Array { + return ResponseOfferSnapshot.encode(message).finish(); + }, + toProtoMsg(message: ResponseOfferSnapshot): ResponseOfferSnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + value: ResponseOfferSnapshot.encode(message).finish() + }; + } +}; +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { + chunk: new Uint8Array() + }; +} +export const ResponseLoadSnapshotChunk = { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chunk = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseLoadSnapshotChunkAmino): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = bytesFromBase64(object.chunk); + } + return message; + }, + toAmino(message: ResponseLoadSnapshotChunk): ResponseLoadSnapshotChunkAmino { + const obj: any = {}; + obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseLoadSnapshotChunkAminoMsg): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseLoadSnapshotChunkProtoMsg): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.decode(message.value); + }, + toProto(message: ResponseLoadSnapshotChunk): Uint8Array { + return ResponseLoadSnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: ResponseLoadSnapshotChunk): ResponseLoadSnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + value: ResponseLoadSnapshotChunk.encode(message).finish() + }; + } +}; +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { + result: 0, + refetchChunks: [], + rejectSenders: [] + }; +} +export const ResponseApplySnapshotChunk = { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.ldelim(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + } else { + message.refetchChunks.push(reader.uint32()); + } + break; + case 3: + message.rejectSenders.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map(e => e) || []; + message.rejectSenders = object.rejectSenders?.map(e => e) || []; + return message; + }, + fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + message.refetchChunks = object.refetch_chunks?.map(e => e) || []; + message.rejectSenders = object.reject_senders?.map(e => e) || []; + return message; + }, + toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + if (message.refetchChunks) { + obj.refetch_chunks = message.refetchChunks.map(e => e); + } else { + obj.refetch_chunks = message.refetchChunks; + } + if (message.rejectSenders) { + obj.reject_senders = message.rejectSenders.map(e => e); + } else { + obj.reject_senders = message.rejectSenders; + } + return obj; + }, + fromAminoMsg(object: ResponseApplySnapshotChunkAminoMsg): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseApplySnapshotChunkProtoMsg): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.decode(message.value); + }, + toProto(message: ResponseApplySnapshotChunk): Uint8Array { + return ResponseApplySnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + value: ResponseApplySnapshotChunk.encode(message).finish() + }; + } +}; +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { + return { + txs: [] + }; +} +export const ResponsePrepareProposal = { + typeUrl: "/tendermint.abci.ResponsePrepareProposal", + encode(message: ResponsePrepareProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map(e => e) || []; + return message; + }, + fromAmino(object: ResponsePrepareProposalAmino): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: ResponsePrepareProposal): ResponsePrepareProposalAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + return obj; + }, + fromAminoMsg(object: ResponsePrepareProposalAminoMsg): ResponsePrepareProposal { + return ResponsePrepareProposal.fromAmino(object.value); + }, + fromProtoMsg(message: ResponsePrepareProposalProtoMsg): ResponsePrepareProposal { + return ResponsePrepareProposal.decode(message.value); + }, + toProto(message: ResponsePrepareProposal): Uint8Array { + return ResponsePrepareProposal.encode(message).finish(); + }, + toProtoMsg(message: ResponsePrepareProposal): ResponsePrepareProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponsePrepareProposal", + value: ResponsePrepareProposal.encode(message).finish() + }; + } +}; +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { + status: 0 + }; +} +export const ResponseProcessProposal = { + typeUrl: "/tendermint.abci.ResponseProcessProposal", + encode(message: ResponseProcessProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, + fromAmino(object: ResponseProcessProposalAmino): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + return message; + }, + toAmino(message: ResponseProcessProposal): ResponseProcessProposalAmino { + const obj: any = {}; + obj.status = message.status === 0 ? undefined : message.status; + return obj; + }, + fromAminoMsg(object: ResponseProcessProposalAminoMsg): ResponseProcessProposal { + return ResponseProcessProposal.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseProcessProposalProtoMsg): ResponseProcessProposal { + return ResponseProcessProposal.decode(message.value); + }, + toProto(message: ResponseProcessProposal): Uint8Array { + return ResponseProcessProposal.encode(message).finish(); + }, + toProtoMsg(message: ResponseProcessProposal): ResponseProcessProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseProcessProposal", + value: ResponseProcessProposal.encode(message).finish() + }; + } +}; +function createBaseCommitInfo(): CommitInfo { + return { + round: 0, + votes: [] + }; +} +export const CommitInfo = { + typeUrl: "/tendermint.abci.CommitInfo", + encode(message: CommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.round = reader.int32(); + break; + case 2: + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map(e => VoteInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CommitInfoAmino): CommitInfo { + const message = createBaseCommitInfo(); + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + message.votes = object.votes?.map(e => VoteInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: CommitInfo): CommitInfoAmino { + const obj: any = {}; + obj.round = message.round === 0 ? undefined : message.round; + if (message.votes) { + obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + return obj; + }, + fromAminoMsg(object: CommitInfoAminoMsg): CommitInfo { + return CommitInfo.fromAmino(object.value); + }, + fromProtoMsg(message: CommitInfoProtoMsg): CommitInfo { + return CommitInfo.decode(message.value); + }, + toProto(message: CommitInfo): Uint8Array { + return CommitInfo.encode(message).finish(); + }, + toProtoMsg(message: CommitInfo): CommitInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.CommitInfo", + value: CommitInfo.encode(message).finish() + }; + } +}; +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { + return { + round: 0, + votes: [] + }; +} +export const ExtendedCommitInfo = { + typeUrl: "/tendermint.abci.ExtendedCommitInfo", + encode(message: ExtendedCommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.round = reader.int32(); + break; + case 2: + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map(e => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ExtendedCommitInfoAmino): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + message.votes = object.votes?.map(e => ExtendedVoteInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExtendedCommitInfo): ExtendedCommitInfoAmino { + const obj: any = {}; + obj.round = message.round === 0 ? undefined : message.round; + if (message.votes) { + obj.votes = message.votes.map(e => e ? ExtendedVoteInfo.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + return obj; + }, + fromAminoMsg(object: ExtendedCommitInfoAminoMsg): ExtendedCommitInfo { + return ExtendedCommitInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedCommitInfoProtoMsg): ExtendedCommitInfo { + return ExtendedCommitInfo.decode(message.value); + }, + toProto(message: ExtendedCommitInfo): Uint8Array { + return ExtendedCommitInfo.encode(message).finish(); + }, + toProtoMsg(message: ExtendedCommitInfo): ExtendedCommitInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ExtendedCommitInfo", + value: ExtendedCommitInfo.encode(message).finish() + }; + } +}; +function createBaseEvent(): Event { + return { + type: "", + attributes: [] + }; +} +export const Event = { + typeUrl: "/tendermint.abci.Event", + encode(message: Event, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Event { + const message = createBaseEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map(e => EventAttribute.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EventAmino): Event { + const message = createBaseEvent(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + message.attributes = object.attributes?.map(e => EventAttribute.fromAmino(e)) || []; + return message; + }, + toAmino(message: Event): EventAmino { + const obj: any = {}; + obj.type = message.type === "" ? undefined : message.type; + if (message.attributes) { + obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); + } else { + obj.attributes = message.attributes; + } + return obj; + }, + fromAminoMsg(object: EventAminoMsg): Event { + return Event.fromAmino(object.value); + }, + fromProtoMsg(message: EventProtoMsg): Event { + return Event.decode(message.value); + }, + toProto(message: Event): Uint8Array { + return Event.encode(message).finish(); + }, + toProtoMsg(message: Event): EventProtoMsg { + return { + typeUrl: "/tendermint.abci.Event", + value: Event.encode(message).finish() + }; + } +}; +function createBaseEventAttribute(): EventAttribute { + return { + key: "", + value: "", + index: false + }; +} +export const EventAttribute = { + typeUrl: "/tendermint.abci.EventAttribute", + encode(message: EventAttribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index === true) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + 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; + case 3: + message.index = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, + fromAmino(object: EventAttributeAmino): EventAttribute { + const message = createBaseEventAttribute(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + return message; + }, + toAmino(message: EventAttribute): EventAttributeAmino { + const obj: any = {}; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; + obj.index = message.index === false ? undefined : message.index; + return obj; + }, + fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { + return EventAttribute.fromAmino(object.value); + }, + fromProtoMsg(message: EventAttributeProtoMsg): EventAttribute { + return EventAttribute.decode(message.value); + }, + toProto(message: EventAttribute): Uint8Array { + return EventAttribute.encode(message).finish(); + }, + toProtoMsg(message: EventAttribute): EventAttributeProtoMsg { + return { + typeUrl: "/tendermint.abci.EventAttribute", + value: EventAttribute.encode(message).finish() + }; + } +}; +function createBaseTxResult(): TxResult { + return { + height: BigInt(0), + index: 0, + tx: new Uint8Array(), + result: ResponseDeliverTx.fromPartial({}) + }; +} +export const TxResult = { + typeUrl: "/tendermint.abci.TxResult", + encode(message: TxResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.index !== 0) { + writer.uint32(16).uint32(message.index); + } + if (message.tx.length !== 0) { + writer.uint32(26).bytes(message.tx); + } + if (message.result !== undefined) { + ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.index = reader.uint32(); + break; + case 3: + message.tx = reader.bytes(); + break; + case 4: + message.result = ResponseDeliverTx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxResult { + const message = createBaseTxResult(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(); + message.result = object.result !== undefined && object.result !== null ? ResponseDeliverTx.fromPartial(object.result) : undefined; + return message; + }, + fromAmino(object: TxResultAmino): TxResult { + const message = createBaseTxResult(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + if (object.result !== undefined && object.result !== null) { + message.result = ResponseDeliverTx.fromAmino(object.result); + } + return message; + }, + toAmino(message: TxResult): TxResultAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.index = message.index === 0 ? undefined : message.index; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: TxResultAminoMsg): TxResult { + return TxResult.fromAmino(object.value); + }, + fromProtoMsg(message: TxResultProtoMsg): TxResult { + return TxResult.decode(message.value); + }, + toProto(message: TxResult): Uint8Array { + return TxResult.encode(message).finish(); + }, + toProtoMsg(message: TxResult): TxResultProtoMsg { + return { + typeUrl: "/tendermint.abci.TxResult", + value: TxResult.encode(message).finish() + }; + } +}; +function createBaseValidator(): Validator { + return { + address: new Uint8Array(), + power: BigInt(0) + }; +} +export const Validator = { + typeUrl: "/tendermint.abci.Validator", + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.power !== BigInt(0)) { + writer.uint32(24).int64(message.power); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.bytes(); + break; + case 3: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.address !== undefined && object.address !== null) { + message.address = bytesFromBase64(object.address); + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } + return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address ? base64FromBytes(message.address) : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/tendermint.abci.Validator", + value: Validator.encode(message).finish() + }; + } +}; +function createBaseValidatorUpdate(): ValidatorUpdate { + return { + pubKey: PublicKey.fromPartial({}), + power: BigInt(0) + }; +} +export const ValidatorUpdate = { + typeUrl: "/tendermint.abci.ValidatorUpdate", + encode(message: ValidatorUpdate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.power !== BigInt(0)) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKey = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorUpdateAmino): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } + return message; + }, + toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { + return ValidatorUpdate.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorUpdateProtoMsg): ValidatorUpdate { + return ValidatorUpdate.decode(message.value); + }, + toProto(message: ValidatorUpdate): Uint8Array { + return ValidatorUpdate.encode(message).finish(); + }, + toProtoMsg(message: ValidatorUpdate): ValidatorUpdateProtoMsg { + return { + typeUrl: "/tendermint.abci.ValidatorUpdate", + value: ValidatorUpdate.encode(message).finish() + }; + } +}; +function createBaseVoteInfo(): VoteInfo { + return { + validator: Validator.fromPartial({}), + signedLastBlock: false + }; +} +export const VoteInfo = { + typeUrl: "/tendermint.abci.VoteInfo", + encode(message: VoteInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 2: + message.signedLastBlock = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.signedLastBlock = object.signedLastBlock ?? false; + return message; + }, + fromAmino(object: VoteInfoAmino): VoteInfo { + const message = createBaseVoteInfo(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + if (object.signed_last_block !== undefined && object.signed_last_block !== null) { + message.signedLastBlock = object.signed_last_block; + } + return message; + }, + toAmino(message: VoteInfo): VoteInfoAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; + return obj; + }, + fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { + return VoteInfo.fromAmino(object.value); + }, + fromProtoMsg(message: VoteInfoProtoMsg): VoteInfo { + return VoteInfo.decode(message.value); + }, + toProto(message: VoteInfo): Uint8Array { + return VoteInfo.encode(message).finish(); + }, + toProtoMsg(message: VoteInfo): VoteInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.VoteInfo", + value: VoteInfo.encode(message).finish() + }; + } +}; +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { + validator: Validator.fromPartial({}), + signedLastBlock: false, + voteExtension: new Uint8Array() + }; +} +export const ExtendedVoteInfo = { + typeUrl: "/tendermint.abci.ExtendedVoteInfo", + encode(message: ExtendedVoteInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 2: + message.signedLastBlock = reader.bool(); + break; + case 3: + message.voteExtension = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.signedLastBlock = object.signedLastBlock ?? false; + message.voteExtension = object.voteExtension ?? new Uint8Array(); + return message; + }, + fromAmino(object: ExtendedVoteInfoAmino): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + if (object.signed_last_block !== undefined && object.signed_last_block !== null) { + message.signedLastBlock = object.signed_last_block; + } + if (object.vote_extension !== undefined && object.vote_extension !== null) { + message.voteExtension = bytesFromBase64(object.vote_extension); + } + return message; + }, + toAmino(message: ExtendedVoteInfo): ExtendedVoteInfoAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; + obj.vote_extension = message.voteExtension ? base64FromBytes(message.voteExtension) : undefined; + return obj; + }, + fromAminoMsg(object: ExtendedVoteInfoAminoMsg): ExtendedVoteInfo { + return ExtendedVoteInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedVoteInfoProtoMsg): ExtendedVoteInfo { + return ExtendedVoteInfo.decode(message.value); + }, + toProto(message: ExtendedVoteInfo): Uint8Array { + return ExtendedVoteInfo.encode(message).finish(); + }, + toProtoMsg(message: ExtendedVoteInfo): ExtendedVoteInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ExtendedVoteInfo", + value: ExtendedVoteInfo.encode(message).finish() + }; + } +}; +function createBaseMisbehavior(): Misbehavior { + return { + type: 0, + validator: Validator.fromPartial({}), + height: BigInt(0), + time: new Date(), + totalVotingPower: BigInt(0) + }; +} +export const Misbehavior = { + typeUrl: "/tendermint.abci.Misbehavior", + encode(message: Misbehavior, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.totalVotingPower !== BigInt(0)) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Misbehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.totalVotingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Misbehavior { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MisbehaviorAmino): Misbehavior { + const message = createBaseMisbehavior(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + return message; + }, + toAmino(message: Misbehavior): MisbehaviorAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviorAminoMsg): Misbehavior { + return Misbehavior.fromAmino(object.value); + }, + fromProtoMsg(message: MisbehaviorProtoMsg): Misbehavior { + return Misbehavior.decode(message.value); + }, + toProto(message: Misbehavior): Uint8Array { + return Misbehavior.encode(message).finish(); + }, + toProtoMsg(message: Misbehavior): MisbehaviorProtoMsg { + return { + typeUrl: "/tendermint.abci.Misbehavior", + value: Misbehavior.encode(message).finish() + }; + } +}; +function createBaseSnapshot(): Snapshot { + return { + height: BigInt(0), + format: 0, + chunks: 0, + hash: new Uint8Array(), + metadata: new Uint8Array() + }; +} +export const Snapshot = { + typeUrl: "/tendermint.abci.Snapshot", + encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata.length !== 0) { + writer.uint32(42).bytes(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunks = reader.uint32(); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.metadata = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = object.metadata ?? new Uint8Array(); + return message; + }, + fromAmino(object: SnapshotAmino): Snapshot { + const message = createBaseSnapshot(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunks !== undefined && object.chunks !== null) { + message.chunks = object.chunks; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = bytesFromBase64(object.metadata); + } + return message; + }, + toAmino(message: Snapshot): SnapshotAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotAminoMsg): Snapshot { + return Snapshot.fromAmino(object.value); + }, + fromProtoMsg(message: SnapshotProtoMsg): Snapshot { + return Snapshot.decode(message.value); + }, + toProto(message: Snapshot): Uint8Array { + return Snapshot.encode(message).finish(); + }, + toProtoMsg(message: Snapshot): SnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.Snapshot", + value: Snapshot.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/blocksync/types.ts b/util/inj-types/tendermint/blocksync/types.ts new file mode 100644 index 00000000..f01e9403 --- /dev/null +++ b/util/inj-types/tendermint/blocksync/types.ts @@ -0,0 +1,554 @@ +import { Block, BlockAmino, BlockSDKType } from "../types/block"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +/** BlockRequest requests a block for a specific height */ +export interface BlockRequest { + height: bigint; +} +export interface BlockRequestProtoMsg { + typeUrl: "/tendermint.blocksync.BlockRequest"; + value: Uint8Array; +} +/** BlockRequest requests a block for a specific height */ +export interface BlockRequestAmino { + height?: string; +} +export interface BlockRequestAminoMsg { + type: "/tendermint.blocksync.BlockRequest"; + value: BlockRequestAmino; +} +/** BlockRequest requests a block for a specific height */ +export interface BlockRequestSDKType { + height: bigint; +} +/** NoBlockResponse informs the node that the peer does not have block at the requested height */ +export interface NoBlockResponse { + height: bigint; +} +export interface NoBlockResponseProtoMsg { + typeUrl: "/tendermint.blocksync.NoBlockResponse"; + value: Uint8Array; +} +/** NoBlockResponse informs the node that the peer does not have block at the requested height */ +export interface NoBlockResponseAmino { + height?: string; +} +export interface NoBlockResponseAminoMsg { + type: "/tendermint.blocksync.NoBlockResponse"; + value: NoBlockResponseAmino; +} +/** NoBlockResponse informs the node that the peer does not have block at the requested height */ +export interface NoBlockResponseSDKType { + height: bigint; +} +/** BlockResponse returns block to the requested */ +export interface BlockResponse { + block?: Block; +} +export interface BlockResponseProtoMsg { + typeUrl: "/tendermint.blocksync.BlockResponse"; + value: Uint8Array; +} +/** BlockResponse returns block to the requested */ +export interface BlockResponseAmino { + block?: BlockAmino; +} +export interface BlockResponseAminoMsg { + type: "/tendermint.blocksync.BlockResponse"; + value: BlockResponseAmino; +} +/** BlockResponse returns block to the requested */ +export interface BlockResponseSDKType { + block?: BlockSDKType; +} +/** StatusRequest requests the status of a peer. */ +export interface StatusRequest {} +export interface StatusRequestProtoMsg { + typeUrl: "/tendermint.blocksync.StatusRequest"; + value: Uint8Array; +} +/** StatusRequest requests the status of a peer. */ +export interface StatusRequestAmino {} +export interface StatusRequestAminoMsg { + type: "/tendermint.blocksync.StatusRequest"; + value: StatusRequestAmino; +} +/** StatusRequest requests the status of a peer. */ +export interface StatusRequestSDKType {} +/** StatusResponse is a peer response to inform their status. */ +export interface StatusResponse { + height: bigint; + base: bigint; +} +export interface StatusResponseProtoMsg { + typeUrl: "/tendermint.blocksync.StatusResponse"; + value: Uint8Array; +} +/** StatusResponse is a peer response to inform their status. */ +export interface StatusResponseAmino { + height?: string; + base?: string; +} +export interface StatusResponseAminoMsg { + type: "/tendermint.blocksync.StatusResponse"; + value: StatusResponseAmino; +} +/** StatusResponse is a peer response to inform their status. */ +export interface StatusResponseSDKType { + height: bigint; + base: bigint; +} +export interface Message { + blockRequest?: BlockRequest; + noBlockResponse?: NoBlockResponse; + blockResponse?: BlockResponse; + statusRequest?: StatusRequest; + statusResponse?: StatusResponse; +} +export interface MessageProtoMsg { + typeUrl: "/tendermint.blocksync.Message"; + value: Uint8Array; +} +export interface MessageAmino { + block_request?: BlockRequestAmino; + no_block_response?: NoBlockResponseAmino; + block_response?: BlockResponseAmino; + status_request?: StatusRequestAmino; + status_response?: StatusResponseAmino; +} +export interface MessageAminoMsg { + type: "/tendermint.blocksync.Message"; + value: MessageAmino; +} +export interface MessageSDKType { + block_request?: BlockRequestSDKType; + no_block_response?: NoBlockResponseSDKType; + block_response?: BlockResponseSDKType; + status_request?: StatusRequestSDKType; + status_response?: StatusResponseSDKType; +} +function createBaseBlockRequest(): BlockRequest { + return { + height: BigInt(0) + }; +} +export const BlockRequest = { + typeUrl: "/tendermint.blocksync.BlockRequest", + encode(message: BlockRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockRequest { + const message = createBaseBlockRequest(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BlockRequestAmino): BlockRequest { + const message = createBaseBlockRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: BlockRequest): BlockRequestAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockRequestAminoMsg): BlockRequest { + return BlockRequest.fromAmino(object.value); + }, + fromProtoMsg(message: BlockRequestProtoMsg): BlockRequest { + return BlockRequest.decode(message.value); + }, + toProto(message: BlockRequest): Uint8Array { + return BlockRequest.encode(message).finish(); + }, + toProtoMsg(message: BlockRequest): BlockRequestProtoMsg { + return { + typeUrl: "/tendermint.blocksync.BlockRequest", + value: BlockRequest.encode(message).finish() + }; + } +}; +function createBaseNoBlockResponse(): NoBlockResponse { + return { + height: BigInt(0) + }; +} +export const NoBlockResponse = { + typeUrl: "/tendermint.blocksync.NoBlockResponse", + encode(message: NoBlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): NoBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNoBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): NoBlockResponse { + const message = createBaseNoBlockResponse(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: NoBlockResponseAmino): NoBlockResponse { + const message = createBaseNoBlockResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: NoBlockResponse): NoBlockResponseAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: NoBlockResponseAminoMsg): NoBlockResponse { + return NoBlockResponse.fromAmino(object.value); + }, + fromProtoMsg(message: NoBlockResponseProtoMsg): NoBlockResponse { + return NoBlockResponse.decode(message.value); + }, + toProto(message: NoBlockResponse): Uint8Array { + return NoBlockResponse.encode(message).finish(); + }, + toProtoMsg(message: NoBlockResponse): NoBlockResponseProtoMsg { + return { + typeUrl: "/tendermint.blocksync.NoBlockResponse", + value: NoBlockResponse.encode(message).finish() + }; + } +}; +function createBaseBlockResponse(): BlockResponse { + return { + block: undefined + }; +} +export const BlockResponse = { + typeUrl: "/tendermint.blocksync.BlockResponse", + encode(message: BlockResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = Block.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockResponse { + const message = createBaseBlockResponse(); + message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; + return message; + }, + fromAmino(object: BlockResponseAmino): BlockResponse { + const message = createBaseBlockResponse(); + if (object.block !== undefined && object.block !== null) { + message.block = Block.fromAmino(object.block); + } + return message; + }, + toAmino(message: BlockResponse): BlockResponseAmino { + const obj: any = {}; + obj.block = message.block ? Block.toAmino(message.block) : undefined; + return obj; + }, + fromAminoMsg(object: BlockResponseAminoMsg): BlockResponse { + return BlockResponse.fromAmino(object.value); + }, + fromProtoMsg(message: BlockResponseProtoMsg): BlockResponse { + return BlockResponse.decode(message.value); + }, + toProto(message: BlockResponse): Uint8Array { + return BlockResponse.encode(message).finish(); + }, + toProtoMsg(message: BlockResponse): BlockResponseProtoMsg { + return { + typeUrl: "/tendermint.blocksync.BlockResponse", + value: BlockResponse.encode(message).finish() + }; + } +}; +function createBaseStatusRequest(): StatusRequest { + return {}; +} +export const StatusRequest = { + typeUrl: "/tendermint.blocksync.StatusRequest", + encode(_: StatusRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, + fromAmino(_: StatusRequestAmino): StatusRequest { + const message = createBaseStatusRequest(); + return message; + }, + toAmino(_: StatusRequest): StatusRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: StatusRequestAminoMsg): StatusRequest { + return StatusRequest.fromAmino(object.value); + }, + fromProtoMsg(message: StatusRequestProtoMsg): StatusRequest { + return StatusRequest.decode(message.value); + }, + toProto(message: StatusRequest): Uint8Array { + return StatusRequest.encode(message).finish(); + }, + toProtoMsg(message: StatusRequest): StatusRequestProtoMsg { + return { + typeUrl: "/tendermint.blocksync.StatusRequest", + value: StatusRequest.encode(message).finish() + }; + } +}; +function createBaseStatusResponse(): StatusResponse { + return { + height: BigInt(0), + base: BigInt(0) + }; +} +export const StatusResponse = { + typeUrl: "/tendermint.blocksync.StatusResponse", + encode(message: StatusResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.base !== BigInt(0)) { + writer.uint32(16).int64(message.base); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.base = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): StatusResponse { + const message = createBaseStatusResponse(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.base = object.base !== undefined && object.base !== null ? BigInt(object.base.toString()) : BigInt(0); + return message; + }, + fromAmino(object: StatusResponseAmino): StatusResponse { + const message = createBaseStatusResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.base !== undefined && object.base !== null) { + message.base = BigInt(object.base); + } + return message; + }, + toAmino(message: StatusResponse): StatusResponseAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.base = message.base !== BigInt(0) ? message.base.toString() : undefined; + return obj; + }, + fromAminoMsg(object: StatusResponseAminoMsg): StatusResponse { + return StatusResponse.fromAmino(object.value); + }, + fromProtoMsg(message: StatusResponseProtoMsg): StatusResponse { + return StatusResponse.decode(message.value); + }, + toProto(message: StatusResponse): Uint8Array { + return StatusResponse.encode(message).finish(); + }, + toProtoMsg(message: StatusResponse): StatusResponseProtoMsg { + return { + typeUrl: "/tendermint.blocksync.StatusResponse", + value: StatusResponse.encode(message).finish() + }; + } +}; +function createBaseMessage(): Message { + return { + blockRequest: undefined, + noBlockResponse: undefined, + blockResponse: undefined, + statusRequest: undefined, + statusResponse: undefined + }; +} +export const Message = { + typeUrl: "/tendermint.blocksync.Message", + encode(message: Message, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockRequest !== undefined) { + BlockRequest.encode(message.blockRequest, writer.uint32(10).fork()).ldelim(); + } + if (message.noBlockResponse !== undefined) { + NoBlockResponse.encode(message.noBlockResponse, writer.uint32(18).fork()).ldelim(); + } + if (message.blockResponse !== undefined) { + BlockResponse.encode(message.blockResponse, writer.uint32(26).fork()).ldelim(); + } + if (message.statusRequest !== undefined) { + StatusRequest.encode(message.statusRequest, writer.uint32(34).fork()).ldelim(); + } + if (message.statusResponse !== undefined) { + StatusResponse.encode(message.statusResponse, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Message { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockRequest = BlockRequest.decode(reader, reader.uint32()); + break; + case 2: + message.noBlockResponse = NoBlockResponse.decode(reader, reader.uint32()); + break; + case 3: + message.blockResponse = BlockResponse.decode(reader, reader.uint32()); + break; + case 4: + message.statusRequest = StatusRequest.decode(reader, reader.uint32()); + break; + case 5: + message.statusResponse = StatusResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Message { + const message = createBaseMessage(); + message.blockRequest = object.blockRequest !== undefined && object.blockRequest !== null ? BlockRequest.fromPartial(object.blockRequest) : undefined; + message.noBlockResponse = object.noBlockResponse !== undefined && object.noBlockResponse !== null ? NoBlockResponse.fromPartial(object.noBlockResponse) : undefined; + message.blockResponse = object.blockResponse !== undefined && object.blockResponse !== null ? BlockResponse.fromPartial(object.blockResponse) : undefined; + message.statusRequest = object.statusRequest !== undefined && object.statusRequest !== null ? StatusRequest.fromPartial(object.statusRequest) : undefined; + message.statusResponse = object.statusResponse !== undefined && object.statusResponse !== null ? StatusResponse.fromPartial(object.statusResponse) : undefined; + return message; + }, + fromAmino(object: MessageAmino): Message { + const message = createBaseMessage(); + if (object.block_request !== undefined && object.block_request !== null) { + message.blockRequest = BlockRequest.fromAmino(object.block_request); + } + if (object.no_block_response !== undefined && object.no_block_response !== null) { + message.noBlockResponse = NoBlockResponse.fromAmino(object.no_block_response); + } + if (object.block_response !== undefined && object.block_response !== null) { + message.blockResponse = BlockResponse.fromAmino(object.block_response); + } + if (object.status_request !== undefined && object.status_request !== null) { + message.statusRequest = StatusRequest.fromAmino(object.status_request); + } + if (object.status_response !== undefined && object.status_response !== null) { + message.statusResponse = StatusResponse.fromAmino(object.status_response); + } + return message; + }, + toAmino(message: Message): MessageAmino { + const obj: any = {}; + obj.block_request = message.blockRequest ? BlockRequest.toAmino(message.blockRequest) : undefined; + obj.no_block_response = message.noBlockResponse ? NoBlockResponse.toAmino(message.noBlockResponse) : undefined; + obj.block_response = message.blockResponse ? BlockResponse.toAmino(message.blockResponse) : undefined; + obj.status_request = message.statusRequest ? StatusRequest.toAmino(message.statusRequest) : undefined; + obj.status_response = message.statusResponse ? StatusResponse.toAmino(message.statusResponse) : undefined; + return obj; + }, + fromAminoMsg(object: MessageAminoMsg): Message { + return Message.fromAmino(object.value); + }, + fromProtoMsg(message: MessageProtoMsg): Message { + return Message.decode(message.value); + }, + toProto(message: Message): Uint8Array { + return Message.encode(message).finish(); + }, + toProtoMsg(message: Message): MessageProtoMsg { + return { + typeUrl: "/tendermint.blocksync.Message", + value: Message.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/bundle.ts b/util/inj-types/tendermint/bundle.ts new file mode 100644 index 00000000..eee3a817 --- /dev/null +++ b/util/inj-types/tendermint/bundle.ts @@ -0,0 +1,82 @@ +import * as _136 from "./abci/types"; +import * as _137 from "./blocksync/types"; +import * as _138 from "./consensus/types"; +import * as _139 from "./consensus/wal"; +import * as _140 from "./crypto/keys"; +import * as _141 from "./crypto/proof"; +import * as _142 from "./libs/bits/types"; +import * as _143 from "./mempool/types"; +import * as _144 from "./p2p/conn"; +import * as _145 from "./p2p/pex"; +import * as _146 from "./p2p/types"; +import * as _147 from "./privval/types"; +import * as _148 from "./rpc/grpc/types"; +import * as _149 from "./state/types"; +import * as _150 from "./statesync/types"; +import * as _151 from "./store/types"; +import * as _152 from "./types/block"; +import * as _153 from "./types/canonical"; +import * as _154 from "./types/events"; +import * as _155 from "./types/evidence"; +import * as _156 from "./types/params"; +import * as _157 from "./types/types"; +import * as _158 from "./types/validator"; +import * as _159 from "./version/types"; +export namespace tendermint { + export const abci = { + ..._136 + }; + export const blocksync = { + ..._137 + }; + export const consensus = { + ..._138, + ..._139 + }; + export const crypto = { + ..._140, + ..._141 + }; + export namespace libs { + export const bits = { + ..._142 + }; + } + export const mempool = { + ..._143 + }; + export const p2p = { + ..._144, + ..._145, + ..._146 + }; + export const privval = { + ..._147 + }; + export namespace rpc { + export const grpc = { + ..._148 + }; + } + export const state = { + ..._149 + }; + export const statesync = { + ..._150 + }; + export const store = { + ..._151 + }; + export const types = { + ..._152, + ..._153, + ..._154, + ..._155, + ..._156, + ..._157, + ..._158 + }; + export const version = { + ..._159 + }; +} \ No newline at end of file diff --git a/util/inj-types/tendermint/consensus/types.ts b/util/inj-types/tendermint/consensus/types.ts new file mode 100644 index 00000000..d1a9d8a1 --- /dev/null +++ b/util/inj-types/tendermint/consensus/types.ts @@ -0,0 +1,1308 @@ +import { PartSetHeader, PartSetHeaderAmino, PartSetHeaderSDKType, Part, PartAmino, PartSDKType, SignedMsgType, BlockID, BlockIDAmino, BlockIDSDKType } from "../types/types"; +import { Proposal as Proposal1 } from "../types/types"; +import { ProposalAmino as Proposal1Amino } from "../types/types"; +import { ProposalSDKType as Proposal1SDKType } from "../types/types"; +import { Vote as Vote1 } from "../types/types"; +import { VoteAmino as Vote1Amino } from "../types/types"; +import { VoteSDKType as Vote1SDKType } from "../types/types"; +import { BitArray, BitArrayAmino, BitArraySDKType } from "../libs/bits/types"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +/** + * NewRoundStep is sent for every step taken in the ConsensusState. + * For every height/round/step transition + */ +export interface NewRoundStep { + height: bigint; + round: number; + step: number; + secondsSinceStartTime: bigint; + lastCommitRound: number; +} +export interface NewRoundStepProtoMsg { + typeUrl: "/tendermint.consensus.NewRoundStep"; + value: Uint8Array; +} +/** + * NewRoundStep is sent for every step taken in the ConsensusState. + * For every height/round/step transition + */ +export interface NewRoundStepAmino { + height?: string; + round?: number; + step?: number; + seconds_since_start_time?: string; + last_commit_round?: number; +} +export interface NewRoundStepAminoMsg { + type: "/tendermint.consensus.NewRoundStep"; + value: NewRoundStepAmino; +} +/** + * NewRoundStep is sent for every step taken in the ConsensusState. + * For every height/round/step transition + */ +export interface NewRoundStepSDKType { + height: bigint; + round: number; + step: number; + seconds_since_start_time: bigint; + last_commit_round: number; +} +/** + * NewValidBlock is sent when a validator observes a valid block B in some round r, + * i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. + * In case the block is also committed, then IsCommit flag is set to true. + */ +export interface NewValidBlock { + height: bigint; + round: number; + blockPartSetHeader: PartSetHeader; + blockParts?: BitArray; + isCommit: boolean; +} +export interface NewValidBlockProtoMsg { + typeUrl: "/tendermint.consensus.NewValidBlock"; + value: Uint8Array; +} +/** + * NewValidBlock is sent when a validator observes a valid block B in some round r, + * i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. + * In case the block is also committed, then IsCommit flag is set to true. + */ +export interface NewValidBlockAmino { + height?: string; + round?: number; + block_part_set_header?: PartSetHeaderAmino; + block_parts?: BitArrayAmino; + is_commit?: boolean; +} +export interface NewValidBlockAminoMsg { + type: "/tendermint.consensus.NewValidBlock"; + value: NewValidBlockAmino; +} +/** + * NewValidBlock is sent when a validator observes a valid block B in some round r, + * i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. + * In case the block is also committed, then IsCommit flag is set to true. + */ +export interface NewValidBlockSDKType { + height: bigint; + round: number; + block_part_set_header: PartSetHeaderSDKType; + block_parts?: BitArraySDKType; + is_commit: boolean; +} +/** Proposal is sent when a new block is proposed. */ +export interface Proposal { + proposal: Proposal1; +} +export interface ProposalProtoMsg { + typeUrl: "/tendermint.consensus.Proposal"; + value: Uint8Array; +} +/** Proposal is sent when a new block is proposed. */ +export interface ProposalAmino { + proposal?: Proposal1Amino; +} +export interface ProposalAminoMsg { + type: "/tendermint.consensus.Proposal"; + value: ProposalAmino; +} +/** Proposal is sent when a new block is proposed. */ +export interface ProposalSDKType { + proposal: Proposal1SDKType; +} +/** ProposalPOL is sent when a previous proposal is re-proposed. */ +export interface ProposalPOL { + height: bigint; + proposalPolRound: number; + proposalPol: BitArray; +} +export interface ProposalPOLProtoMsg { + typeUrl: "/tendermint.consensus.ProposalPOL"; + value: Uint8Array; +} +/** ProposalPOL is sent when a previous proposal is re-proposed. */ +export interface ProposalPOLAmino { + height?: string; + proposal_pol_round?: number; + proposal_pol?: BitArrayAmino; +} +export interface ProposalPOLAminoMsg { + type: "/tendermint.consensus.ProposalPOL"; + value: ProposalPOLAmino; +} +/** ProposalPOL is sent when a previous proposal is re-proposed. */ +export interface ProposalPOLSDKType { + height: bigint; + proposal_pol_round: number; + proposal_pol: BitArraySDKType; +} +/** BlockPart is sent when gossipping a piece of the proposed block. */ +export interface BlockPart { + height: bigint; + round: number; + part: Part; +} +export interface BlockPartProtoMsg { + typeUrl: "/tendermint.consensus.BlockPart"; + value: Uint8Array; +} +/** BlockPart is sent when gossipping a piece of the proposed block. */ +export interface BlockPartAmino { + height?: string; + round?: number; + part?: PartAmino; +} +export interface BlockPartAminoMsg { + type: "/tendermint.consensus.BlockPart"; + value: BlockPartAmino; +} +/** BlockPart is sent when gossipping a piece of the proposed block. */ +export interface BlockPartSDKType { + height: bigint; + round: number; + part: PartSDKType; +} +/** Vote is sent when voting for a proposal (or lack thereof). */ +export interface Vote { + vote?: Vote1; +} +export interface VoteProtoMsg { + typeUrl: "/tendermint.consensus.Vote"; + value: Uint8Array; +} +/** Vote is sent when voting for a proposal (or lack thereof). */ +export interface VoteAmino { + vote?: Vote1Amino; +} +export interface VoteAminoMsg { + type: "/tendermint.consensus.Vote"; + value: VoteAmino; +} +/** Vote is sent when voting for a proposal (or lack thereof). */ +export interface VoteSDKType { + vote?: Vote1SDKType; +} +/** HasVote is sent to indicate that a particular vote has been received. */ +export interface HasVote { + height: bigint; + round: number; + type: SignedMsgType; + index: number; +} +export interface HasVoteProtoMsg { + typeUrl: "/tendermint.consensus.HasVote"; + value: Uint8Array; +} +/** HasVote is sent to indicate that a particular vote has been received. */ +export interface HasVoteAmino { + height?: string; + round?: number; + type?: SignedMsgType; + index?: number; +} +export interface HasVoteAminoMsg { + type: "/tendermint.consensus.HasVote"; + value: HasVoteAmino; +} +/** HasVote is sent to indicate that a particular vote has been received. */ +export interface HasVoteSDKType { + height: bigint; + round: number; + type: SignedMsgType; + index: number; +} +/** VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. */ +export interface VoteSetMaj23 { + height: bigint; + round: number; + type: SignedMsgType; + blockId: BlockID; +} +export interface VoteSetMaj23ProtoMsg { + typeUrl: "/tendermint.consensus.VoteSetMaj23"; + value: Uint8Array; +} +/** VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. */ +export interface VoteSetMaj23Amino { + height?: string; + round?: number; + type?: SignedMsgType; + block_id?: BlockIDAmino; +} +export interface VoteSetMaj23AminoMsg { + type: "/tendermint.consensus.VoteSetMaj23"; + value: VoteSetMaj23Amino; +} +/** VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. */ +export interface VoteSetMaj23SDKType { + height: bigint; + round: number; + type: SignedMsgType; + block_id: BlockIDSDKType; +} +/** VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. */ +export interface VoteSetBits { + height: bigint; + round: number; + type: SignedMsgType; + blockId: BlockID; + votes: BitArray; +} +export interface VoteSetBitsProtoMsg { + typeUrl: "/tendermint.consensus.VoteSetBits"; + value: Uint8Array; +} +/** VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. */ +export interface VoteSetBitsAmino { + height?: string; + round?: number; + type?: SignedMsgType; + block_id?: BlockIDAmino; + votes?: BitArrayAmino; +} +export interface VoteSetBitsAminoMsg { + type: "/tendermint.consensus.VoteSetBits"; + value: VoteSetBitsAmino; +} +/** VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. */ +export interface VoteSetBitsSDKType { + height: bigint; + round: number; + type: SignedMsgType; + block_id: BlockIDSDKType; + votes: BitArraySDKType; +} +export interface Message { + newRoundStep?: NewRoundStep; + newValidBlock?: NewValidBlock; + proposal?: Proposal; + proposalPol?: ProposalPOL; + blockPart?: BlockPart; + vote?: Vote; + hasVote?: HasVote; + voteSetMaj23?: VoteSetMaj23; + voteSetBits?: VoteSetBits; +} +export interface MessageProtoMsg { + typeUrl: "/tendermint.consensus.Message"; + value: Uint8Array; +} +export interface MessageAmino { + new_round_step?: NewRoundStepAmino; + new_valid_block?: NewValidBlockAmino; + proposal?: ProposalAmino; + proposal_pol?: ProposalPOLAmino; + block_part?: BlockPartAmino; + vote?: VoteAmino; + has_vote?: HasVoteAmino; + vote_set_maj23?: VoteSetMaj23Amino; + vote_set_bits?: VoteSetBitsAmino; +} +export interface MessageAminoMsg { + type: "/tendermint.consensus.Message"; + value: MessageAmino; +} +export interface MessageSDKType { + new_round_step?: NewRoundStepSDKType; + new_valid_block?: NewValidBlockSDKType; + proposal?: ProposalSDKType; + proposal_pol?: ProposalPOLSDKType; + block_part?: BlockPartSDKType; + vote?: VoteSDKType; + has_vote?: HasVoteSDKType; + vote_set_maj23?: VoteSetMaj23SDKType; + vote_set_bits?: VoteSetBitsSDKType; +} +function createBaseNewRoundStep(): NewRoundStep { + return { + height: BigInt(0), + round: 0, + step: 0, + secondsSinceStartTime: BigInt(0), + lastCommitRound: 0 + }; +} +export const NewRoundStep = { + typeUrl: "/tendermint.consensus.NewRoundStep", + encode(message: NewRoundStep, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.step !== 0) { + writer.uint32(24).uint32(message.step); + } + if (message.secondsSinceStartTime !== BigInt(0)) { + writer.uint32(32).int64(message.secondsSinceStartTime); + } + if (message.lastCommitRound !== 0) { + writer.uint32(40).int32(message.lastCommitRound); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): NewRoundStep { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNewRoundStep(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.step = reader.uint32(); + break; + case 4: + message.secondsSinceStartTime = reader.int64(); + break; + case 5: + message.lastCommitRound = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): NewRoundStep { + const message = createBaseNewRoundStep(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.step = object.step ?? 0; + message.secondsSinceStartTime = object.secondsSinceStartTime !== undefined && object.secondsSinceStartTime !== null ? BigInt(object.secondsSinceStartTime.toString()) : BigInt(0); + message.lastCommitRound = object.lastCommitRound ?? 0; + return message; + }, + fromAmino(object: NewRoundStepAmino): NewRoundStep { + const message = createBaseNewRoundStep(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.step !== undefined && object.step !== null) { + message.step = object.step; + } + if (object.seconds_since_start_time !== undefined && object.seconds_since_start_time !== null) { + message.secondsSinceStartTime = BigInt(object.seconds_since_start_time); + } + if (object.last_commit_round !== undefined && object.last_commit_round !== null) { + message.lastCommitRound = object.last_commit_round; + } + return message; + }, + toAmino(message: NewRoundStep): NewRoundStepAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.step = message.step === 0 ? undefined : message.step; + obj.seconds_since_start_time = message.secondsSinceStartTime !== BigInt(0) ? message.secondsSinceStartTime.toString() : undefined; + obj.last_commit_round = message.lastCommitRound === 0 ? undefined : message.lastCommitRound; + return obj; + }, + fromAminoMsg(object: NewRoundStepAminoMsg): NewRoundStep { + return NewRoundStep.fromAmino(object.value); + }, + fromProtoMsg(message: NewRoundStepProtoMsg): NewRoundStep { + return NewRoundStep.decode(message.value); + }, + toProto(message: NewRoundStep): Uint8Array { + return NewRoundStep.encode(message).finish(); + }, + toProtoMsg(message: NewRoundStep): NewRoundStepProtoMsg { + return { + typeUrl: "/tendermint.consensus.NewRoundStep", + value: NewRoundStep.encode(message).finish() + }; + } +}; +function createBaseNewValidBlock(): NewValidBlock { + return { + height: BigInt(0), + round: 0, + blockPartSetHeader: PartSetHeader.fromPartial({}), + blockParts: undefined, + isCommit: false + }; +} +export const NewValidBlock = { + typeUrl: "/tendermint.consensus.NewValidBlock", + encode(message: NewValidBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockPartSetHeader !== undefined) { + PartSetHeader.encode(message.blockPartSetHeader, writer.uint32(26).fork()).ldelim(); + } + if (message.blockParts !== undefined) { + BitArray.encode(message.blockParts, writer.uint32(34).fork()).ldelim(); + } + if (message.isCommit === true) { + writer.uint32(40).bool(message.isCommit); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): NewValidBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNewValidBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.blockPartSetHeader = PartSetHeader.decode(reader, reader.uint32()); + break; + case 4: + message.blockParts = BitArray.decode(reader, reader.uint32()); + break; + case 5: + message.isCommit = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): NewValidBlock { + const message = createBaseNewValidBlock(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.blockPartSetHeader = object.blockPartSetHeader !== undefined && object.blockPartSetHeader !== null ? PartSetHeader.fromPartial(object.blockPartSetHeader) : undefined; + message.blockParts = object.blockParts !== undefined && object.blockParts !== null ? BitArray.fromPartial(object.blockParts) : undefined; + message.isCommit = object.isCommit ?? false; + return message; + }, + fromAmino(object: NewValidBlockAmino): NewValidBlock { + const message = createBaseNewValidBlock(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_part_set_header !== undefined && object.block_part_set_header !== null) { + message.blockPartSetHeader = PartSetHeader.fromAmino(object.block_part_set_header); + } + if (object.block_parts !== undefined && object.block_parts !== null) { + message.blockParts = BitArray.fromAmino(object.block_parts); + } + if (object.is_commit !== undefined && object.is_commit !== null) { + message.isCommit = object.is_commit; + } + return message; + }, + toAmino(message: NewValidBlock): NewValidBlockAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.block_part_set_header = message.blockPartSetHeader ? PartSetHeader.toAmino(message.blockPartSetHeader) : undefined; + obj.block_parts = message.blockParts ? BitArray.toAmino(message.blockParts) : undefined; + obj.is_commit = message.isCommit === false ? undefined : message.isCommit; + return obj; + }, + fromAminoMsg(object: NewValidBlockAminoMsg): NewValidBlock { + return NewValidBlock.fromAmino(object.value); + }, + fromProtoMsg(message: NewValidBlockProtoMsg): NewValidBlock { + return NewValidBlock.decode(message.value); + }, + toProto(message: NewValidBlock): Uint8Array { + return NewValidBlock.encode(message).finish(); + }, + toProtoMsg(message: NewValidBlock): NewValidBlockProtoMsg { + return { + typeUrl: "/tendermint.consensus.NewValidBlock", + value: NewValidBlock.encode(message).finish() + }; + } +}; +function createBaseProposal(): Proposal { + return { + proposal: Proposal1.fromPartial({}) + }; +} +export const Proposal = { + typeUrl: "/tendermint.consensus.Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal1.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal1.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal1.fromPartial(object.proposal) : undefined; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal1.fromAmino(object.proposal); + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal1.toAmino(message.proposal) : undefined; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/tendermint.consensus.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +function createBaseProposalPOL(): ProposalPOL { + return { + height: BigInt(0), + proposalPolRound: 0, + proposalPol: BitArray.fromPartial({}) + }; +} +export const ProposalPOL = { + typeUrl: "/tendermint.consensus.ProposalPOL", + encode(message: ProposalPOL, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.proposalPolRound !== 0) { + writer.uint32(16).int32(message.proposalPolRound); + } + if (message.proposalPol !== undefined) { + BitArray.encode(message.proposalPol, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProposalPOL { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposalPOL(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.proposalPolRound = reader.int32(); + break; + case 3: + message.proposalPol = BitArray.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ProposalPOL { + const message = createBaseProposalPOL(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.proposalPolRound = object.proposalPolRound ?? 0; + message.proposalPol = object.proposalPol !== undefined && object.proposalPol !== null ? BitArray.fromPartial(object.proposalPol) : undefined; + return message; + }, + fromAmino(object: ProposalPOLAmino): ProposalPOL { + const message = createBaseProposalPOL(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.proposal_pol_round !== undefined && object.proposal_pol_round !== null) { + message.proposalPolRound = object.proposal_pol_round; + } + if (object.proposal_pol !== undefined && object.proposal_pol !== null) { + message.proposalPol = BitArray.fromAmino(object.proposal_pol); + } + return message; + }, + toAmino(message: ProposalPOL): ProposalPOLAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.proposal_pol_round = message.proposalPolRound === 0 ? undefined : message.proposalPolRound; + obj.proposal_pol = message.proposalPol ? BitArray.toAmino(message.proposalPol) : undefined; + return obj; + }, + fromAminoMsg(object: ProposalPOLAminoMsg): ProposalPOL { + return ProposalPOL.fromAmino(object.value); + }, + fromProtoMsg(message: ProposalPOLProtoMsg): ProposalPOL { + return ProposalPOL.decode(message.value); + }, + toProto(message: ProposalPOL): Uint8Array { + return ProposalPOL.encode(message).finish(); + }, + toProtoMsg(message: ProposalPOL): ProposalPOLProtoMsg { + return { + typeUrl: "/tendermint.consensus.ProposalPOL", + value: ProposalPOL.encode(message).finish() + }; + } +}; +function createBaseBlockPart(): BlockPart { + return { + height: BigInt(0), + round: 0, + part: Part.fromPartial({}) + }; +} +export const BlockPart = { + typeUrl: "/tendermint.consensus.BlockPart", + encode(message: BlockPart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.part !== undefined) { + Part.encode(message.part, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockPart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockPart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.part = Part.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockPart { + const message = createBaseBlockPart(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.part = object.part !== undefined && object.part !== null ? Part.fromPartial(object.part) : undefined; + return message; + }, + fromAmino(object: BlockPartAmino): BlockPart { + const message = createBaseBlockPart(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.part !== undefined && object.part !== null) { + message.part = Part.fromAmino(object.part); + } + return message; + }, + toAmino(message: BlockPart): BlockPartAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.part = message.part ? Part.toAmino(message.part) : undefined; + return obj; + }, + fromAminoMsg(object: BlockPartAminoMsg): BlockPart { + return BlockPart.fromAmino(object.value); + }, + fromProtoMsg(message: BlockPartProtoMsg): BlockPart { + return BlockPart.decode(message.value); + }, + toProto(message: BlockPart): Uint8Array { + return BlockPart.encode(message).finish(); + }, + toProtoMsg(message: BlockPart): BlockPartProtoMsg { + return { + typeUrl: "/tendermint.consensus.BlockPart", + value: BlockPart.encode(message).finish() + }; + } +}; +function createBaseVote(): Vote { + return { + vote: undefined + }; +} +export const Vote = { + typeUrl: "/tendermint.consensus.Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.vote !== undefined) { + Vote1.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote1.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.vote = object.vote !== undefined && object.vote !== null ? Vote1.fromPartial(object.vote) : undefined; + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote1.fromAmino(object.vote); + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote1.toAmino(message.vote) : undefined; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/tendermint.consensus.Vote", + value: Vote.encode(message).finish() + }; + } +}; +function createBaseHasVote(): HasVote { + return { + height: BigInt(0), + round: 0, + type: 0, + index: 0 + }; +} +export const HasVote = { + typeUrl: "/tendermint.consensus.HasVote", + encode(message: HasVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.type !== 0) { + writer.uint32(24).int32(message.type); + } + if (message.index !== 0) { + writer.uint32(32).int32(message.index); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HasVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHasVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.type = (reader.int32() as any); + break; + case 4: + message.index = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HasVote { + const message = createBaseHasVote(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.type = object.type ?? 0; + message.index = object.index ?? 0; + return message; + }, + fromAmino(object: HasVoteAmino): HasVote { + const message = createBaseHasVote(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + return message; + }, + toAmino(message: HasVote): HasVoteAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.type = message.type === 0 ? undefined : message.type; + obj.index = message.index === 0 ? undefined : message.index; + return obj; + }, + fromAminoMsg(object: HasVoteAminoMsg): HasVote { + return HasVote.fromAmino(object.value); + }, + fromProtoMsg(message: HasVoteProtoMsg): HasVote { + return HasVote.decode(message.value); + }, + toProto(message: HasVote): Uint8Array { + return HasVote.encode(message).finish(); + }, + toProtoMsg(message: HasVote): HasVoteProtoMsg { + return { + typeUrl: "/tendermint.consensus.HasVote", + value: HasVote.encode(message).finish() + }; + } +}; +function createBaseVoteSetMaj23(): VoteSetMaj23 { + return { + height: BigInt(0), + round: 0, + type: 0, + blockId: BlockID.fromPartial({}) + }; +} +export const VoteSetMaj23 = { + typeUrl: "/tendermint.consensus.VoteSetMaj23", + encode(message: VoteSetMaj23, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.type !== 0) { + writer.uint32(24).int32(message.type); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VoteSetMaj23 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteSetMaj23(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.type = (reader.int32() as any); + break; + case 4: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VoteSetMaj23 { + const message = createBaseVoteSetMaj23(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.type = object.type ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + return message; + }, + fromAmino(object: VoteSetMaj23Amino): VoteSetMaj23 { + const message = createBaseVoteSetMaj23(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + return message; + }, + toAmino(message: VoteSetMaj23): VoteSetMaj23Amino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.type = message.type === 0 ? undefined : message.type; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + return obj; + }, + fromAminoMsg(object: VoteSetMaj23AminoMsg): VoteSetMaj23 { + return VoteSetMaj23.fromAmino(object.value); + }, + fromProtoMsg(message: VoteSetMaj23ProtoMsg): VoteSetMaj23 { + return VoteSetMaj23.decode(message.value); + }, + toProto(message: VoteSetMaj23): Uint8Array { + return VoteSetMaj23.encode(message).finish(); + }, + toProtoMsg(message: VoteSetMaj23): VoteSetMaj23ProtoMsg { + return { + typeUrl: "/tendermint.consensus.VoteSetMaj23", + value: VoteSetMaj23.encode(message).finish() + }; + } +}; +function createBaseVoteSetBits(): VoteSetBits { + return { + height: BigInt(0), + round: 0, + type: 0, + blockId: BlockID.fromPartial({}), + votes: BitArray.fromPartial({}) + }; +} +export const VoteSetBits = { + typeUrl: "/tendermint.consensus.VoteSetBits", + encode(message: VoteSetBits, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.type !== 0) { + writer.uint32(24).int32(message.type); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); + } + if (message.votes !== undefined) { + BitArray.encode(message.votes, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VoteSetBits { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteSetBits(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.type = (reader.int32() as any); + break; + case 4: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 5: + message.votes = BitArray.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VoteSetBits { + const message = createBaseVoteSetBits(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.type = object.type ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.votes = object.votes !== undefined && object.votes !== null ? BitArray.fromPartial(object.votes) : undefined; + return message; + }, + fromAmino(object: VoteSetBitsAmino): VoteSetBits { + const message = createBaseVoteSetBits(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.votes !== undefined && object.votes !== null) { + message.votes = BitArray.fromAmino(object.votes); + } + return message; + }, + toAmino(message: VoteSetBits): VoteSetBitsAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.type = message.type === 0 ? undefined : message.type; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.votes = message.votes ? BitArray.toAmino(message.votes) : undefined; + return obj; + }, + fromAminoMsg(object: VoteSetBitsAminoMsg): VoteSetBits { + return VoteSetBits.fromAmino(object.value); + }, + fromProtoMsg(message: VoteSetBitsProtoMsg): VoteSetBits { + return VoteSetBits.decode(message.value); + }, + toProto(message: VoteSetBits): Uint8Array { + return VoteSetBits.encode(message).finish(); + }, + toProtoMsg(message: VoteSetBits): VoteSetBitsProtoMsg { + return { + typeUrl: "/tendermint.consensus.VoteSetBits", + value: VoteSetBits.encode(message).finish() + }; + } +}; +function createBaseMessage(): Message { + return { + newRoundStep: undefined, + newValidBlock: undefined, + proposal: undefined, + proposalPol: undefined, + blockPart: undefined, + vote: undefined, + hasVote: undefined, + voteSetMaj23: undefined, + voteSetBits: undefined + }; +} +export const Message = { + typeUrl: "/tendermint.consensus.Message", + encode(message: Message, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.newRoundStep !== undefined) { + NewRoundStep.encode(message.newRoundStep, writer.uint32(10).fork()).ldelim(); + } + if (message.newValidBlock !== undefined) { + NewValidBlock.encode(message.newValidBlock, writer.uint32(18).fork()).ldelim(); + } + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(26).fork()).ldelim(); + } + if (message.proposalPol !== undefined) { + ProposalPOL.encode(message.proposalPol, writer.uint32(34).fork()).ldelim(); + } + if (message.blockPart !== undefined) { + BlockPart.encode(message.blockPart, writer.uint32(42).fork()).ldelim(); + } + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(50).fork()).ldelim(); + } + if (message.hasVote !== undefined) { + HasVote.encode(message.hasVote, writer.uint32(58).fork()).ldelim(); + } + if (message.voteSetMaj23 !== undefined) { + VoteSetMaj23.encode(message.voteSetMaj23, writer.uint32(66).fork()).ldelim(); + } + if (message.voteSetBits !== undefined) { + VoteSetBits.encode(message.voteSetBits, writer.uint32(74).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Message { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.newRoundStep = NewRoundStep.decode(reader, reader.uint32()); + break; + case 2: + message.newValidBlock = NewValidBlock.decode(reader, reader.uint32()); + break; + case 3: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + case 4: + message.proposalPol = ProposalPOL.decode(reader, reader.uint32()); + break; + case 5: + message.blockPart = BlockPart.decode(reader, reader.uint32()); + break; + case 6: + message.vote = Vote.decode(reader, reader.uint32()); + break; + case 7: + message.hasVote = HasVote.decode(reader, reader.uint32()); + break; + case 8: + message.voteSetMaj23 = VoteSetMaj23.decode(reader, reader.uint32()); + break; + case 9: + message.voteSetBits = VoteSetBits.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Message { + const message = createBaseMessage(); + message.newRoundStep = object.newRoundStep !== undefined && object.newRoundStep !== null ? NewRoundStep.fromPartial(object.newRoundStep) : undefined; + message.newValidBlock = object.newValidBlock !== undefined && object.newValidBlock !== null ? NewValidBlock.fromPartial(object.newValidBlock) : undefined; + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; + message.proposalPol = object.proposalPol !== undefined && object.proposalPol !== null ? ProposalPOL.fromPartial(object.proposalPol) : undefined; + message.blockPart = object.blockPart !== undefined && object.blockPart !== null ? BlockPart.fromPartial(object.blockPart) : undefined; + message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; + message.hasVote = object.hasVote !== undefined && object.hasVote !== null ? HasVote.fromPartial(object.hasVote) : undefined; + message.voteSetMaj23 = object.voteSetMaj23 !== undefined && object.voteSetMaj23 !== null ? VoteSetMaj23.fromPartial(object.voteSetMaj23) : undefined; + message.voteSetBits = object.voteSetBits !== undefined && object.voteSetBits !== null ? VoteSetBits.fromPartial(object.voteSetBits) : undefined; + return message; + }, + fromAmino(object: MessageAmino): Message { + const message = createBaseMessage(); + if (object.new_round_step !== undefined && object.new_round_step !== null) { + message.newRoundStep = NewRoundStep.fromAmino(object.new_round_step); + } + if (object.new_valid_block !== undefined && object.new_valid_block !== null) { + message.newValidBlock = NewValidBlock.fromAmino(object.new_valid_block); + } + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + if (object.proposal_pol !== undefined && object.proposal_pol !== null) { + message.proposalPol = ProposalPOL.fromAmino(object.proposal_pol); + } + if (object.block_part !== undefined && object.block_part !== null) { + message.blockPart = BlockPart.fromAmino(object.block_part); + } + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + if (object.has_vote !== undefined && object.has_vote !== null) { + message.hasVote = HasVote.fromAmino(object.has_vote); + } + if (object.vote_set_maj23 !== undefined && object.vote_set_maj23 !== null) { + message.voteSetMaj23 = VoteSetMaj23.fromAmino(object.vote_set_maj23); + } + if (object.vote_set_bits !== undefined && object.vote_set_bits !== null) { + message.voteSetBits = VoteSetBits.fromAmino(object.vote_set_bits); + } + return message; + }, + toAmino(message: Message): MessageAmino { + const obj: any = {}; + obj.new_round_step = message.newRoundStep ? NewRoundStep.toAmino(message.newRoundStep) : undefined; + obj.new_valid_block = message.newValidBlock ? NewValidBlock.toAmino(message.newValidBlock) : undefined; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + obj.proposal_pol = message.proposalPol ? ProposalPOL.toAmino(message.proposalPol) : undefined; + obj.block_part = message.blockPart ? BlockPart.toAmino(message.blockPart) : undefined; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + obj.has_vote = message.hasVote ? HasVote.toAmino(message.hasVote) : undefined; + obj.vote_set_maj23 = message.voteSetMaj23 ? VoteSetMaj23.toAmino(message.voteSetMaj23) : undefined; + obj.vote_set_bits = message.voteSetBits ? VoteSetBits.toAmino(message.voteSetBits) : undefined; + return obj; + }, + fromAminoMsg(object: MessageAminoMsg): Message { + return Message.fromAmino(object.value); + }, + fromProtoMsg(message: MessageProtoMsg): Message { + return Message.decode(message.value); + }, + toProto(message: Message): Uint8Array { + return Message.encode(message).finish(); + }, + toProtoMsg(message: Message): MessageProtoMsg { + return { + typeUrl: "/tendermint.consensus.Message", + value: Message.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/consensus/wal.ts b/util/inj-types/tendermint/consensus/wal.ts new file mode 100644 index 00000000..a1edca0a --- /dev/null +++ b/util/inj-types/tendermint/consensus/wal.ts @@ -0,0 +1,547 @@ +import { Message, MessageAmino, MessageSDKType } from "./types"; +import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; +import { EventDataRoundState, EventDataRoundStateAmino, EventDataRoundStateSDKType } from "../types/events"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +/** MsgInfo are msgs from the reactor which may update the state */ +export interface MsgInfo { + msg: Message; + peerId: string; +} +export interface MsgInfoProtoMsg { + typeUrl: "/tendermint.consensus.MsgInfo"; + value: Uint8Array; +} +/** MsgInfo are msgs from the reactor which may update the state */ +export interface MsgInfoAmino { + msg?: MessageAmino; + peer_id?: string; +} +export interface MsgInfoAminoMsg { + type: "/tendermint.consensus.MsgInfo"; + value: MsgInfoAmino; +} +/** MsgInfo are msgs from the reactor which may update the state */ +export interface MsgInfoSDKType { + msg: MessageSDKType; + peer_id: string; +} +/** TimeoutInfo internally generated messages which may update the state */ +export interface TimeoutInfo { + duration: Duration; + height: bigint; + round: number; + step: number; +} +export interface TimeoutInfoProtoMsg { + typeUrl: "/tendermint.consensus.TimeoutInfo"; + value: Uint8Array; +} +/** TimeoutInfo internally generated messages which may update the state */ +export interface TimeoutInfoAmino { + duration?: DurationAmino; + height?: string; + round?: number; + step?: number; +} +export interface TimeoutInfoAminoMsg { + type: "/tendermint.consensus.TimeoutInfo"; + value: TimeoutInfoAmino; +} +/** TimeoutInfo internally generated messages which may update the state */ +export interface TimeoutInfoSDKType { + duration: DurationSDKType; + height: bigint; + round: number; + step: number; +} +/** + * EndHeight marks the end of the given height inside WAL. + * @internal used by scripts/wal2json util. + */ +export interface EndHeight { + height: bigint; +} +export interface EndHeightProtoMsg { + typeUrl: "/tendermint.consensus.EndHeight"; + value: Uint8Array; +} +/** + * EndHeight marks the end of the given height inside WAL. + * @internal used by scripts/wal2json util. + */ +export interface EndHeightAmino { + height?: string; +} +export interface EndHeightAminoMsg { + type: "/tendermint.consensus.EndHeight"; + value: EndHeightAmino; +} +/** + * EndHeight marks the end of the given height inside WAL. + * @internal used by scripts/wal2json util. + */ +export interface EndHeightSDKType { + height: bigint; +} +export interface WALMessage { + eventDataRoundState?: EventDataRoundState; + msgInfo?: MsgInfo; + timeoutInfo?: TimeoutInfo; + endHeight?: EndHeight; +} +export interface WALMessageProtoMsg { + typeUrl: "/tendermint.consensus.WALMessage"; + value: Uint8Array; +} +export interface WALMessageAmino { + event_data_round_state?: EventDataRoundStateAmino; + msg_info?: MsgInfoAmino; + timeout_info?: TimeoutInfoAmino; + end_height?: EndHeightAmino; +} +export interface WALMessageAminoMsg { + type: "/tendermint.consensus.WALMessage"; + value: WALMessageAmino; +} +export interface WALMessageSDKType { + event_data_round_state?: EventDataRoundStateSDKType; + msg_info?: MsgInfoSDKType; + timeout_info?: TimeoutInfoSDKType; + end_height?: EndHeightSDKType; +} +/** TimedWALMessage wraps WALMessage and adds Time for debugging purposes. */ +export interface TimedWALMessage { + time: Date; + msg?: WALMessage; +} +export interface TimedWALMessageProtoMsg { + typeUrl: "/tendermint.consensus.TimedWALMessage"; + value: Uint8Array; +} +/** TimedWALMessage wraps WALMessage and adds Time for debugging purposes. */ +export interface TimedWALMessageAmino { + time?: string; + msg?: WALMessageAmino; +} +export interface TimedWALMessageAminoMsg { + type: "/tendermint.consensus.TimedWALMessage"; + value: TimedWALMessageAmino; +} +/** TimedWALMessage wraps WALMessage and adds Time for debugging purposes. */ +export interface TimedWALMessageSDKType { + time: Date; + msg?: WALMessageSDKType; +} +function createBaseMsgInfo(): MsgInfo { + return { + msg: Message.fromPartial({}), + peerId: "" + }; +} +export const MsgInfo = { + typeUrl: "/tendermint.consensus.MsgInfo", + encode(message: MsgInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.msg !== undefined) { + Message.encode(message.msg, writer.uint32(10).fork()).ldelim(); + } + if (message.peerId !== "") { + writer.uint32(18).string(message.peerId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msg = Message.decode(reader, reader.uint32()); + break; + case 2: + message.peerId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInfo { + const message = createBaseMsgInfo(); + message.msg = object.msg !== undefined && object.msg !== null ? Message.fromPartial(object.msg) : undefined; + message.peerId = object.peerId ?? ""; + return message; + }, + fromAmino(object: MsgInfoAmino): MsgInfo { + const message = createBaseMsgInfo(); + if (object.msg !== undefined && object.msg !== null) { + message.msg = Message.fromAmino(object.msg); + } + if (object.peer_id !== undefined && object.peer_id !== null) { + message.peerId = object.peer_id; + } + return message; + }, + toAmino(message: MsgInfo): MsgInfoAmino { + const obj: any = {}; + obj.msg = message.msg ? Message.toAmino(message.msg) : undefined; + obj.peer_id = message.peerId === "" ? undefined : message.peerId; + return obj; + }, + fromAminoMsg(object: MsgInfoAminoMsg): MsgInfo { + return MsgInfo.fromAmino(object.value); + }, + fromProtoMsg(message: MsgInfoProtoMsg): MsgInfo { + return MsgInfo.decode(message.value); + }, + toProto(message: MsgInfo): Uint8Array { + return MsgInfo.encode(message).finish(); + }, + toProtoMsg(message: MsgInfo): MsgInfoProtoMsg { + return { + typeUrl: "/tendermint.consensus.MsgInfo", + value: MsgInfo.encode(message).finish() + }; + } +}; +function createBaseTimeoutInfo(): TimeoutInfo { + return { + duration: Duration.fromPartial({}), + height: BigInt(0), + round: 0, + step: 0 + }; +} +export const TimeoutInfo = { + typeUrl: "/tendermint.consensus.TimeoutInfo", + encode(message: TimeoutInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.duration !== undefined) { + Duration.encode(message.duration, writer.uint32(10).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.step !== 0) { + writer.uint32(32).uint32(message.step); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TimeoutInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimeoutInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.duration = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.step = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TimeoutInfo { + const message = createBaseTimeoutInfo(); + message.duration = object.duration !== undefined && object.duration !== null ? Duration.fromPartial(object.duration) : undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.step = object.step ?? 0; + return message; + }, + fromAmino(object: TimeoutInfoAmino): TimeoutInfo { + const message = createBaseTimeoutInfo(); + if (object.duration !== undefined && object.duration !== null) { + message.duration = Duration.fromAmino(object.duration); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.step !== undefined && object.step !== null) { + message.step = object.step; + } + return message; + }, + toAmino(message: TimeoutInfo): TimeoutInfoAmino { + const obj: any = {}; + obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.step = message.step === 0 ? undefined : message.step; + return obj; + }, + fromAminoMsg(object: TimeoutInfoAminoMsg): TimeoutInfo { + return TimeoutInfo.fromAmino(object.value); + }, + fromProtoMsg(message: TimeoutInfoProtoMsg): TimeoutInfo { + return TimeoutInfo.decode(message.value); + }, + toProto(message: TimeoutInfo): Uint8Array { + return TimeoutInfo.encode(message).finish(); + }, + toProtoMsg(message: TimeoutInfo): TimeoutInfoProtoMsg { + return { + typeUrl: "/tendermint.consensus.TimeoutInfo", + value: TimeoutInfo.encode(message).finish() + }; + } +}; +function createBaseEndHeight(): EndHeight { + return { + height: BigInt(0) + }; +} +export const EndHeight = { + typeUrl: "/tendermint.consensus.EndHeight", + encode(message: EndHeight, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EndHeight { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndHeight(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EndHeight { + const message = createBaseEndHeight(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EndHeightAmino): EndHeight { + const message = createBaseEndHeight(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: EndHeight): EndHeightAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EndHeightAminoMsg): EndHeight { + return EndHeight.fromAmino(object.value); + }, + fromProtoMsg(message: EndHeightProtoMsg): EndHeight { + return EndHeight.decode(message.value); + }, + toProto(message: EndHeight): Uint8Array { + return EndHeight.encode(message).finish(); + }, + toProtoMsg(message: EndHeight): EndHeightProtoMsg { + return { + typeUrl: "/tendermint.consensus.EndHeight", + value: EndHeight.encode(message).finish() + }; + } +}; +function createBaseWALMessage(): WALMessage { + return { + eventDataRoundState: undefined, + msgInfo: undefined, + timeoutInfo: undefined, + endHeight: undefined + }; +} +export const WALMessage = { + typeUrl: "/tendermint.consensus.WALMessage", + encode(message: WALMessage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.eventDataRoundState !== undefined) { + EventDataRoundState.encode(message.eventDataRoundState, writer.uint32(10).fork()).ldelim(); + } + if (message.msgInfo !== undefined) { + MsgInfo.encode(message.msgInfo, writer.uint32(18).fork()).ldelim(); + } + if (message.timeoutInfo !== undefined) { + TimeoutInfo.encode(message.timeoutInfo, writer.uint32(26).fork()).ldelim(); + } + if (message.endHeight !== undefined) { + EndHeight.encode(message.endHeight, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): WALMessage { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWALMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.eventDataRoundState = EventDataRoundState.decode(reader, reader.uint32()); + break; + case 2: + message.msgInfo = MsgInfo.decode(reader, reader.uint32()); + break; + case 3: + message.timeoutInfo = TimeoutInfo.decode(reader, reader.uint32()); + break; + case 4: + message.endHeight = EndHeight.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): WALMessage { + const message = createBaseWALMessage(); + message.eventDataRoundState = object.eventDataRoundState !== undefined && object.eventDataRoundState !== null ? EventDataRoundState.fromPartial(object.eventDataRoundState) : undefined; + message.msgInfo = object.msgInfo !== undefined && object.msgInfo !== null ? MsgInfo.fromPartial(object.msgInfo) : undefined; + message.timeoutInfo = object.timeoutInfo !== undefined && object.timeoutInfo !== null ? TimeoutInfo.fromPartial(object.timeoutInfo) : undefined; + message.endHeight = object.endHeight !== undefined && object.endHeight !== null ? EndHeight.fromPartial(object.endHeight) : undefined; + return message; + }, + fromAmino(object: WALMessageAmino): WALMessage { + const message = createBaseWALMessage(); + if (object.event_data_round_state !== undefined && object.event_data_round_state !== null) { + message.eventDataRoundState = EventDataRoundState.fromAmino(object.event_data_round_state); + } + if (object.msg_info !== undefined && object.msg_info !== null) { + message.msgInfo = MsgInfo.fromAmino(object.msg_info); + } + if (object.timeout_info !== undefined && object.timeout_info !== null) { + message.timeoutInfo = TimeoutInfo.fromAmino(object.timeout_info); + } + if (object.end_height !== undefined && object.end_height !== null) { + message.endHeight = EndHeight.fromAmino(object.end_height); + } + return message; + }, + toAmino(message: WALMessage): WALMessageAmino { + const obj: any = {}; + obj.event_data_round_state = message.eventDataRoundState ? EventDataRoundState.toAmino(message.eventDataRoundState) : undefined; + obj.msg_info = message.msgInfo ? MsgInfo.toAmino(message.msgInfo) : undefined; + obj.timeout_info = message.timeoutInfo ? TimeoutInfo.toAmino(message.timeoutInfo) : undefined; + obj.end_height = message.endHeight ? EndHeight.toAmino(message.endHeight) : undefined; + return obj; + }, + fromAminoMsg(object: WALMessageAminoMsg): WALMessage { + return WALMessage.fromAmino(object.value); + }, + fromProtoMsg(message: WALMessageProtoMsg): WALMessage { + return WALMessage.decode(message.value); + }, + toProto(message: WALMessage): Uint8Array { + return WALMessage.encode(message).finish(); + }, + toProtoMsg(message: WALMessage): WALMessageProtoMsg { + return { + typeUrl: "/tendermint.consensus.WALMessage", + value: WALMessage.encode(message).finish() + }; + } +}; +function createBaseTimedWALMessage(): TimedWALMessage { + return { + time: new Date(), + msg: undefined + }; +} +export const TimedWALMessage = { + typeUrl: "/tendermint.consensus.TimedWALMessage", + encode(message: TimedWALMessage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); + } + if (message.msg !== undefined) { + WALMessage.encode(message.msg, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TimedWALMessage { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimedWALMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 2: + message.msg = WALMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TimedWALMessage { + const message = createBaseTimedWALMessage(); + message.time = object.time ?? undefined; + message.msg = object.msg !== undefined && object.msg !== null ? WALMessage.fromPartial(object.msg) : undefined; + return message; + }, + fromAmino(object: TimedWALMessageAmino): TimedWALMessage { + const message = createBaseTimedWALMessage(); + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = WALMessage.fromAmino(object.msg); + } + return message; + }, + toAmino(message: TimedWALMessage): TimedWALMessageAmino { + const obj: any = {}; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.msg = message.msg ? WALMessage.toAmino(message.msg) : undefined; + return obj; + }, + fromAminoMsg(object: TimedWALMessageAminoMsg): TimedWALMessage { + return TimedWALMessage.fromAmino(object.value); + }, + fromProtoMsg(message: TimedWALMessageProtoMsg): TimedWALMessage { + return TimedWALMessage.decode(message.value); + }, + toProto(message: TimedWALMessage): Uint8Array { + return TimedWALMessage.encode(message).finish(); + }, + toProtoMsg(message: TimedWALMessage): TimedWALMessageProtoMsg { + return { + typeUrl: "/tendermint.consensus.TimedWALMessage", + value: TimedWALMessage.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/crypto/keys.ts b/util/inj-types/tendermint/crypto/keys.ts new file mode 100644 index 00000000..623827d7 --- /dev/null +++ b/util/inj-types/tendermint/crypto/keys.ts @@ -0,0 +1,100 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array; + secp256k1?: Uint8Array; +} +export interface PublicKeyProtoMsg { + typeUrl: "/tendermint.crypto.PublicKey"; + value: Uint8Array; +} +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKeyAmino { + ed25519?: string; + secp256k1?: string; +} +export interface PublicKeyAminoMsg { + type: "/tendermint.crypto.PublicKey"; + value: PublicKeyAmino; +} +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKeySDKType { + ed25519?: Uint8Array; + secp256k1?: Uint8Array; +} +function createBasePublicKey(): PublicKey { + return { + ed25519: undefined, + secp256k1: undefined + }; +} +export const PublicKey = { + typeUrl: "/tendermint.crypto.PublicKey", + encode(message: PublicKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ed25519 = reader.bytes(); + break; + case 2: + message.secp256k1 = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, + fromAmino(object: PublicKeyAmino): PublicKey { + const message = createBasePublicKey(); + if (object.ed25519 !== undefined && object.ed25519 !== null) { + message.ed25519 = bytesFromBase64(object.ed25519); + } + if (object.secp256k1 !== undefined && object.secp256k1 !== null) { + message.secp256k1 = bytesFromBase64(object.secp256k1); + } + return message; + }, + toAmino(message: PublicKey): PublicKeyAmino { + const obj: any = {}; + obj.ed25519 = message.ed25519 ? base64FromBytes(message.ed25519) : undefined; + obj.secp256k1 = message.secp256k1 ? base64FromBytes(message.secp256k1) : undefined; + return obj; + }, + fromAminoMsg(object: PublicKeyAminoMsg): PublicKey { + return PublicKey.fromAmino(object.value); + }, + fromProtoMsg(message: PublicKeyProtoMsg): PublicKey { + return PublicKey.decode(message.value); + }, + toProto(message: PublicKey): Uint8Array { + return PublicKey.encode(message).finish(); + }, + toProtoMsg(message: PublicKey): PublicKeyProtoMsg { + return { + typeUrl: "/tendermint.crypto.PublicKey", + value: PublicKey.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/crypto/proof.ts b/util/inj-types/tendermint/crypto/proof.ts new file mode 100644 index 00000000..71d20d77 --- /dev/null +++ b/util/inj-types/tendermint/crypto/proof.ts @@ -0,0 +1,548 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +export interface Proof { + total: bigint; + index: bigint; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} +export interface ProofProtoMsg { + typeUrl: "/tendermint.crypto.Proof"; + value: Uint8Array; +} +export interface ProofAmino { + total?: string; + index?: string; + leaf_hash?: string; + aunts?: string[]; +} +export interface ProofAminoMsg { + type: "/tendermint.crypto.Proof"; + value: ProofAmino; +} +export interface ProofSDKType { + total: bigint; + index: bigint; + leaf_hash: Uint8Array; + aunts: Uint8Array[]; +} +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof?: Proof; +} +export interface ValueOpProtoMsg { + typeUrl: "/tendermint.crypto.ValueOp"; + value: Uint8Array; +} +export interface ValueOpAmino { + /** Encoded in ProofOp.Key. */ + key?: string; + /** To encode in ProofOp.Data */ + proof?: ProofAmino; +} +export interface ValueOpAminoMsg { + type: "/tendermint.crypto.ValueOp"; + value: ValueOpAmino; +} +export interface ValueOpSDKType { + key: Uint8Array; + proof?: ProofSDKType; +} +export interface DominoOp { + key: string; + input: string; + output: string; +} +export interface DominoOpProtoMsg { + typeUrl: "/tendermint.crypto.DominoOp"; + value: Uint8Array; +} +export interface DominoOpAmino { + key?: string; + input?: string; + output?: string; +} +export interface DominoOpAminoMsg { + type: "/tendermint.crypto.DominoOp"; + value: DominoOpAmino; +} +export interface DominoOpSDKType { + key: string; + input: string; + output: string; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} +export interface ProofOpProtoMsg { + typeUrl: "/tendermint.crypto.ProofOp"; + value: Uint8Array; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOpAmino { + type?: string; + key?: string; + data?: string; +} +export interface ProofOpAminoMsg { + type: "/tendermint.crypto.ProofOp"; + value: ProofOpAmino; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOpSDKType { + type: string; + key: Uint8Array; + data: Uint8Array; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOps { + ops: ProofOp[]; +} +export interface ProofOpsProtoMsg { + typeUrl: "/tendermint.crypto.ProofOps"; + value: Uint8Array; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOpsAmino { + ops?: ProofOpAmino[]; +} +export interface ProofOpsAminoMsg { + type: "/tendermint.crypto.ProofOps"; + value: ProofOpsAmino; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOpsSDKType { + ops: ProofOpSDKType[]; +} +function createBaseProof(): Proof { + return { + total: BigInt(0), + index: BigInt(0), + leafHash: new Uint8Array(), + aunts: [] + }; +} +export const Proof = { + typeUrl: "/tendermint.crypto.Proof", + encode(message: Proof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.total !== BigInt(0)) { + writer.uint32(8).int64(message.total); + } + if (message.index !== BigInt(0)) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total = reader.int64(); + break; + case 2: + message.index = reader.int64(); + break; + case 3: + message.leafHash = reader.bytes(); + break; + case 4: + message.aunts.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proof { + const message = createBaseProof(); + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); + message.leafHash = object.leafHash ?? new Uint8Array(); + message.aunts = object.aunts?.map(e => e) || []; + return message; + }, + fromAmino(object: ProofAmino): Proof { + const message = createBaseProof(); + if (object.total !== undefined && object.total !== null) { + message.total = BigInt(object.total); + } + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + if (object.leaf_hash !== undefined && object.leaf_hash !== null) { + message.leafHash = bytesFromBase64(object.leaf_hash); + } + message.aunts = object.aunts?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Proof): ProofAmino { + const obj: any = {}; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; + obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; + if (message.aunts) { + obj.aunts = message.aunts.map(e => base64FromBytes(e)); + } else { + obj.aunts = message.aunts; + } + return obj; + }, + fromAminoMsg(object: ProofAminoMsg): Proof { + return Proof.fromAmino(object.value); + }, + fromProtoMsg(message: ProofProtoMsg): Proof { + return Proof.decode(message.value); + }, + toProto(message: Proof): Uint8Array { + return Proof.encode(message).finish(); + }, + toProtoMsg(message: Proof): ProofProtoMsg { + return { + typeUrl: "/tendermint.crypto.Proof", + value: Proof.encode(message).finish() + }; + } +}; +function createBaseValueOp(): ValueOp { + return { + key: new Uint8Array(), + proof: undefined + }; +} +export const ValueOp = { + typeUrl: "/tendermint.crypto.ValueOp", + encode(message: ValueOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.proof = Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValueOp { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, + fromAmino(object: ValueOpAmino): ValueOp { + const message = createBaseValueOp(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: ValueOp): ValueOpAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: ValueOpAminoMsg): ValueOp { + return ValueOp.fromAmino(object.value); + }, + fromProtoMsg(message: ValueOpProtoMsg): ValueOp { + return ValueOp.decode(message.value); + }, + toProto(message: ValueOp): Uint8Array { + return ValueOp.encode(message).finish(); + }, + toProtoMsg(message: ValueOp): ValueOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.ValueOp", + value: ValueOp.encode(message).finish() + }; + } +}; +function createBaseDominoOp(): DominoOp { + return { + key: "", + input: "", + output: "" + }; +} +export const DominoOp = { + typeUrl: "/tendermint.crypto.DominoOp", + encode(message: DominoOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.input = reader.string(); + break; + case 3: + message.output = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DominoOp { + const message = createBaseDominoOp(); + message.key = object.key ?? ""; + message.input = object.input ?? ""; + message.output = object.output ?? ""; + return message; + }, + fromAmino(object: DominoOpAmino): DominoOp { + const message = createBaseDominoOp(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.input !== undefined && object.input !== null) { + message.input = object.input; + } + if (object.output !== undefined && object.output !== null) { + message.output = object.output; + } + return message; + }, + toAmino(message: DominoOp): DominoOpAmino { + const obj: any = {}; + obj.key = message.key === "" ? undefined : message.key; + obj.input = message.input === "" ? undefined : message.input; + obj.output = message.output === "" ? undefined : message.output; + return obj; + }, + fromAminoMsg(object: DominoOpAminoMsg): DominoOp { + return DominoOp.fromAmino(object.value); + }, + fromProtoMsg(message: DominoOpProtoMsg): DominoOp { + return DominoOp.decode(message.value); + }, + toProto(message: DominoOp): Uint8Array { + return DominoOp.encode(message).finish(); + }, + toProtoMsg(message: DominoOp): DominoOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.DominoOp", + value: DominoOp.encode(message).finish() + }; + } +}; +function createBaseProofOp(): ProofOp { + return { + type: "", + key: new Uint8Array(), + data: new Uint8Array() + }; +} +export const ProofOp = { + typeUrl: "/tendermint.crypto.ProofOp", + encode(message: ProofOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.key = reader.bytes(); + break; + case 3: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: ProofOpAmino): ProofOp { + const message = createBaseProofOp(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: ProofOp): ProofOpAmino { + const obj: any = {}; + obj.type = message.type === "" ? undefined : message.type; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: ProofOpAminoMsg): ProofOp { + return ProofOp.fromAmino(object.value); + }, + fromProtoMsg(message: ProofOpProtoMsg): ProofOp { + return ProofOp.decode(message.value); + }, + toProto(message: ProofOp): Uint8Array { + return ProofOp.encode(message).finish(); + }, + toProtoMsg(message: ProofOp): ProofOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.ProofOp", + value: ProofOp.encode(message).finish() + }; + } +}; +function createBaseProofOps(): ProofOps { + return { + ops: [] + }; +} +export const ProofOps = { + typeUrl: "/tendermint.crypto.ProofOps", + encode(message: ProofOps, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ops.push(ProofOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map(e => ProofOp.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ProofOpsAmino): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map(e => ProofOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: ProofOps): ProofOpsAmino { + const obj: any = {}; + if (message.ops) { + obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e) : undefined); + } else { + obj.ops = message.ops; + } + return obj; + }, + fromAminoMsg(object: ProofOpsAminoMsg): ProofOps { + return ProofOps.fromAmino(object.value); + }, + fromProtoMsg(message: ProofOpsProtoMsg): ProofOps { + return ProofOps.decode(message.value); + }, + toProto(message: ProofOps): Uint8Array { + return ProofOps.encode(message).finish(); + }, + toProtoMsg(message: ProofOps): ProofOpsProtoMsg { + return { + typeUrl: "/tendermint.crypto.ProofOps", + value: ProofOps.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/libs/bits/types.ts b/util/inj-types/tendermint/libs/bits/types.ts new file mode 100644 index 00000000..063bab54 --- /dev/null +++ b/util/inj-types/tendermint/libs/bits/types.ts @@ -0,0 +1,108 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +export interface BitArray { + bits: bigint; + elems: bigint[]; +} +export interface BitArrayProtoMsg { + typeUrl: "/tendermint.libs.bits.BitArray"; + value: Uint8Array; +} +export interface BitArrayAmino { + bits?: string; + elems?: string[]; +} +export interface BitArrayAminoMsg { + type: "/tendermint.libs.bits.BitArray"; + value: BitArrayAmino; +} +export interface BitArraySDKType { + bits: bigint; + elems: bigint[]; +} +function createBaseBitArray(): BitArray { + return { + bits: BigInt(0), + elems: [] + }; +} +export const BitArray = { + typeUrl: "/tendermint.libs.bits.BitArray", + encode(message: BitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bits !== BigInt(0)) { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bits = reader.int64(); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(reader.uint64()); + } + } else { + message.elems.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BitArray { + const message = createBaseBitArray(); + message.bits = object.bits !== undefined && object.bits !== null ? BigInt(object.bits.toString()) : BigInt(0); + message.elems = object.elems?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: BitArrayAmino): BitArray { + const message = createBaseBitArray(); + if (object.bits !== undefined && object.bits !== null) { + message.bits = BigInt(object.bits); + } + message.elems = object.elems?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: BitArray): BitArrayAmino { + const obj: any = {}; + obj.bits = message.bits !== BigInt(0) ? message.bits.toString() : undefined; + if (message.elems) { + obj.elems = message.elems.map(e => e.toString()); + } else { + obj.elems = message.elems; + } + return obj; + }, + fromAminoMsg(object: BitArrayAminoMsg): BitArray { + return BitArray.fromAmino(object.value); + }, + fromProtoMsg(message: BitArrayProtoMsg): BitArray { + return BitArray.decode(message.value); + }, + toProto(message: BitArray): Uint8Array { + return BitArray.encode(message).finish(); + }, + toProtoMsg(message: BitArray): BitArrayProtoMsg { + return { + typeUrl: "/tendermint.libs.bits.BitArray", + value: BitArray.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/mempool/types.ts b/util/inj-types/tendermint/mempool/types.ts new file mode 100644 index 00000000..449dfc55 --- /dev/null +++ b/util/inj-types/tendermint/mempool/types.ts @@ -0,0 +1,164 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +export interface Txs { + txs: Uint8Array[]; +} +export interface TxsProtoMsg { + typeUrl: "/tendermint.mempool.Txs"; + value: Uint8Array; +} +export interface TxsAmino { + txs?: string[]; +} +export interface TxsAminoMsg { + type: "/tendermint.mempool.Txs"; + value: TxsAmino; +} +export interface TxsSDKType { + txs: Uint8Array[]; +} +export interface Message { + txs?: Txs; +} +export interface MessageProtoMsg { + typeUrl: "/tendermint.mempool.Message"; + value: Uint8Array; +} +export interface MessageAmino { + txs?: TxsAmino; +} +export interface MessageAminoMsg { + type: "/tendermint.mempool.Message"; + value: MessageAmino; +} +export interface MessageSDKType { + txs?: TxsSDKType; +} +function createBaseTxs(): Txs { + return { + txs: [] + }; +} +export const Txs = { + typeUrl: "/tendermint.mempool.Txs", + encode(message: Txs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Txs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Txs { + const message = createBaseTxs(); + message.txs = object.txs?.map(e => e) || []; + return message; + }, + fromAmino(object: TxsAmino): Txs { + const message = createBaseTxs(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Txs): TxsAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + return obj; + }, + fromAminoMsg(object: TxsAminoMsg): Txs { + return Txs.fromAmino(object.value); + }, + fromProtoMsg(message: TxsProtoMsg): Txs { + return Txs.decode(message.value); + }, + toProto(message: Txs): Uint8Array { + return Txs.encode(message).finish(); + }, + toProtoMsg(message: Txs): TxsProtoMsg { + return { + typeUrl: "/tendermint.mempool.Txs", + value: Txs.encode(message).finish() + }; + } +}; +function createBaseMessage(): Message { + return { + txs: undefined + }; +} +export const Message = { + typeUrl: "/tendermint.mempool.Message", + encode(message: Message, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txs !== undefined) { + Txs.encode(message.txs, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Message { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs = Txs.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Message { + const message = createBaseMessage(); + message.txs = object.txs !== undefined && object.txs !== null ? Txs.fromPartial(object.txs) : undefined; + return message; + }, + fromAmino(object: MessageAmino): Message { + const message = createBaseMessage(); + if (object.txs !== undefined && object.txs !== null) { + message.txs = Txs.fromAmino(object.txs); + } + return message; + }, + toAmino(message: Message): MessageAmino { + const obj: any = {}; + obj.txs = message.txs ? Txs.toAmino(message.txs) : undefined; + return obj; + }, + fromAminoMsg(object: MessageAminoMsg): Message { + return Message.fromAmino(object.value); + }, + fromProtoMsg(message: MessageProtoMsg): Message { + return Message.decode(message.value); + }, + toProto(message: Message): Uint8Array { + return Message.encode(message).finish(); + }, + toProtoMsg(message: Message): MessageProtoMsg { + return { + typeUrl: "/tendermint.mempool.Message", + value: Message.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/p2p/conn.ts b/util/inj-types/tendermint/p2p/conn.ts new file mode 100644 index 00000000..e28951aa --- /dev/null +++ b/util/inj-types/tendermint/p2p/conn.ts @@ -0,0 +1,440 @@ +import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +export interface PacketPing {} +export interface PacketPingProtoMsg { + typeUrl: "/tendermint.p2p.PacketPing"; + value: Uint8Array; +} +export interface PacketPingAmino {} +export interface PacketPingAminoMsg { + type: "/tendermint.p2p.PacketPing"; + value: PacketPingAmino; +} +export interface PacketPingSDKType {} +export interface PacketPong {} +export interface PacketPongProtoMsg { + typeUrl: "/tendermint.p2p.PacketPong"; + value: Uint8Array; +} +export interface PacketPongAmino {} +export interface PacketPongAminoMsg { + type: "/tendermint.p2p.PacketPong"; + value: PacketPongAmino; +} +export interface PacketPongSDKType {} +export interface PacketMsg { + channelId: number; + eof: boolean; + data: Uint8Array; +} +export interface PacketMsgProtoMsg { + typeUrl: "/tendermint.p2p.PacketMsg"; + value: Uint8Array; +} +export interface PacketMsgAmino { + channel_id?: number; + eof?: boolean; + data?: string; +} +export interface PacketMsgAminoMsg { + type: "/tendermint.p2p.PacketMsg"; + value: PacketMsgAmino; +} +export interface PacketMsgSDKType { + channel_id: number; + eof: boolean; + data: Uint8Array; +} +export interface Packet { + packetPing?: PacketPing; + packetPong?: PacketPong; + packetMsg?: PacketMsg; +} +export interface PacketProtoMsg { + typeUrl: "/tendermint.p2p.Packet"; + value: Uint8Array; +} +export interface PacketAmino { + packet_ping?: PacketPingAmino; + packet_pong?: PacketPongAmino; + packet_msg?: PacketMsgAmino; +} +export interface PacketAminoMsg { + type: "/tendermint.p2p.Packet"; + value: PacketAmino; +} +export interface PacketSDKType { + packet_ping?: PacketPingSDKType; + packet_pong?: PacketPongSDKType; + packet_msg?: PacketMsgSDKType; +} +export interface AuthSigMessage { + pubKey: PublicKey; + sig: Uint8Array; +} +export interface AuthSigMessageProtoMsg { + typeUrl: "/tendermint.p2p.AuthSigMessage"; + value: Uint8Array; +} +export interface AuthSigMessageAmino { + pub_key?: PublicKeyAmino; + sig?: string; +} +export interface AuthSigMessageAminoMsg { + type: "/tendermint.p2p.AuthSigMessage"; + value: AuthSigMessageAmino; +} +export interface AuthSigMessageSDKType { + pub_key: PublicKeySDKType; + sig: Uint8Array; +} +function createBasePacketPing(): PacketPing { + return {}; +} +export const PacketPing = { + typeUrl: "/tendermint.p2p.PacketPing", + encode(_: PacketPing, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketPing { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketPing(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): PacketPing { + const message = createBasePacketPing(); + return message; + }, + fromAmino(_: PacketPingAmino): PacketPing { + const message = createBasePacketPing(); + return message; + }, + toAmino(_: PacketPing): PacketPingAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: PacketPingAminoMsg): PacketPing { + return PacketPing.fromAmino(object.value); + }, + fromProtoMsg(message: PacketPingProtoMsg): PacketPing { + return PacketPing.decode(message.value); + }, + toProto(message: PacketPing): Uint8Array { + return PacketPing.encode(message).finish(); + }, + toProtoMsg(message: PacketPing): PacketPingProtoMsg { + return { + typeUrl: "/tendermint.p2p.PacketPing", + value: PacketPing.encode(message).finish() + }; + } +}; +function createBasePacketPong(): PacketPong { + return {}; +} +export const PacketPong = { + typeUrl: "/tendermint.p2p.PacketPong", + encode(_: PacketPong, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketPong { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketPong(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): PacketPong { + const message = createBasePacketPong(); + return message; + }, + fromAmino(_: PacketPongAmino): PacketPong { + const message = createBasePacketPong(); + return message; + }, + toAmino(_: PacketPong): PacketPongAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: PacketPongAminoMsg): PacketPong { + return PacketPong.fromAmino(object.value); + }, + fromProtoMsg(message: PacketPongProtoMsg): PacketPong { + return PacketPong.decode(message.value); + }, + toProto(message: PacketPong): Uint8Array { + return PacketPong.encode(message).finish(); + }, + toProtoMsg(message: PacketPong): PacketPongProtoMsg { + return { + typeUrl: "/tendermint.p2p.PacketPong", + value: PacketPong.encode(message).finish() + }; + } +}; +function createBasePacketMsg(): PacketMsg { + return { + channelId: 0, + eof: false, + data: new Uint8Array() + }; +} +export const PacketMsg = { + typeUrl: "/tendermint.p2p.PacketMsg", + encode(message: PacketMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.channelId !== 0) { + writer.uint32(8).int32(message.channelId); + } + if (message.eof === true) { + writer.uint32(16).bool(message.eof); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channelId = reader.int32(); + break; + case 2: + message.eof = reader.bool(); + break; + case 3: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketMsg { + const message = createBasePacketMsg(); + message.channelId = object.channelId ?? 0; + message.eof = object.eof ?? false; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: PacketMsgAmino): PacketMsg { + const message = createBasePacketMsg(); + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.eof !== undefined && object.eof !== null) { + message.eof = object.eof; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: PacketMsg): PacketMsgAmino { + const obj: any = {}; + obj.channel_id = message.channelId === 0 ? undefined : message.channelId; + obj.eof = message.eof === false ? undefined : message.eof; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: PacketMsgAminoMsg): PacketMsg { + return PacketMsg.fromAmino(object.value); + }, + fromProtoMsg(message: PacketMsgProtoMsg): PacketMsg { + return PacketMsg.decode(message.value); + }, + toProto(message: PacketMsg): Uint8Array { + return PacketMsg.encode(message).finish(); + }, + toProtoMsg(message: PacketMsg): PacketMsgProtoMsg { + return { + typeUrl: "/tendermint.p2p.PacketMsg", + value: PacketMsg.encode(message).finish() + }; + } +}; +function createBasePacket(): Packet { + return { + packetPing: undefined, + packetPong: undefined, + packetMsg: undefined + }; +} +export const Packet = { + typeUrl: "/tendermint.p2p.Packet", + encode(message: Packet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packetPing !== undefined) { + PacketPing.encode(message.packetPing, writer.uint32(10).fork()).ldelim(); + } + if (message.packetPong !== undefined) { + PacketPong.encode(message.packetPong, writer.uint32(18).fork()).ldelim(); + } + if (message.packetMsg !== undefined) { + PacketMsg.encode(message.packetMsg, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Packet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packetPing = PacketPing.decode(reader, reader.uint32()); + break; + case 2: + message.packetPong = PacketPong.decode(reader, reader.uint32()); + break; + case 3: + message.packetMsg = PacketMsg.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Packet { + const message = createBasePacket(); + message.packetPing = object.packetPing !== undefined && object.packetPing !== null ? PacketPing.fromPartial(object.packetPing) : undefined; + message.packetPong = object.packetPong !== undefined && object.packetPong !== null ? PacketPong.fromPartial(object.packetPong) : undefined; + message.packetMsg = object.packetMsg !== undefined && object.packetMsg !== null ? PacketMsg.fromPartial(object.packetMsg) : undefined; + return message; + }, + fromAmino(object: PacketAmino): Packet { + const message = createBasePacket(); + if (object.packet_ping !== undefined && object.packet_ping !== null) { + message.packetPing = PacketPing.fromAmino(object.packet_ping); + } + if (object.packet_pong !== undefined && object.packet_pong !== null) { + message.packetPong = PacketPong.fromAmino(object.packet_pong); + } + if (object.packet_msg !== undefined && object.packet_msg !== null) { + message.packetMsg = PacketMsg.fromAmino(object.packet_msg); + } + return message; + }, + toAmino(message: Packet): PacketAmino { + const obj: any = {}; + obj.packet_ping = message.packetPing ? PacketPing.toAmino(message.packetPing) : undefined; + obj.packet_pong = message.packetPong ? PacketPong.toAmino(message.packetPong) : undefined; + obj.packet_msg = message.packetMsg ? PacketMsg.toAmino(message.packetMsg) : undefined; + return obj; + }, + fromAminoMsg(object: PacketAminoMsg): Packet { + return Packet.fromAmino(object.value); + }, + fromProtoMsg(message: PacketProtoMsg): Packet { + return Packet.decode(message.value); + }, + toProto(message: Packet): Uint8Array { + return Packet.encode(message).finish(); + }, + toProtoMsg(message: Packet): PacketProtoMsg { + return { + typeUrl: "/tendermint.p2p.Packet", + value: Packet.encode(message).finish() + }; + } +}; +function createBaseAuthSigMessage(): AuthSigMessage { + return { + pubKey: PublicKey.fromPartial({}), + sig: new Uint8Array() + }; +} +export const AuthSigMessage = { + typeUrl: "/tendermint.p2p.AuthSigMessage", + encode(message: AuthSigMessage, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.sig.length !== 0) { + writer.uint32(18).bytes(message.sig); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AuthSigMessage { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthSigMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKey = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.sig = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AuthSigMessage { + const message = createBaseAuthSigMessage(); + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.sig = object.sig ?? new Uint8Array(); + return message; + }, + fromAmino(object: AuthSigMessageAmino): AuthSigMessage { + const message = createBaseAuthSigMessage(); + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.sig !== undefined && object.sig !== null) { + message.sig = bytesFromBase64(object.sig); + } + return message; + }, + toAmino(message: AuthSigMessage): AuthSigMessageAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; + return obj; + }, + fromAminoMsg(object: AuthSigMessageAminoMsg): AuthSigMessage { + return AuthSigMessage.fromAmino(object.value); + }, + fromProtoMsg(message: AuthSigMessageProtoMsg): AuthSigMessage { + return AuthSigMessage.decode(message.value); + }, + toProto(message: AuthSigMessage): Uint8Array { + return AuthSigMessage.encode(message).finish(); + }, + toProtoMsg(message: AuthSigMessage): AuthSigMessageProtoMsg { + return { + typeUrl: "/tendermint.p2p.AuthSigMessage", + value: AuthSigMessage.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/p2p/pex.ts b/util/inj-types/tendermint/p2p/pex.ts new file mode 100644 index 00000000..619b0af6 --- /dev/null +++ b/util/inj-types/tendermint/p2p/pex.ts @@ -0,0 +1,241 @@ +import { NetAddress, NetAddressAmino, NetAddressSDKType } from "./types"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +export interface PexRequest {} +export interface PexRequestProtoMsg { + typeUrl: "/tendermint.p2p.PexRequest"; + value: Uint8Array; +} +export interface PexRequestAmino {} +export interface PexRequestAminoMsg { + type: "/tendermint.p2p.PexRequest"; + value: PexRequestAmino; +} +export interface PexRequestSDKType {} +export interface PexAddrs { + addrs: NetAddress[]; +} +export interface PexAddrsProtoMsg { + typeUrl: "/tendermint.p2p.PexAddrs"; + value: Uint8Array; +} +export interface PexAddrsAmino { + addrs?: NetAddressAmino[]; +} +export interface PexAddrsAminoMsg { + type: "/tendermint.p2p.PexAddrs"; + value: PexAddrsAmino; +} +export interface PexAddrsSDKType { + addrs: NetAddressSDKType[]; +} +export interface Message { + pexRequest?: PexRequest; + pexAddrs?: PexAddrs; +} +export interface MessageProtoMsg { + typeUrl: "/tendermint.p2p.Message"; + value: Uint8Array; +} +export interface MessageAmino { + pex_request?: PexRequestAmino; + pex_addrs?: PexAddrsAmino; +} +export interface MessageAminoMsg { + type: "/tendermint.p2p.Message"; + value: MessageAmino; +} +export interface MessageSDKType { + pex_request?: PexRequestSDKType; + pex_addrs?: PexAddrsSDKType; +} +function createBasePexRequest(): PexRequest { + return {}; +} +export const PexRequest = { + typeUrl: "/tendermint.p2p.PexRequest", + encode(_: PexRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PexRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePexRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): PexRequest { + const message = createBasePexRequest(); + return message; + }, + fromAmino(_: PexRequestAmino): PexRequest { + const message = createBasePexRequest(); + return message; + }, + toAmino(_: PexRequest): PexRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: PexRequestAminoMsg): PexRequest { + return PexRequest.fromAmino(object.value); + }, + fromProtoMsg(message: PexRequestProtoMsg): PexRequest { + return PexRequest.decode(message.value); + }, + toProto(message: PexRequest): Uint8Array { + return PexRequest.encode(message).finish(); + }, + toProtoMsg(message: PexRequest): PexRequestProtoMsg { + return { + typeUrl: "/tendermint.p2p.PexRequest", + value: PexRequest.encode(message).finish() + }; + } +}; +function createBasePexAddrs(): PexAddrs { + return { + addrs: [] + }; +} +export const PexAddrs = { + typeUrl: "/tendermint.p2p.PexAddrs", + encode(message: PexAddrs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.addrs) { + NetAddress.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PexAddrs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePexAddrs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addrs.push(NetAddress.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PexAddrs { + const message = createBasePexAddrs(); + message.addrs = object.addrs?.map(e => NetAddress.fromPartial(e)) || []; + return message; + }, + fromAmino(object: PexAddrsAmino): PexAddrs { + const message = createBasePexAddrs(); + message.addrs = object.addrs?.map(e => NetAddress.fromAmino(e)) || []; + return message; + }, + toAmino(message: PexAddrs): PexAddrsAmino { + const obj: any = {}; + if (message.addrs) { + obj.addrs = message.addrs.map(e => e ? NetAddress.toAmino(e) : undefined); + } else { + obj.addrs = message.addrs; + } + return obj; + }, + fromAminoMsg(object: PexAddrsAminoMsg): PexAddrs { + return PexAddrs.fromAmino(object.value); + }, + fromProtoMsg(message: PexAddrsProtoMsg): PexAddrs { + return PexAddrs.decode(message.value); + }, + toProto(message: PexAddrs): Uint8Array { + return PexAddrs.encode(message).finish(); + }, + toProtoMsg(message: PexAddrs): PexAddrsProtoMsg { + return { + typeUrl: "/tendermint.p2p.PexAddrs", + value: PexAddrs.encode(message).finish() + }; + } +}; +function createBaseMessage(): Message { + return { + pexRequest: undefined, + pexAddrs: undefined + }; +} +export const Message = { + typeUrl: "/tendermint.p2p.Message", + encode(message: Message, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pexRequest !== undefined) { + PexRequest.encode(message.pexRequest, writer.uint32(10).fork()).ldelim(); + } + if (message.pexAddrs !== undefined) { + PexAddrs.encode(message.pexAddrs, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Message { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pexRequest = PexRequest.decode(reader, reader.uint32()); + break; + case 2: + message.pexAddrs = PexAddrs.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Message { + const message = createBaseMessage(); + message.pexRequest = object.pexRequest !== undefined && object.pexRequest !== null ? PexRequest.fromPartial(object.pexRequest) : undefined; + message.pexAddrs = object.pexAddrs !== undefined && object.pexAddrs !== null ? PexAddrs.fromPartial(object.pexAddrs) : undefined; + return message; + }, + fromAmino(object: MessageAmino): Message { + const message = createBaseMessage(); + if (object.pex_request !== undefined && object.pex_request !== null) { + message.pexRequest = PexRequest.fromAmino(object.pex_request); + } + if (object.pex_addrs !== undefined && object.pex_addrs !== null) { + message.pexAddrs = PexAddrs.fromAmino(object.pex_addrs); + } + return message; + }, + toAmino(message: Message): MessageAmino { + const obj: any = {}; + obj.pex_request = message.pexRequest ? PexRequest.toAmino(message.pexRequest) : undefined; + obj.pex_addrs = message.pexAddrs ? PexAddrs.toAmino(message.pexAddrs) : undefined; + return obj; + }, + fromAminoMsg(object: MessageAminoMsg): Message { + return Message.fromAmino(object.value); + }, + fromProtoMsg(message: MessageProtoMsg): Message { + return Message.decode(message.value); + }, + toProto(message: Message): Uint8Array { + return Message.encode(message).finish(); + }, + toProtoMsg(message: Message): MessageProtoMsg { + return { + typeUrl: "/tendermint.p2p.Message", + value: Message.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/p2p/types.ts b/util/inj-types/tendermint/p2p/types.ts new file mode 100644 index 00000000..2e95e898 --- /dev/null +++ b/util/inj-types/tendermint/p2p/types.ts @@ -0,0 +1,502 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +export interface NetAddress { + id: string; + ip: string; + port: number; +} +export interface NetAddressProtoMsg { + typeUrl: "/tendermint.p2p.NetAddress"; + value: Uint8Array; +} +export interface NetAddressAmino { + id?: string; + ip?: string; + port?: number; +} +export interface NetAddressAminoMsg { + type: "/tendermint.p2p.NetAddress"; + value: NetAddressAmino; +} +export interface NetAddressSDKType { + id: string; + ip: string; + port: number; +} +export interface ProtocolVersion { + p2p: bigint; + block: bigint; + app: bigint; +} +export interface ProtocolVersionProtoMsg { + typeUrl: "/tendermint.p2p.ProtocolVersion"; + value: Uint8Array; +} +export interface ProtocolVersionAmino { + p2p?: string; + block?: string; + app?: string; +} +export interface ProtocolVersionAminoMsg { + type: "/tendermint.p2p.ProtocolVersion"; + value: ProtocolVersionAmino; +} +export interface ProtocolVersionSDKType { + p2p: bigint; + block: bigint; + app: bigint; +} +export interface DefaultNodeInfo { + protocolVersion: ProtocolVersion; + defaultNodeId: string; + listenAddr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other: DefaultNodeInfoOther; +} +export interface DefaultNodeInfoProtoMsg { + typeUrl: "/tendermint.p2p.DefaultNodeInfo"; + value: Uint8Array; +} +export interface DefaultNodeInfoAmino { + protocol_version?: ProtocolVersionAmino; + default_node_id?: string; + listen_addr?: string; + network?: string; + version?: string; + channels?: string; + moniker?: string; + other?: DefaultNodeInfoOtherAmino; +} +export interface DefaultNodeInfoAminoMsg { + type: "/tendermint.p2p.DefaultNodeInfo"; + value: DefaultNodeInfoAmino; +} +export interface DefaultNodeInfoSDKType { + protocol_version: ProtocolVersionSDKType; + default_node_id: string; + listen_addr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other: DefaultNodeInfoOtherSDKType; +} +export interface DefaultNodeInfoOther { + txIndex: string; + rpcAddress: string; +} +export interface DefaultNodeInfoOtherProtoMsg { + typeUrl: "/tendermint.p2p.DefaultNodeInfoOther"; + value: Uint8Array; +} +export interface DefaultNodeInfoOtherAmino { + tx_index?: string; + rpc_address?: string; +} +export interface DefaultNodeInfoOtherAminoMsg { + type: "/tendermint.p2p.DefaultNodeInfoOther"; + value: DefaultNodeInfoOtherAmino; +} +export interface DefaultNodeInfoOtherSDKType { + tx_index: string; + rpc_address: string; +} +function createBaseNetAddress(): NetAddress { + return { + id: "", + ip: "", + port: 0 + }; +} +export const NetAddress = { + typeUrl: "/tendermint.p2p.NetAddress", + encode(message: NetAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.ip !== "") { + writer.uint32(18).string(message.ip); + } + if (message.port !== 0) { + writer.uint32(24).uint32(message.port); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): NetAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.ip = reader.string(); + break; + case 3: + message.port = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): NetAddress { + const message = createBaseNetAddress(); + message.id = object.id ?? ""; + message.ip = object.ip ?? ""; + message.port = object.port ?? 0; + return message; + }, + fromAmino(object: NetAddressAmino): NetAddress { + const message = createBaseNetAddress(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.ip !== undefined && object.ip !== null) { + message.ip = object.ip; + } + if (object.port !== undefined && object.port !== null) { + message.port = object.port; + } + return message; + }, + toAmino(message: NetAddress): NetAddressAmino { + const obj: any = {}; + obj.id = message.id === "" ? undefined : message.id; + obj.ip = message.ip === "" ? undefined : message.ip; + obj.port = message.port === 0 ? undefined : message.port; + return obj; + }, + fromAminoMsg(object: NetAddressAminoMsg): NetAddress { + return NetAddress.fromAmino(object.value); + }, + fromProtoMsg(message: NetAddressProtoMsg): NetAddress { + return NetAddress.decode(message.value); + }, + toProto(message: NetAddress): Uint8Array { + return NetAddress.encode(message).finish(); + }, + toProtoMsg(message: NetAddress): NetAddressProtoMsg { + return { + typeUrl: "/tendermint.p2p.NetAddress", + value: NetAddress.encode(message).finish() + }; + } +}; +function createBaseProtocolVersion(): ProtocolVersion { + return { + p2p: BigInt(0), + block: BigInt(0), + app: BigInt(0) + }; +} +export const ProtocolVersion = { + typeUrl: "/tendermint.p2p.ProtocolVersion", + encode(message: ProtocolVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.p2p !== BigInt(0)) { + writer.uint32(8).uint64(message.p2p); + } + if (message.block !== BigInt(0)) { + writer.uint32(16).uint64(message.block); + } + if (message.app !== BigInt(0)) { + writer.uint32(24).uint64(message.app); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProtocolVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.p2p = reader.uint64(); + break; + case 2: + message.block = reader.uint64(); + break; + case 3: + message.app = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ProtocolVersion { + const message = createBaseProtocolVersion(); + message.p2p = object.p2p !== undefined && object.p2p !== null ? BigInt(object.p2p.toString()) : BigInt(0); + message.block = object.block !== undefined && object.block !== null ? BigInt(object.block.toString()) : BigInt(0); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ProtocolVersionAmino): ProtocolVersion { + const message = createBaseProtocolVersion(); + if (object.p2p !== undefined && object.p2p !== null) { + message.p2p = BigInt(object.p2p); + } + if (object.block !== undefined && object.block !== null) { + message.block = BigInt(object.block); + } + if (object.app !== undefined && object.app !== null) { + message.app = BigInt(object.app); + } + return message; + }, + toAmino(message: ProtocolVersion): ProtocolVersionAmino { + const obj: any = {}; + obj.p2p = message.p2p !== BigInt(0) ? message.p2p.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { + return ProtocolVersion.fromAmino(object.value); + }, + fromProtoMsg(message: ProtocolVersionProtoMsg): ProtocolVersion { + return ProtocolVersion.decode(message.value); + }, + toProto(message: ProtocolVersion): Uint8Array { + return ProtocolVersion.encode(message).finish(); + }, + toProtoMsg(message: ProtocolVersion): ProtocolVersionProtoMsg { + return { + typeUrl: "/tendermint.p2p.ProtocolVersion", + value: ProtocolVersion.encode(message).finish() + }; + } +}; +function createBaseDefaultNodeInfo(): DefaultNodeInfo { + return { + protocolVersion: ProtocolVersion.fromPartial({}), + defaultNodeId: "", + listenAddr: "", + network: "", + version: "", + channels: new Uint8Array(), + moniker: "", + other: DefaultNodeInfoOther.fromPartial({}) + }; +} +export const DefaultNodeInfo = { + typeUrl: "/tendermint.p2p.DefaultNodeInfo", + encode(message: DefaultNodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.protocolVersion !== undefined) { + ProtocolVersion.encode(message.protocolVersion, writer.uint32(10).fork()).ldelim(); + } + if (message.defaultNodeId !== "") { + writer.uint32(18).string(message.defaultNodeId); + } + if (message.listenAddr !== "") { + writer.uint32(26).string(message.listenAddr); + } + if (message.network !== "") { + writer.uint32(34).string(message.network); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.channels.length !== 0) { + writer.uint32(50).bytes(message.channels); + } + if (message.moniker !== "") { + writer.uint32(58).string(message.moniker); + } + if (message.other !== undefined) { + DefaultNodeInfoOther.encode(message.other, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.protocolVersion = ProtocolVersion.decode(reader, reader.uint32()); + break; + case 2: + message.defaultNodeId = reader.string(); + break; + case 3: + message.listenAddr = reader.string(); + break; + case 4: + message.network = reader.string(); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.channels = reader.bytes(); + break; + case 7: + message.moniker = reader.string(); + break; + case 8: + message.other = DefaultNodeInfoOther.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DefaultNodeInfo { + const message = createBaseDefaultNodeInfo(); + message.protocolVersion = object.protocolVersion !== undefined && object.protocolVersion !== null ? ProtocolVersion.fromPartial(object.protocolVersion) : undefined; + message.defaultNodeId = object.defaultNodeId ?? ""; + message.listenAddr = object.listenAddr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(); + message.moniker = object.moniker ?? ""; + message.other = object.other !== undefined && object.other !== null ? DefaultNodeInfoOther.fromPartial(object.other) : undefined; + return message; + }, + fromAmino(object: DefaultNodeInfoAmino): DefaultNodeInfo { + const message = createBaseDefaultNodeInfo(); + if (object.protocol_version !== undefined && object.protocol_version !== null) { + message.protocolVersion = ProtocolVersion.fromAmino(object.protocol_version); + } + if (object.default_node_id !== undefined && object.default_node_id !== null) { + message.defaultNodeId = object.default_node_id; + } + if (object.listen_addr !== undefined && object.listen_addr !== null) { + message.listenAddr = object.listen_addr; + } + if (object.network !== undefined && object.network !== null) { + message.network = object.network; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.channels !== undefined && object.channels !== null) { + message.channels = bytesFromBase64(object.channels); + } + if (object.moniker !== undefined && object.moniker !== null) { + message.moniker = object.moniker; + } + if (object.other !== undefined && object.other !== null) { + message.other = DefaultNodeInfoOther.fromAmino(object.other); + } + return message; + }, + toAmino(message: DefaultNodeInfo): DefaultNodeInfoAmino { + const obj: any = {}; + obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; + obj.default_node_id = message.defaultNodeId === "" ? undefined : message.defaultNodeId; + obj.listen_addr = message.listenAddr === "" ? undefined : message.listenAddr; + obj.network = message.network === "" ? undefined : message.network; + obj.version = message.version === "" ? undefined : message.version; + obj.channels = message.channels ? base64FromBytes(message.channels) : undefined; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.other = message.other ? DefaultNodeInfoOther.toAmino(message.other) : undefined; + return obj; + }, + fromAminoMsg(object: DefaultNodeInfoAminoMsg): DefaultNodeInfo { + return DefaultNodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: DefaultNodeInfoProtoMsg): DefaultNodeInfo { + return DefaultNodeInfo.decode(message.value); + }, + toProto(message: DefaultNodeInfo): Uint8Array { + return DefaultNodeInfo.encode(message).finish(); + }, + toProtoMsg(message: DefaultNodeInfo): DefaultNodeInfoProtoMsg { + return { + typeUrl: "/tendermint.p2p.DefaultNodeInfo", + value: DefaultNodeInfo.encode(message).finish() + }; + } +}; +function createBaseDefaultNodeInfoOther(): DefaultNodeInfoOther { + return { + txIndex: "", + rpcAddress: "" + }; +} +export const DefaultNodeInfoOther = { + typeUrl: "/tendermint.p2p.DefaultNodeInfoOther", + encode(message: DefaultNodeInfoOther, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txIndex !== "") { + writer.uint32(10).string(message.txIndex); + } + if (message.rpcAddress !== "") { + writer.uint32(18).string(message.rpcAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DefaultNodeInfoOther { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefaultNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txIndex = reader.string(); + break; + case 2: + message.rpcAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DefaultNodeInfoOther { + const message = createBaseDefaultNodeInfoOther(); + message.txIndex = object.txIndex ?? ""; + message.rpcAddress = object.rpcAddress ?? ""; + return message; + }, + fromAmino(object: DefaultNodeInfoOtherAmino): DefaultNodeInfoOther { + const message = createBaseDefaultNodeInfoOther(); + if (object.tx_index !== undefined && object.tx_index !== null) { + message.txIndex = object.tx_index; + } + if (object.rpc_address !== undefined && object.rpc_address !== null) { + message.rpcAddress = object.rpc_address; + } + return message; + }, + toAmino(message: DefaultNodeInfoOther): DefaultNodeInfoOtherAmino { + const obj: any = {}; + obj.tx_index = message.txIndex === "" ? undefined : message.txIndex; + obj.rpc_address = message.rpcAddress === "" ? undefined : message.rpcAddress; + return obj; + }, + fromAminoMsg(object: DefaultNodeInfoOtherAminoMsg): DefaultNodeInfoOther { + return DefaultNodeInfoOther.fromAmino(object.value); + }, + fromProtoMsg(message: DefaultNodeInfoOtherProtoMsg): DefaultNodeInfoOther { + return DefaultNodeInfoOther.decode(message.value); + }, + toProto(message: DefaultNodeInfoOther): Uint8Array { + return DefaultNodeInfoOther.encode(message).finish(); + }, + toProtoMsg(message: DefaultNodeInfoOther): DefaultNodeInfoOtherProtoMsg { + return { + typeUrl: "/tendermint.p2p.DefaultNodeInfoOther", + value: DefaultNodeInfoOther.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/privval/types.ts b/util/inj-types/tendermint/privval/types.ts new file mode 100644 index 00000000..a71c45bd --- /dev/null +++ b/util/inj-types/tendermint/privval/types.ts @@ -0,0 +1,1041 @@ +import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; +import { Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType } from "../types/types"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +export enum Errors { + ERRORS_UNKNOWN = 0, + ERRORS_UNEXPECTED_RESPONSE = 1, + ERRORS_NO_CONNECTION = 2, + ERRORS_CONNECTION_TIMEOUT = 3, + ERRORS_READ_TIMEOUT = 4, + ERRORS_WRITE_TIMEOUT = 5, + UNRECOGNIZED = -1, +} +export const ErrorsSDKType = Errors; +export const ErrorsAmino = Errors; +export function errorsFromJSON(object: any): Errors { + switch (object) { + case 0: + case "ERRORS_UNKNOWN": + return Errors.ERRORS_UNKNOWN; + case 1: + case "ERRORS_UNEXPECTED_RESPONSE": + return Errors.ERRORS_UNEXPECTED_RESPONSE; + case 2: + case "ERRORS_NO_CONNECTION": + return Errors.ERRORS_NO_CONNECTION; + case 3: + case "ERRORS_CONNECTION_TIMEOUT": + return Errors.ERRORS_CONNECTION_TIMEOUT; + case 4: + case "ERRORS_READ_TIMEOUT": + return Errors.ERRORS_READ_TIMEOUT; + case 5: + case "ERRORS_WRITE_TIMEOUT": + return Errors.ERRORS_WRITE_TIMEOUT; + case -1: + case "UNRECOGNIZED": + default: + return Errors.UNRECOGNIZED; + } +} +export function errorsToJSON(object: Errors): string { + switch (object) { + case Errors.ERRORS_UNKNOWN: + return "ERRORS_UNKNOWN"; + case Errors.ERRORS_UNEXPECTED_RESPONSE: + return "ERRORS_UNEXPECTED_RESPONSE"; + case Errors.ERRORS_NO_CONNECTION: + return "ERRORS_NO_CONNECTION"; + case Errors.ERRORS_CONNECTION_TIMEOUT: + return "ERRORS_CONNECTION_TIMEOUT"; + case Errors.ERRORS_READ_TIMEOUT: + return "ERRORS_READ_TIMEOUT"; + case Errors.ERRORS_WRITE_TIMEOUT: + return "ERRORS_WRITE_TIMEOUT"; + case Errors.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export interface RemoteSignerError { + code: number; + description: string; +} +export interface RemoteSignerErrorProtoMsg { + typeUrl: "/tendermint.privval.RemoteSignerError"; + value: Uint8Array; +} +export interface RemoteSignerErrorAmino { + code?: number; + description?: string; +} +export interface RemoteSignerErrorAminoMsg { + type: "/tendermint.privval.RemoteSignerError"; + value: RemoteSignerErrorAmino; +} +export interface RemoteSignerErrorSDKType { + code: number; + description: string; +} +/** PubKeyRequest requests the consensus public key from the remote signer. */ +export interface PubKeyRequest { + chainId: string; +} +export interface PubKeyRequestProtoMsg { + typeUrl: "/tendermint.privval.PubKeyRequest"; + value: Uint8Array; +} +/** PubKeyRequest requests the consensus public key from the remote signer. */ +export interface PubKeyRequestAmino { + chain_id?: string; +} +export interface PubKeyRequestAminoMsg { + type: "/tendermint.privval.PubKeyRequest"; + value: PubKeyRequestAmino; +} +/** PubKeyRequest requests the consensus public key from the remote signer. */ +export interface PubKeyRequestSDKType { + chain_id: string; +} +/** PubKeyResponse is a response message containing the public key. */ +export interface PubKeyResponse { + pubKey: PublicKey; + error?: RemoteSignerError; +} +export interface PubKeyResponseProtoMsg { + typeUrl: "/tendermint.privval.PubKeyResponse"; + value: Uint8Array; +} +/** PubKeyResponse is a response message containing the public key. */ +export interface PubKeyResponseAmino { + pub_key?: PublicKeyAmino; + error?: RemoteSignerErrorAmino; +} +export interface PubKeyResponseAminoMsg { + type: "/tendermint.privval.PubKeyResponse"; + value: PubKeyResponseAmino; +} +/** PubKeyResponse is a response message containing the public key. */ +export interface PubKeyResponseSDKType { + pub_key: PublicKeySDKType; + error?: RemoteSignerErrorSDKType; +} +/** SignVoteRequest is a request to sign a vote */ +export interface SignVoteRequest { + vote?: Vote; + chainId: string; +} +export interface SignVoteRequestProtoMsg { + typeUrl: "/tendermint.privval.SignVoteRequest"; + value: Uint8Array; +} +/** SignVoteRequest is a request to sign a vote */ +export interface SignVoteRequestAmino { + vote?: VoteAmino; + chain_id?: string; +} +export interface SignVoteRequestAminoMsg { + type: "/tendermint.privval.SignVoteRequest"; + value: SignVoteRequestAmino; +} +/** SignVoteRequest is a request to sign a vote */ +export interface SignVoteRequestSDKType { + vote?: VoteSDKType; + chain_id: string; +} +/** SignedVoteResponse is a response containing a signed vote or an error */ +export interface SignedVoteResponse { + vote: Vote; + error?: RemoteSignerError; +} +export interface SignedVoteResponseProtoMsg { + typeUrl: "/tendermint.privval.SignedVoteResponse"; + value: Uint8Array; +} +/** SignedVoteResponse is a response containing a signed vote or an error */ +export interface SignedVoteResponseAmino { + vote?: VoteAmino; + error?: RemoteSignerErrorAmino; +} +export interface SignedVoteResponseAminoMsg { + type: "/tendermint.privval.SignedVoteResponse"; + value: SignedVoteResponseAmino; +} +/** SignedVoteResponse is a response containing a signed vote or an error */ +export interface SignedVoteResponseSDKType { + vote: VoteSDKType; + error?: RemoteSignerErrorSDKType; +} +/** SignProposalRequest is a request to sign a proposal */ +export interface SignProposalRequest { + proposal?: Proposal; + chainId: string; +} +export interface SignProposalRequestProtoMsg { + typeUrl: "/tendermint.privval.SignProposalRequest"; + value: Uint8Array; +} +/** SignProposalRequest is a request to sign a proposal */ +export interface SignProposalRequestAmino { + proposal?: ProposalAmino; + chain_id?: string; +} +export interface SignProposalRequestAminoMsg { + type: "/tendermint.privval.SignProposalRequest"; + value: SignProposalRequestAmino; +} +/** SignProposalRequest is a request to sign a proposal */ +export interface SignProposalRequestSDKType { + proposal?: ProposalSDKType; + chain_id: string; +} +/** SignedProposalResponse is response containing a signed proposal or an error */ +export interface SignedProposalResponse { + proposal: Proposal; + error?: RemoteSignerError; +} +export interface SignedProposalResponseProtoMsg { + typeUrl: "/tendermint.privval.SignedProposalResponse"; + value: Uint8Array; +} +/** SignedProposalResponse is response containing a signed proposal or an error */ +export interface SignedProposalResponseAmino { + proposal?: ProposalAmino; + error?: RemoteSignerErrorAmino; +} +export interface SignedProposalResponseAminoMsg { + type: "/tendermint.privval.SignedProposalResponse"; + value: SignedProposalResponseAmino; +} +/** SignedProposalResponse is response containing a signed proposal or an error */ +export interface SignedProposalResponseSDKType { + proposal: ProposalSDKType; + error?: RemoteSignerErrorSDKType; +} +/** PingRequest is a request to confirm that the connection is alive. */ +export interface PingRequest {} +export interface PingRequestProtoMsg { + typeUrl: "/tendermint.privval.PingRequest"; + value: Uint8Array; +} +/** PingRequest is a request to confirm that the connection is alive. */ +export interface PingRequestAmino {} +export interface PingRequestAminoMsg { + type: "/tendermint.privval.PingRequest"; + value: PingRequestAmino; +} +/** PingRequest is a request to confirm that the connection is alive. */ +export interface PingRequestSDKType {} +/** PingResponse is a response to confirm that the connection is alive. */ +export interface PingResponse {} +export interface PingResponseProtoMsg { + typeUrl: "/tendermint.privval.PingResponse"; + value: Uint8Array; +} +/** PingResponse is a response to confirm that the connection is alive. */ +export interface PingResponseAmino {} +export interface PingResponseAminoMsg { + type: "/tendermint.privval.PingResponse"; + value: PingResponseAmino; +} +/** PingResponse is a response to confirm that the connection is alive. */ +export interface PingResponseSDKType {} +export interface Message { + pubKeyRequest?: PubKeyRequest; + pubKeyResponse?: PubKeyResponse; + signVoteRequest?: SignVoteRequest; + signedVoteResponse?: SignedVoteResponse; + signProposalRequest?: SignProposalRequest; + signedProposalResponse?: SignedProposalResponse; + pingRequest?: PingRequest; + pingResponse?: PingResponse; +} +export interface MessageProtoMsg { + typeUrl: "/tendermint.privval.Message"; + value: Uint8Array; +} +export interface MessageAmino { + pub_key_request?: PubKeyRequestAmino; + pub_key_response?: PubKeyResponseAmino; + sign_vote_request?: SignVoteRequestAmino; + signed_vote_response?: SignedVoteResponseAmino; + sign_proposal_request?: SignProposalRequestAmino; + signed_proposal_response?: SignedProposalResponseAmino; + ping_request?: PingRequestAmino; + ping_response?: PingResponseAmino; +} +export interface MessageAminoMsg { + type: "/tendermint.privval.Message"; + value: MessageAmino; +} +export interface MessageSDKType { + pub_key_request?: PubKeyRequestSDKType; + pub_key_response?: PubKeyResponseSDKType; + sign_vote_request?: SignVoteRequestSDKType; + signed_vote_response?: SignedVoteResponseSDKType; + sign_proposal_request?: SignProposalRequestSDKType; + signed_proposal_response?: SignedProposalResponseSDKType; + ping_request?: PingRequestSDKType; + ping_response?: PingResponseSDKType; +} +function createBaseRemoteSignerError(): RemoteSignerError { + return { + code: 0, + description: "" + }; +} +export const RemoteSignerError = { + typeUrl: "/tendermint.privval.RemoteSignerError", + encode(message: RemoteSignerError, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).int32(message.code); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RemoteSignerError { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRemoteSignerError(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.int32(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RemoteSignerError { + const message = createBaseRemoteSignerError(); + message.code = object.code ?? 0; + message.description = object.description ?? ""; + return message; + }, + fromAmino(object: RemoteSignerErrorAmino): RemoteSignerError { + const message = createBaseRemoteSignerError(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: RemoteSignerError): RemoteSignerErrorAmino { + const obj: any = {}; + obj.code = message.code === 0 ? undefined : message.code; + obj.description = message.description === "" ? undefined : message.description; + return obj; + }, + fromAminoMsg(object: RemoteSignerErrorAminoMsg): RemoteSignerError { + return RemoteSignerError.fromAmino(object.value); + }, + fromProtoMsg(message: RemoteSignerErrorProtoMsg): RemoteSignerError { + return RemoteSignerError.decode(message.value); + }, + toProto(message: RemoteSignerError): Uint8Array { + return RemoteSignerError.encode(message).finish(); + }, + toProtoMsg(message: RemoteSignerError): RemoteSignerErrorProtoMsg { + return { + typeUrl: "/tendermint.privval.RemoteSignerError", + value: RemoteSignerError.encode(message).finish() + }; + } +}; +function createBasePubKeyRequest(): PubKeyRequest { + return { + chainId: "" + }; +} +export const PubKeyRequest = { + typeUrl: "/tendermint.privval.PubKeyRequest", + encode(message: PubKeyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.chainId !== "") { + writer.uint32(10).string(message.chainId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PubKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chainId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PubKeyRequest { + const message = createBasePubKeyRequest(); + message.chainId = object.chainId ?? ""; + return message; + }, + fromAmino(object: PubKeyRequestAmino): PubKeyRequest { + const message = createBasePubKeyRequest(); + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + return message; + }, + toAmino(message: PubKeyRequest): PubKeyRequestAmino { + const obj: any = {}; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + return obj; + }, + fromAminoMsg(object: PubKeyRequestAminoMsg): PubKeyRequest { + return PubKeyRequest.fromAmino(object.value); + }, + fromProtoMsg(message: PubKeyRequestProtoMsg): PubKeyRequest { + return PubKeyRequest.decode(message.value); + }, + toProto(message: PubKeyRequest): Uint8Array { + return PubKeyRequest.encode(message).finish(); + }, + toProtoMsg(message: PubKeyRequest): PubKeyRequestProtoMsg { + return { + typeUrl: "/tendermint.privval.PubKeyRequest", + value: PubKeyRequest.encode(message).finish() + }; + } +}; +function createBasePubKeyResponse(): PubKeyResponse { + return { + pubKey: PublicKey.fromPartial({}), + error: undefined + }; +} +export const PubKeyResponse = { + typeUrl: "/tendermint.privval.PubKeyResponse", + encode(message: PubKeyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.error !== undefined) { + RemoteSignerError.encode(message.error, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PubKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKey = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.error = RemoteSignerError.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PubKeyResponse { + const message = createBasePubKeyResponse(); + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.error = object.error !== undefined && object.error !== null ? RemoteSignerError.fromPartial(object.error) : undefined; + return message; + }, + fromAmino(object: PubKeyResponseAmino): PubKeyResponse { + const message = createBasePubKeyResponse(); + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.error !== undefined && object.error !== null) { + message.error = RemoteSignerError.fromAmino(object.error); + } + return message; + }, + toAmino(message: PubKeyResponse): PubKeyResponseAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.error = message.error ? RemoteSignerError.toAmino(message.error) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyResponseAminoMsg): PubKeyResponse { + return PubKeyResponse.fromAmino(object.value); + }, + fromProtoMsg(message: PubKeyResponseProtoMsg): PubKeyResponse { + return PubKeyResponse.decode(message.value); + }, + toProto(message: PubKeyResponse): Uint8Array { + return PubKeyResponse.encode(message).finish(); + }, + toProtoMsg(message: PubKeyResponse): PubKeyResponseProtoMsg { + return { + typeUrl: "/tendermint.privval.PubKeyResponse", + value: PubKeyResponse.encode(message).finish() + }; + } +}; +function createBaseSignVoteRequest(): SignVoteRequest { + return { + vote: undefined, + chainId: "" + }; +} +export const SignVoteRequest = { + typeUrl: "/tendermint.privval.SignVoteRequest", + encode(message: SignVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote.decode(reader, reader.uint32()); + break; + case 2: + message.chainId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignVoteRequest { + const message = createBaseSignVoteRequest(); + message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; + message.chainId = object.chainId ?? ""; + return message; + }, + fromAmino(object: SignVoteRequestAmino): SignVoteRequest { + const message = createBaseSignVoteRequest(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + return message; + }, + toAmino(message: SignVoteRequest): SignVoteRequestAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + return obj; + }, + fromAminoMsg(object: SignVoteRequestAminoMsg): SignVoteRequest { + return SignVoteRequest.fromAmino(object.value); + }, + fromProtoMsg(message: SignVoteRequestProtoMsg): SignVoteRequest { + return SignVoteRequest.decode(message.value); + }, + toProto(message: SignVoteRequest): Uint8Array { + return SignVoteRequest.encode(message).finish(); + }, + toProtoMsg(message: SignVoteRequest): SignVoteRequestProtoMsg { + return { + typeUrl: "/tendermint.privval.SignVoteRequest", + value: SignVoteRequest.encode(message).finish() + }; + } +}; +function createBaseSignedVoteResponse(): SignedVoteResponse { + return { + vote: Vote.fromPartial({}), + error: undefined + }; +} +export const SignedVoteResponse = { + typeUrl: "/tendermint.privval.SignedVoteResponse", + encode(message: SignedVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + if (message.error !== undefined) { + RemoteSignerError.encode(message.error, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignedVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote.decode(reader, reader.uint32()); + break; + case 2: + message.error = RemoteSignerError.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignedVoteResponse { + const message = createBaseSignedVoteResponse(); + message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; + message.error = object.error !== undefined && object.error !== null ? RemoteSignerError.fromPartial(object.error) : undefined; + return message; + }, + fromAmino(object: SignedVoteResponseAmino): SignedVoteResponse { + const message = createBaseSignedVoteResponse(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + if (object.error !== undefined && object.error !== null) { + message.error = RemoteSignerError.fromAmino(object.error); + } + return message; + }, + toAmino(message: SignedVoteResponse): SignedVoteResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + obj.error = message.error ? RemoteSignerError.toAmino(message.error) : undefined; + return obj; + }, + fromAminoMsg(object: SignedVoteResponseAminoMsg): SignedVoteResponse { + return SignedVoteResponse.fromAmino(object.value); + }, + fromProtoMsg(message: SignedVoteResponseProtoMsg): SignedVoteResponse { + return SignedVoteResponse.decode(message.value); + }, + toProto(message: SignedVoteResponse): Uint8Array { + return SignedVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: SignedVoteResponse): SignedVoteResponseProtoMsg { + return { + typeUrl: "/tendermint.privval.SignedVoteResponse", + value: SignedVoteResponse.encode(message).finish() + }; + } +}; +function createBaseSignProposalRequest(): SignProposalRequest { + return { + proposal: undefined, + chainId: "" + }; +} +export const SignProposalRequest = { + typeUrl: "/tendermint.privval.SignProposalRequest", + encode(message: SignProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + case 2: + message.chainId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignProposalRequest { + const message = createBaseSignProposalRequest(); + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; + message.chainId = object.chainId ?? ""; + return message; + }, + fromAmino(object: SignProposalRequestAmino): SignProposalRequest { + const message = createBaseSignProposalRequest(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + return message; + }, + toAmino(message: SignProposalRequest): SignProposalRequestAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + return obj; + }, + fromAminoMsg(object: SignProposalRequestAminoMsg): SignProposalRequest { + return SignProposalRequest.fromAmino(object.value); + }, + fromProtoMsg(message: SignProposalRequestProtoMsg): SignProposalRequest { + return SignProposalRequest.decode(message.value); + }, + toProto(message: SignProposalRequest): Uint8Array { + return SignProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: SignProposalRequest): SignProposalRequestProtoMsg { + return { + typeUrl: "/tendermint.privval.SignProposalRequest", + value: SignProposalRequest.encode(message).finish() + }; + } +}; +function createBaseSignedProposalResponse(): SignedProposalResponse { + return { + proposal: Proposal.fromPartial({}), + error: undefined + }; +} +export const SignedProposalResponse = { + typeUrl: "/tendermint.privval.SignedProposalResponse", + encode(message: SignedProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + if (message.error !== undefined) { + RemoteSignerError.encode(message.error, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignedProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + case 2: + message.error = RemoteSignerError.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignedProposalResponse { + const message = createBaseSignedProposalResponse(); + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; + message.error = object.error !== undefined && object.error !== null ? RemoteSignerError.fromPartial(object.error) : undefined; + return message; + }, + fromAmino(object: SignedProposalResponseAmino): SignedProposalResponse { + const message = createBaseSignedProposalResponse(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + if (object.error !== undefined && object.error !== null) { + message.error = RemoteSignerError.fromAmino(object.error); + } + return message; + }, + toAmino(message: SignedProposalResponse): SignedProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : undefined; + obj.error = message.error ? RemoteSignerError.toAmino(message.error) : undefined; + return obj; + }, + fromAminoMsg(object: SignedProposalResponseAminoMsg): SignedProposalResponse { + return SignedProposalResponse.fromAmino(object.value); + }, + fromProtoMsg(message: SignedProposalResponseProtoMsg): SignedProposalResponse { + return SignedProposalResponse.decode(message.value); + }, + toProto(message: SignedProposalResponse): Uint8Array { + return SignedProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: SignedProposalResponse): SignedProposalResponseProtoMsg { + return { + typeUrl: "/tendermint.privval.SignedProposalResponse", + value: SignedProposalResponse.encode(message).finish() + }; + } +}; +function createBasePingRequest(): PingRequest { + return {}; +} +export const PingRequest = { + typeUrl: "/tendermint.privval.PingRequest", + encode(_: PingRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): PingRequest { + const message = createBasePingRequest(); + return message; + }, + fromAmino(_: PingRequestAmino): PingRequest { + const message = createBasePingRequest(); + return message; + }, + toAmino(_: PingRequest): PingRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: PingRequestAminoMsg): PingRequest { + return PingRequest.fromAmino(object.value); + }, + fromProtoMsg(message: PingRequestProtoMsg): PingRequest { + return PingRequest.decode(message.value); + }, + toProto(message: PingRequest): Uint8Array { + return PingRequest.encode(message).finish(); + }, + toProtoMsg(message: PingRequest): PingRequestProtoMsg { + return { + typeUrl: "/tendermint.privval.PingRequest", + value: PingRequest.encode(message).finish() + }; + } +}; +function createBasePingResponse(): PingResponse { + return {}; +} +export const PingResponse = { + typeUrl: "/tendermint.privval.PingResponse", + encode(_: PingResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): PingResponse { + const message = createBasePingResponse(); + return message; + }, + fromAmino(_: PingResponseAmino): PingResponse { + const message = createBasePingResponse(); + return message; + }, + toAmino(_: PingResponse): PingResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: PingResponseAminoMsg): PingResponse { + return PingResponse.fromAmino(object.value); + }, + fromProtoMsg(message: PingResponseProtoMsg): PingResponse { + return PingResponse.decode(message.value); + }, + toProto(message: PingResponse): Uint8Array { + return PingResponse.encode(message).finish(); + }, + toProtoMsg(message: PingResponse): PingResponseProtoMsg { + return { + typeUrl: "/tendermint.privval.PingResponse", + value: PingResponse.encode(message).finish() + }; + } +}; +function createBaseMessage(): Message { + return { + pubKeyRequest: undefined, + pubKeyResponse: undefined, + signVoteRequest: undefined, + signedVoteResponse: undefined, + signProposalRequest: undefined, + signedProposalResponse: undefined, + pingRequest: undefined, + pingResponse: undefined + }; +} +export const Message = { + typeUrl: "/tendermint.privval.Message", + encode(message: Message, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pubKeyRequest !== undefined) { + PubKeyRequest.encode(message.pubKeyRequest, writer.uint32(10).fork()).ldelim(); + } + if (message.pubKeyResponse !== undefined) { + PubKeyResponse.encode(message.pubKeyResponse, writer.uint32(18).fork()).ldelim(); + } + if (message.signVoteRequest !== undefined) { + SignVoteRequest.encode(message.signVoteRequest, writer.uint32(26).fork()).ldelim(); + } + if (message.signedVoteResponse !== undefined) { + SignedVoteResponse.encode(message.signedVoteResponse, writer.uint32(34).fork()).ldelim(); + } + if (message.signProposalRequest !== undefined) { + SignProposalRequest.encode(message.signProposalRequest, writer.uint32(42).fork()).ldelim(); + } + if (message.signedProposalResponse !== undefined) { + SignedProposalResponse.encode(message.signedProposalResponse, writer.uint32(50).fork()).ldelim(); + } + if (message.pingRequest !== undefined) { + PingRequest.encode(message.pingRequest, writer.uint32(58).fork()).ldelim(); + } + if (message.pingResponse !== undefined) { + PingResponse.encode(message.pingResponse, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Message { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKeyRequest = PubKeyRequest.decode(reader, reader.uint32()); + break; + case 2: + message.pubKeyResponse = PubKeyResponse.decode(reader, reader.uint32()); + break; + case 3: + message.signVoteRequest = SignVoteRequest.decode(reader, reader.uint32()); + break; + case 4: + message.signedVoteResponse = SignedVoteResponse.decode(reader, reader.uint32()); + break; + case 5: + message.signProposalRequest = SignProposalRequest.decode(reader, reader.uint32()); + break; + case 6: + message.signedProposalResponse = SignedProposalResponse.decode(reader, reader.uint32()); + break; + case 7: + message.pingRequest = PingRequest.decode(reader, reader.uint32()); + break; + case 8: + message.pingResponse = PingResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Message { + const message = createBaseMessage(); + message.pubKeyRequest = object.pubKeyRequest !== undefined && object.pubKeyRequest !== null ? PubKeyRequest.fromPartial(object.pubKeyRequest) : undefined; + message.pubKeyResponse = object.pubKeyResponse !== undefined && object.pubKeyResponse !== null ? PubKeyResponse.fromPartial(object.pubKeyResponse) : undefined; + message.signVoteRequest = object.signVoteRequest !== undefined && object.signVoteRequest !== null ? SignVoteRequest.fromPartial(object.signVoteRequest) : undefined; + message.signedVoteResponse = object.signedVoteResponse !== undefined && object.signedVoteResponse !== null ? SignedVoteResponse.fromPartial(object.signedVoteResponse) : undefined; + message.signProposalRequest = object.signProposalRequest !== undefined && object.signProposalRequest !== null ? SignProposalRequest.fromPartial(object.signProposalRequest) : undefined; + message.signedProposalResponse = object.signedProposalResponse !== undefined && object.signedProposalResponse !== null ? SignedProposalResponse.fromPartial(object.signedProposalResponse) : undefined; + message.pingRequest = object.pingRequest !== undefined && object.pingRequest !== null ? PingRequest.fromPartial(object.pingRequest) : undefined; + message.pingResponse = object.pingResponse !== undefined && object.pingResponse !== null ? PingResponse.fromPartial(object.pingResponse) : undefined; + return message; + }, + fromAmino(object: MessageAmino): Message { + const message = createBaseMessage(); + if (object.pub_key_request !== undefined && object.pub_key_request !== null) { + message.pubKeyRequest = PubKeyRequest.fromAmino(object.pub_key_request); + } + if (object.pub_key_response !== undefined && object.pub_key_response !== null) { + message.pubKeyResponse = PubKeyResponse.fromAmino(object.pub_key_response); + } + if (object.sign_vote_request !== undefined && object.sign_vote_request !== null) { + message.signVoteRequest = SignVoteRequest.fromAmino(object.sign_vote_request); + } + if (object.signed_vote_response !== undefined && object.signed_vote_response !== null) { + message.signedVoteResponse = SignedVoteResponse.fromAmino(object.signed_vote_response); + } + if (object.sign_proposal_request !== undefined && object.sign_proposal_request !== null) { + message.signProposalRequest = SignProposalRequest.fromAmino(object.sign_proposal_request); + } + if (object.signed_proposal_response !== undefined && object.signed_proposal_response !== null) { + message.signedProposalResponse = SignedProposalResponse.fromAmino(object.signed_proposal_response); + } + if (object.ping_request !== undefined && object.ping_request !== null) { + message.pingRequest = PingRequest.fromAmino(object.ping_request); + } + if (object.ping_response !== undefined && object.ping_response !== null) { + message.pingResponse = PingResponse.fromAmino(object.ping_response); + } + return message; + }, + toAmino(message: Message): MessageAmino { + const obj: any = {}; + obj.pub_key_request = message.pubKeyRequest ? PubKeyRequest.toAmino(message.pubKeyRequest) : undefined; + obj.pub_key_response = message.pubKeyResponse ? PubKeyResponse.toAmino(message.pubKeyResponse) : undefined; + obj.sign_vote_request = message.signVoteRequest ? SignVoteRequest.toAmino(message.signVoteRequest) : undefined; + obj.signed_vote_response = message.signedVoteResponse ? SignedVoteResponse.toAmino(message.signedVoteResponse) : undefined; + obj.sign_proposal_request = message.signProposalRequest ? SignProposalRequest.toAmino(message.signProposalRequest) : undefined; + obj.signed_proposal_response = message.signedProposalResponse ? SignedProposalResponse.toAmino(message.signedProposalResponse) : undefined; + obj.ping_request = message.pingRequest ? PingRequest.toAmino(message.pingRequest) : undefined; + obj.ping_response = message.pingResponse ? PingResponse.toAmino(message.pingResponse) : undefined; + return obj; + }, + fromAminoMsg(object: MessageAminoMsg): Message { + return Message.fromAmino(object.value); + }, + fromProtoMsg(message: MessageProtoMsg): Message { + return Message.decode(message.value); + }, + toProto(message: Message): Uint8Array { + return Message.encode(message).finish(); + }, + toProtoMsg(message: Message): MessageProtoMsg { + return { + typeUrl: "/tendermint.privval.Message", + value: Message.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/rpc/grpc/types.ts b/util/inj-types/tendermint/rpc/grpc/types.ts new file mode 100644 index 00000000..117fa6dd --- /dev/null +++ b/util/inj-types/tendermint/rpc/grpc/types.ts @@ -0,0 +1,300 @@ +import { ResponseCheckTx, ResponseCheckTxAmino, ResponseCheckTxSDKType, ResponseDeliverTx, ResponseDeliverTxAmino, ResponseDeliverTxSDKType } from "../../abci/types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +export interface RequestPing {} +export interface RequestPingProtoMsg { + typeUrl: "/tendermint.rpc.grpc.RequestPing"; + value: Uint8Array; +} +export interface RequestPingAmino {} +export interface RequestPingAminoMsg { + type: "/tendermint.rpc.grpc.RequestPing"; + value: RequestPingAmino; +} +export interface RequestPingSDKType {} +export interface RequestBroadcastTx { + tx: Uint8Array; +} +export interface RequestBroadcastTxProtoMsg { + typeUrl: "/tendermint.rpc.grpc.RequestBroadcastTx"; + value: Uint8Array; +} +export interface RequestBroadcastTxAmino { + tx?: string; +} +export interface RequestBroadcastTxAminoMsg { + type: "/tendermint.rpc.grpc.RequestBroadcastTx"; + value: RequestBroadcastTxAmino; +} +export interface RequestBroadcastTxSDKType { + tx: Uint8Array; +} +export interface ResponsePing {} +export interface ResponsePingProtoMsg { + typeUrl: "/tendermint.rpc.grpc.ResponsePing"; + value: Uint8Array; +} +export interface ResponsePingAmino {} +export interface ResponsePingAminoMsg { + type: "/tendermint.rpc.grpc.ResponsePing"; + value: ResponsePingAmino; +} +export interface ResponsePingSDKType {} +export interface ResponseBroadcastTx { + checkTx?: ResponseCheckTx; + deliverTx?: ResponseDeliverTx; +} +export interface ResponseBroadcastTxProtoMsg { + typeUrl: "/tendermint.rpc.grpc.ResponseBroadcastTx"; + value: Uint8Array; +} +export interface ResponseBroadcastTxAmino { + check_tx?: ResponseCheckTxAmino; + deliver_tx?: ResponseDeliverTxAmino; +} +export interface ResponseBroadcastTxAminoMsg { + type: "/tendermint.rpc.grpc.ResponseBroadcastTx"; + value: ResponseBroadcastTxAmino; +} +export interface ResponseBroadcastTxSDKType { + check_tx?: ResponseCheckTxSDKType; + deliver_tx?: ResponseDeliverTxSDKType; +} +function createBaseRequestPing(): RequestPing { + return {}; +} +export const RequestPing = { + typeUrl: "/tendermint.rpc.grpc.RequestPing", + encode(_: RequestPing, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestPing { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPing(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): RequestPing { + const message = createBaseRequestPing(); + return message; + }, + fromAmino(_: RequestPingAmino): RequestPing { + const message = createBaseRequestPing(); + return message; + }, + toAmino(_: RequestPing): RequestPingAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestPingAminoMsg): RequestPing { + return RequestPing.fromAmino(object.value); + }, + fromProtoMsg(message: RequestPingProtoMsg): RequestPing { + return RequestPing.decode(message.value); + }, + toProto(message: RequestPing): Uint8Array { + return RequestPing.encode(message).finish(); + }, + toProtoMsg(message: RequestPing): RequestPingProtoMsg { + return { + typeUrl: "/tendermint.rpc.grpc.RequestPing", + value: RequestPing.encode(message).finish() + }; + } +}; +function createBaseRequestBroadcastTx(): RequestBroadcastTx { + return { + tx: new Uint8Array() + }; +} +export const RequestBroadcastTx = { + typeUrl: "/tendermint.rpc.grpc.RequestBroadcastTx", + encode(message: RequestBroadcastTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestBroadcastTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestBroadcastTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestBroadcastTx { + const message = createBaseRequestBroadcastTx(); + message.tx = object.tx ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestBroadcastTxAmino): RequestBroadcastTx { + const message = createBaseRequestBroadcastTx(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + return message; + }, + toAmino(message: RequestBroadcastTx): RequestBroadcastTxAmino { + const obj: any = {}; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: RequestBroadcastTxAminoMsg): RequestBroadcastTx { + return RequestBroadcastTx.fromAmino(object.value); + }, + fromProtoMsg(message: RequestBroadcastTxProtoMsg): RequestBroadcastTx { + return RequestBroadcastTx.decode(message.value); + }, + toProto(message: RequestBroadcastTx): Uint8Array { + return RequestBroadcastTx.encode(message).finish(); + }, + toProtoMsg(message: RequestBroadcastTx): RequestBroadcastTxProtoMsg { + return { + typeUrl: "/tendermint.rpc.grpc.RequestBroadcastTx", + value: RequestBroadcastTx.encode(message).finish() + }; + } +}; +function createBaseResponsePing(): ResponsePing { + return {}; +} +export const ResponsePing = { + typeUrl: "/tendermint.rpc.grpc.ResponsePing", + encode(_: ResponsePing, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePing { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePing(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): ResponsePing { + const message = createBaseResponsePing(); + return message; + }, + fromAmino(_: ResponsePingAmino): ResponsePing { + const message = createBaseResponsePing(); + return message; + }, + toAmino(_: ResponsePing): ResponsePingAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ResponsePingAminoMsg): ResponsePing { + return ResponsePing.fromAmino(object.value); + }, + fromProtoMsg(message: ResponsePingProtoMsg): ResponsePing { + return ResponsePing.decode(message.value); + }, + toProto(message: ResponsePing): Uint8Array { + return ResponsePing.encode(message).finish(); + }, + toProtoMsg(message: ResponsePing): ResponsePingProtoMsg { + return { + typeUrl: "/tendermint.rpc.grpc.ResponsePing", + value: ResponsePing.encode(message).finish() + }; + } +}; +function createBaseResponseBroadcastTx(): ResponseBroadcastTx { + return { + checkTx: undefined, + deliverTx: undefined + }; +} +export const ResponseBroadcastTx = { + typeUrl: "/tendermint.rpc.grpc.ResponseBroadcastTx", + encode(message: ResponseBroadcastTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(10).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + ResponseDeliverTx.encode(message.deliverTx, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseBroadcastTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseBroadcastTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + break; + case 2: + message.deliverTx = ResponseDeliverTx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseBroadcastTx { + const message = createBaseResponseBroadcastTx(); + message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? ResponseCheckTx.fromPartial(object.checkTx) : undefined; + message.deliverTx = object.deliverTx !== undefined && object.deliverTx !== null ? ResponseDeliverTx.fromPartial(object.deliverTx) : undefined; + return message; + }, + fromAmino(object: ResponseBroadcastTxAmino): ResponseBroadcastTx { + const message = createBaseResponseBroadcastTx(); + if (object.check_tx !== undefined && object.check_tx !== null) { + message.checkTx = ResponseCheckTx.fromAmino(object.check_tx); + } + if (object.deliver_tx !== undefined && object.deliver_tx !== null) { + message.deliverTx = ResponseDeliverTx.fromAmino(object.deliver_tx); + } + return message; + }, + toAmino(message: ResponseBroadcastTx): ResponseBroadcastTxAmino { + const obj: any = {}; + obj.check_tx = message.checkTx ? ResponseCheckTx.toAmino(message.checkTx) : undefined; + obj.deliver_tx = message.deliverTx ? ResponseDeliverTx.toAmino(message.deliverTx) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseBroadcastTxAminoMsg): ResponseBroadcastTx { + return ResponseBroadcastTx.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseBroadcastTxProtoMsg): ResponseBroadcastTx { + return ResponseBroadcastTx.decode(message.value); + }, + toProto(message: ResponseBroadcastTx): Uint8Array { + return ResponseBroadcastTx.encode(message).finish(); + }, + toProtoMsg(message: ResponseBroadcastTx): ResponseBroadcastTxProtoMsg { + return { + typeUrl: "/tendermint.rpc.grpc.ResponseBroadcastTx", + value: ResponseBroadcastTx.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/state/types.ts b/util/inj-types/tendermint/state/types.ts new file mode 100644 index 00000000..630f86c2 --- /dev/null +++ b/util/inj-types/tendermint/state/types.ts @@ -0,0 +1,828 @@ +import { ResponseDeliverTx, ResponseDeliverTxAmino, ResponseDeliverTxSDKType, ResponseEndBlock, ResponseEndBlockAmino, ResponseEndBlockSDKType, ResponseBeginBlock, ResponseBeginBlockAmino, ResponseBeginBlockSDKType } from "../abci/types"; +import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "../types/validator"; +import { ConsensusParams, ConsensusParamsAmino, ConsensusParamsSDKType } from "../types/params"; +import { Consensus, ConsensusAmino, ConsensusSDKType } from "../version/types"; +import { BlockID, BlockIDAmino, BlockIDSDKType } from "../types/types"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; +/** + * ABCIResponses retains the responses + * of the various ABCI calls during block processing. + * It is persisted to disk for each height before calling Commit. + */ +export interface ABCIResponses { + deliverTxs: ResponseDeliverTx[]; + endBlock?: ResponseEndBlock; + beginBlock?: ResponseBeginBlock; +} +export interface ABCIResponsesProtoMsg { + typeUrl: "/tendermint.state.ABCIResponses"; + value: Uint8Array; +} +/** + * ABCIResponses retains the responses + * of the various ABCI calls during block processing. + * It is persisted to disk for each height before calling Commit. + */ +export interface ABCIResponsesAmino { + deliver_txs?: ResponseDeliverTxAmino[]; + end_block?: ResponseEndBlockAmino; + begin_block?: ResponseBeginBlockAmino; +} +export interface ABCIResponsesAminoMsg { + type: "/tendermint.state.ABCIResponses"; + value: ABCIResponsesAmino; +} +/** + * ABCIResponses retains the responses + * of the various ABCI calls during block processing. + * It is persisted to disk for each height before calling Commit. + */ +export interface ABCIResponsesSDKType { + deliver_txs: ResponseDeliverTxSDKType[]; + end_block?: ResponseEndBlockSDKType; + begin_block?: ResponseBeginBlockSDKType; +} +/** ValidatorsInfo represents the latest validator set, or the last height it changed */ +export interface ValidatorsInfo { + validatorSet?: ValidatorSet; + lastHeightChanged: bigint; +} +export interface ValidatorsInfoProtoMsg { + typeUrl: "/tendermint.state.ValidatorsInfo"; + value: Uint8Array; +} +/** ValidatorsInfo represents the latest validator set, or the last height it changed */ +export interface ValidatorsInfoAmino { + validator_set?: ValidatorSetAmino; + last_height_changed?: string; +} +export interface ValidatorsInfoAminoMsg { + type: "/tendermint.state.ValidatorsInfo"; + value: ValidatorsInfoAmino; +} +/** ValidatorsInfo represents the latest validator set, or the last height it changed */ +export interface ValidatorsInfoSDKType { + validator_set?: ValidatorSetSDKType; + last_height_changed: bigint; +} +/** ConsensusParamsInfo represents the latest consensus params, or the last height it changed */ +export interface ConsensusParamsInfo { + consensusParams: ConsensusParams; + lastHeightChanged: bigint; +} +export interface ConsensusParamsInfoProtoMsg { + typeUrl: "/tendermint.state.ConsensusParamsInfo"; + value: Uint8Array; +} +/** ConsensusParamsInfo represents the latest consensus params, or the last height it changed */ +export interface ConsensusParamsInfoAmino { + consensus_params?: ConsensusParamsAmino; + last_height_changed?: string; +} +export interface ConsensusParamsInfoAminoMsg { + type: "/tendermint.state.ConsensusParamsInfo"; + value: ConsensusParamsInfoAmino; +} +/** ConsensusParamsInfo represents the latest consensus params, or the last height it changed */ +export interface ConsensusParamsInfoSDKType { + consensus_params: ConsensusParamsSDKType; + last_height_changed: bigint; +} +export interface ABCIResponsesInfo { + abciResponses?: ABCIResponses; + height: bigint; +} +export interface ABCIResponsesInfoProtoMsg { + typeUrl: "/tendermint.state.ABCIResponsesInfo"; + value: Uint8Array; +} +export interface ABCIResponsesInfoAmino { + abci_responses?: ABCIResponsesAmino; + height?: string; +} +export interface ABCIResponsesInfoAminoMsg { + type: "/tendermint.state.ABCIResponsesInfo"; + value: ABCIResponsesInfoAmino; +} +export interface ABCIResponsesInfoSDKType { + abci_responses?: ABCIResponsesSDKType; + height: bigint; +} +export interface Version { + consensus: Consensus; + software: string; +} +export interface VersionProtoMsg { + typeUrl: "/tendermint.state.Version"; + value: Uint8Array; +} +export interface VersionAmino { + consensus?: ConsensusAmino; + software?: string; +} +export interface VersionAminoMsg { + type: "/tendermint.state.Version"; + value: VersionAmino; +} +export interface VersionSDKType { + consensus: ConsensusSDKType; + software: string; +} +export interface State { + version: Version; + /** immutable */ + chainId: string; + initialHeight: bigint; + /** LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) */ + lastBlockHeight: bigint; + lastBlockId: BlockID; + lastBlockTime: Date; + /** + * LastValidators is used to validate block.LastCommit. + * Validators are persisted to the database separately every time they change, + * so we can query for historical validator sets. + * Note that if s.LastBlockHeight causes a valset change, + * we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 + * Extra +1 due to nextValSet delay. + */ + nextValidators?: ValidatorSet; + validators?: ValidatorSet; + lastValidators?: ValidatorSet; + lastHeightValidatorsChanged: bigint; + /** + * Consensus parameters used for validating blocks. + * Changes returned by EndBlock and updated after Commit. + */ + consensusParams: ConsensusParams; + lastHeightConsensusParamsChanged: bigint; + /** Merkle root of the results from executing prev block */ + lastResultsHash: Uint8Array; + /** the latest AppHash we've received from calling abci.Commit() */ + appHash: Uint8Array; +} +export interface StateProtoMsg { + typeUrl: "/tendermint.state.State"; + value: Uint8Array; +} +export interface StateAmino { + version?: VersionAmino; + /** immutable */ + chain_id?: string; + initial_height?: string; + /** LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) */ + last_block_height?: string; + last_block_id?: BlockIDAmino; + last_block_time?: string; + /** + * LastValidators is used to validate block.LastCommit. + * Validators are persisted to the database separately every time they change, + * so we can query for historical validator sets. + * Note that if s.LastBlockHeight causes a valset change, + * we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 + * Extra +1 due to nextValSet delay. + */ + next_validators?: ValidatorSetAmino; + validators?: ValidatorSetAmino; + last_validators?: ValidatorSetAmino; + last_height_validators_changed?: string; + /** + * Consensus parameters used for validating blocks. + * Changes returned by EndBlock and updated after Commit. + */ + consensus_params?: ConsensusParamsAmino; + last_height_consensus_params_changed?: string; + /** Merkle root of the results from executing prev block */ + last_results_hash?: string; + /** the latest AppHash we've received from calling abci.Commit() */ + app_hash?: string; +} +export interface StateAminoMsg { + type: "/tendermint.state.State"; + value: StateAmino; +} +export interface StateSDKType { + version: VersionSDKType; + chain_id: string; + initial_height: bigint; + last_block_height: bigint; + last_block_id: BlockIDSDKType; + last_block_time: Date; + next_validators?: ValidatorSetSDKType; + validators?: ValidatorSetSDKType; + last_validators?: ValidatorSetSDKType; + last_height_validators_changed: bigint; + consensus_params: ConsensusParamsSDKType; + last_height_consensus_params_changed: bigint; + last_results_hash: Uint8Array; + app_hash: Uint8Array; +} +function createBaseABCIResponses(): ABCIResponses { + return { + deliverTxs: [], + endBlock: undefined, + beginBlock: undefined + }; +} +export const ABCIResponses = { + typeUrl: "/tendermint.state.ABCIResponses", + encode(message: ABCIResponses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.deliverTxs) { + ResponseDeliverTx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + ResponseEndBlock.encode(message.endBlock, writer.uint32(18).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + ResponseBeginBlock.encode(message.beginBlock, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ABCIResponses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIResponses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deliverTxs.push(ResponseDeliverTx.decode(reader, reader.uint32())); + break; + case 2: + message.endBlock = ResponseEndBlock.decode(reader, reader.uint32()); + break; + case 3: + message.beginBlock = ResponseBeginBlock.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ABCIResponses { + const message = createBaseABCIResponses(); + message.deliverTxs = object.deliverTxs?.map(e => ResponseDeliverTx.fromPartial(e)) || []; + message.endBlock = object.endBlock !== undefined && object.endBlock !== null ? ResponseEndBlock.fromPartial(object.endBlock) : undefined; + message.beginBlock = object.beginBlock !== undefined && object.beginBlock !== null ? ResponseBeginBlock.fromPartial(object.beginBlock) : undefined; + return message; + }, + fromAmino(object: ABCIResponsesAmino): ABCIResponses { + const message = createBaseABCIResponses(); + message.deliverTxs = object.deliver_txs?.map(e => ResponseDeliverTx.fromAmino(e)) || []; + if (object.end_block !== undefined && object.end_block !== null) { + message.endBlock = ResponseEndBlock.fromAmino(object.end_block); + } + if (object.begin_block !== undefined && object.begin_block !== null) { + message.beginBlock = ResponseBeginBlock.fromAmino(object.begin_block); + } + return message; + }, + toAmino(message: ABCIResponses): ABCIResponsesAmino { + const obj: any = {}; + if (message.deliverTxs) { + obj.deliver_txs = message.deliverTxs.map(e => e ? ResponseDeliverTx.toAmino(e) : undefined); + } else { + obj.deliver_txs = message.deliverTxs; + } + obj.end_block = message.endBlock ? ResponseEndBlock.toAmino(message.endBlock) : undefined; + obj.begin_block = message.beginBlock ? ResponseBeginBlock.toAmino(message.beginBlock) : undefined; + return obj; + }, + fromAminoMsg(object: ABCIResponsesAminoMsg): ABCIResponses { + return ABCIResponses.fromAmino(object.value); + }, + fromProtoMsg(message: ABCIResponsesProtoMsg): ABCIResponses { + return ABCIResponses.decode(message.value); + }, + toProto(message: ABCIResponses): Uint8Array { + return ABCIResponses.encode(message).finish(); + }, + toProtoMsg(message: ABCIResponses): ABCIResponsesProtoMsg { + return { + typeUrl: "/tendermint.state.ABCIResponses", + value: ABCIResponses.encode(message).finish() + }; + } +}; +function createBaseValidatorsInfo(): ValidatorsInfo { + return { + validatorSet: undefined, + lastHeightChanged: BigInt(0) + }; +} +export const ValidatorsInfo = { + typeUrl: "/tendermint.state.ValidatorsInfo", + encode(message: ValidatorsInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(10).fork()).ldelim(); + } + if (message.lastHeightChanged !== BigInt(0)) { + writer.uint32(16).int64(message.lastHeightChanged); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorsInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorsInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + break; + case 2: + message.lastHeightChanged = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorsInfo { + const message = createBaseValidatorsInfo(); + message.validatorSet = object.validatorSet !== undefined && object.validatorSet !== null ? ValidatorSet.fromPartial(object.validatorSet) : undefined; + message.lastHeightChanged = object.lastHeightChanged !== undefined && object.lastHeightChanged !== null ? BigInt(object.lastHeightChanged.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorsInfoAmino): ValidatorsInfo { + const message = createBaseValidatorsInfo(); + if (object.validator_set !== undefined && object.validator_set !== null) { + message.validatorSet = ValidatorSet.fromAmino(object.validator_set); + } + if (object.last_height_changed !== undefined && object.last_height_changed !== null) { + message.lastHeightChanged = BigInt(object.last_height_changed); + } + return message; + }, + toAmino(message: ValidatorsInfo): ValidatorsInfoAmino { + const obj: any = {}; + obj.validator_set = message.validatorSet ? ValidatorSet.toAmino(message.validatorSet) : undefined; + obj.last_height_changed = message.lastHeightChanged !== BigInt(0) ? message.lastHeightChanged.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorsInfoAminoMsg): ValidatorsInfo { + return ValidatorsInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorsInfoProtoMsg): ValidatorsInfo { + return ValidatorsInfo.decode(message.value); + }, + toProto(message: ValidatorsInfo): Uint8Array { + return ValidatorsInfo.encode(message).finish(); + }, + toProtoMsg(message: ValidatorsInfo): ValidatorsInfoProtoMsg { + return { + typeUrl: "/tendermint.state.ValidatorsInfo", + value: ValidatorsInfo.encode(message).finish() + }; + } +}; +function createBaseConsensusParamsInfo(): ConsensusParamsInfo { + return { + consensusParams: ConsensusParams.fromPartial({}), + lastHeightChanged: BigInt(0) + }; +} +export const ConsensusParamsInfo = { + typeUrl: "/tendermint.state.ConsensusParamsInfo", + encode(message: ConsensusParamsInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); + } + if (message.lastHeightChanged !== BigInt(0)) { + writer.uint32(16).int64(message.lastHeightChanged); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParamsInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParamsInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + break; + case 2: + message.lastHeightChanged = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusParamsInfo { + const message = createBaseConsensusParamsInfo(); + message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; + message.lastHeightChanged = object.lastHeightChanged !== undefined && object.lastHeightChanged !== null ? BigInt(object.lastHeightChanged.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConsensusParamsInfoAmino): ConsensusParamsInfo { + const message = createBaseConsensusParamsInfo(); + if (object.consensus_params !== undefined && object.consensus_params !== null) { + message.consensusParams = ConsensusParams.fromAmino(object.consensus_params); + } + if (object.last_height_changed !== undefined && object.last_height_changed !== null) { + message.lastHeightChanged = BigInt(object.last_height_changed); + } + return message; + }, + toAmino(message: ConsensusParamsInfo): ConsensusParamsInfoAmino { + const obj: any = {}; + obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; + obj.last_height_changed = message.lastHeightChanged !== BigInt(0) ? message.lastHeightChanged.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusParamsInfoAminoMsg): ConsensusParamsInfo { + return ConsensusParamsInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusParamsInfoProtoMsg): ConsensusParamsInfo { + return ConsensusParamsInfo.decode(message.value); + }, + toProto(message: ConsensusParamsInfo): Uint8Array { + return ConsensusParamsInfo.encode(message).finish(); + }, + toProtoMsg(message: ConsensusParamsInfo): ConsensusParamsInfoProtoMsg { + return { + typeUrl: "/tendermint.state.ConsensusParamsInfo", + value: ConsensusParamsInfo.encode(message).finish() + }; + } +}; +function createBaseABCIResponsesInfo(): ABCIResponsesInfo { + return { + abciResponses: undefined, + height: BigInt(0) + }; +} +export const ABCIResponsesInfo = { + typeUrl: "/tendermint.state.ABCIResponsesInfo", + encode(message: ABCIResponsesInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.abciResponses !== undefined) { + ABCIResponses.encode(message.abciResponses, writer.uint32(10).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ABCIResponsesInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIResponsesInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.abciResponses = ABCIResponses.decode(reader, reader.uint32()); + break; + case 2: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ABCIResponsesInfo { + const message = createBaseABCIResponsesInfo(); + message.abciResponses = object.abciResponses !== undefined && object.abciResponses !== null ? ABCIResponses.fromPartial(object.abciResponses) : undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ABCIResponsesInfoAmino): ABCIResponsesInfo { + const message = createBaseABCIResponsesInfo(); + if (object.abci_responses !== undefined && object.abci_responses !== null) { + message.abciResponses = ABCIResponses.fromAmino(object.abci_responses); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: ABCIResponsesInfo): ABCIResponsesInfoAmino { + const obj: any = {}; + obj.abci_responses = message.abciResponses ? ABCIResponses.toAmino(message.abciResponses) : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ABCIResponsesInfoAminoMsg): ABCIResponsesInfo { + return ABCIResponsesInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ABCIResponsesInfoProtoMsg): ABCIResponsesInfo { + return ABCIResponsesInfo.decode(message.value); + }, + toProto(message: ABCIResponsesInfo): Uint8Array { + return ABCIResponsesInfo.encode(message).finish(); + }, + toProtoMsg(message: ABCIResponsesInfo): ABCIResponsesInfoProtoMsg { + return { + typeUrl: "/tendermint.state.ABCIResponsesInfo", + value: ABCIResponsesInfo.encode(message).finish() + }; + } +}; +function createBaseVersion(): Version { + return { + consensus: Consensus.fromPartial({}), + software: "" + }; +} +export const Version = { + typeUrl: "/tendermint.state.Version", + encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.consensus !== undefined) { + Consensus.encode(message.consensus, writer.uint32(10).fork()).ldelim(); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Version { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensus = Consensus.decode(reader, reader.uint32()); + break; + case 2: + message.software = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Version { + const message = createBaseVersion(); + message.consensus = object.consensus !== undefined && object.consensus !== null ? Consensus.fromPartial(object.consensus) : undefined; + message.software = object.software ?? ""; + return message; + }, + fromAmino(object: VersionAmino): Version { + const message = createBaseVersion(); + if (object.consensus !== undefined && object.consensus !== null) { + message.consensus = Consensus.fromAmino(object.consensus); + } + if (object.software !== undefined && object.software !== null) { + message.software = object.software; + } + return message; + }, + toAmino(message: Version): VersionAmino { + const obj: any = {}; + obj.consensus = message.consensus ? Consensus.toAmino(message.consensus) : undefined; + obj.software = message.software === "" ? undefined : message.software; + return obj; + }, + fromAminoMsg(object: VersionAminoMsg): Version { + return Version.fromAmino(object.value); + }, + fromProtoMsg(message: VersionProtoMsg): Version { + return Version.decode(message.value); + }, + toProto(message: Version): Uint8Array { + return Version.encode(message).finish(); + }, + toProtoMsg(message: Version): VersionProtoMsg { + return { + typeUrl: "/tendermint.state.Version", + value: Version.encode(message).finish() + }; + } +}; +function createBaseState(): State { + return { + version: Version.fromPartial({}), + chainId: "", + initialHeight: BigInt(0), + lastBlockHeight: BigInt(0), + lastBlockId: BlockID.fromPartial({}), + lastBlockTime: new Date(), + nextValidators: undefined, + validators: undefined, + lastValidators: undefined, + lastHeightValidatorsChanged: BigInt(0), + consensusParams: ConsensusParams.fromPartial({}), + lastHeightConsensusParamsChanged: BigInt(0), + lastResultsHash: new Uint8Array(), + appHash: new Uint8Array() + }; +} +export const State = { + typeUrl: "/tendermint.state.State", + encode(message: State, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== undefined) { + Version.encode(message.version, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.initialHeight !== BigInt(0)) { + writer.uint32(112).int64(message.initialHeight); + } + if (message.lastBlockHeight !== BigInt(0)) { + writer.uint32(24).int64(message.lastBlockHeight); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(34).fork()).ldelim(); + } + if (message.lastBlockTime !== undefined) { + Timestamp.encode(toTimestamp(message.lastBlockTime), writer.uint32(42).fork()).ldelim(); + } + if (message.nextValidators !== undefined) { + ValidatorSet.encode(message.nextValidators, writer.uint32(50).fork()).ldelim(); + } + if (message.validators !== undefined) { + ValidatorSet.encode(message.validators, writer.uint32(58).fork()).ldelim(); + } + if (message.lastValidators !== undefined) { + ValidatorSet.encode(message.lastValidators, writer.uint32(66).fork()).ldelim(); + } + if (message.lastHeightValidatorsChanged !== BigInt(0)) { + writer.uint32(72).int64(message.lastHeightValidatorsChanged); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(82).fork()).ldelim(); + } + if (message.lastHeightConsensusParamsChanged !== BigInt(0)) { + writer.uint32(88).int64(message.lastHeightConsensusParamsChanged); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.appHash.length !== 0) { + writer.uint32(106).bytes(message.appHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): State { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = Version.decode(reader, reader.uint32()); + break; + case 2: + message.chainId = reader.string(); + break; + case 14: + message.initialHeight = reader.int64(); + break; + case 3: + message.lastBlockHeight = reader.int64(); + break; + case 4: + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + break; + case 5: + message.lastBlockTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.nextValidators = ValidatorSet.decode(reader, reader.uint32()); + break; + case 7: + message.validators = ValidatorSet.decode(reader, reader.uint32()); + break; + case 8: + message.lastValidators = ValidatorSet.decode(reader, reader.uint32()); + break; + case 9: + message.lastHeightValidatorsChanged = reader.int64(); + break; + case 10: + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + break; + case 11: + message.lastHeightConsensusParamsChanged = reader.int64(); + break; + case 12: + message.lastResultsHash = reader.bytes(); + break; + case 13: + message.appHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): State { + const message = createBaseState(); + message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; + message.chainId = object.chainId ?? ""; + message.initialHeight = object.initialHeight !== undefined && object.initialHeight !== null ? BigInt(object.initialHeight.toString()) : BigInt(0); + message.lastBlockHeight = object.lastBlockHeight !== undefined && object.lastBlockHeight !== null ? BigInt(object.lastBlockHeight.toString()) : BigInt(0); + message.lastBlockId = object.lastBlockId !== undefined && object.lastBlockId !== null ? BlockID.fromPartial(object.lastBlockId) : undefined; + message.lastBlockTime = object.lastBlockTime ?? undefined; + message.nextValidators = object.nextValidators !== undefined && object.nextValidators !== null ? ValidatorSet.fromPartial(object.nextValidators) : undefined; + message.validators = object.validators !== undefined && object.validators !== null ? ValidatorSet.fromPartial(object.validators) : undefined; + message.lastValidators = object.lastValidators !== undefined && object.lastValidators !== null ? ValidatorSet.fromPartial(object.lastValidators) : undefined; + message.lastHeightValidatorsChanged = object.lastHeightValidatorsChanged !== undefined && object.lastHeightValidatorsChanged !== null ? BigInt(object.lastHeightValidatorsChanged.toString()) : BigInt(0); + message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; + message.lastHeightConsensusParamsChanged = object.lastHeightConsensusParamsChanged !== undefined && object.lastHeightConsensusParamsChanged !== null ? BigInt(object.lastHeightConsensusParamsChanged.toString()) : BigInt(0); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(); + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: StateAmino): State { + const message = createBaseState(); + if (object.version !== undefined && object.version !== null) { + message.version = Version.fromAmino(object.version); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.initial_height !== undefined && object.initial_height !== null) { + message.initialHeight = BigInt(object.initial_height); + } + if (object.last_block_height !== undefined && object.last_block_height !== null) { + message.lastBlockHeight = BigInt(object.last_block_height); + } + if (object.last_block_id !== undefined && object.last_block_id !== null) { + message.lastBlockId = BlockID.fromAmino(object.last_block_id); + } + if (object.last_block_time !== undefined && object.last_block_time !== null) { + message.lastBlockTime = fromTimestamp(Timestamp.fromAmino(object.last_block_time)); + } + if (object.next_validators !== undefined && object.next_validators !== null) { + message.nextValidators = ValidatorSet.fromAmino(object.next_validators); + } + if (object.validators !== undefined && object.validators !== null) { + message.validators = ValidatorSet.fromAmino(object.validators); + } + if (object.last_validators !== undefined && object.last_validators !== null) { + message.lastValidators = ValidatorSet.fromAmino(object.last_validators); + } + if (object.last_height_validators_changed !== undefined && object.last_height_validators_changed !== null) { + message.lastHeightValidatorsChanged = BigInt(object.last_height_validators_changed); + } + if (object.consensus_params !== undefined && object.consensus_params !== null) { + message.consensusParams = ConsensusParams.fromAmino(object.consensus_params); + } + if (object.last_height_consensus_params_changed !== undefined && object.last_height_consensus_params_changed !== null) { + message.lastHeightConsensusParamsChanged = BigInt(object.last_height_consensus_params_changed); + } + if (object.last_results_hash !== undefined && object.last_results_hash !== null) { + message.lastResultsHash = bytesFromBase64(object.last_results_hash); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + return message; + }, + toAmino(message: State): StateAmino { + const obj: any = {}; + obj.version = message.version ? Version.toAmino(message.version) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight.toString() : undefined; + obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; + obj.last_block_time = message.lastBlockTime ? Timestamp.toAmino(toTimestamp(message.lastBlockTime)) : undefined; + obj.next_validators = message.nextValidators ? ValidatorSet.toAmino(message.nextValidators) : undefined; + obj.validators = message.validators ? ValidatorSet.toAmino(message.validators) : undefined; + obj.last_validators = message.lastValidators ? ValidatorSet.toAmino(message.lastValidators) : undefined; + obj.last_height_validators_changed = message.lastHeightValidatorsChanged !== BigInt(0) ? message.lastHeightValidatorsChanged.toString() : undefined; + obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; + obj.last_height_consensus_params_changed = message.lastHeightConsensusParamsChanged !== BigInt(0) ? message.lastHeightConsensusParamsChanged.toString() : undefined; + obj.last_results_hash = message.lastResultsHash ? base64FromBytes(message.lastResultsHash) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + return obj; + }, + fromAminoMsg(object: StateAminoMsg): State { + return State.fromAmino(object.value); + }, + fromProtoMsg(message: StateProtoMsg): State { + return State.decode(message.value); + }, + toProto(message: State): Uint8Array { + return State.encode(message).finish(); + }, + toProtoMsg(message: State): StateProtoMsg { + return { + typeUrl: "/tendermint.state.State", + value: State.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/statesync/types.ts b/util/inj-types/tendermint/statesync/types.ts new file mode 100644 index 00000000..3e8ae9b5 --- /dev/null +++ b/util/inj-types/tendermint/statesync/types.ts @@ -0,0 +1,578 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +export interface Message { + snapshotsRequest?: SnapshotsRequest; + snapshotsResponse?: SnapshotsResponse; + chunkRequest?: ChunkRequest; + chunkResponse?: ChunkResponse; +} +export interface MessageProtoMsg { + typeUrl: "/tendermint.statesync.Message"; + value: Uint8Array; +} +export interface MessageAmino { + snapshots_request?: SnapshotsRequestAmino; + snapshots_response?: SnapshotsResponseAmino; + chunk_request?: ChunkRequestAmino; + chunk_response?: ChunkResponseAmino; +} +export interface MessageAminoMsg { + type: "/tendermint.statesync.Message"; + value: MessageAmino; +} +export interface MessageSDKType { + snapshots_request?: SnapshotsRequestSDKType; + snapshots_response?: SnapshotsResponseSDKType; + chunk_request?: ChunkRequestSDKType; + chunk_response?: ChunkResponseSDKType; +} +export interface SnapshotsRequest {} +export interface SnapshotsRequestProtoMsg { + typeUrl: "/tendermint.statesync.SnapshotsRequest"; + value: Uint8Array; +} +export interface SnapshotsRequestAmino {} +export interface SnapshotsRequestAminoMsg { + type: "/tendermint.statesync.SnapshotsRequest"; + value: SnapshotsRequestAmino; +} +export interface SnapshotsRequestSDKType {} +export interface SnapshotsResponse { + height: bigint; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Uint8Array; +} +export interface SnapshotsResponseProtoMsg { + typeUrl: "/tendermint.statesync.SnapshotsResponse"; + value: Uint8Array; +} +export interface SnapshotsResponseAmino { + height?: string; + format?: number; + chunks?: number; + hash?: string; + metadata?: string; +} +export interface SnapshotsResponseAminoMsg { + type: "/tendermint.statesync.SnapshotsResponse"; + value: SnapshotsResponseAmino; +} +export interface SnapshotsResponseSDKType { + height: bigint; + format: number; + chunks: number; + hash: Uint8Array; + metadata: Uint8Array; +} +export interface ChunkRequest { + height: bigint; + format: number; + index: number; +} +export interface ChunkRequestProtoMsg { + typeUrl: "/tendermint.statesync.ChunkRequest"; + value: Uint8Array; +} +export interface ChunkRequestAmino { + height?: string; + format?: number; + index?: number; +} +export interface ChunkRequestAminoMsg { + type: "/tendermint.statesync.ChunkRequest"; + value: ChunkRequestAmino; +} +export interface ChunkRequestSDKType { + height: bigint; + format: number; + index: number; +} +export interface ChunkResponse { + height: bigint; + format: number; + index: number; + chunk: Uint8Array; + missing: boolean; +} +export interface ChunkResponseProtoMsg { + typeUrl: "/tendermint.statesync.ChunkResponse"; + value: Uint8Array; +} +export interface ChunkResponseAmino { + height?: string; + format?: number; + index?: number; + chunk?: string; + missing?: boolean; +} +export interface ChunkResponseAminoMsg { + type: "/tendermint.statesync.ChunkResponse"; + value: ChunkResponseAmino; +} +export interface ChunkResponseSDKType { + height: bigint; + format: number; + index: number; + chunk: Uint8Array; + missing: boolean; +} +function createBaseMessage(): Message { + return { + snapshotsRequest: undefined, + snapshotsResponse: undefined, + chunkRequest: undefined, + chunkResponse: undefined + }; +} +export const Message = { + typeUrl: "/tendermint.statesync.Message", + encode(message: Message, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.snapshotsRequest !== undefined) { + SnapshotsRequest.encode(message.snapshotsRequest, writer.uint32(10).fork()).ldelim(); + } + if (message.snapshotsResponse !== undefined) { + SnapshotsResponse.encode(message.snapshotsResponse, writer.uint32(18).fork()).ldelim(); + } + if (message.chunkRequest !== undefined) { + ChunkRequest.encode(message.chunkRequest, writer.uint32(26).fork()).ldelim(); + } + if (message.chunkResponse !== undefined) { + ChunkResponse.encode(message.chunkResponse, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Message { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.snapshotsRequest = SnapshotsRequest.decode(reader, reader.uint32()); + break; + case 2: + message.snapshotsResponse = SnapshotsResponse.decode(reader, reader.uint32()); + break; + case 3: + message.chunkRequest = ChunkRequest.decode(reader, reader.uint32()); + break; + case 4: + message.chunkResponse = ChunkResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Message { + const message = createBaseMessage(); + message.snapshotsRequest = object.snapshotsRequest !== undefined && object.snapshotsRequest !== null ? SnapshotsRequest.fromPartial(object.snapshotsRequest) : undefined; + message.snapshotsResponse = object.snapshotsResponse !== undefined && object.snapshotsResponse !== null ? SnapshotsResponse.fromPartial(object.snapshotsResponse) : undefined; + message.chunkRequest = object.chunkRequest !== undefined && object.chunkRequest !== null ? ChunkRequest.fromPartial(object.chunkRequest) : undefined; + message.chunkResponse = object.chunkResponse !== undefined && object.chunkResponse !== null ? ChunkResponse.fromPartial(object.chunkResponse) : undefined; + return message; + }, + fromAmino(object: MessageAmino): Message { + const message = createBaseMessage(); + if (object.snapshots_request !== undefined && object.snapshots_request !== null) { + message.snapshotsRequest = SnapshotsRequest.fromAmino(object.snapshots_request); + } + if (object.snapshots_response !== undefined && object.snapshots_response !== null) { + message.snapshotsResponse = SnapshotsResponse.fromAmino(object.snapshots_response); + } + if (object.chunk_request !== undefined && object.chunk_request !== null) { + message.chunkRequest = ChunkRequest.fromAmino(object.chunk_request); + } + if (object.chunk_response !== undefined && object.chunk_response !== null) { + message.chunkResponse = ChunkResponse.fromAmino(object.chunk_response); + } + return message; + }, + toAmino(message: Message): MessageAmino { + const obj: any = {}; + obj.snapshots_request = message.snapshotsRequest ? SnapshotsRequest.toAmino(message.snapshotsRequest) : undefined; + obj.snapshots_response = message.snapshotsResponse ? SnapshotsResponse.toAmino(message.snapshotsResponse) : undefined; + obj.chunk_request = message.chunkRequest ? ChunkRequest.toAmino(message.chunkRequest) : undefined; + obj.chunk_response = message.chunkResponse ? ChunkResponse.toAmino(message.chunkResponse) : undefined; + return obj; + }, + fromAminoMsg(object: MessageAminoMsg): Message { + return Message.fromAmino(object.value); + }, + fromProtoMsg(message: MessageProtoMsg): Message { + return Message.decode(message.value); + }, + toProto(message: Message): Uint8Array { + return Message.encode(message).finish(); + }, + toProtoMsg(message: Message): MessageProtoMsg { + return { + typeUrl: "/tendermint.statesync.Message", + value: Message.encode(message).finish() + }; + } +}; +function createBaseSnapshotsRequest(): SnapshotsRequest { + return {}; +} +export const SnapshotsRequest = { + typeUrl: "/tendermint.statesync.SnapshotsRequest", + encode(_: SnapshotsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): SnapshotsRequest { + const message = createBaseSnapshotsRequest(); + return message; + }, + fromAmino(_: SnapshotsRequestAmino): SnapshotsRequest { + const message = createBaseSnapshotsRequest(); + return message; + }, + toAmino(_: SnapshotsRequest): SnapshotsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: SnapshotsRequestAminoMsg): SnapshotsRequest { + return SnapshotsRequest.fromAmino(object.value); + }, + fromProtoMsg(message: SnapshotsRequestProtoMsg): SnapshotsRequest { + return SnapshotsRequest.decode(message.value); + }, + toProto(message: SnapshotsRequest): Uint8Array { + return SnapshotsRequest.encode(message).finish(); + }, + toProtoMsg(message: SnapshotsRequest): SnapshotsRequestProtoMsg { + return { + typeUrl: "/tendermint.statesync.SnapshotsRequest", + value: SnapshotsRequest.encode(message).finish() + }; + } +}; +function createBaseSnapshotsResponse(): SnapshotsResponse { + return { + height: BigInt(0), + format: 0, + chunks: 0, + hash: new Uint8Array(), + metadata: new Uint8Array() + }; +} +export const SnapshotsResponse = { + typeUrl: "/tendermint.statesync.SnapshotsResponse", + encode(message: SnapshotsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata.length !== 0) { + writer.uint32(42).bytes(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunks = reader.uint32(); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.metadata = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SnapshotsResponse { + const message = createBaseSnapshotsResponse(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = object.metadata ?? new Uint8Array(); + return message; + }, + fromAmino(object: SnapshotsResponseAmino): SnapshotsResponse { + const message = createBaseSnapshotsResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunks !== undefined && object.chunks !== null) { + message.chunks = object.chunks; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = bytesFromBase64(object.metadata); + } + return message; + }, + toAmino(message: SnapshotsResponse): SnapshotsResponseAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotsResponseAminoMsg): SnapshotsResponse { + return SnapshotsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: SnapshotsResponseProtoMsg): SnapshotsResponse { + return SnapshotsResponse.decode(message.value); + }, + toProto(message: SnapshotsResponse): Uint8Array { + return SnapshotsResponse.encode(message).finish(); + }, + toProtoMsg(message: SnapshotsResponse): SnapshotsResponseProtoMsg { + return { + typeUrl: "/tendermint.statesync.SnapshotsResponse", + value: SnapshotsResponse.encode(message).finish() + }; + } +}; +function createBaseChunkRequest(): ChunkRequest { + return { + height: BigInt(0), + format: 0, + index: 0 + }; +} +export const ChunkRequest = { + typeUrl: "/tendermint.statesync.ChunkRequest", + encode(message: ChunkRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.index !== 0) { + writer.uint32(24).uint32(message.index); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ChunkRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChunkRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.index = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ChunkRequest { + const message = createBaseChunkRequest(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.format = object.format ?? 0; + message.index = object.index ?? 0; + return message; + }, + fromAmino(object: ChunkRequestAmino): ChunkRequest { + const message = createBaseChunkRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + return message; + }, + toAmino(message: ChunkRequest): ChunkRequestAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.format = message.format === 0 ? undefined : message.format; + obj.index = message.index === 0 ? undefined : message.index; + return obj; + }, + fromAminoMsg(object: ChunkRequestAminoMsg): ChunkRequest { + return ChunkRequest.fromAmino(object.value); + }, + fromProtoMsg(message: ChunkRequestProtoMsg): ChunkRequest { + return ChunkRequest.decode(message.value); + }, + toProto(message: ChunkRequest): Uint8Array { + return ChunkRequest.encode(message).finish(); + }, + toProtoMsg(message: ChunkRequest): ChunkRequestProtoMsg { + return { + typeUrl: "/tendermint.statesync.ChunkRequest", + value: ChunkRequest.encode(message).finish() + }; + } +}; +function createBaseChunkResponse(): ChunkResponse { + return { + height: BigInt(0), + format: 0, + index: 0, + chunk: new Uint8Array(), + missing: false + }; +} +export const ChunkResponse = { + typeUrl: "/tendermint.statesync.ChunkResponse", + encode(message: ChunkResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.index !== 0) { + writer.uint32(24).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(34).bytes(message.chunk); + } + if (message.missing === true) { + writer.uint32(40).bool(message.missing); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ChunkResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChunkResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.index = reader.uint32(); + break; + case 4: + message.chunk = reader.bytes(); + break; + case 5: + message.missing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ChunkResponse { + const message = createBaseChunkResponse(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.format = object.format ?? 0; + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(); + message.missing = object.missing ?? false; + return message; + }, + fromAmino(object: ChunkResponseAmino): ChunkResponse { + const message = createBaseChunkResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = bytesFromBase64(object.chunk); + } + if (object.missing !== undefined && object.missing !== null) { + message.missing = object.missing; + } + return message; + }, + toAmino(message: ChunkResponse): ChunkResponseAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.format = message.format === 0 ? undefined : message.format; + obj.index = message.index === 0 ? undefined : message.index; + obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; + obj.missing = message.missing === false ? undefined : message.missing; + return obj; + }, + fromAminoMsg(object: ChunkResponseAminoMsg): ChunkResponse { + return ChunkResponse.fromAmino(object.value); + }, + fromProtoMsg(message: ChunkResponseProtoMsg): ChunkResponse { + return ChunkResponse.decode(message.value); + }, + toProto(message: ChunkResponse): Uint8Array { + return ChunkResponse.encode(message).finish(); + }, + toProtoMsg(message: ChunkResponse): ChunkResponseProtoMsg { + return { + typeUrl: "/tendermint.statesync.ChunkResponse", + value: ChunkResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/store/types.ts b/util/inj-types/tendermint/store/types.ts new file mode 100644 index 00000000..27a132c4 --- /dev/null +++ b/util/inj-types/tendermint/store/types.ts @@ -0,0 +1,97 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +export interface BlockStoreState { + base: bigint; + height: bigint; +} +export interface BlockStoreStateProtoMsg { + typeUrl: "/tendermint.store.BlockStoreState"; + value: Uint8Array; +} +export interface BlockStoreStateAmino { + base?: string; + height?: string; +} +export interface BlockStoreStateAminoMsg { + type: "/tendermint.store.BlockStoreState"; + value: BlockStoreStateAmino; +} +export interface BlockStoreStateSDKType { + base: bigint; + height: bigint; +} +function createBaseBlockStoreState(): BlockStoreState { + return { + base: BigInt(0), + height: BigInt(0) + }; +} +export const BlockStoreState = { + typeUrl: "/tendermint.store.BlockStoreState", + encode(message: BlockStoreState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.base !== BigInt(0)) { + writer.uint32(8).int64(message.base); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockStoreState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockStoreState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.base = reader.int64(); + break; + case 2: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockStoreState { + const message = createBaseBlockStoreState(); + message.base = object.base !== undefined && object.base !== null ? BigInt(object.base.toString()) : BigInt(0); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BlockStoreStateAmino): BlockStoreState { + const message = createBaseBlockStoreState(); + if (object.base !== undefined && object.base !== null) { + message.base = BigInt(object.base); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: BlockStoreState): BlockStoreStateAmino { + const obj: any = {}; + obj.base = message.base !== BigInt(0) ? message.base.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockStoreStateAminoMsg): BlockStoreState { + return BlockStoreState.fromAmino(object.value); + }, + fromProtoMsg(message: BlockStoreStateProtoMsg): BlockStoreState { + return BlockStoreState.decode(message.value); + }, + toProto(message: BlockStoreState): Uint8Array { + return BlockStoreState.encode(message).finish(); + }, + toProtoMsg(message: BlockStoreState): BlockStoreStateProtoMsg { + return { + typeUrl: "/tendermint.store.BlockStoreState", + value: BlockStoreState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/types/block.ts b/util/inj-types/tendermint/types/block.ts new file mode 100644 index 00000000..e9a669fc --- /dev/null +++ b/util/inj-types/tendermint/types/block.ts @@ -0,0 +1,129 @@ +import { Header, HeaderAmino, HeaderSDKType, Data, DataAmino, DataSDKType, Commit, CommitAmino, CommitSDKType } from "./types"; +import { EvidenceList, EvidenceListAmino, EvidenceListSDKType } from "./evidence"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +export interface Block { + header: Header; + data: Data; + evidence: EvidenceList; + lastCommit?: Commit; +} +export interface BlockProtoMsg { + typeUrl: "/tendermint.types.Block"; + value: Uint8Array; +} +export interface BlockAmino { + header?: HeaderAmino; + data?: DataAmino; + evidence?: EvidenceListAmino; + last_commit?: CommitAmino; +} +export interface BlockAminoMsg { + type: "/tendermint.types.Block"; + value: BlockAmino; +} +export interface BlockSDKType { + header: HeaderSDKType; + data: DataSDKType; + evidence: EvidenceListSDKType; + last_commit?: CommitSDKType; +} +function createBaseBlock(): Block { + return { + header: Header.fromPartial({}), + data: Data.fromPartial({}), + evidence: EvidenceList.fromPartial({}), + lastCommit: undefined + }; +} +export const Block = { + typeUrl: "/tendermint.types.Block", + encode(message: Block, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).ldelim(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = Header.decode(reader, reader.uint32()); + break; + case 2: + message.data = Data.decode(reader, reader.uint32()); + break; + case 3: + message.evidence = EvidenceList.decode(reader, reader.uint32()); + break; + case 4: + message.lastCommit = Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Block { + const message = createBaseBlock(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.data = object.data !== undefined && object.data !== null ? Data.fromPartial(object.data) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceList.fromPartial(object.evidence) : undefined; + message.lastCommit = object.lastCommit !== undefined && object.lastCommit !== null ? Commit.fromPartial(object.lastCommit) : undefined; + return message; + }, + fromAmino(object: BlockAmino): Block { + const message = createBaseBlock(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.data !== undefined && object.data !== null) { + message.data = Data.fromAmino(object.data); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceList.fromAmino(object.evidence); + } + if (object.last_commit !== undefined && object.last_commit !== null) { + message.lastCommit = Commit.fromAmino(object.last_commit); + } + return message; + }, + toAmino(message: Block): BlockAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.data = message.data ? Data.toAmino(message.data) : undefined; + obj.evidence = message.evidence ? EvidenceList.toAmino(message.evidence) : undefined; + obj.last_commit = message.lastCommit ? Commit.toAmino(message.lastCommit) : undefined; + return obj; + }, + fromAminoMsg(object: BlockAminoMsg): Block { + return Block.fromAmino(object.value); + }, + fromProtoMsg(message: BlockProtoMsg): Block { + return Block.decode(message.value); + }, + toProto(message: Block): Uint8Array { + return Block.encode(message).finish(); + }, + toProtoMsg(message: Block): BlockProtoMsg { + return { + typeUrl: "/tendermint.types.Block", + value: Block.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/types/canonical.ts b/util/inj-types/tendermint/types/canonical.ts new file mode 100644 index 00000000..a57edf4a --- /dev/null +++ b/util/inj-types/tendermint/types/canonical.ts @@ -0,0 +1,531 @@ +import { SignedMsgType } from "./types"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +export interface CanonicalBlockID { + hash: Uint8Array; + partSetHeader: CanonicalPartSetHeader; +} +export interface CanonicalBlockIDProtoMsg { + typeUrl: "/tendermint.types.CanonicalBlockID"; + value: Uint8Array; +} +export interface CanonicalBlockIDAmino { + hash?: string; + part_set_header?: CanonicalPartSetHeaderAmino; +} +export interface CanonicalBlockIDAminoMsg { + type: "/tendermint.types.CanonicalBlockID"; + value: CanonicalBlockIDAmino; +} +export interface CanonicalBlockIDSDKType { + hash: Uint8Array; + part_set_header: CanonicalPartSetHeaderSDKType; +} +export interface CanonicalPartSetHeader { + total: number; + hash: Uint8Array; +} +export interface CanonicalPartSetHeaderProtoMsg { + typeUrl: "/tendermint.types.CanonicalPartSetHeader"; + value: Uint8Array; +} +export interface CanonicalPartSetHeaderAmino { + total?: number; + hash?: string; +} +export interface CanonicalPartSetHeaderAminoMsg { + type: "/tendermint.types.CanonicalPartSetHeader"; + value: CanonicalPartSetHeaderAmino; +} +export interface CanonicalPartSetHeaderSDKType { + total: number; + hash: Uint8Array; +} +export interface CanonicalProposal { + /** type alias for byte */ + type: SignedMsgType; + /** canonicalization requires fixed size encoding here */ + height: bigint; + /** canonicalization requires fixed size encoding here */ + round: bigint; + polRound: bigint; + blockId?: CanonicalBlockID; + timestamp: Date; + chainId: string; +} +export interface CanonicalProposalProtoMsg { + typeUrl: "/tendermint.types.CanonicalProposal"; + value: Uint8Array; +} +export interface CanonicalProposalAmino { + /** type alias for byte */ + type?: SignedMsgType; + /** canonicalization requires fixed size encoding here */ + height?: string; + /** canonicalization requires fixed size encoding here */ + round?: string; + pol_round?: string; + block_id?: CanonicalBlockIDAmino; + timestamp?: string; + chain_id?: string; +} +export interface CanonicalProposalAminoMsg { + type: "/tendermint.types.CanonicalProposal"; + value: CanonicalProposalAmino; +} +export interface CanonicalProposalSDKType { + type: SignedMsgType; + height: bigint; + round: bigint; + pol_round: bigint; + block_id?: CanonicalBlockIDSDKType; + timestamp: Date; + chain_id: string; +} +export interface CanonicalVote { + /** type alias for byte */ + type: SignedMsgType; + /** canonicalization requires fixed size encoding here */ + height: bigint; + /** canonicalization requires fixed size encoding here */ + round: bigint; + blockId?: CanonicalBlockID; + timestamp: Date; + chainId: string; +} +export interface CanonicalVoteProtoMsg { + typeUrl: "/tendermint.types.CanonicalVote"; + value: Uint8Array; +} +export interface CanonicalVoteAmino { + /** type alias for byte */ + type?: SignedMsgType; + /** canonicalization requires fixed size encoding here */ + height?: string; + /** canonicalization requires fixed size encoding here */ + round?: string; + block_id?: CanonicalBlockIDAmino; + timestamp?: string; + chain_id?: string; +} +export interface CanonicalVoteAminoMsg { + type: "/tendermint.types.CanonicalVote"; + value: CanonicalVoteAmino; +} +export interface CanonicalVoteSDKType { + type: SignedMsgType; + height: bigint; + round: bigint; + block_id?: CanonicalBlockIDSDKType; + timestamp: Date; + chain_id: string; +} +function createBaseCanonicalBlockID(): CanonicalBlockID { + return { + hash: new Uint8Array(), + partSetHeader: CanonicalPartSetHeader.fromPartial({}) + }; +} +export const CanonicalBlockID = { + typeUrl: "/tendermint.types.CanonicalBlockID", + encode(message: CanonicalBlockID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + CanonicalPartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CanonicalBlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCanonicalBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.partSetHeader = CanonicalPartSetHeader.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CanonicalBlockID { + const message = createBaseCanonicalBlockID(); + message.hash = object.hash ?? new Uint8Array(); + message.partSetHeader = object.partSetHeader !== undefined && object.partSetHeader !== null ? CanonicalPartSetHeader.fromPartial(object.partSetHeader) : undefined; + return message; + }, + fromAmino(object: CanonicalBlockIDAmino): CanonicalBlockID { + const message = createBaseCanonicalBlockID(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.part_set_header !== undefined && object.part_set_header !== null) { + message.partSetHeader = CanonicalPartSetHeader.fromAmino(object.part_set_header); + } + return message; + }, + toAmino(message: CanonicalBlockID): CanonicalBlockIDAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.part_set_header = message.partSetHeader ? CanonicalPartSetHeader.toAmino(message.partSetHeader) : undefined; + return obj; + }, + fromAminoMsg(object: CanonicalBlockIDAminoMsg): CanonicalBlockID { + return CanonicalBlockID.fromAmino(object.value); + }, + fromProtoMsg(message: CanonicalBlockIDProtoMsg): CanonicalBlockID { + return CanonicalBlockID.decode(message.value); + }, + toProto(message: CanonicalBlockID): Uint8Array { + return CanonicalBlockID.encode(message).finish(); + }, + toProtoMsg(message: CanonicalBlockID): CanonicalBlockIDProtoMsg { + return { + typeUrl: "/tendermint.types.CanonicalBlockID", + value: CanonicalBlockID.encode(message).finish() + }; + } +}; +function createBaseCanonicalPartSetHeader(): CanonicalPartSetHeader { + return { + total: 0, + hash: new Uint8Array() + }; +} +export const CanonicalPartSetHeader = { + typeUrl: "/tendermint.types.CanonicalPartSetHeader", + encode(message: CanonicalPartSetHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CanonicalPartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCanonicalPartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total = reader.uint32(); + break; + case 2: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CanonicalPartSetHeader { + const message = createBaseCanonicalPartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, + fromAmino(object: CanonicalPartSetHeaderAmino): CanonicalPartSetHeader { + const message = createBaseCanonicalPartSetHeader(); + if (object.total !== undefined && object.total !== null) { + message.total = object.total; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: CanonicalPartSetHeader): CanonicalPartSetHeaderAmino { + const obj: any = {}; + obj.total = message.total === 0 ? undefined : message.total; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: CanonicalPartSetHeaderAminoMsg): CanonicalPartSetHeader { + return CanonicalPartSetHeader.fromAmino(object.value); + }, + fromProtoMsg(message: CanonicalPartSetHeaderProtoMsg): CanonicalPartSetHeader { + return CanonicalPartSetHeader.decode(message.value); + }, + toProto(message: CanonicalPartSetHeader): Uint8Array { + return CanonicalPartSetHeader.encode(message).finish(); + }, + toProtoMsg(message: CanonicalPartSetHeader): CanonicalPartSetHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.CanonicalPartSetHeader", + value: CanonicalPartSetHeader.encode(message).finish() + }; + } +}; +function createBaseCanonicalProposal(): CanonicalProposal { + return { + type: 0, + height: BigInt(0), + round: BigInt(0), + polRound: BigInt(0), + blockId: undefined, + timestamp: new Date(), + chainId: "" + }; +} +export const CanonicalProposal = { + typeUrl: "/tendermint.types.CanonicalProposal", + encode(message: CanonicalProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== BigInt(0)) { + writer.uint32(17).sfixed64(message.height); + } + if (message.round !== BigInt(0)) { + writer.uint32(25).sfixed64(message.round); + } + if (message.polRound !== BigInt(0)) { + writer.uint32(32).int64(message.polRound); + } + if (message.blockId !== undefined) { + CanonicalBlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(58).string(message.chainId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CanonicalProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCanonicalProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.height = reader.sfixed64(); + break; + case 3: + message.round = reader.sfixed64(); + break; + case 4: + message.polRound = reader.int64(); + break; + case 5: + message.blockId = CanonicalBlockID.decode(reader, reader.uint32()); + break; + case 6: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.chainId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CanonicalProposal { + const message = createBaseCanonicalProposal(); + message.type = object.type ?? 0; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round !== undefined && object.round !== null ? BigInt(object.round.toString()) : BigInt(0); + message.polRound = object.polRound !== undefined && object.polRound !== null ? BigInt(object.polRound.toString()) : BigInt(0); + message.blockId = object.blockId !== undefined && object.blockId !== null ? CanonicalBlockID.fromPartial(object.blockId) : undefined; + message.timestamp = object.timestamp ?? undefined; + message.chainId = object.chainId ?? ""; + return message; + }, + fromAmino(object: CanonicalProposalAmino): CanonicalProposal { + const message = createBaseCanonicalProposal(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = BigInt(object.round); + } + if (object.pol_round !== undefined && object.pol_round !== null) { + message.polRound = BigInt(object.pol_round); + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = CanonicalBlockID.fromAmino(object.block_id); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + return message; + }, + toAmino(message: CanonicalProposal): CanonicalProposalAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round !== BigInt(0) ? message.round.toString() : undefined; + obj.pol_round = message.polRound !== BigInt(0) ? message.polRound.toString() : undefined; + obj.block_id = message.blockId ? CanonicalBlockID.toAmino(message.blockId) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + return obj; + }, + fromAminoMsg(object: CanonicalProposalAminoMsg): CanonicalProposal { + return CanonicalProposal.fromAmino(object.value); + }, + fromProtoMsg(message: CanonicalProposalProtoMsg): CanonicalProposal { + return CanonicalProposal.decode(message.value); + }, + toProto(message: CanonicalProposal): Uint8Array { + return CanonicalProposal.encode(message).finish(); + }, + toProtoMsg(message: CanonicalProposal): CanonicalProposalProtoMsg { + return { + typeUrl: "/tendermint.types.CanonicalProposal", + value: CanonicalProposal.encode(message).finish() + }; + } +}; +function createBaseCanonicalVote(): CanonicalVote { + return { + type: 0, + height: BigInt(0), + round: BigInt(0), + blockId: undefined, + timestamp: new Date(), + chainId: "" + }; +} +export const CanonicalVote = { + typeUrl: "/tendermint.types.CanonicalVote", + encode(message: CanonicalVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== BigInt(0)) { + writer.uint32(17).sfixed64(message.height); + } + if (message.round !== BigInt(0)) { + writer.uint32(25).sfixed64(message.round); + } + if (message.blockId !== undefined) { + CanonicalBlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(50).string(message.chainId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CanonicalVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCanonicalVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.height = reader.sfixed64(); + break; + case 3: + message.round = reader.sfixed64(); + break; + case 4: + message.blockId = CanonicalBlockID.decode(reader, reader.uint32()); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.chainId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CanonicalVote { + const message = createBaseCanonicalVote(); + message.type = object.type ?? 0; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round !== undefined && object.round !== null ? BigInt(object.round.toString()) : BigInt(0); + message.blockId = object.blockId !== undefined && object.blockId !== null ? CanonicalBlockID.fromPartial(object.blockId) : undefined; + message.timestamp = object.timestamp ?? undefined; + message.chainId = object.chainId ?? ""; + return message; + }, + fromAmino(object: CanonicalVoteAmino): CanonicalVote { + const message = createBaseCanonicalVote(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = BigInt(object.round); + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = CanonicalBlockID.fromAmino(object.block_id); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + return message; + }, + toAmino(message: CanonicalVote): CanonicalVoteAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round !== BigInt(0) ? message.round.toString() : undefined; + obj.block_id = message.blockId ? CanonicalBlockID.toAmino(message.blockId) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + return obj; + }, + fromAminoMsg(object: CanonicalVoteAminoMsg): CanonicalVote { + return CanonicalVote.fromAmino(object.value); + }, + fromProtoMsg(message: CanonicalVoteProtoMsg): CanonicalVote { + return CanonicalVote.decode(message.value); + }, + toProto(message: CanonicalVote): Uint8Array { + return CanonicalVote.encode(message).finish(); + }, + toProtoMsg(message: CanonicalVote): CanonicalVoteProtoMsg { + return { + typeUrl: "/tendermint.types.CanonicalVote", + value: CanonicalVote.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/types/events.ts b/util/inj-types/tendermint/types/events.ts new file mode 100644 index 00000000..bc5fb41d --- /dev/null +++ b/util/inj-types/tendermint/types/events.ts @@ -0,0 +1,112 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +export interface EventDataRoundState { + height: bigint; + round: number; + step: string; +} +export interface EventDataRoundStateProtoMsg { + typeUrl: "/tendermint.types.EventDataRoundState"; + value: Uint8Array; +} +export interface EventDataRoundStateAmino { + height?: string; + round?: number; + step?: string; +} +export interface EventDataRoundStateAminoMsg { + type: "/tendermint.types.EventDataRoundState"; + value: EventDataRoundStateAmino; +} +export interface EventDataRoundStateSDKType { + height: bigint; + round: number; + step: string; +} +function createBaseEventDataRoundState(): EventDataRoundState { + return { + height: BigInt(0), + round: 0, + step: "" + }; +} +export const EventDataRoundState = { + typeUrl: "/tendermint.types.EventDataRoundState", + encode(message: EventDataRoundState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.step !== "") { + writer.uint32(26).string(message.step); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventDataRoundState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDataRoundState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.step = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventDataRoundState { + const message = createBaseEventDataRoundState(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.step = object.step ?? ""; + return message; + }, + fromAmino(object: EventDataRoundStateAmino): EventDataRoundState { + const message = createBaseEventDataRoundState(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.step !== undefined && object.step !== null) { + message.step = object.step; + } + return message; + }, + toAmino(message: EventDataRoundState): EventDataRoundStateAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.step = message.step === "" ? undefined : message.step; + return obj; + }, + fromAminoMsg(object: EventDataRoundStateAminoMsg): EventDataRoundState { + return EventDataRoundState.fromAmino(object.value); + }, + fromProtoMsg(message: EventDataRoundStateProtoMsg): EventDataRoundState { + return EventDataRoundState.decode(message.value); + }, + toProto(message: EventDataRoundState): Uint8Array { + return EventDataRoundState.encode(message).finish(); + }, + toProtoMsg(message: EventDataRoundState): EventDataRoundStateProtoMsg { + return { + typeUrl: "/tendermint.types.EventDataRoundState", + value: EventDataRoundState.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/types/evidence.ts b/util/inj-types/tendermint/types/evidence.ts new file mode 100644 index 00000000..3253fc86 --- /dev/null +++ b/util/inj-types/tendermint/types/evidence.ts @@ -0,0 +1,470 @@ +import { Vote, VoteAmino, VoteSDKType, LightBlock, LightBlockAmino, LightBlockSDKType } from "./types"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Validator, ValidatorAmino, ValidatorSDKType } from "./validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +export interface Evidence { + duplicateVoteEvidence?: DuplicateVoteEvidence; + lightClientAttackEvidence?: LightClientAttackEvidence; +} +export interface EvidenceProtoMsg { + typeUrl: "/tendermint.types.Evidence"; + value: Uint8Array; +} +export interface EvidenceAmino { + duplicate_vote_evidence?: DuplicateVoteEvidenceAmino; + light_client_attack_evidence?: LightClientAttackEvidenceAmino; +} +export interface EvidenceAminoMsg { + type: "/tendermint.types.Evidence"; + value: EvidenceAmino; +} +export interface EvidenceSDKType { + duplicate_vote_evidence?: DuplicateVoteEvidenceSDKType; + light_client_attack_evidence?: LightClientAttackEvidenceSDKType; +} +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + voteA?: Vote; + voteB?: Vote; + totalVotingPower: bigint; + validatorPower: bigint; + timestamp: Date; +} +export interface DuplicateVoteEvidenceProtoMsg { + typeUrl: "/tendermint.types.DuplicateVoteEvidence"; + value: Uint8Array; +} +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidenceAmino { + vote_a?: VoteAmino; + vote_b?: VoteAmino; + total_voting_power?: string; + validator_power?: string; + timestamp?: string; +} +export interface DuplicateVoteEvidenceAminoMsg { + type: "/tendermint.types.DuplicateVoteEvidence"; + value: DuplicateVoteEvidenceAmino; +} +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidenceSDKType { + vote_a?: VoteSDKType; + vote_b?: VoteSDKType; + total_voting_power: bigint; + validator_power: bigint; + timestamp: Date; +} +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflictingBlock?: LightBlock; + commonHeight: bigint; + byzantineValidators: Validator[]; + totalVotingPower: bigint; + timestamp: Date; +} +export interface LightClientAttackEvidenceProtoMsg { + typeUrl: "/tendermint.types.LightClientAttackEvidence"; + value: Uint8Array; +} +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidenceAmino { + conflicting_block?: LightBlockAmino; + common_height?: string; + byzantine_validators?: ValidatorAmino[]; + total_voting_power?: string; + timestamp?: string; +} +export interface LightClientAttackEvidenceAminoMsg { + type: "/tendermint.types.LightClientAttackEvidence"; + value: LightClientAttackEvidenceAmino; +} +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidenceSDKType { + conflicting_block?: LightBlockSDKType; + common_height: bigint; + byzantine_validators: ValidatorSDKType[]; + total_voting_power: bigint; + timestamp: Date; +} +export interface EvidenceList { + evidence: Evidence[]; +} +export interface EvidenceListProtoMsg { + typeUrl: "/tendermint.types.EvidenceList"; + value: Uint8Array; +} +export interface EvidenceListAmino { + evidence?: EvidenceAmino[]; +} +export interface EvidenceListAminoMsg { + type: "/tendermint.types.EvidenceList"; + value: EvidenceListAmino; +} +export interface EvidenceListSDKType { + evidence: EvidenceSDKType[]; +} +function createBaseEvidence(): Evidence { + return { + duplicateVoteEvidence: undefined, + lightClientAttackEvidence: undefined + }; +} +export const Evidence = { + typeUrl: "/tendermint.types.Evidence", + encode(message: Evidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.duplicateVoteEvidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).ldelim(); + } + if (message.lightClientAttackEvidence !== undefined) { + LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.duplicateVoteEvidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + break; + case 2: + message.lightClientAttackEvidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Evidence { + const message = createBaseEvidence(); + message.duplicateVoteEvidence = object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) : undefined; + message.lightClientAttackEvidence = object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) : undefined; + return message; + }, + fromAmino(object: EvidenceAmino): Evidence { + const message = createBaseEvidence(); + if (object.duplicate_vote_evidence !== undefined && object.duplicate_vote_evidence !== null) { + message.duplicateVoteEvidence = DuplicateVoteEvidence.fromAmino(object.duplicate_vote_evidence); + } + if (object.light_client_attack_evidence !== undefined && object.light_client_attack_evidence !== null) { + message.lightClientAttackEvidence = LightClientAttackEvidence.fromAmino(object.light_client_attack_evidence); + } + return message; + }, + toAmino(message: Evidence): EvidenceAmino { + const obj: any = {}; + obj.duplicate_vote_evidence = message.duplicateVoteEvidence ? DuplicateVoteEvidence.toAmino(message.duplicateVoteEvidence) : undefined; + obj.light_client_attack_evidence = message.lightClientAttackEvidence ? LightClientAttackEvidence.toAmino(message.lightClientAttackEvidence) : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceAminoMsg): Evidence { + return Evidence.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceProtoMsg): Evidence { + return Evidence.decode(message.value); + }, + toProto(message: Evidence): Uint8Array { + return Evidence.encode(message).finish(); + }, + toProtoMsg(message: Evidence): EvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.Evidence", + value: Evidence.encode(message).finish() + }; + } +}; +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { + voteA: undefined, + voteB: undefined, + totalVotingPower: BigInt(0), + validatorPower: BigInt(0), + timestamp: new Date() + }; +} +export const DuplicateVoteEvidence = { + typeUrl: "/tendermint.types.DuplicateVoteEvidence", + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.voteA !== undefined) { + Vote.encode(message.voteA, writer.uint32(10).fork()).ldelim(); + } + if (message.voteB !== undefined) { + Vote.encode(message.voteB, writer.uint32(18).fork()).ldelim(); + } + if (message.totalVotingPower !== BigInt(0)) { + writer.uint32(24).int64(message.totalVotingPower); + } + if (message.validatorPower !== BigInt(0)) { + writer.uint32(32).int64(message.validatorPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voteA = Vote.decode(reader, reader.uint32()); + break; + case 2: + message.voteB = Vote.decode(reader, reader.uint32()); + break; + case 3: + message.totalVotingPower = reader.int64(); + break; + case 4: + message.validatorPower = reader.int64(); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.voteA = object.voteA !== undefined && object.voteA !== null ? Vote.fromPartial(object.voteA) : undefined; + message.voteB = object.voteB !== undefined && object.voteB !== null ? Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + message.validatorPower = object.validatorPower !== undefined && object.validatorPower !== null ? BigInt(object.validatorPower.toString()) : BigInt(0); + message.timestamp = object.timestamp ?? undefined; + return message; + }, + fromAmino(object: DuplicateVoteEvidenceAmino): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + if (object.vote_a !== undefined && object.vote_a !== null) { + message.voteA = Vote.fromAmino(object.vote_a); + } + if (object.vote_b !== undefined && object.vote_b !== null) { + message.voteB = Vote.fromAmino(object.vote_b); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + if (object.validator_power !== undefined && object.validator_power !== null) { + message.validatorPower = BigInt(object.validator_power); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + return message; + }, + toAmino(message: DuplicateVoteEvidence): DuplicateVoteEvidenceAmino { + const obj: any = {}; + obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; + obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + obj.validator_power = message.validatorPower !== BigInt(0) ? message.validatorPower.toString() : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + return obj; + }, + fromAminoMsg(object: DuplicateVoteEvidenceAminoMsg): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromAmino(object.value); + }, + fromProtoMsg(message: DuplicateVoteEvidenceProtoMsg): DuplicateVoteEvidence { + return DuplicateVoteEvidence.decode(message.value); + }, + toProto(message: DuplicateVoteEvidence): Uint8Array { + return DuplicateVoteEvidence.encode(message).finish(); + }, + toProtoMsg(message: DuplicateVoteEvidence): DuplicateVoteEvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.DuplicateVoteEvidence", + value: DuplicateVoteEvidence.encode(message).finish() + }; + } +}; +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflictingBlock: undefined, + commonHeight: BigInt(0), + byzantineValidators: [], + totalVotingPower: BigInt(0), + timestamp: new Date() + }; +} +export const LightClientAttackEvidence = { + typeUrl: "/tendermint.types.LightClientAttackEvidence", + encode(message: LightClientAttackEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.conflictingBlock !== undefined) { + LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).ldelim(); + } + if (message.commonHeight !== BigInt(0)) { + writer.uint32(16).int64(message.commonHeight); + } + for (const v of message.byzantineValidators) { + Validator.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.totalVotingPower !== BigInt(0)) { + writer.uint32(32).int64(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.conflictingBlock = LightBlock.decode(reader, reader.uint32()); + break; + case 2: + message.commonHeight = reader.int64(); + break; + case 3: + message.byzantineValidators.push(Validator.decode(reader, reader.uint32())); + break; + case 4: + message.totalVotingPower = reader.int64(); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflictingBlock = object.conflictingBlock !== undefined && object.conflictingBlock !== null ? LightBlock.fromPartial(object.conflictingBlock) : undefined; + message.commonHeight = object.commonHeight !== undefined && object.commonHeight !== null ? BigInt(object.commonHeight.toString()) : BigInt(0); + message.byzantineValidators = object.byzantineValidators?.map(e => Validator.fromPartial(e)) || []; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + message.timestamp = object.timestamp ?? undefined; + return message; + }, + fromAmino(object: LightClientAttackEvidenceAmino): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + if (object.conflicting_block !== undefined && object.conflicting_block !== null) { + message.conflictingBlock = LightBlock.fromAmino(object.conflicting_block); + } + if (object.common_height !== undefined && object.common_height !== null) { + message.commonHeight = BigInt(object.common_height); + } + message.byzantineValidators = object.byzantine_validators?.map(e => Validator.fromAmino(e)) || []; + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + return message; + }, + toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { + const obj: any = {}; + obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; + obj.common_height = message.commonHeight !== BigInt(0) ? message.commonHeight.toString() : undefined; + if (message.byzantineValidators) { + obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.byzantine_validators = message.byzantineValidators; + } + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + return obj; + }, + fromAminoMsg(object: LightClientAttackEvidenceAminoMsg): LightClientAttackEvidence { + return LightClientAttackEvidence.fromAmino(object.value); + }, + fromProtoMsg(message: LightClientAttackEvidenceProtoMsg): LightClientAttackEvidence { + return LightClientAttackEvidence.decode(message.value); + }, + toProto(message: LightClientAttackEvidence): Uint8Array { + return LightClientAttackEvidence.encode(message).finish(); + }, + toProtoMsg(message: LightClientAttackEvidence): LightClientAttackEvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.LightClientAttackEvidence", + value: LightClientAttackEvidence.encode(message).finish() + }; + } +}; +function createBaseEvidenceList(): EvidenceList { + return { + evidence: [] + }; +} +export const EvidenceList = { + typeUrl: "/tendermint.types.EvidenceList", + encode(message: EvidenceList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence.push(Evidence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EvidenceList { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map(e => Evidence.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EvidenceListAmino): EvidenceList { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map(e => Evidence.fromAmino(e)) || []; + return message; + }, + toAmino(message: EvidenceList): EvidenceListAmino { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e) : undefined); + } else { + obj.evidence = message.evidence; + } + return obj; + }, + fromAminoMsg(object: EvidenceListAminoMsg): EvidenceList { + return EvidenceList.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceListProtoMsg): EvidenceList { + return EvidenceList.decode(message.value); + }, + toProto(message: EvidenceList): Uint8Array { + return EvidenceList.encode(message).finish(); + }, + toProtoMsg(message: EvidenceList): EvidenceListProtoMsg { + return { + typeUrl: "/tendermint.types.EvidenceList", + value: EvidenceList.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/types/params.ts b/util/inj-types/tendermint/types/params.ts new file mode 100644 index 00000000..d3ae57f8 --- /dev/null +++ b/util/inj-types/tendermint/types/params.ts @@ -0,0 +1,690 @@ +import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParams { + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; + version?: VersionParams; +} +export interface ConsensusParamsProtoMsg { + typeUrl: "/tendermint.types.ConsensusParams"; + value: Uint8Array; +} +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParamsAmino { + block?: BlockParamsAmino; + evidence?: EvidenceParamsAmino; + validator?: ValidatorParamsAmino; + version?: VersionParamsAmino; +} +export interface ConsensusParamsAminoMsg { + type: "/tendermint.types.ConsensusParams"; + value: ConsensusParamsAmino; +} +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParamsSDKType { + block?: BlockParamsSDKType; + evidence?: EvidenceParamsSDKType; + validator?: ValidatorParamsSDKType; + version?: VersionParamsSDKType; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: bigint; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: bigint; +} +export interface BlockParamsProtoMsg { + typeUrl: "/tendermint.types.BlockParams"; + value: Uint8Array; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParamsAmino { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + max_bytes?: string; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + max_gas?: string; +} +export interface BlockParamsAminoMsg { + type: "/tendermint.types.BlockParams"; + value: BlockParamsAmino; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParamsSDKType { + max_bytes: bigint; + max_gas: bigint; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: bigint; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: Duration; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: bigint; +} +export interface EvidenceParamsProtoMsg { + typeUrl: "/tendermint.types.EvidenceParams"; + value: Uint8Array; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParamsAmino { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + max_age_num_blocks?: string; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + max_age_duration?: DurationAmino; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + max_bytes?: string; +} +export interface EvidenceParamsAminoMsg { + type: "/tendermint.types.EvidenceParams"; + value: EvidenceParamsAmino; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParamsSDKType { + max_age_num_blocks: bigint; + max_age_duration: DurationSDKType; + max_bytes: bigint; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} +export interface ValidatorParamsProtoMsg { + typeUrl: "/tendermint.types.ValidatorParams"; + value: Uint8Array; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParamsAmino { + pub_key_types?: string[]; +} +export interface ValidatorParamsAminoMsg { + type: "/tendermint.types.ValidatorParams"; + value: ValidatorParamsAmino; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParamsSDKType { + pub_key_types: string[]; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: bigint; +} +export interface VersionParamsProtoMsg { + typeUrl: "/tendermint.types.VersionParams"; + value: Uint8Array; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParamsAmino { + app?: string; +} +export interface VersionParamsAminoMsg { + type: "/tendermint.types.VersionParams"; + value: VersionParamsAmino; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParamsSDKType { + app: bigint; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: bigint; + blockMaxGas: bigint; +} +export interface HashedParamsProtoMsg { + typeUrl: "/tendermint.types.HashedParams"; + value: Uint8Array; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParamsAmino { + block_max_bytes?: string; + block_max_gas?: string; +} +export interface HashedParamsAminoMsg { + type: "/tendermint.types.HashedParams"; + value: HashedParamsAmino; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParamsSDKType { + block_max_bytes: bigint; + block_max_gas: bigint; +} +function createBaseConsensusParams(): ConsensusParams { + return { + block: undefined, + evidence: undefined, + validator: undefined, + version: undefined + }; +} +export const ConsensusParams = { + typeUrl: "/tendermint.types.ConsensusParams", + encode(message: ConsensusParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = BlockParams.decode(reader, reader.uint32()); + break; + case 2: + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + break; + case 3: + message.validator = ValidatorParams.decode(reader, reader.uint32()); + break; + case 4: + message.version = VersionParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusParams { + const message = createBaseConsensusParams(); + message.block = object.block !== undefined && object.block !== null ? BlockParams.fromPartial(object.block) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; + message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; + message.version = object.version !== undefined && object.version !== null ? VersionParams.fromPartial(object.version) : undefined; + return message; + }, + fromAmino(object: ConsensusParamsAmino): ConsensusParams { + const message = createBaseConsensusParams(); + if (object.block !== undefined && object.block !== null) { + message.block = BlockParams.fromAmino(object.block); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceParams.fromAmino(object.evidence); + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = ValidatorParams.fromAmino(object.validator); + } + if (object.version !== undefined && object.version !== null) { + message.version = VersionParams.fromAmino(object.version); + } + return message; + }, + toAmino(message: ConsensusParams): ConsensusParamsAmino { + const obj: any = {}; + obj.block = message.block ? BlockParams.toAmino(message.block) : undefined; + obj.evidence = message.evidence ? EvidenceParams.toAmino(message.evidence) : undefined; + obj.validator = message.validator ? ValidatorParams.toAmino(message.validator) : undefined; + obj.version = message.version ? VersionParams.toAmino(message.version) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusParamsAminoMsg): ConsensusParams { + return ConsensusParams.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusParamsProtoMsg): ConsensusParams { + return ConsensusParams.decode(message.value); + }, + toProto(message: ConsensusParams): Uint8Array { + return ConsensusParams.encode(message).finish(); + }, + toProtoMsg(message: ConsensusParams): ConsensusParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ConsensusParams", + value: ConsensusParams.encode(message).finish() + }; + } +}; +function createBaseBlockParams(): BlockParams { + return { + maxBytes: BigInt(0), + maxGas: BigInt(0) + }; +} +export const BlockParams = { + typeUrl: "/tendermint.types.BlockParams", + encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxBytes !== BigInt(0)) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== BigInt(0)) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxBytes = reader.int64(); + break; + case 2: + message.maxGas = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockParams { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); + message.maxGas = object.maxGas !== undefined && object.maxGas !== null ? BigInt(object.maxGas.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BlockParamsAmino): BlockParams { + const message = createBaseBlockParams(); + if (object.max_bytes !== undefined && object.max_bytes !== null) { + message.maxBytes = BigInt(object.max_bytes); + } + if (object.max_gas !== undefined && object.max_gas !== null) { + message.maxGas = BigInt(object.max_gas); + } + return message; + }, + toAmino(message: BlockParams): BlockParamsAmino { + const obj: any = {}; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { + return BlockParams.fromAmino(object.value); + }, + fromProtoMsg(message: BlockParamsProtoMsg): BlockParams { + return BlockParams.decode(message.value); + }, + toProto(message: BlockParams): Uint8Array { + return BlockParams.encode(message).finish(); + }, + toProtoMsg(message: BlockParams): BlockParamsProtoMsg { + return { + typeUrl: "/tendermint.types.BlockParams", + value: BlockParams.encode(message).finish() + }; + } +}; +function createBaseEvidenceParams(): EvidenceParams { + return { + maxAgeNumBlocks: BigInt(0), + maxAgeDuration: Duration.fromPartial({}), + maxBytes: BigInt(0) + }; +} +export const EvidenceParams = { + typeUrl: "/tendermint.types.EvidenceParams", + encode(message: EvidenceParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxAgeNumBlocks !== BigInt(0)) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim(); + } + if (message.maxBytes !== BigInt(0)) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxAgeNumBlocks = reader.int64(); + break; + case 2: + message.maxAgeDuration = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.maxBytes = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EvidenceParams { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null ? BigInt(object.maxAgeNumBlocks.toString()) : BigInt(0); + message.maxAgeDuration = object.maxAgeDuration !== undefined && object.maxAgeDuration !== null ? Duration.fromPartial(object.maxAgeDuration) : undefined; + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EvidenceParamsAmino): EvidenceParams { + const message = createBaseEvidenceParams(); + if (object.max_age_num_blocks !== undefined && object.max_age_num_blocks !== null) { + message.maxAgeNumBlocks = BigInt(object.max_age_num_blocks); + } + if (object.max_age_duration !== undefined && object.max_age_duration !== null) { + message.maxAgeDuration = Duration.fromAmino(object.max_age_duration); + } + if (object.max_bytes !== undefined && object.max_bytes !== null) { + message.maxBytes = BigInt(object.max_bytes); + } + return message; + }, + toAmino(message: EvidenceParams): EvidenceParamsAmino { + const obj: any = {}; + obj.max_age_num_blocks = message.maxAgeNumBlocks !== BigInt(0) ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { + return EvidenceParams.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceParamsProtoMsg): EvidenceParams { + return EvidenceParams.decode(message.value); + }, + toProto(message: EvidenceParams): Uint8Array { + return EvidenceParams.encode(message).finish(); + }, + toProtoMsg(message: EvidenceParams): EvidenceParamsProtoMsg { + return { + typeUrl: "/tendermint.types.EvidenceParams", + value: EvidenceParams.encode(message).finish() + }; + } +}; +function createBaseValidatorParams(): ValidatorParams { + return { + pubKeyTypes: [] + }; +} +export const ValidatorParams = { + typeUrl: "/tendermint.types.ValidatorParams", + encode(message: ValidatorParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKeyTypes.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map(e => e) || []; + return message; + }, + fromAmino(object: ValidatorParamsAmino): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pub_key_types?.map(e => e) || []; + return message; + }, + toAmino(message: ValidatorParams): ValidatorParamsAmino { + const obj: any = {}; + if (message.pubKeyTypes) { + obj.pub_key_types = message.pubKeyTypes.map(e => e); + } else { + obj.pub_key_types = message.pubKeyTypes; + } + return obj; + }, + fromAminoMsg(object: ValidatorParamsAminoMsg): ValidatorParams { + return ValidatorParams.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorParamsProtoMsg): ValidatorParams { + return ValidatorParams.decode(message.value); + }, + toProto(message: ValidatorParams): Uint8Array { + return ValidatorParams.encode(message).finish(); + }, + toProtoMsg(message: ValidatorParams): ValidatorParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ValidatorParams", + value: ValidatorParams.encode(message).finish() + }; + } +}; +function createBaseVersionParams(): VersionParams { + return { + app: BigInt(0) + }; +} +export const VersionParams = { + typeUrl: "/tendermint.types.VersionParams", + encode(message: VersionParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.app !== BigInt(0)) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.app = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VersionParams { + const message = createBaseVersionParams(); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); + return message; + }, + fromAmino(object: VersionParamsAmino): VersionParams { + const message = createBaseVersionParams(); + if (object.app !== undefined && object.app !== null) { + message.app = BigInt(object.app); + } + return message; + }, + toAmino(message: VersionParams): VersionParamsAmino { + const obj: any = {}; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; + return obj; + }, + fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { + return VersionParams.fromAmino(object.value); + }, + fromProtoMsg(message: VersionParamsProtoMsg): VersionParams { + return VersionParams.decode(message.value); + }, + toProto(message: VersionParams): Uint8Array { + return VersionParams.encode(message).finish(); + }, + toProtoMsg(message: VersionParams): VersionParamsProtoMsg { + return { + typeUrl: "/tendermint.types.VersionParams", + value: VersionParams.encode(message).finish() + }; + } +}; +function createBaseHashedParams(): HashedParams { + return { + blockMaxBytes: BigInt(0), + blockMaxGas: BigInt(0) + }; +} +export const HashedParams = { + typeUrl: "/tendermint.types.HashedParams", + encode(message: HashedParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockMaxBytes !== BigInt(0)) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== BigInt(0)) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockMaxBytes = reader.int64(); + break; + case 2: + message.blockMaxGas = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HashedParams { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes !== undefined && object.blockMaxBytes !== null ? BigInt(object.blockMaxBytes.toString()) : BigInt(0); + message.blockMaxGas = object.blockMaxGas !== undefined && object.blockMaxGas !== null ? BigInt(object.blockMaxGas.toString()) : BigInt(0); + return message; + }, + fromAmino(object: HashedParamsAmino): HashedParams { + const message = createBaseHashedParams(); + if (object.block_max_bytes !== undefined && object.block_max_bytes !== null) { + message.blockMaxBytes = BigInt(object.block_max_bytes); + } + if (object.block_max_gas !== undefined && object.block_max_gas !== null) { + message.blockMaxGas = BigInt(object.block_max_gas); + } + return message; + }, + toAmino(message: HashedParams): HashedParamsAmino { + const obj: any = {}; + obj.block_max_bytes = message.blockMaxBytes !== BigInt(0) ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas !== BigInt(0) ? message.blockMaxGas.toString() : undefined; + return obj; + }, + fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { + return HashedParams.fromAmino(object.value); + }, + fromProtoMsg(message: HashedParamsProtoMsg): HashedParams { + return HashedParams.decode(message.value); + }, + toProto(message: HashedParams): Uint8Array { + return HashedParams.encode(message).finish(); + }, + toProtoMsg(message: HashedParams): HashedParamsProtoMsg { + return { + typeUrl: "/tendermint.types.HashedParams", + value: HashedParams.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/types/types.ts b/util/inj-types/tendermint/types/types.ts new file mode 100644 index 00000000..d2e83d5d --- /dev/null +++ b/util/inj-types/tendermint/types/types.ts @@ -0,0 +1,1848 @@ +import { Proof, ProofAmino, ProofSDKType } from "../crypto/proof"; +import { Consensus, ConsensusAmino, ConsensusSDKType } from "../version/types"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "./validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +/** BlockIdFlag indicates which BlcokID the signature is for */ +export enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = 0, + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + BLOCK_ID_FLAG_NIL = 3, + UNRECOGNIZED = -1, +} +export const BlockIDFlagSDKType = BlockIDFlag; +export const BlockIDFlagAmino = BlockIDFlag; +export function blockIDFlagFromJSON(object: any): BlockIDFlag { + switch (object) { + case 0: + case "BLOCK_ID_FLAG_UNKNOWN": + return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; + case 1: + case "BLOCK_ID_FLAG_ABSENT": + return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; + case 2: + case "BLOCK_ID_FLAG_COMMIT": + return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; + case 3: + case "BLOCK_ID_FLAG_NIL": + return BlockIDFlag.BLOCK_ID_FLAG_NIL; + case -1: + case "UNRECOGNIZED": + default: + return BlockIDFlag.UNRECOGNIZED; + } +} +export function blockIDFlagToJSON(object: BlockIDFlag): string { + switch (object) { + case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: + return "BLOCK_ID_FLAG_UNKNOWN"; + case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: + return "BLOCK_ID_FLAG_ABSENT"; + case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: + return "BLOCK_ID_FLAG_COMMIT"; + case BlockIDFlag.BLOCK_ID_FLAG_NIL: + return "BLOCK_ID_FLAG_NIL"; + case BlockIDFlag.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** SignedMsgType is a type of signed message in the consensus. */ +export enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = 0, + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SIGNED_MSG_TYPE_PREVOTE = 1, + SIGNED_MSG_TYPE_PRECOMMIT = 2, + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SIGNED_MSG_TYPE_PROPOSAL = 32, + UNRECOGNIZED = -1, +} +export const SignedMsgTypeSDKType = SignedMsgType; +export const SignedMsgTypeAmino = SignedMsgType; +export function signedMsgTypeFromJSON(object: any): SignedMsgType { + switch (object) { + case 0: + case "SIGNED_MSG_TYPE_UNKNOWN": + return SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; + case 1: + case "SIGNED_MSG_TYPE_PREVOTE": + return SignedMsgType.SIGNED_MSG_TYPE_PREVOTE; + case 2: + case "SIGNED_MSG_TYPE_PRECOMMIT": + return SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT; + case 32: + case "SIGNED_MSG_TYPE_PROPOSAL": + return SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL; + case -1: + case "UNRECOGNIZED": + default: + return SignedMsgType.UNRECOGNIZED; + } +} +export function signedMsgTypeToJSON(object: SignedMsgType): string { + switch (object) { + case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN: + return "SIGNED_MSG_TYPE_UNKNOWN"; + case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE: + return "SIGNED_MSG_TYPE_PREVOTE"; + case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT: + return "SIGNED_MSG_TYPE_PRECOMMIT"; + case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL: + return "SIGNED_MSG_TYPE_PROPOSAL"; + case SignedMsgType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** PartsetHeader */ +export interface PartSetHeader { + total: number; + hash: Uint8Array; +} +export interface PartSetHeaderProtoMsg { + typeUrl: "/tendermint.types.PartSetHeader"; + value: Uint8Array; +} +/** PartsetHeader */ +export interface PartSetHeaderAmino { + total?: number; + hash?: string; +} +export interface PartSetHeaderAminoMsg { + type: "/tendermint.types.PartSetHeader"; + value: PartSetHeaderAmino; +} +/** PartsetHeader */ +export interface PartSetHeaderSDKType { + total: number; + hash: Uint8Array; +} +export interface Part { + index: number; + bytes: Uint8Array; + proof: Proof; +} +export interface PartProtoMsg { + typeUrl: "/tendermint.types.Part"; + value: Uint8Array; +} +export interface PartAmino { + index?: number; + bytes?: string; + proof?: ProofAmino; +} +export interface PartAminoMsg { + type: "/tendermint.types.Part"; + value: PartAmino; +} +export interface PartSDKType { + index: number; + bytes: Uint8Array; + proof: ProofSDKType; +} +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader; +} +export interface BlockIDProtoMsg { + typeUrl: "/tendermint.types.BlockID"; + value: Uint8Array; +} +/** BlockID */ +export interface BlockIDAmino { + hash?: string; + part_set_header?: PartSetHeaderAmino; +} +export interface BlockIDAminoMsg { + type: "/tendermint.types.BlockID"; + value: BlockIDAmino; +} +/** BlockID */ +export interface BlockIDSDKType { + hash: Uint8Array; + part_set_header: PartSetHeaderSDKType; +} +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus; + chainId: string; + height: bigint; + time: Date; + /** prev block info */ + lastBlockId: BlockID; + /** hashes of block data */ + lastCommitHash: Uint8Array; + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} +export interface HeaderProtoMsg { + typeUrl: "/tendermint.types.Header"; + value: Uint8Array; +} +/** Header defines the structure of a block header. */ +export interface HeaderAmino { + /** basic block info */ + version?: ConsensusAmino; + chain_id?: string; + height?: string; + time?: string; + /** prev block info */ + last_block_id?: BlockIDAmino; + /** hashes of block data */ + last_commit_hash?: string; + data_hash?: string; + /** hashes from the app output from the prev block */ + validators_hash?: string; + /** validators for the next block */ + next_validators_hash?: string; + /** consensus params for current block */ + consensus_hash?: string; + /** state after txs from the previous block */ + app_hash?: string; + last_results_hash?: string; + /** consensus info */ + evidence_hash?: string; + /** original proposer of the block */ + proposer_address?: string; +} +export interface HeaderAminoMsg { + type: "/tendermint.types.Header"; + value: HeaderAmino; +} +/** Header defines the structure of a block header. */ +export interface HeaderSDKType { + version: ConsensusSDKType; + chain_id: string; + height: bigint; + time: Date; + last_block_id: BlockIDSDKType; + last_commit_hash: Uint8Array; + data_hash: Uint8Array; + validators_hash: Uint8Array; + next_validators_hash: Uint8Array; + consensus_hash: Uint8Array; + app_hash: Uint8Array; + last_results_hash: Uint8Array; + evidence_hash: Uint8Array; + proposer_address: Uint8Array; +} +/** Data contains the set of transactions included in the block */ +export interface Data { + /** + * Txs that will be applied by state @ block.Height+1. + * NOTE: not all txs here are valid. We're just agreeing on the order first. + * This means that block.AppHash does not include these txs. + */ + txs: Uint8Array[]; +} +export interface DataProtoMsg { + typeUrl: "/tendermint.types.Data"; + value: Uint8Array; +} +/** Data contains the set of transactions included in the block */ +export interface DataAmino { + /** + * Txs that will be applied by state @ block.Height+1. + * NOTE: not all txs here are valid. We're just agreeing on the order first. + * This means that block.AppHash does not include these txs. + */ + txs?: string[]; +} +export interface DataAminoMsg { + type: "/tendermint.types.Data"; + value: DataAmino; +} +/** Data contains the set of transactions included in the block */ +export interface DataSDKType { + txs: Uint8Array[]; +} +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: bigint; + round: number; + blockId: BlockID; + timestamp: Date; + validatorAddress: Uint8Array; + validatorIndex: number; + signature: Uint8Array; +} +export interface VoteProtoMsg { + typeUrl: "/tendermint.types.Vote"; + value: Uint8Array; +} +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface VoteAmino { + type?: SignedMsgType; + height?: string; + round?: number; + block_id?: BlockIDAmino; + timestamp?: string; + validator_address?: string; + validator_index?: number; + signature?: string; +} +export interface VoteAminoMsg { + type: "/tendermint.types.Vote"; + value: VoteAmino; +} +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface VoteSDKType { + type: SignedMsgType; + height: bigint; + round: number; + block_id: BlockIDSDKType; + timestamp: Date; + validator_address: Uint8Array; + validator_index: number; + signature: Uint8Array; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: bigint; + round: number; + blockId: BlockID; + signatures: CommitSig[]; +} +export interface CommitProtoMsg { + typeUrl: "/tendermint.types.Commit"; + value: Uint8Array; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface CommitAmino { + height?: string; + round?: number; + block_id?: BlockIDAmino; + signatures?: CommitSigAmino[]; +} +export interface CommitAminoMsg { + type: "/tendermint.types.Commit"; + value: CommitAmino; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface CommitSDKType { + height: bigint; + round: number; + block_id: BlockIDSDKType; + signatures: CommitSigSDKType[]; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date; + signature: Uint8Array; +} +export interface CommitSigProtoMsg { + typeUrl: "/tendermint.types.CommitSig"; + value: Uint8Array; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSigAmino { + block_id_flag?: BlockIDFlag; + validator_address?: string; + timestamp?: string; + signature?: string; +} +export interface CommitSigAminoMsg { + type: "/tendermint.types.CommitSig"; + value: CommitSigAmino; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSigSDKType { + block_id_flag: BlockIDFlag; + validator_address: Uint8Array; + timestamp: Date; + signature: Uint8Array; +} +export interface Proposal { + type: SignedMsgType; + height: bigint; + round: number; + polRound: number; + blockId: BlockID; + timestamp: Date; + signature: Uint8Array; +} +export interface ProposalProtoMsg { + typeUrl: "/tendermint.types.Proposal"; + value: Uint8Array; +} +export interface ProposalAmino { + type?: SignedMsgType; + height?: string; + round?: number; + pol_round?: number; + block_id?: BlockIDAmino; + timestamp?: string; + signature?: string; +} +export interface ProposalAminoMsg { + type: "/tendermint.types.Proposal"; + value: ProposalAmino; +} +export interface ProposalSDKType { + type: SignedMsgType; + height: bigint; + round: number; + pol_round: number; + block_id: BlockIDSDKType; + timestamp: Date; + signature: Uint8Array; +} +export interface SignedHeader { + header?: Header; + commit?: Commit; +} +export interface SignedHeaderProtoMsg { + typeUrl: "/tendermint.types.SignedHeader"; + value: Uint8Array; +} +export interface SignedHeaderAmino { + header?: HeaderAmino; + commit?: CommitAmino; +} +export interface SignedHeaderAminoMsg { + type: "/tendermint.types.SignedHeader"; + value: SignedHeaderAmino; +} +export interface SignedHeaderSDKType { + header?: HeaderSDKType; + commit?: CommitSDKType; +} +export interface LightBlock { + signedHeader?: SignedHeader; + validatorSet?: ValidatorSet; +} +export interface LightBlockProtoMsg { + typeUrl: "/tendermint.types.LightBlock"; + value: Uint8Array; +} +export interface LightBlockAmino { + signed_header?: SignedHeaderAmino; + validator_set?: ValidatorSetAmino; +} +export interface LightBlockAminoMsg { + type: "/tendermint.types.LightBlock"; + value: LightBlockAmino; +} +export interface LightBlockSDKType { + signed_header?: SignedHeaderSDKType; + validator_set?: ValidatorSetSDKType; +} +export interface BlockMeta { + blockId: BlockID; + blockSize: bigint; + header: Header; + numTxs: bigint; +} +export interface BlockMetaProtoMsg { + typeUrl: "/tendermint.types.BlockMeta"; + value: Uint8Array; +} +export interface BlockMetaAmino { + block_id?: BlockIDAmino; + block_size?: string; + header?: HeaderAmino; + num_txs?: string; +} +export interface BlockMetaAminoMsg { + type: "/tendermint.types.BlockMeta"; + value: BlockMetaAmino; +} +export interface BlockMetaSDKType { + block_id: BlockIDSDKType; + block_size: bigint; + header: HeaderSDKType; + num_txs: bigint; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof?: Proof; +} +export interface TxProofProtoMsg { + typeUrl: "/tendermint.types.TxProof"; + value: Uint8Array; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProofAmino { + root_hash?: string; + data?: string; + proof?: ProofAmino; +} +export interface TxProofAminoMsg { + type: "/tendermint.types.TxProof"; + value: TxProofAmino; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProofSDKType { + root_hash: Uint8Array; + data: Uint8Array; + proof?: ProofSDKType; +} +function createBasePartSetHeader(): PartSetHeader { + return { + total: 0, + hash: new Uint8Array() + }; +} +export const PartSetHeader = { + typeUrl: "/tendermint.types.PartSetHeader", + encode(message: PartSetHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total = reader.uint32(); + break; + case 2: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, + fromAmino(object: PartSetHeaderAmino): PartSetHeader { + const message = createBasePartSetHeader(); + if (object.total !== undefined && object.total !== null) { + message.total = object.total; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: PartSetHeader): PartSetHeaderAmino { + const obj: any = {}; + obj.total = message.total === 0 ? undefined : message.total; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: PartSetHeaderAminoMsg): PartSetHeader { + return PartSetHeader.fromAmino(object.value); + }, + fromProtoMsg(message: PartSetHeaderProtoMsg): PartSetHeader { + return PartSetHeader.decode(message.value); + }, + toProto(message: PartSetHeader): Uint8Array { + return PartSetHeader.encode(message).finish(); + }, + toProtoMsg(message: PartSetHeader): PartSetHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.PartSetHeader", + value: PartSetHeader.encode(message).finish() + }; + } +}; +function createBasePart(): Part { + return { + index: 0, + bytes: new Uint8Array(), + proof: Proof.fromPartial({}) + }; +} +export const Part = { + typeUrl: "/tendermint.types.Part", + encode(message: Part, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.bytes = reader.bytes(); + break; + case 3: + message.proof = Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Part { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, + fromAmino(object: PartAmino): Part { + const message = createBasePart(); + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.bytes !== undefined && object.bytes !== null) { + message.bytes = bytesFromBase64(object.bytes); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: Part): PartAmino { + const obj: any = {}; + obj.index = message.index === 0 ? undefined : message.index; + obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: PartAminoMsg): Part { + return Part.fromAmino(object.value); + }, + fromProtoMsg(message: PartProtoMsg): Part { + return Part.decode(message.value); + }, + toProto(message: Part): Uint8Array { + return Part.encode(message).finish(); + }, + toProtoMsg(message: Part): PartProtoMsg { + return { + typeUrl: "/tendermint.types.Part", + value: Part.encode(message).finish() + }; + } +}; +function createBaseBlockID(): BlockID { + return { + hash: new Uint8Array(), + partSetHeader: PartSetHeader.fromPartial({}) + }; +} +export const BlockID = { + typeUrl: "/tendermint.types.BlockID", + encode(message: BlockID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(); + message.partSetHeader = object.partSetHeader !== undefined && object.partSetHeader !== null ? PartSetHeader.fromPartial(object.partSetHeader) : undefined; + return message; + }, + fromAmino(object: BlockIDAmino): BlockID { + const message = createBaseBlockID(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.part_set_header !== undefined && object.part_set_header !== null) { + message.partSetHeader = PartSetHeader.fromAmino(object.part_set_header); + } + return message; + }, + toAmino(message: BlockID): BlockIDAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.part_set_header = message.partSetHeader ? PartSetHeader.toAmino(message.partSetHeader) : undefined; + return obj; + }, + fromAminoMsg(object: BlockIDAminoMsg): BlockID { + return BlockID.fromAmino(object.value); + }, + fromProtoMsg(message: BlockIDProtoMsg): BlockID { + return BlockID.decode(message.value); + }, + toProto(message: BlockID): Uint8Array { + return BlockID.encode(message).finish(); + }, + toProtoMsg(message: BlockID): BlockIDProtoMsg { + return { + typeUrl: "/tendermint.types.BlockID", + value: BlockID.encode(message).finish() + }; + } +}; +function createBaseHeader(): Header { + return { + version: Consensus.fromPartial({}), + chainId: "", + height: BigInt(0), + time: new Date(), + lastBlockId: BlockID.fromPartial({}), + lastCommitHash: new Uint8Array(), + dataHash: new Uint8Array(), + validatorsHash: new Uint8Array(), + nextValidatorsHash: new Uint8Array(), + consensusHash: new Uint8Array(), + appHash: new Uint8Array(), + lastResultsHash: new Uint8Array(), + evidenceHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const Header = { + typeUrl: "/tendermint.types.Header", + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = Consensus.decode(reader, reader.uint32()); + break; + case 2: + message.chainId = reader.string(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.lastCommitHash = reader.bytes(); + break; + case 7: + message.dataHash = reader.bytes(); + break; + case 8: + message.validatorsHash = reader.bytes(); + break; + case 9: + message.nextValidatorsHash = reader.bytes(); + break; + case 10: + message.consensusHash = reader.bytes(); + break; + case 11: + message.appHash = reader.bytes(); + break; + case 12: + message.lastResultsHash = reader.bytes(); + break; + case 13: + message.evidenceHash = reader.bytes(); + break; + case 14: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial
): Header { + const message = createBaseHeader(); + message.version = object.version !== undefined && object.version !== null ? Consensus.fromPartial(object.version) : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.lastBlockId = object.lastBlockId !== undefined && object.lastBlockId !== null ? BlockID.fromPartial(object.lastBlockId) : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(); + message.dataHash = object.dataHash ?? new Uint8Array(); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.consensusHash = object.consensusHash ?? new Uint8Array(); + message.appHash = object.appHash ?? new Uint8Array(); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.version !== undefined && object.version !== null) { + message.version = Consensus.fromAmino(object.version); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.last_block_id !== undefined && object.last_block_id !== null) { + message.lastBlockId = BlockID.fromAmino(object.last_block_id); + } + if (object.last_commit_hash !== undefined && object.last_commit_hash !== null) { + message.lastCommitHash = bytesFromBase64(object.last_commit_hash); + } + if (object.data_hash !== undefined && object.data_hash !== null) { + message.dataHash = bytesFromBase64(object.data_hash); + } + if (object.validators_hash !== undefined && object.validators_hash !== null) { + message.validatorsHash = bytesFromBase64(object.validators_hash); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.consensus_hash !== undefined && object.consensus_hash !== null) { + message.consensusHash = bytesFromBase64(object.consensus_hash); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + if (object.last_results_hash !== undefined && object.last_results_hash !== null) { + message.lastResultsHash = bytesFromBase64(object.last_results_hash); + } + if (object.evidence_hash !== undefined && object.evidence_hash !== null) { + message.evidenceHash = bytesFromBase64(object.evidence_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.version = message.version ? Consensus.toAmino(message.version) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; + obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; + obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; + obj.validators_hash = message.validatorsHash ? base64FromBytes(message.validatorsHash) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.consensus_hash = message.consensusHash ? base64FromBytes(message.consensusHash) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + obj.last_results_hash = message.lastResultsHash ? base64FromBytes(message.lastResultsHash) : undefined; + obj.evidence_hash = message.evidenceHash ? base64FromBytes(message.evidenceHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/tendermint.types.Header", + value: Header.encode(message).finish() + }; + } +}; +function createBaseData(): Data { + return { + txs: [] + }; +} +export const Data = { + typeUrl: "/tendermint.types.Data", + encode(message: Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Data { + const message = createBaseData(); + message.txs = object.txs?.map(e => e) || []; + return message; + }, + fromAmino(object: DataAmino): Data { + const message = createBaseData(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Data): DataAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + return obj; + }, + fromAminoMsg(object: DataAminoMsg): Data { + return Data.fromAmino(object.value); + }, + fromProtoMsg(message: DataProtoMsg): Data { + return Data.decode(message.value); + }, + toProto(message: Data): Uint8Array { + return Data.encode(message).finish(); + }, + toProtoMsg(message: Data): DataProtoMsg { + return { + typeUrl: "/tendermint.types.Data", + value: Data.encode(message).finish() + }; + } +}; +function createBaseVote(): Vote { + return { + type: 0, + height: BigInt(0), + round: 0, + blockId: BlockID.fromPartial({}), + timestamp: new Date(), + validatorAddress: new Uint8Array(), + validatorIndex: 0, + signature: new Uint8Array() + }; +} +export const Vote = { + typeUrl: "/tendermint.types.Vote", + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.validatorAddress = reader.bytes(); + break; + case 7: + message.validatorIndex = reader.int32(); + break; + case 8: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.validator_index !== undefined && object.validator_index !== null) { + message.validatorIndex = object.validator_index; + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/tendermint.types.Vote", + value: Vote.encode(message).finish() + }; + } +}; +function createBaseCommit(): Commit { + return { + height: BigInt(0), + round: 0, + blockId: BlockID.fromPartial({}), + signatures: [] + }; +} +export const Commit = { + typeUrl: "/tendermint.types.Commit", + encode(message: Commit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 4: + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Commit { + const message = createBaseCommit(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.signatures = object.signatures?.map(e => CommitSig.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CommitAmino): Commit { + const message = createBaseCommit(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + message.signatures = object.signatures?.map(e => CommitSig.fromAmino(e)) || []; + return message; + }, + toAmino(message: Commit): CommitAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: CommitAminoMsg): Commit { + return Commit.fromAmino(object.value); + }, + fromProtoMsg(message: CommitProtoMsg): Commit { + return Commit.decode(message.value); + }, + toProto(message: Commit): Uint8Array { + return Commit.encode(message).finish(); + }, + toProtoMsg(message: Commit): CommitProtoMsg { + return { + typeUrl: "/tendermint.types.Commit", + value: Commit.encode(message).finish() + }; + } +}; +function createBaseCommitSig(): CommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(), + timestamp: new Date(), + signature: new Uint8Array() + }; +} +export const CommitSig = { + typeUrl: "/tendermint.types.CommitSig", + encode(message: CommitSig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockIdFlag = (reader.int32() as any); + break; + case 2: + message.validatorAddress = reader.bytes(); + break; + case 3: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommitSig { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, + fromAmino(object: CommitSigAmino): CommitSig { + const message = createBaseCommitSig(); + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = object.block_id_flag; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: CommitSig): CommitSigAmino { + const obj: any = {}; + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: CommitSigAminoMsg): CommitSig { + return CommitSig.fromAmino(object.value); + }, + fromProtoMsg(message: CommitSigProtoMsg): CommitSig { + return CommitSig.decode(message.value); + }, + toProto(message: CommitSig): Uint8Array { + return CommitSig.encode(message).finish(); + }, + toProtoMsg(message: CommitSig): CommitSigProtoMsg { + return { + typeUrl: "/tendermint.types.CommitSig", + value: CommitSig.encode(message).finish() + }; + } +}; +function createBaseProposal(): Proposal { + return { + type: 0, + height: BigInt(0), + round: 0, + polRound: 0, + blockId: BlockID.fromPartial({}), + timestamp: new Date(), + signature: new Uint8Array() + }; +} +export const Proposal = { + typeUrl: "/tendermint.types.Proposal", + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.polRound = reader.int32(); + break; + case 5: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.pol_round !== undefined && object.pol_round !== null) { + message.polRound = object.pol_round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.pol_round = message.polRound === 0 ? undefined : message.polRound; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/tendermint.types.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +function createBaseSignedHeader(): SignedHeader { + return { + header: undefined, + commit: undefined + }; +} +export const SignedHeader = { + typeUrl: "/tendermint.types.SignedHeader", + encode(message: SignedHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = Header.decode(reader, reader.uint32()); + break; + case 2: + message.commit = Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignedHeader { + const message = createBaseSignedHeader(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? Commit.fromPartial(object.commit) : undefined; + return message; + }, + fromAmino(object: SignedHeaderAmino): SignedHeader { + const message = createBaseSignedHeader(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = Commit.fromAmino(object.commit); + } + return message; + }, + toAmino(message: SignedHeader): SignedHeaderAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.commit = message.commit ? Commit.toAmino(message.commit) : undefined; + return obj; + }, + fromAminoMsg(object: SignedHeaderAminoMsg): SignedHeader { + return SignedHeader.fromAmino(object.value); + }, + fromProtoMsg(message: SignedHeaderProtoMsg): SignedHeader { + return SignedHeader.decode(message.value); + }, + toProto(message: SignedHeader): Uint8Array { + return SignedHeader.encode(message).finish(); + }, + toProtoMsg(message: SignedHeader): SignedHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.SignedHeader", + value: SignedHeader.encode(message).finish() + }; + } +}; +function createBaseLightBlock(): LightBlock { + return { + signedHeader: undefined, + validatorSet: undefined + }; +} +export const LightBlock = { + typeUrl: "/tendermint.types.LightBlock", + encode(message: LightBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): LightBlock { + const message = createBaseLightBlock(); + message.signedHeader = object.signedHeader !== undefined && object.signedHeader !== null ? SignedHeader.fromPartial(object.signedHeader) : undefined; + message.validatorSet = object.validatorSet !== undefined && object.validatorSet !== null ? ValidatorSet.fromPartial(object.validatorSet) : undefined; + return message; + }, + fromAmino(object: LightBlockAmino): LightBlock { + const message = createBaseLightBlock(); + if (object.signed_header !== undefined && object.signed_header !== null) { + message.signedHeader = SignedHeader.fromAmino(object.signed_header); + } + if (object.validator_set !== undefined && object.validator_set !== null) { + message.validatorSet = ValidatorSet.fromAmino(object.validator_set); + } + return message; + }, + toAmino(message: LightBlock): LightBlockAmino { + const obj: any = {}; + obj.signed_header = message.signedHeader ? SignedHeader.toAmino(message.signedHeader) : undefined; + obj.validator_set = message.validatorSet ? ValidatorSet.toAmino(message.validatorSet) : undefined; + return obj; + }, + fromAminoMsg(object: LightBlockAminoMsg): LightBlock { + return LightBlock.fromAmino(object.value); + }, + fromProtoMsg(message: LightBlockProtoMsg): LightBlock { + return LightBlock.decode(message.value); + }, + toProto(message: LightBlock): Uint8Array { + return LightBlock.encode(message).finish(); + }, + toProtoMsg(message: LightBlock): LightBlockProtoMsg { + return { + typeUrl: "/tendermint.types.LightBlock", + value: LightBlock.encode(message).finish() + }; + } +}; +function createBaseBlockMeta(): BlockMeta { + return { + blockId: BlockID.fromPartial({}), + blockSize: BigInt(0), + header: Header.fromPartial({}), + numTxs: BigInt(0) + }; +} +export const BlockMeta = { + typeUrl: "/tendermint.types.BlockMeta", + encode(message: BlockMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); + } + if (message.blockSize !== BigInt(0)) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).ldelim(); + } + if (message.numTxs !== BigInt(0)) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.blockSize = reader.int64(); + break; + case 3: + message.header = Header.decode(reader, reader.uint32()); + break; + case 4: + message.numTxs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockMeta { + const message = createBaseBlockMeta(); + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.blockSize = object.blockSize !== undefined && object.blockSize !== null ? BigInt(object.blockSize.toString()) : BigInt(0); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.numTxs = object.numTxs !== undefined && object.numTxs !== null ? BigInt(object.numTxs.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BlockMetaAmino): BlockMeta { + const message = createBaseBlockMeta(); + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.block_size !== undefined && object.block_size !== null) { + message.blockSize = BigInt(object.block_size); + } + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.num_txs !== undefined && object.num_txs !== null) { + message.numTxs = BigInt(object.num_txs); + } + return message; + }, + toAmino(message: BlockMeta): BlockMetaAmino { + const obj: any = {}; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.block_size = message.blockSize !== BigInt(0) ? message.blockSize.toString() : undefined; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.num_txs = message.numTxs !== BigInt(0) ? message.numTxs.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { + return BlockMeta.fromAmino(object.value); + }, + fromProtoMsg(message: BlockMetaProtoMsg): BlockMeta { + return BlockMeta.decode(message.value); + }, + toProto(message: BlockMeta): Uint8Array { + return BlockMeta.encode(message).finish(); + }, + toProtoMsg(message: BlockMeta): BlockMetaProtoMsg { + return { + typeUrl: "/tendermint.types.BlockMeta", + value: BlockMeta.encode(message).finish() + }; + } +}; +function createBaseTxProof(): TxProof { + return { + rootHash: new Uint8Array(), + data: new Uint8Array(), + proof: undefined + }; +} +export const TxProof = { + typeUrl: "/tendermint.types.TxProof", + encode(message: TxProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rootHash = reader.bytes(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.proof = Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxProof { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, + fromAmino(object: TxProofAmino): TxProof { + const message = createBaseTxProof(); + if (object.root_hash !== undefined && object.root_hash !== null) { + message.rootHash = bytesFromBase64(object.root_hash); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: TxProof): TxProofAmino { + const obj: any = {}; + obj.root_hash = message.rootHash ? base64FromBytes(message.rootHash) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: TxProofAminoMsg): TxProof { + return TxProof.fromAmino(object.value); + }, + fromProtoMsg(message: TxProofProtoMsg): TxProof { + return TxProof.decode(message.value); + }, + toProto(message: TxProof): Uint8Array { + return TxProof.encode(message).finish(); + }, + toProtoMsg(message: TxProof): TxProofProtoMsg { + return { + typeUrl: "/tendermint.types.TxProof", + value: TxProof.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/types/validator.ts b/util/inj-types/tendermint/types/validator.ts new file mode 100644 index 00000000..63d7e8c2 --- /dev/null +++ b/util/inj-types/tendermint/types/validator.ts @@ -0,0 +1,335 @@ +import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +export interface ValidatorSet { + validators: Validator[]; + proposer?: Validator; + totalVotingPower: bigint; +} +export interface ValidatorSetProtoMsg { + typeUrl: "/tendermint.types.ValidatorSet"; + value: Uint8Array; +} +export interface ValidatorSetAmino { + validators?: ValidatorAmino[]; + proposer?: ValidatorAmino; + total_voting_power?: string; +} +export interface ValidatorSetAminoMsg { + type: "/tendermint.types.ValidatorSet"; + value: ValidatorSetAmino; +} +export interface ValidatorSetSDKType { + validators: ValidatorSDKType[]; + proposer?: ValidatorSDKType; + total_voting_power: bigint; +} +export interface Validator { + address: Uint8Array; + pubKey: PublicKey; + votingPower: bigint; + proposerPriority: bigint; +} +export interface ValidatorProtoMsg { + typeUrl: "/tendermint.types.Validator"; + value: Uint8Array; +} +export interface ValidatorAmino { + address?: string; + pub_key?: PublicKeyAmino; + voting_power?: string; + proposer_priority?: string; +} +export interface ValidatorAminoMsg { + type: "/tendermint.types.Validator"; + value: ValidatorAmino; +} +export interface ValidatorSDKType { + address: Uint8Array; + pub_key: PublicKeySDKType; + voting_power: bigint; + proposer_priority: bigint; +} +export interface SimpleValidator { + pubKey?: PublicKey; + votingPower: bigint; +} +export interface SimpleValidatorProtoMsg { + typeUrl: "/tendermint.types.SimpleValidator"; + value: Uint8Array; +} +export interface SimpleValidatorAmino { + pub_key?: PublicKeyAmino; + voting_power?: string; +} +export interface SimpleValidatorAminoMsg { + type: "/tendermint.types.SimpleValidator"; + value: SimpleValidatorAmino; +} +export interface SimpleValidatorSDKType { + pub_key?: PublicKeySDKType; + voting_power: bigint; +} +function createBaseValidatorSet(): ValidatorSet { + return { + validators: [], + proposer: undefined, + totalVotingPower: BigInt(0) + }; +} +export const ValidatorSet = { + typeUrl: "/tendermint.types.ValidatorSet", + encode(message: ValidatorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim(); + } + if (message.totalVotingPower !== BigInt(0)) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 2: + message.proposer = Validator.decode(reader, reader.uint32()); + break; + case 3: + message.totalVotingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorSet { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; + message.proposer = object.proposer !== undefined && object.proposer !== null ? Validator.fromPartial(object.proposer) : undefined; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorSetAmino): ValidatorSet { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = Validator.fromAmino(object.proposer); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + return message; + }, + toAmino(message: ValidatorSet): ValidatorSetAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { + return ValidatorSet.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorSetProtoMsg): ValidatorSet { + return ValidatorSet.decode(message.value); + }, + toProto(message: ValidatorSet): Uint8Array { + return ValidatorSet.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSet): ValidatorSetProtoMsg { + return { + typeUrl: "/tendermint.types.ValidatorSet", + value: ValidatorSet.encode(message).finish() + }; + } +}; +function createBaseValidator(): Validator { + return { + address: new Uint8Array(), + pubKey: PublicKey.fromPartial({}), + votingPower: BigInt(0), + proposerPriority: BigInt(0) + }; +} +export const Validator = { + typeUrl: "/tendermint.types.Validator", + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (message.votingPower !== BigInt(0)) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== BigInt(0)) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.bytes(); + break; + case 2: + message.pubKey = PublicKey.decode(reader, reader.uint32()); + break; + case 3: + message.votingPower = reader.int64(); + break; + case 4: + message.proposerPriority = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); + message.proposerPriority = object.proposerPriority !== undefined && object.proposerPriority !== null ? BigInt(object.proposerPriority.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.address !== undefined && object.address !== null) { + message.address = bytesFromBase64(object.address); + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.voting_power !== undefined && object.voting_power !== null) { + message.votingPower = BigInt(object.voting_power); + } + if (object.proposer_priority !== undefined && object.proposer_priority !== null) { + message.proposerPriority = BigInt(object.proposer_priority); + } + return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address ? base64FromBytes(message.address) : undefined; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/tendermint.types.Validator", + value: Validator.encode(message).finish() + }; + } +}; +function createBaseSimpleValidator(): SimpleValidator { + return { + pubKey: undefined, + votingPower: BigInt(0) + }; +} +export const SimpleValidator = { + typeUrl: "/tendermint.types.SimpleValidator", + encode(message: SimpleValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.votingPower !== BigInt(0)) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKey = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.votingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SimpleValidatorAmino): SimpleValidator { + const message = createBaseSimpleValidator(); + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.voting_power !== undefined && object.voting_power !== null) { + message.votingPower = BigInt(object.voting_power); + } + return message; + }, + toAmino(message: SimpleValidator): SimpleValidatorAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { + return SimpleValidator.fromAmino(object.value); + }, + fromProtoMsg(message: SimpleValidatorProtoMsg): SimpleValidator { + return SimpleValidator.decode(message.value); + }, + toProto(message: SimpleValidator): Uint8Array { + return SimpleValidator.encode(message).finish(); + }, + toProtoMsg(message: SimpleValidator): SimpleValidatorProtoMsg { + return { + typeUrl: "/tendermint.types.SimpleValidator", + value: SimpleValidator.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/tendermint/version/types.ts b/util/inj-types/tendermint/version/types.ts new file mode 100644 index 00000000..a5c9ecf5 --- /dev/null +++ b/util/inj-types/tendermint/version/types.ts @@ -0,0 +1,222 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface App { + protocol: bigint; + software: string; +} +export interface AppProtoMsg { + typeUrl: "/tendermint.version.App"; + value: Uint8Array; +} +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface AppAmino { + protocol?: string; + software?: string; +} +export interface AppAminoMsg { + type: "/tendermint.version.App"; + value: AppAmino; +} +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface AppSDKType { + protocol: bigint; + software: string; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface Consensus { + block: bigint; + app: bigint; +} +export interface ConsensusProtoMsg { + typeUrl: "/tendermint.version.Consensus"; + value: Uint8Array; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface ConsensusAmino { + block?: string; + app?: string; +} +export interface ConsensusAminoMsg { + type: "/tendermint.version.Consensus"; + value: ConsensusAmino; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface ConsensusSDKType { + block: bigint; + app: bigint; +} +function createBaseApp(): App { + return { + protocol: BigInt(0), + software: "" + }; +} +export const App = { + typeUrl: "/tendermint.version.App", + encode(message: App, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.protocol !== BigInt(0)) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.protocol = reader.uint64(); + break; + case 2: + message.software = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): App { + const message = createBaseApp(); + message.protocol = object.protocol !== undefined && object.protocol !== null ? BigInt(object.protocol.toString()) : BigInt(0); + message.software = object.software ?? ""; + return message; + }, + fromAmino(object: AppAmino): App { + const message = createBaseApp(); + if (object.protocol !== undefined && object.protocol !== null) { + message.protocol = BigInt(object.protocol); + } + if (object.software !== undefined && object.software !== null) { + message.software = object.software; + } + return message; + }, + toAmino(message: App): AppAmino { + const obj: any = {}; + obj.protocol = message.protocol !== BigInt(0) ? message.protocol.toString() : undefined; + obj.software = message.software === "" ? undefined : message.software; + return obj; + }, + fromAminoMsg(object: AppAminoMsg): App { + return App.fromAmino(object.value); + }, + fromProtoMsg(message: AppProtoMsg): App { + return App.decode(message.value); + }, + toProto(message: App): Uint8Array { + return App.encode(message).finish(); + }, + toProtoMsg(message: App): AppProtoMsg { + return { + typeUrl: "/tendermint.version.App", + value: App.encode(message).finish() + }; + } +}; +function createBaseConsensus(): Consensus { + return { + block: BigInt(0), + app: BigInt(0) + }; +} +export const Consensus = { + typeUrl: "/tendermint.version.Consensus", + encode(message: Consensus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.block !== BigInt(0)) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== BigInt(0)) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = reader.uint64(); + break; + case 2: + message.app = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Consensus { + const message = createBaseConsensus(); + message.block = object.block !== undefined && object.block !== null ? BigInt(object.block.toString()) : BigInt(0); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConsensusAmino): Consensus { + const message = createBaseConsensus(); + if (object.block !== undefined && object.block !== null) { + message.block = BigInt(object.block); + } + if (object.app !== undefined && object.app !== null) { + message.app = BigInt(object.app); + } + return message; + }, + toAmino(message: Consensus): ConsensusAmino { + const obj: any = {}; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusAminoMsg): Consensus { + return Consensus.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusProtoMsg): Consensus { + return Consensus.decode(message.value); + }, + toProto(message: Consensus): Uint8Array { + return Consensus.encode(message).finish(); + }, + toProtoMsg(message: Consensus): ConsensusProtoMsg { + return { + typeUrl: "/tendermint.version.Consensus", + value: Consensus.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/util/inj-types/utf8.ts b/util/inj-types/utf8.ts new file mode 100644 index 00000000..e539a83e --- /dev/null +++ b/util/inj-types/utf8.ts @@ -0,0 +1,148 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.5.0 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright (c) 2016, Daniel Wirtz All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of its author, nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"use strict"; + +/** + * Calculates the UTF8 byte length of a string. + * @param {string} string String + * @returns {number} Byte length + */ +export function utf8Length(str: string) { + let len = 0, + c = 0; + for (let i = 0; i < str.length; ++i) { + c = str.charCodeAt(i); + if (c < 128) len += 1; + else if (c < 2048) len += 2; + else if ( + (c & 0xfc00) === 0xd800 && + (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00 + ) { + ++i; + len += 4; + } else len += 3; + } + return len; +} + +/** + * Reads UTF8 bytes as a string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} String read + */ +export function utf8Read( + buffer: ArrayLike, + start: number, + end: number +) { + const len = end - start; + if (len < 1) return ""; + const chunk = []; + let parts: string[] = [], + i = 0, // char offset + t; // temporary + while (start < end) { + t = buffer[start++]; + if (t < 128) chunk[i++] = t; + else if (t > 191 && t < 224) + chunk[i++] = ((t & 31) << 6) | (buffer[start++] & 63); + else if (t > 239 && t < 365) { + t = + (((t & 7) << 18) | + ((buffer[start++] & 63) << 12) | + ((buffer[start++] & 63) << 6) | + (buffer[start++] & 63)) - + 0x10000; + chunk[i++] = 0xd800 + (t >> 10); + chunk[i++] = 0xdc00 + (t & 1023); + } else + chunk[i++] = + ((t & 15) << 12) | + ((buffer[start++] & 63) << 6) | + (buffer[start++] & 63); + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode(...chunk)); + i = 0; + } + } + if (parts) { + if (i) parts.push(String.fromCharCode(...chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode(...chunk.slice(0, i)); +} + +/** + * Writes a string as UTF8 bytes. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Bytes written + */ +export function utf8Write( + str: string, + buffer: Uint8Array | Array, + offset: number +) { + const start = offset; + let c1, // character 1 + c2; // character 2 + for (let i = 0; i < str.length; ++i) { + c1 = str.charCodeAt(i); + if (c1 < 128) { + buffer[offset++] = c1; + } else if (c1 < 2048) { + buffer[offset++] = (c1 >> 6) | 192; + buffer[offset++] = (c1 & 63) | 128; + } else if ( + (c1 & 0xfc00) === 0xd800 && + ((c2 = str.charCodeAt(i + 1)) & 0xfc00) === 0xdc00 + ) { + c1 = 0x10000 + ((c1 & 0x03ff) << 10) + (c2 & 0x03ff); + ++i; + buffer[offset++] = (c1 >> 18) | 240; + buffer[offset++] = ((c1 >> 12) & 63) | 128; + buffer[offset++] = ((c1 >> 6) & 63) | 128; + buffer[offset++] = (c1 & 63) | 128; + } else { + buffer[offset++] = (c1 >> 12) | 224; + buffer[offset++] = ((c1 >> 6) & 63) | 128; + buffer[offset++] = (c1 & 63) | 128; + } + } + return offset - start; +} diff --git a/util/inj-types/varint.ts b/util/inj-types/varint.ts new file mode 100644 index 00000000..514ab4a5 --- /dev/null +++ b/util/inj-types/varint.ts @@ -0,0 +1,488 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.5.0 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright 2008 Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Code generated by the Protocol Buffer compiler is owned by the owner +// of the input file used when generating it. This code is not +// standalone and requires a support library to be linked with it. This +// support library is itself covered by the above license. + +/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */ + +/** + * Read a 64 bit varint as two JS numbers. + * + * Returns tuple: + * [0]: low bits + * [1]: high bits + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175 + */ +export function varint64read(this: ReaderLike): [number, number] { + let lowBits = 0; + let highBits = 0; + + for (let shift = 0; shift < 28; shift += 7) { + let b = this.buf[this.pos++]; + lowBits |= (b & 0x7f) << shift; + if ((b & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + + let middleByte = this.buf[this.pos++]; + + // last four bits of the first 32 bit number + lowBits |= (middleByte & 0x0f) << 28; + + // 3 upper bits are part of the next 32 bit number + highBits = (middleByte & 0x70) >> 4; + + if ((middleByte & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + + for (let shift = 3; shift <= 31; shift += 7) { + let b = this.buf[this.pos++]; + highBits |= (b & 0x7f) << shift; + if ((b & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + + throw new Error("invalid varint"); +} + +/** + * Write a 64 bit varint, given as two JS numbers, to the given bytes array. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344 + */ +export function varint64write(lo: number, hi: number, bytes: number[]): void { + for (let i = 0; i < 28; i = i + 7) { + const shift = lo >>> i; + const hasNext = !(shift >>> 7 == 0 && hi == 0); + const byte = (hasNext ? shift | 0x80 : shift) & 0xff; + bytes.push(byte); + if (!hasNext) { + return; + } + } + + const splitBits = ((lo >>> 28) & 0x0f) | ((hi & 0x07) << 4); + const hasMoreBits = !(hi >> 3 == 0); + bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xff); + + if (!hasMoreBits) { + return; + } + + for (let i = 3; i < 31; i = i + 7) { + const shift = hi >>> i; + const hasNext = !(shift >>> 7 == 0); + const byte = (hasNext ? shift | 0x80 : shift) & 0xff; + bytes.push(byte); + if (!hasNext) { + return; + } + } + + bytes.push((hi >>> 31) & 0x01); +} + +// constants for binary math +const TWO_PWR_32_DBL = 0x100000000; + +/** + * Parse decimal string of 64 bit integer value as two JS numbers. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function int64FromString(dec: string): { lo: number; hi: number } { + // Check for minus sign. + const minus = dec[0] === "-"; + if (minus) { + dec = dec.slice(1); + } + + // Work 6 decimal digits at a time, acting like we're converting base 1e6 + // digits to binary. This is safe to do with floating point math because + // Number.isSafeInteger(ALL_32_BITS * 1e6) == true. + const base = 1e6; + let lowBits = 0; + let highBits = 0; + + function add1e6digit(begin: number, end?: number) { + // Note: Number('') is 0. + const digit1e6 = Number(dec.slice(begin, end)); + highBits *= base; + lowBits = lowBits * base + digit1e6; + // Carry bits from lowBits to + if (lowBits >= TWO_PWR_32_DBL) { + highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0); + lowBits = lowBits % TWO_PWR_32_DBL; + } + } + + add1e6digit(-24, -18); + add1e6digit(-18, -12); + add1e6digit(-12, -6); + add1e6digit(-6); + return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits); +} + +/** + * Losslessly converts a 64-bit signed integer in 32:32 split representation + * into a decimal string. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function int64ToString(lo: number, hi: number): string { + let bits = newBits(lo, hi); + // If we're treating the input as a signed value and the high bit is set, do + // a manual two's complement conversion before the decimal conversion. + const negative = bits.hi & 0x80000000; + if (negative) { + bits = negate(bits.lo, bits.hi); + } + const result = uInt64ToString(bits.lo, bits.hi); + return negative ? "-" + result : result; +} + +/** + * Losslessly converts a 64-bit unsigned integer in 32:32 split representation + * into a decimal string. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function uInt64ToString(lo: number, hi: number): string { + ({ lo, hi } = toUnsigned(lo, hi)); + // Skip the expensive conversion if the number is small enough to use the + // built-in conversions. + // Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with + // highBits <= 0x1FFFFF can be safely expressed with a double and retain + // integer precision. + // Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true. + if (hi <= 0x1fffff) { + return String(TWO_PWR_32_DBL * hi + lo); + } + + // What this code is doing is essentially converting the input number from + // base-2 to base-1e7, which allows us to represent the 64-bit range with + // only 3 (very large) digits. Those digits are then trivial to convert to + // a base-10 string. + + // The magic numbers used here are - + // 2^24 = 16777216 = (1,6777216) in base-1e7. + // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7. + + // Split 32:32 representation into 16:24:24 representation so our + // intermediate digits don't overflow. + const low = lo & 0xffffff; + const mid = ((lo >>> 24) | (hi << 8)) & 0xffffff; + const high = (hi >> 16) & 0xffff; + + // Assemble our three base-1e7 digits, ignoring carries. The maximum + // value in a digit at this step is representable as a 48-bit integer, which + // can be stored in a 64-bit floating point number. + let digitA = low + mid * 6777216 + high * 6710656; + let digitB = mid + high * 8147497; + let digitC = high * 2; + + // Apply carries from A to B and from B to C. + const base = 10000000; + if (digitA >= base) { + digitB += Math.floor(digitA / base); + digitA %= base; + } + + if (digitB >= base) { + digitC += Math.floor(digitB / base); + digitB %= base; + } + + // If digitC is 0, then we should have returned in the trivial code path + // at the top for non-safe integers. Given this, we can assume both digitB + // and digitA need leading zeros. + return ( + digitC.toString() + + decimalFrom1e7WithLeadingZeros(digitB) + + decimalFrom1e7WithLeadingZeros(digitA) + ); +} + +function toUnsigned(lo: number, hi: number): { lo: number; hi: number } { + return { lo: lo >>> 0, hi: hi >>> 0 }; +} + +function newBits(lo: number, hi: number): { lo: number; hi: number } { + return { lo: lo | 0, hi: hi | 0 }; +} + +/** + * Returns two's compliment negation of input. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers + */ +function negate(lowBits: number, highBits: number) { + highBits = ~highBits; + if (lowBits) { + lowBits = ~lowBits + 1; + } else { + // If lowBits is 0, then bitwise-not is 0xFFFFFFFF, + // adding 1 to that, results in 0x100000000, which leaves + // the low bits 0x0 and simply adds one to the high bits. + highBits += 1; + } + return newBits(lowBits, highBits); +} + +/** + * Returns decimal representation of digit1e7 with leading zeros. + */ +const decimalFrom1e7WithLeadingZeros = (digit1e7: number) => { + const partial = String(digit1e7); + return "0000000".slice(partial.length) + partial; +}; + +/** + * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)` + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144 + */ +export function varint32write(value: number, bytes: number[]): void { + if (value >= 0) { + // write value as varint 32 + while (value > 0x7f) { + bytes.push((value & 0x7f) | 0x80); + value = value >>> 7; + } + bytes.push(value); + } else { + for (let i = 0; i < 9; i++) { + bytes.push((value & 127) | 128); + value = value >> 7; + } + bytes.push(1); + } +} + +/** + * Read an unsigned 32 bit varint. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220 + */ +export function varint32read(this: ReaderLike): number { + let b = this.buf[this.pos++]; + let result = b & 0x7f; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 7; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 14; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 21; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + // Extract only last 4 bits + b = this.buf[this.pos++]; + result |= (b & 0x0f) << 28; + + for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++) + b = this.buf[this.pos++]; + + if ((b & 0x80) != 0) throw new Error("invalid varint"); + + this.assertBounds(); + + // Result can have 32 bits, convert it to unsigned + return result >>> 0; +} + +type ReaderLike = { + buf: Uint8Array; + pos: number; + len: number; + assertBounds(): void; +}; + +/** + * encode zig zag + */ +export function zzEncode(lo: number, hi: number) { + let mask = hi >> 31; + hi = (((hi << 1) | (lo >>> 31)) ^ mask) >>> 0; + lo = ((lo << 1) ^ mask) >>> 0; + return [lo, hi]; +} + +/** + * decode zig zag + */ +export function zzDecode(lo: number, hi: number) { + let mask = -(lo & 1); + lo = (((lo >>> 1) | (hi << 31)) ^ mask) >>> 0; + hi = ((hi >>> 1) ^ mask) >>> 0; + return [lo, hi]; +} + +/** + * unsigned int32 without moving pos. + */ +export function readUInt32(buf: Uint8Array, pos: number) { + return ( + (buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16)) + + buf[pos + 3] * 0x1000000 + ); +} + +/** + * signed int32 without moving pos. + */ +export function readInt32(buf: Uint8Array, pos: number) { + return ( + (buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16)) + + (buf[pos + 3] << 24) + ); +} + +/** + * writing varint32 to pos + */ +export function writeVarint32( + val: number, + buf: Uint8Array | number[], + pos: number +) { + while (val > 127) { + buf[pos++] = (val & 127) | 128; + val >>>= 7; + } + buf[pos] = val; +} + +/** + * writing varint64 to pos + */ +export function writeVarint64( + val: { lo: number; hi: number }, + buf: Uint8Array | number[], + pos: number +) { + while (val.hi) { + buf[pos++] = (val.lo & 127) | 128; + val.lo = ((val.lo >>> 7) | (val.hi << 25)) >>> 0; + val.hi >>>= 7; + } + while (val.lo > 127) { + buf[pos++] = (val.lo & 127) | 128; + val.lo = val.lo >>> 7; + } + buf[pos++] = val.lo; +} + +export function int64Length(lo: number, hi: number) { + let part0 = lo, + part1 = ((lo >>> 28) | (hi << 4)) >>> 0, + part2 = hi >>> 24; + return part2 === 0 + ? part1 === 0 + ? part0 < 16384 + ? part0 < 128 + ? 1 + : 2 + : part0 < 2097152 + ? 3 + : 4 + : part1 < 16384 + ? part1 < 128 + ? 5 + : 6 + : part1 < 2097152 + ? 7 + : 8 + : part2 < 128 + ? 9 + : 10; +} + +export function writeFixed32( + val: number, + buf: Uint8Array | number[], + pos: number +) { + buf[pos] = val & 255; + buf[pos + 1] = (val >>> 8) & 255; + buf[pos + 2] = (val >>> 16) & 255; + buf[pos + 3] = val >>> 24; +} + +export function writeByte( + val: number, + buf: Uint8Array | number[], + pos: number +) { + buf[pos] = val & 255; +}