From 3e8051f7babcda125246f6597f6829348bc3ef6f Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Mon, 11 Dec 2023 11:13:44 -0600 Subject: [PATCH] Added in the IBC Portal module --- app/app.go | 29 +- proto/portal/genesis.proto | 15 + proto/portal/packet.proto | 18 + proto/portal/params.proto | 12 + proto/portal/query.proto | 30 + proto/portal/tx.proto | 13 + testutil/keeper/portal.go | 86 + vue/src/store/generated/index.ts | 2 + .../generated/market/market.portal/index.ts | 145 + .../market/market.portal/module/index.ts | 57 + .../market/market.portal/module/rest.ts | 247 + .../cosmos/base/query/v1beta1/pagination.ts | 328 + .../module/types/gogoproto/gogo.ts | 2 + .../module/types/google/api/annotations.ts | 2 + .../module/types/google/api/http.ts | 706 +++ .../types/google/protobuf/descriptor.ts | 5314 +++++++++++++++++ .../module/types/portal/genesis.ts | 96 + .../module/types/portal/packet.ts | 116 + .../module/types/portal/params.ts | 56 + .../module/types/portal/query.ts | 148 + .../market.portal/module/types/portal/tx.ts | 20 + .../market/market.portal/package.json | 18 + .../generated/market/market.portal/vuex-root | 1 + x/portal/client/cli/query.go | 31 + x/portal/client/cli/query_params.go | 34 + x/portal/client/cli/tx.go | 36 + x/portal/genesis.go | 36 + x/portal/genesis_test.go | 31 + x/portal/handler.go | 26 + x/portal/keeper/grpc_query.go | 7 + x/portal/keeper/grpc_query_params.go | 19 + x/portal/keeper/grpc_query_params_test.go | 21 + x/portal/keeper/keeper.go | 57 + x/portal/keeper/msg_server.go | 17 + x/portal/keeper/msg_server_test.go | 16 + x/portal/keeper/params.go | 16 + x/portal/keeper/params_test.go | 18 + x/portal/module.go | 177 + x/portal/module_ibc.go | 228 + x/portal/module_simulation.go | 65 + x/portal/simulation/simap.go | 15 + x/portal/types/codec.go | 23 + x/portal/types/errors.go | 14 + x/portal/types/events_ibc.go | 11 + x/portal/types/expected_keepers.go | 18 + x/portal/types/genesis.go | 29 + x/portal/types/genesis.pb.go | 371 ++ x/portal/types/genesis_test.go | 40 + x/portal/types/keys.go | 33 + x/portal/types/packet.pb.go | 498 ++ x/portal/types/params.go | 39 + x/portal/types/params.pb.go | 263 + x/portal/types/query.pb.go | 536 ++ x/portal/types/query.pb.gw.go | 153 + x/portal/types/tx.pb.go | 79 + x/portal/types/types.go | 1 + 56 files changed, 10418 insertions(+), 1 deletion(-) create mode 100644 proto/portal/genesis.proto create mode 100644 proto/portal/packet.proto create mode 100644 proto/portal/params.proto create mode 100644 proto/portal/query.proto create mode 100644 proto/portal/tx.proto create mode 100644 testutil/keeper/portal.go create mode 100755 vue/src/store/generated/market/market.portal/index.ts create mode 100755 vue/src/store/generated/market/market.portal/module/index.ts create mode 100644 vue/src/store/generated/market/market.portal/module/rest.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/cosmos/base/query/v1beta1/pagination.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/gogoproto/gogo.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/google/api/annotations.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/google/api/http.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/google/protobuf/descriptor.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/portal/genesis.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/portal/packet.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/portal/params.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/portal/query.ts create mode 100644 vue/src/store/generated/market/market.portal/module/types/portal/tx.ts create mode 100755 vue/src/store/generated/market/market.portal/package.json create mode 100755 vue/src/store/generated/market/market.portal/vuex-root create mode 100644 x/portal/client/cli/query.go create mode 100644 x/portal/client/cli/query_params.go create mode 100644 x/portal/client/cli/tx.go create mode 100644 x/portal/genesis.go create mode 100644 x/portal/genesis_test.go create mode 100644 x/portal/handler.go create mode 100644 x/portal/keeper/grpc_query.go create mode 100644 x/portal/keeper/grpc_query_params.go create mode 100644 x/portal/keeper/grpc_query_params_test.go create mode 100644 x/portal/keeper/keeper.go create mode 100644 x/portal/keeper/msg_server.go create mode 100644 x/portal/keeper/msg_server_test.go create mode 100644 x/portal/keeper/params.go create mode 100644 x/portal/keeper/params_test.go create mode 100644 x/portal/module.go create mode 100644 x/portal/module_ibc.go create mode 100644 x/portal/module_simulation.go create mode 100644 x/portal/simulation/simap.go create mode 100644 x/portal/types/codec.go create mode 100644 x/portal/types/errors.go create mode 100644 x/portal/types/events_ibc.go create mode 100644 x/portal/types/expected_keepers.go create mode 100644 x/portal/types/genesis.go create mode 100644 x/portal/types/genesis.pb.go create mode 100644 x/portal/types/genesis_test.go create mode 100644 x/portal/types/keys.go create mode 100644 x/portal/types/packet.pb.go create mode 100644 x/portal/types/params.go create mode 100644 x/portal/types/params.pb.go create mode 100644 x/portal/types/query.pb.go create mode 100644 x/portal/types/query.pb.gw.go create mode 100644 x/portal/types/tx.pb.go create mode 100644 x/portal/types/types.go diff --git a/app/app.go b/app/app.go index dac2b2af..e9be7f35 100644 --- a/app/app.go +++ b/app/app.go @@ -103,6 +103,9 @@ import ( marketmodule "market/x/market" marketmodulekeeper "market/x/market/keeper" marketmoduletypes "market/x/market/types" + portalmodule "market/x/portal" + portalmodulekeeper "market/x/portal/keeper" + portalmoduletypes "market/x/portal/types" // this line is used by starport scaffolding # stargate/app/moduleImport ) @@ -158,6 +161,7 @@ var ( vesting.AppModuleBasic{}, monitoringp.AppModuleBasic{}, marketmodule.AppModuleBasic{}, + portalmodule.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic ) @@ -230,7 +234,9 @@ type App struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper ScopedMonitoringKeeper capabilitykeeper.ScopedKeeper - MarketKeeper marketmodulekeeper.Keeper + MarketKeeper marketmodulekeeper.Keeper + ScopedPortalKeeper capabilitykeeper.ScopedKeeper + PortalKeeper portalmodulekeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration // mm is the module manager @@ -268,6 +274,7 @@ func New( govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, monitoringptypes.StoreKey, marketmoduletypes.StoreKey, + portalmoduletypes.StoreKey, // this line is used by starport scaffolding # stargate/app/storeKey ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -397,12 +404,26 @@ func New( ) marketModule := marketmodule.NewAppModule(appCodec, app.MarketKeeper, app.AccountKeeper, app.BankKeeper) + scopedPortalKeeper := app.CapabilityKeeper.ScopeToModule(portalmoduletypes.ModuleName) + app.ScopedPortalKeeper = scopedPortalKeeper + app.PortalKeeper = *portalmodulekeeper.NewKeeper( + appCodec, + keys[portalmoduletypes.StoreKey], + keys[portalmoduletypes.MemStoreKey], + app.GetSubspace(portalmoduletypes.ModuleName), + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, + scopedPortalKeeper, + ) + portalModule := portalmodule.NewAppModule(appCodec, app.PortalKeeper, app.AccountKeeper, app.BankKeeper) + // this line is used by starport scaffolding # stargate/app/keeperDefinition // Create static IBC router, add transfer route, then set and seal it ibcRouter := ibcporttypes.NewRouter() ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule) ibcRouter.AddRoute(monitoringptypes.ModuleName, monitoringModule) + ibcRouter.AddRoute(portalmoduletypes.ModuleName, portalModule) // this line is used by starport scaffolding # ibc/app/router app.IBCKeeper.SetRouter(ibcRouter) @@ -439,6 +460,7 @@ func New( transferModule, monitoringModule, marketModule, + portalModule, // this line is used by starport scaffolding # stargate/app/appModule ) @@ -467,6 +489,7 @@ func New( paramstypes.ModuleName, monitoringptypes.ModuleName, marketmoduletypes.ModuleName, + portalmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers ) @@ -491,6 +514,7 @@ func New( ibctransfertypes.ModuleName, monitoringptypes.ModuleName, marketmoduletypes.ModuleName, + portalmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/endBlockers ) @@ -520,6 +544,7 @@ func New( feegrant.ModuleName, monitoringptypes.ModuleName, marketmoduletypes.ModuleName, + portalmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis ) @@ -545,6 +570,7 @@ func New( transferModule, monitoringModule, marketModule, + portalModule, // this line is used by starport scaffolding # stargate/app/appModule ) app.sm.RegisterStoreDecoders() @@ -735,6 +761,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(ibchost.ModuleName) paramsKeeper.Subspace(monitoringptypes.ModuleName) paramsKeeper.Subspace(marketmoduletypes.ModuleName) + paramsKeeper.Subspace(portalmoduletypes.ModuleName) // this line is used by starport scaffolding # stargate/app/paramSubspace return paramsKeeper diff --git a/proto/portal/genesis.proto b/proto/portal/genesis.proto new file mode 100644 index 00000000..1e37291a --- /dev/null +++ b/proto/portal/genesis.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package market.portal; + +import "gogoproto/gogo.proto"; +import "portal/params.proto"; +// this line is used by starport scaffolding # genesis/proto/import + +option go_package = "market/x/portal/types"; + +// GenesisState defines the portal module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + string port_id = 2; + // this line is used by starport scaffolding # genesis/proto/state +} diff --git a/proto/portal/packet.proto b/proto/portal/packet.proto new file mode 100644 index 00000000..89aa0ea6 --- /dev/null +++ b/proto/portal/packet.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package market.portal; + +// this line is used by starport scaffolding # proto/packet/import + +option go_package = "market/x/portal/types"; + +message PortalPacketData { + oneof packet { + NoData noData = 1; + // this line is used by starport scaffolding # ibc/packet/proto/field + } +} + +message NoData { +} + +// this line is used by starport scaffolding # ibc/packet/proto/message diff --git a/proto/portal/params.proto b/proto/portal/params.proto new file mode 100644 index 00000000..3a2a035e --- /dev/null +++ b/proto/portal/params.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package market.portal; + +import "gogoproto/gogo.proto"; + +option go_package = "market/x/portal/types"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + +} diff --git a/proto/portal/query.proto b/proto/portal/query.proto new file mode 100644 index 00000000..76565bc0 --- /dev/null +++ b/proto/portal/query.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package market.portal; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "portal/params.proto"; +// this line is used by starport scaffolding # 1 + +option go_package = "market/x/portal/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/market/portal/params"; + } + // this line is used by starport scaffolding # 2 +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false]; +} + +// this line is used by starport scaffolding # 3 diff --git a/proto/portal/tx.proto b/proto/portal/tx.proto new file mode 100644 index 00000000..60c3e771 --- /dev/null +++ b/proto/portal/tx.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package market.portal; + +// this line is used by starport scaffolding # proto/tx/import + +option go_package = "market/x/portal/types"; + +// Msg defines the Msg service. +service Msg { + // this line is used by starport scaffolding # proto/tx/rpc +} + +// this line is used by starport scaffolding # proto/tx/message diff --git a/testutil/keeper/portal.go b/testutil/keeper/portal.go new file mode 100644 index 00000000..7cfc8387 --- /dev/null +++ b/testutil/keeper/portal.go @@ -0,0 +1,86 @@ +package keeper + +import ( + "testing" + + "market/x/portal/keeper" + "market/x/portal/types" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmdb "github.com/tendermint/tm-db" +) + +// portalChannelKeeper is a stub of cosmosibckeeper.ChannelKeeper. +type portalChannelKeeper struct{} + +func (portalChannelKeeper) GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) { + return channeltypes.Channel{}, false +} +func (portalChannelKeeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) { + return 0, false +} +func (portalChannelKeeper) SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error { + return nil +} +func (portalChannelKeeper) ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error { + return nil +} + +// portalportKeeper is a stub of cosmosibckeeper.PortKeeper +type portalPortKeeper struct{} + +func (portalPortKeeper) BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability { + return &capabilitytypes.Capability{} +} + +func PortalKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { + logger := log.NewNopLogger() + + storeKey := sdk.NewKVStoreKey(types.StoreKey) + memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + + db := tmdb.NewMemDB() + stateStore := store.NewCommitMultiStore(db) + stateStore.MountStoreWithDB(storeKey, sdk.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(memStoreKey, sdk.StoreTypeMemory, nil) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + appCodec := codec.NewProtoCodec(registry) + capabilityKeeper := capabilitykeeper.NewKeeper(appCodec, storeKey, memStoreKey) + + paramsSubspace := typesparams.NewSubspace(appCodec, + types.Amino, + storeKey, + memStoreKey, + "PortalParams", + ) + k := keeper.NewKeeper( + appCodec, + storeKey, + memStoreKey, + paramsSubspace, + portalChannelKeeper{}, + portalPortKeeper{}, + capabilityKeeper.ScopeToModule("PortalScopedKeeper"), + ) + + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, logger) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} diff --git a/vue/src/store/generated/index.ts b/vue/src/store/generated/index.ts index 6571e0ea..9f316395 100644 --- a/vue/src/store/generated/index.ts +++ b/vue/src/store/generated/index.ts @@ -21,6 +21,7 @@ import CosmosIbcGoIbcCoreClientV1 from './cosmos/ibc-go/ibc.core.client.v1' import CosmosIbcGoIbcCoreConnectionV1 from './cosmos/ibc-go/ibc.core.connection.v1' import CosmosIbcGoIbcCorePortV1 from './cosmos/ibc-go/ibc.core.port.v1' import MarketMarketMarket from './market/market.market' +import MarketMarketPortal from './market/market.portal' export default { @@ -45,6 +46,7 @@ export default { CosmosIbcGoIbcCoreConnectionV1: load(CosmosIbcGoIbcCoreConnectionV1, 'ibc.core.connection.v1'), CosmosIbcGoIbcCorePortV1: load(CosmosIbcGoIbcCorePortV1, 'ibc.core.port.v1'), MarketMarketMarket: load(MarketMarketMarket, 'market.market'), + MarketMarketPortal: load(MarketMarketPortal, 'market.portal'), } diff --git a/vue/src/store/generated/market/market.portal/index.ts b/vue/src/store/generated/market/market.portal/index.ts new file mode 100755 index 00000000..ae2a6e04 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/index.ts @@ -0,0 +1,145 @@ +import { txClient, queryClient, MissingWalletError , registry} from './module' + +import { PortalPacketData } from "./module/types/portal/packet" +import { NoData } from "./module/types/portal/packet" +import { Params } from "./module/types/portal/params" + + +export { PortalPacketData, NoData, Params }; + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['common/wallet/signer'], { + addr: vuexGetters['common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['common/env/apiCosmos'] + }) +} + +function mergeResults(value, next_values) { + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + return value +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + Params: {}, + + _Structure: { + PortalPacketData: getStructure(PortalPacketData.fromPartial({})), + NoData: getStructure(NoData.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + + }, + _Registry: registry, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(JSON.stringify(subscription)) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(JSON.stringify(subscription)) + } + }, + getters: { + getParams: (state) => (params = { params: {}}) => { + if (!( params).query) { + ( params).query=null + } + return state.Params[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + }, + getRegistry: (state) => { + return state._Registry + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('Vuex module: market.portal initialized!') + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach(async (subscription) => { + try { + const sub=JSON.parse(subscription) + await dispatch(sub.action, sub.payload) + }catch(e) { + throw new Error('Subscriptions: ' + e.message) + } + }) + }, + + + + + + + async QueryParams({ commit, rootGetters, getters }, { options: { subscribe, all} = { subscribe:false, all:false}, params, query=null }) { + try { + const key = params ?? {}; + const queryClient=await initQueryClient(rootGetters) + let value= (await queryClient.queryParams()).data + + + commit('QUERY', { query: 'Params', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryParams', payload: { options: { all }, params: {...key},query }}) + return getters['getParams']( { params: {...key}, query}) ?? {} + } catch (e) { + throw new Error('QueryClient:QueryParams API Node Unavailable. Could not perform query: ' + e.message) + + } + }, + + + + + } +} diff --git a/vue/src/store/generated/market/market.portal/module/index.ts b/vue/src/store/generated/market/market.portal/module/index.ts new file mode 100755 index 00000000..67d4b093 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/index.ts @@ -0,0 +1,57 @@ +// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY. + +import { StdFee } from "@cosmjs/launchpad"; +import { SigningStargateClient } from "@cosmjs/stargate"; +import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; +import { Api } from "./rest"; + + +const types = [ + +]; +export const MissingWalletError = new Error("wallet is required"); + +export const registry = new Registry(types); + +const defaultFee = { + amount: [], + gas: "200000", +}; + +interface TxClientOptions { + addr: string +} + +interface SignAndBroadcastOptions { + fee: StdFee, + memo?: string +} + +const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => { + if (!wallet) throw MissingWalletError; + let client; + if (addr) { + client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry }); + }else{ + client = await SigningStargateClient.offline( wallet, { registry }); + } + const { address } = (await wallet.getAccounts())[0]; + + return { + signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo), + + }; +}; + +interface QueryClientOptions { + addr: string +} + +const queryClient = async ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => { + return new Api({ baseUrl: addr }); +}; + +export { + txClient, + queryClient, +}; diff --git a/vue/src/store/generated/market/market.portal/module/rest.ts b/vue/src/store/generated/market/market.portal/module/rest.ts new file mode 100644 index 00000000..3bc2fc7a --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/rest.ts @@ -0,0 +1,247 @@ +/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** + * Params defines the parameters for the module. + */ +export type PortalParams = object; + +/** + * QueryParamsResponse is response type for the Query/Params RPC method. + */ +export interface PortalQueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: PortalParams; +} + +export interface ProtobufAny { + "@type"?: string; +} + +export interface RpcStatus { + /** @format int32 */ + code?: number; + message?: string; + details?: ProtobufAny[]; +} + +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; + +export interface FullRequestParams extends Omit { + /** set parameter to `true` for call `securityWorker` for this request */ + secure?: boolean; + /** request path */ + path: string; + /** content type of request body */ + type?: ContentType; + /** query params */ + query?: QueryParamsType; + /** format of response (i.e. response.json() -> format: "json") */ + format?: keyof Omit; + /** request body */ + body?: unknown; + /** base url */ + baseUrl?: string; + /** request cancellation token */ + cancelToken?: CancelToken; +} + +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType) => RequestParams | void; +} + +export interface HttpResponse extends Response { + data: D; + error: E; +} + +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", +} + +export class HttpClient { + public baseUrl: string = ""; + private securityData: SecurityDataType = null as any; + private securityWorker: null | ApiConfig["securityWorker"] = null; + private abortControllers = new Map(); + + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType) => { + this.securityData = data; + }; + + private addQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + + return ( + encodeURIComponent(key) + + "=" + + encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`) + ); + } + + protected toQueryString(rawQuery?: QueryParamsType): string { + const query = rawQuery || {}; + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); + return keys + .map((key) => + typeof query[key] === "object" && !Array.isArray(query[key]) + ? this.toQueryString(query[key] as QueryParamsType) + : this.addQueryParam(query, key), + ) + .join("&"); + } + + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? `?${queryString}` : ""; + } + + private contentFormatters: Record any> = { + [ContentType.Json]: (input: any) => + input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.FormData]: (input: any) => + Object.keys(input || {}).reduce((data, key) => { + data.append(key, input[key]); + return data; + }, new FormData()), + [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), + }; + + private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } + + private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { + if (this.abortControllers.has(cancelToken)) { + const abortController = this.abortControllers.get(cancelToken); + if (abortController) { + return abortController.signal; + } + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; + + public request = ({ + body, + secure, + path, + type, + query, + format = "json", + baseUrl, + cancelToken, + ...params + }: FullRequestParams): Promise> => { + const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {}; + const requestParams = this.mergeRequestParams(params, secureParams); + const queryString = query && this.toQueryString(query); + const payloadFormatter = this.contentFormatters[type || ContentType.Json]; + + return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + ...requestParams, + headers: { + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), + ...(requestParams.headers || {}), + }, + signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response as HttpResponse; + r.data = (null as unknown) as T; + r.error = (null as unknown) as E; + + const data = await response[format]() + .then((data) => { + if (r.ok) { + r.data = data; + } else { + r.error = data; + } + return r; + }) + .catch((e) => { + r.error = e; + return r; + }); + + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} + +/** + * @title portal/genesis.proto + * @version version not set + */ +export class Api extends HttpClient { + /** + * No description + * + * @tags Query + * @name QueryParams + * @summary Parameters queries the parameters of the module. + * @request GET:/market/portal/params + */ + queryParams = (params: RequestParams = {}) => + this.request({ + path: `/market/portal/params`, + method: "GET", + format: "json", + ...params, + }); +} diff --git a/vue/src/store/generated/market/market.portal/module/types/cosmos/base/query/v1beta1/pagination.ts b/vue/src/store/generated/market/market.portal/module/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..9c87ac0c --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,328 @@ +/* eslint-disable */ +import * as Long from "long"; +import { util, configure, Writer, Reader } from "protobufjs/minimal"; + +export const protobufPackage = "cosmos.base.query.v1beta1"; + +/** + * 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: number; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: number; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + count_total: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} + +/** + * 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 + */ + next_key: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} + +const basePageRequest: object = { + offset: 0, + limit: 0, + count_total: false, + reverse: false, +}; + +export const PageRequest = { + encode(message: PageRequest, writer: Writer = Writer.create()): Writer { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.count_total === true) { + writer.uint32(32).bool(message.count_total); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...basePageRequest } as PageRequest; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.offset = longToNumber(reader.uint64() as Long); + break; + case 3: + message.limit = longToNumber(reader.uint64() as Long); + break; + case 4: + message.count_total = reader.bool(); + break; + case 5: + message.reverse = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PageRequest { + const message = { ...basePageRequest } as PageRequest; + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.offset !== undefined && object.offset !== null) { + message.offset = Number(object.offset); + } else { + message.offset = 0; + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = Number(object.limit); + } else { + message.limit = 0; + } + if (object.count_total !== undefined && object.count_total !== null) { + message.count_total = Boolean(object.count_total); + } else { + message.count_total = false; + } + if (object.reverse !== undefined && object.reverse !== null) { + message.reverse = Boolean(object.reverse); + } else { + message.reverse = false; + } + return message; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes( + message.key !== undefined ? message.key : new Uint8Array() + )); + message.offset !== undefined && (obj.offset = message.offset); + message.limit !== undefined && (obj.limit = message.limit); + message.count_total !== undefined && + (obj.count_total = message.count_total); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + + fromPartial(object: DeepPartial): PageRequest { + const message = { ...basePageRequest } as PageRequest; + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } else { + message.key = new Uint8Array(); + } + if (object.offset !== undefined && object.offset !== null) { + message.offset = object.offset; + } else { + message.offset = 0; + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = object.limit; + } else { + message.limit = 0; + } + if (object.count_total !== undefined && object.count_total !== null) { + message.count_total = object.count_total; + } else { + message.count_total = false; + } + if (object.reverse !== undefined && object.reverse !== null) { + message.reverse = object.reverse; + } else { + message.reverse = false; + } + return message; + }, +}; + +const basePageResponse: object = { total: 0 }; + +export const PageResponse = { + encode(message: PageResponse, writer: Writer = Writer.create()): Writer { + if (message.next_key.length !== 0) { + writer.uint32(10).bytes(message.next_key); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...basePageResponse } as PageResponse; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.next_key = reader.bytes(); + break; + case 2: + message.total = longToNumber(reader.uint64() as Long); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PageResponse { + const message = { ...basePageResponse } as PageResponse; + if (object.next_key !== undefined && object.next_key !== null) { + message.next_key = bytesFromBase64(object.next_key); + } + if (object.total !== undefined && object.total !== null) { + message.total = Number(object.total); + } else { + message.total = 0; + } + return message; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + message.next_key !== undefined && + (obj.next_key = base64FromBytes( + message.next_key !== undefined ? message.next_key : new Uint8Array() + )); + message.total !== undefined && (obj.total = message.total); + return obj; + }, + + fromPartial(object: DeepPartial): PageResponse { + const message = { ...basePageResponse } as PageResponse; + if (object.next_key !== undefined && object.next_key !== null) { + message.next_key = object.next_key; + } else { + message.next_key = new Uint8Array(); + } + if (object.total !== undefined && object.total !== null) { + message.total = object.total; + } else { + message.total = 0; + } + return message; + }, +}; + +declare var self: any | undefined; +declare var window: 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")); +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")); +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + for (let i = 0; i < arr.byteLength; ++i) { + bin.push(String.fromCharCode(arr[i])); + } + return btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (util.Long !== Long) { + util.Long = Long as any; + configure(); +} diff --git a/vue/src/store/generated/market/market.portal/module/types/gogoproto/gogo.ts b/vue/src/store/generated/market/market.portal/module/types/gogoproto/gogo.ts new file mode 100644 index 00000000..3f41a047 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/gogoproto/gogo.ts @@ -0,0 +1,2 @@ +/* eslint-disable */ +export const protobufPackage = "gogoproto"; diff --git a/vue/src/store/generated/market/market.portal/module/types/google/api/annotations.ts b/vue/src/store/generated/market/market.portal/module/types/google/api/annotations.ts new file mode 100644 index 00000000..aace4787 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/google/api/annotations.ts @@ -0,0 +1,2 @@ +/* eslint-disable */ +export const protobufPackage = "google.api"; diff --git a/vue/src/store/generated/market/market.portal/module/types/google/api/http.ts b/vue/src/store/generated/market/market.portal/module/types/google/api/http.ts new file mode 100644 index 00000000..ccadff68 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/google/api/http.ts @@ -0,0 +1,706 @@ +/* eslint-disable */ +import { Writer, Reader } from "protobufjs/minimal"; + +export const protobufPackage = "google.api"; + +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fully_decode_reserved_expansion: boolean; +} + +/** + * `HttpRule` defines the mapping of an RPC method to one or more HTTP + * REST API methods. The mapping specifies how different portions of the RPC + * request message are mapped to URL path, URL query parameters, and + * HTTP request body. The mapping is typically specified as an + * `google.api.http` annotation on the RPC method, + * see "google/api/annotations.proto" for details. + * + * The mapping consists of a field specifying the path template and + * method kind. The path template can refer to fields in the request + * message, as in the example below which describes a REST GET + * operation on a resource collection of messages: + * + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // mapped to the URL + * SubMessage sub = 2; // `sub.subfield` is url-mapped + * } + * message Message { + * string text = 1; // content of the resource + * } + * + * The same http annotation can alternatively be expressed inside the + * `GRPC API Configuration` YAML file. + * + * http: + * rules: + * - selector: .Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * This definition enables an automatic, bidrectional mapping of HTTP + * JSON to RPC. Example: + * + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * + * In general, not only fields but also field paths can be referenced + * from a path pattern. Fields mapped to the path pattern cannot be + * repeated and must have a primitive (non-message) type. + * + * Any fields in the request message which are not bound by the path + * pattern automatically become (optional) HTTP query + * parameters. Assume the following definition of the request message: + * + * + * 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 the URL + * int64 revision = 2; // becomes a parameter + * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * } + * + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | RPC + * -----|----- + * `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 HTTP parameters must have a + * primitive type or a repeated primitive type. Message types are not + * allowed. In the case of a repeated type, the parameter can be + * repeated in the URL, as in `...?param=A¶m=B`. + * + * For HTTP method kinds which 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) = { + * put: "/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 | RPC + * -----|----- + * `PUT /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) = { + * put: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | RPC + * -----|----- + * `PUT /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 of + * 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 | RPC + * -----|----- + * `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 + * + * The rules for mapping HTTP path, query parameters, and body fields + * to the request message are as follows: + * + * 1. The `body` field specifies either `*` or a field path, or is + * omitted. If omitted, it indicates there is no HTTP request body. + * 2. Leaf fields (recursive expansion of nested messages in the + * request) can be classified into three types: + * (a) Matched in the URL template. + * (b) Covered by body (if body is `*`, everything except (a) fields; + * else everything under the body field) + * (c) All other fields. + * 3. URL query parameters found in the HTTP request are mapped to (c) fields. + * 4. Any body sent with an HTTP request can contain only (b) fields. + * + * The syntax of the path template is as follows: + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single path segment. The syntax `**` matches zero + * or more path segments, which must be the last part of the path except the + * `Verb`. The syntax `LITERAL` matches literal text in the path. + * + * 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=*}`. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path, all characters + * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the + * Discovery Document as `{var}`. + * + * If a variable contains one or more path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path, all + * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables + * show up in the Discovery Document as `{+var}`. + * + * NOTE: While the single segment variable matches the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 + * Simple String Expansion, the multi segment variable **does not** match + * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. + * + * NOTE: the field paths in variables and in the `body` must not refer to + * repeated fields or map fields. + */ +export interface HttpRule { + /** + * Selects methods to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + */ + selector: string; + /** Used for listing and getting information about resources. */ + get: string | undefined; + /** Used for updating a resource. */ + put: string | undefined; + /** Used for creating a resource. */ + post: string | undefined; + /** Used for deleting a resource. */ + delete: string | undefined; + /** Used for updating a resource. */ + patch: string | undefined; + /** + * 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 | undefined; + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + */ + response_body: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additional_bindings: HttpRule[]; +} + +/** 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; +} + +const baseHttp: object = { fully_decode_reserved_expansion: false }; + +export const Http = { + encode(message: Http, writer: Writer = Writer.create()): Writer { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fully_decode_reserved_expansion === true) { + writer.uint32(16).bool(message.fully_decode_reserved_expansion); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): Http { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseHttp } as Http; + message.rules = []; + 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.fully_decode_reserved_expansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Http { + const message = { ...baseHttp } as Http; + message.rules = []; + if (object.rules !== undefined && object.rules !== null) { + for (const e of object.rules) { + message.rules.push(HttpRule.fromJSON(e)); + } + } + if ( + object.fully_decode_reserved_expansion !== undefined && + object.fully_decode_reserved_expansion !== null + ) { + message.fully_decode_reserved_expansion = Boolean( + object.fully_decode_reserved_expansion + ); + } else { + message.fully_decode_reserved_expansion = false; + } + return message; + }, + + toJSON(message: Http): unknown { + const obj: any = {}; + if (message.rules) { + obj.rules = message.rules.map((e) => + e ? HttpRule.toJSON(e) : undefined + ); + } else { + obj.rules = []; + } + message.fully_decode_reserved_expansion !== undefined && + (obj.fully_decode_reserved_expansion = + message.fully_decode_reserved_expansion); + return obj; + }, + + fromPartial(object: DeepPartial): Http { + const message = { ...baseHttp } as Http; + message.rules = []; + if (object.rules !== undefined && object.rules !== null) { + for (const e of object.rules) { + message.rules.push(HttpRule.fromPartial(e)); + } + } + if ( + object.fully_decode_reserved_expansion !== undefined && + object.fully_decode_reserved_expansion !== null + ) { + message.fully_decode_reserved_expansion = + object.fully_decode_reserved_expansion; + } else { + message.fully_decode_reserved_expansion = false; + } + return message; + }, +}; + +const baseHttpRule: object = { selector: "", body: "", response_body: "" }; + +export const HttpRule = { + encode(message: HttpRule, writer: Writer = Writer.create()): Writer { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode( + message.custom, + writer.uint32(66).fork() + ).ldelim(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.response_body !== "") { + writer.uint32(98).string(message.response_body); + } + for (const v of message.additional_bindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseHttpRule } as HttpRule; + message.additional_bindings = []; + 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.response_body = reader.string(); + break; + case 11: + message.additional_bindings.push( + HttpRule.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): HttpRule { + const message = { ...baseHttpRule } as HttpRule; + message.additional_bindings = []; + if (object.selector !== undefined && object.selector !== null) { + message.selector = String(object.selector); + } else { + message.selector = ""; + } + if (object.get !== undefined && object.get !== null) { + message.get = String(object.get); + } else { + message.get = undefined; + } + if (object.put !== undefined && object.put !== null) { + message.put = String(object.put); + } else { + message.put = undefined; + } + if (object.post !== undefined && object.post !== null) { + message.post = String(object.post); + } else { + message.post = undefined; + } + if (object.delete !== undefined && object.delete !== null) { + message.delete = String(object.delete); + } else { + message.delete = undefined; + } + if (object.patch !== undefined && object.patch !== null) { + message.patch = String(object.patch); + } else { + message.patch = undefined; + } + if (object.custom !== undefined && object.custom !== null) { + message.custom = CustomHttpPattern.fromJSON(object.custom); + } else { + message.custom = undefined; + } + if (object.body !== undefined && object.body !== null) { + message.body = String(object.body); + } else { + message.body = ""; + } + if (object.response_body !== undefined && object.response_body !== null) { + message.response_body = String(object.response_body); + } else { + message.response_body = ""; + } + if ( + object.additional_bindings !== undefined && + object.additional_bindings !== null + ) { + for (const e of object.additional_bindings) { + message.additional_bindings.push(HttpRule.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: HttpRule): unknown { + const obj: any = {}; + message.selector !== undefined && (obj.selector = message.selector); + message.get !== undefined && (obj.get = message.get); + message.put !== undefined && (obj.put = message.put); + message.post !== undefined && (obj.post = message.post); + message.delete !== undefined && (obj.delete = message.delete); + message.patch !== undefined && (obj.patch = message.patch); + message.custom !== undefined && + (obj.custom = message.custom + ? CustomHttpPattern.toJSON(message.custom) + : undefined); + message.body !== undefined && (obj.body = message.body); + message.response_body !== undefined && + (obj.response_body = message.response_body); + if (message.additional_bindings) { + obj.additional_bindings = message.additional_bindings.map((e) => + e ? HttpRule.toJSON(e) : undefined + ); + } else { + obj.additional_bindings = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): HttpRule { + const message = { ...baseHttpRule } as HttpRule; + message.additional_bindings = []; + if (object.selector !== undefined && object.selector !== null) { + message.selector = object.selector; + } else { + message.selector = ""; + } + if (object.get !== undefined && object.get !== null) { + message.get = object.get; + } else { + message.get = undefined; + } + if (object.put !== undefined && object.put !== null) { + message.put = object.put; + } else { + message.put = undefined; + } + if (object.post !== undefined && object.post !== null) { + message.post = object.post; + } else { + message.post = undefined; + } + if (object.delete !== undefined && object.delete !== null) { + message.delete = object.delete; + } else { + message.delete = undefined; + } + if (object.patch !== undefined && object.patch !== null) { + message.patch = object.patch; + } else { + message.patch = undefined; + } + if (object.custom !== undefined && object.custom !== null) { + message.custom = CustomHttpPattern.fromPartial(object.custom); + } else { + message.custom = undefined; + } + if (object.body !== undefined && object.body !== null) { + message.body = object.body; + } else { + message.body = ""; + } + if (object.response_body !== undefined && object.response_body !== null) { + message.response_body = object.response_body; + } else { + message.response_body = ""; + } + if ( + object.additional_bindings !== undefined && + object.additional_bindings !== null + ) { + for (const e of object.additional_bindings) { + message.additional_bindings.push(HttpRule.fromPartial(e)); + } + } + return message; + }, +}; + +const baseCustomHttpPattern: object = { kind: "", path: "" }; + +export const CustomHttpPattern = { + encode(message: CustomHttpPattern, writer: Writer = Writer.create()): Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseCustomHttpPattern } as CustomHttpPattern; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.kind = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CustomHttpPattern { + const message = { ...baseCustomHttpPattern } as CustomHttpPattern; + if (object.kind !== undefined && object.kind !== null) { + message.kind = String(object.kind); + } else { + message.kind = ""; + } + if (object.path !== undefined && object.path !== null) { + message.path = String(object.path); + } else { + message.path = ""; + } + return message; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.path !== undefined && (obj.path = message.path); + return obj; + }, + + fromPartial(object: DeepPartial): CustomHttpPattern { + const message = { ...baseCustomHttpPattern } as CustomHttpPattern; + if (object.kind !== undefined && object.kind !== null) { + message.kind = object.kind; + } else { + message.kind = ""; + } + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } else { + message.path = ""; + } + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/vue/src/store/generated/market/market.portal/module/types/google/protobuf/descriptor.ts b/vue/src/store/generated/market/market.portal/module/types/google/protobuf/descriptor.ts new file mode 100644 index 00000000..a0167cb2 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/google/protobuf/descriptor.ts @@ -0,0 +1,5314 @@ +/* eslint-disable */ +import * as Long from "long"; +import { util, configure, Writer, Reader } from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} + +/** Describes a complete .proto file. */ +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name: string; + /** e.g. "foo", "foo.bar", etc. */ + package: string; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + public_dependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weak_dependency: number[]; + /** All top-level definitions in this file. */ + message_type: DescriptorProto[]; + enum_type: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options: FileOptions | undefined; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + source_code_info: SourceCodeInfo | undefined; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax: string; +} + +/** Describes a message type. */ +export interface DescriptorProto { + name: string; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nested_type: DescriptorProto[]; + enum_type: EnumDescriptorProto[]; + extension_range: DescriptorProto_ExtensionRange[]; + oneof_decl: OneofDescriptorProto[]; + options: MessageOptions | undefined; + reserved_range: DescriptorProto_ReservedRange[]; + /** + * 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 DescriptorProto_ExtensionRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options: ExtensionRangeOptions | undefined; +} + +/** + * 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 ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +/** 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). + */ + 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: FieldOptions | undefined; + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * + * When proto3_optional is true, this field must be belong to a oneof to + * signal to old proto3 clients that presence is tracked for this field. This + * oneof is known as a "synthetic" oneof, and this field must be its sole + * member (each proto3 optional field gets its own synthetic oneof). Synthetic + * oneofs exist in the descriptor only, and do not generate any API. Synthetic + * oneofs must be ordered after all "real" oneofs. + * + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + */ + proto3_optional: boolean; +} + +export enum 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 - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} + +export 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"; + default: + return "UNKNOWN"; + } +} + +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + UNRECOGNIZED = -1, +} + +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"; + default: + return "UNKNOWN"; + } +} + +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options: OneofOptions | undefined; +} + +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name: string; + value: EnumValueDescriptorProto[]; + options: EnumOptions | undefined; + /** + * 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_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + 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; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options: EnumValueOptions | undefined; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options: ServiceOptions | undefined; +} + +/** 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. + */ + input_type: string; + output_type: string; + options: MethodOptions | undefined; + /** Identifies if client streams multiple client messages */ + client_streaming: boolean; + /** Identifies if server streams multiple server messages */ + server_streaming: boolean; +} + +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + java_package: string; + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + */ + java_outer_classname: string; + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + java_multiple_files: boolean; + /** + * This option does nothing. + * + * @deprecated + */ + java_generate_equals_and_hash: boolean; + /** + * 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: UninterpretedOption[]; +} + +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** SPEED - Generate complete code for parsing, serialization, */ + SPEED = 1, + /** CODE_SIZE - etc. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -1, +} + +export 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"; + default: + return "UNKNOWN"; + } +} + +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + message_set_wire_format: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + no_standard_descriptor_accessor: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + map_entry: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface FieldOptions { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is 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: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} + +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"; + default: + return "UNKNOWN"; + } +} + +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 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"; + default: + return "UNKNOWN"; + } +} + +export interface OneofOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allow_alias: boolean; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface EnumValueOptions { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +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. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface MethodOptions { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated: boolean; + idempotency_level: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +/** + * 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 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"; + default: + return "UNKNOWN"; + } +} + +/** + * 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. + */ + identifier_value: string; + positive_int_value: number; + negative_int_value: number; + 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 { + 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 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. + */ + 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 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. */ + 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; +} + +const baseFileDescriptorSet: object = {}; + +export const FileDescriptorSet = { + encode(message: FileDescriptorSet, writer: Writer = Writer.create()): Writer { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseFileDescriptorSet } as FileDescriptorSet; + message.file = []; + 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; + }, + + fromJSON(object: any): FileDescriptorSet { + const message = { ...baseFileDescriptorSet } as FileDescriptorSet; + message.file = []; + if (object.file !== undefined && object.file !== null) { + for (const e of object.file) { + message.file.push(FileDescriptorProto.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: FileDescriptorSet): unknown { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map((e) => + e ? FileDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.file = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): FileDescriptorSet { + const message = { ...baseFileDescriptorSet } as FileDescriptorSet; + message.file = []; + if (object.file !== undefined && object.file !== null) { + for (const e of object.file) { + message.file.push(FileDescriptorProto.fromPartial(e)); + } + } + return message; + }, +}; + +const baseFileDescriptorProto: object = { + name: "", + package: "", + dependency: "", + public_dependency: 0, + weak_dependency: 0, + syntax: "", +}; + +export const FileDescriptorProto = { + encode( + message: FileDescriptorProto, + writer: Writer = Writer.create() + ): Writer { + 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.public_dependency) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(90).fork(); + for (const v of message.weak_dependency) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.message_type) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.enum_type) { + 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.source_code_info !== undefined) { + SourceCodeInfo.encode( + message.source_code_info, + writer.uint32(74).fork() + ).ldelim(); + } + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseFileDescriptorProto } as FileDescriptorProto; + message.dependency = []; + message.public_dependency = []; + message.weak_dependency = []; + message.message_type = []; + message.enum_type = []; + message.service = []; + message.extension = []; + 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.public_dependency.push(reader.int32()); + } + } else { + message.public_dependency.push(reader.int32()); + } + break; + case 11: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weak_dependency.push(reader.int32()); + } + } else { + message.weak_dependency.push(reader.int32()); + } + break; + case 4: + message.message_type.push( + DescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 5: + message.enum_type.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.source_code_info = SourceCodeInfo.decode( + reader, + reader.uint32() + ); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileDescriptorProto { + const message = { ...baseFileDescriptorProto } as FileDescriptorProto; + message.dependency = []; + message.public_dependency = []; + message.weak_dependency = []; + message.message_type = []; + message.enum_type = []; + message.service = []; + message.extension = []; + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.package !== undefined && object.package !== null) { + message.package = String(object.package); + } else { + message.package = ""; + } + if (object.dependency !== undefined && object.dependency !== null) { + for (const e of object.dependency) { + message.dependency.push(String(e)); + } + } + if ( + object.public_dependency !== undefined && + object.public_dependency !== null + ) { + for (const e of object.public_dependency) { + message.public_dependency.push(Number(e)); + } + } + if ( + object.weak_dependency !== undefined && + object.weak_dependency !== null + ) { + for (const e of object.weak_dependency) { + message.weak_dependency.push(Number(e)); + } + } + if (object.message_type !== undefined && object.message_type !== null) { + for (const e of object.message_type) { + message.message_type.push(DescriptorProto.fromJSON(e)); + } + } + if (object.enum_type !== undefined && object.enum_type !== null) { + for (const e of object.enum_type) { + message.enum_type.push(EnumDescriptorProto.fromJSON(e)); + } + } + if (object.service !== undefined && object.service !== null) { + for (const e of object.service) { + message.service.push(ServiceDescriptorProto.fromJSON(e)); + } + } + if (object.extension !== undefined && object.extension !== null) { + for (const e of object.extension) { + message.extension.push(FieldDescriptorProto.fromJSON(e)); + } + } + if (object.options !== undefined && object.options !== null) { + message.options = FileOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + if ( + object.source_code_info !== undefined && + object.source_code_info !== null + ) { + message.source_code_info = SourceCodeInfo.fromJSON( + object.source_code_info + ); + } else { + message.source_code_info = undefined; + } + if (object.syntax !== undefined && object.syntax !== null) { + message.syntax = String(object.syntax); + } else { + message.syntax = ""; + } + return message; + }, + + toJSON(message: FileDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.package !== undefined && (obj.package = message.package); + if (message.dependency) { + obj.dependency = message.dependency.map((e) => e); + } else { + obj.dependency = []; + } + if (message.public_dependency) { + obj.public_dependency = message.public_dependency.map((e) => e); + } else { + obj.public_dependency = []; + } + if (message.weak_dependency) { + obj.weak_dependency = message.weak_dependency.map((e) => e); + } else { + obj.weak_dependency = []; + } + if (message.message_type) { + obj.message_type = message.message_type.map((e) => + e ? DescriptorProto.toJSON(e) : undefined + ); + } else { + obj.message_type = []; + } + if (message.enum_type) { + obj.enum_type = message.enum_type.map((e) => + e ? EnumDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.enum_type = []; + } + if (message.service) { + obj.service = message.service.map((e) => + e ? ServiceDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => + e ? FieldDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.extension = []; + } + message.options !== undefined && + (obj.options = message.options + ? FileOptions.toJSON(message.options) + : undefined); + message.source_code_info !== undefined && + (obj.source_code_info = message.source_code_info + ? SourceCodeInfo.toJSON(message.source_code_info) + : undefined); + message.syntax !== undefined && (obj.syntax = message.syntax); + return obj; + }, + + fromPartial(object: DeepPartial): FileDescriptorProto { + const message = { ...baseFileDescriptorProto } as FileDescriptorProto; + message.dependency = []; + message.public_dependency = []; + message.weak_dependency = []; + message.message_type = []; + message.enum_type = []; + message.service = []; + message.extension = []; + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.package !== undefined && object.package !== null) { + message.package = object.package; + } else { + message.package = ""; + } + if (object.dependency !== undefined && object.dependency !== null) { + for (const e of object.dependency) { + message.dependency.push(e); + } + } + if ( + object.public_dependency !== undefined && + object.public_dependency !== null + ) { + for (const e of object.public_dependency) { + message.public_dependency.push(e); + } + } + if ( + object.weak_dependency !== undefined && + object.weak_dependency !== null + ) { + for (const e of object.weak_dependency) { + message.weak_dependency.push(e); + } + } + if (object.message_type !== undefined && object.message_type !== null) { + for (const e of object.message_type) { + message.message_type.push(DescriptorProto.fromPartial(e)); + } + } + if (object.enum_type !== undefined && object.enum_type !== null) { + for (const e of object.enum_type) { + message.enum_type.push(EnumDescriptorProto.fromPartial(e)); + } + } + if (object.service !== undefined && object.service !== null) { + for (const e of object.service) { + message.service.push(ServiceDescriptorProto.fromPartial(e)); + } + } + if (object.extension !== undefined && object.extension !== null) { + for (const e of object.extension) { + message.extension.push(FieldDescriptorProto.fromPartial(e)); + } + } + if (object.options !== undefined && object.options !== null) { + message.options = FileOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + if ( + object.source_code_info !== undefined && + object.source_code_info !== null + ) { + message.source_code_info = SourceCodeInfo.fromPartial( + object.source_code_info + ); + } else { + message.source_code_info = undefined; + } + if (object.syntax !== undefined && object.syntax !== null) { + message.syntax = object.syntax; + } else { + message.syntax = ""; + } + return message; + }, +}; + +const baseDescriptorProto: object = { name: "", reserved_name: "" }; + +export const DescriptorProto = { + encode(message: DescriptorProto, writer: Writer = Writer.create()): Writer { + 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.nested_type) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.enum_type) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.extension_range) { + DescriptorProto_ExtensionRange.encode( + v!, + writer.uint32(42).fork() + ).ldelim(); + } + for (const v of message.oneof_decl) { + 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.reserved_range) { + DescriptorProto_ReservedRange.encode( + v!, + writer.uint32(74).fork() + ).ldelim(); + } + for (const v of message.reserved_name) { + writer.uint32(82).string(v!); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseDescriptorProto } as DescriptorProto; + message.field = []; + message.extension = []; + message.nested_type = []; + message.enum_type = []; + message.extension_range = []; + message.oneof_decl = []; + message.reserved_range = []; + message.reserved_name = []; + 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.nested_type.push( + DescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 4: + message.enum_type.push( + EnumDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 5: + message.extension_range.push( + DescriptorProto_ExtensionRange.decode(reader, reader.uint32()) + ); + break; + case 8: + message.oneof_decl.push( + OneofDescriptorProto.decode(reader, reader.uint32()) + ); + break; + case 7: + message.options = MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + message.reserved_range.push( + DescriptorProto_ReservedRange.decode(reader, reader.uint32()) + ); + break; + case 10: + message.reserved_name.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): DescriptorProto { + const message = { ...baseDescriptorProto } as DescriptorProto; + message.field = []; + message.extension = []; + message.nested_type = []; + message.enum_type = []; + message.extension_range = []; + message.oneof_decl = []; + message.reserved_range = []; + message.reserved_name = []; + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.field !== undefined && object.field !== null) { + for (const e of object.field) { + message.field.push(FieldDescriptorProto.fromJSON(e)); + } + } + if (object.extension !== undefined && object.extension !== null) { + for (const e of object.extension) { + message.extension.push(FieldDescriptorProto.fromJSON(e)); + } + } + if (object.nested_type !== undefined && object.nested_type !== null) { + for (const e of object.nested_type) { + message.nested_type.push(DescriptorProto.fromJSON(e)); + } + } + if (object.enum_type !== undefined && object.enum_type !== null) { + for (const e of object.enum_type) { + message.enum_type.push(EnumDescriptorProto.fromJSON(e)); + } + } + if ( + object.extension_range !== undefined && + object.extension_range !== null + ) { + for (const e of object.extension_range) { + message.extension_range.push( + DescriptorProto_ExtensionRange.fromJSON(e) + ); + } + } + if (object.oneof_decl !== undefined && object.oneof_decl !== null) { + for (const e of object.oneof_decl) { + message.oneof_decl.push(OneofDescriptorProto.fromJSON(e)); + } + } + if (object.options !== undefined && object.options !== null) { + message.options = MessageOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + if (object.reserved_range !== undefined && object.reserved_range !== null) { + for (const e of object.reserved_range) { + message.reserved_range.push(DescriptorProto_ReservedRange.fromJSON(e)); + } + } + if (object.reserved_name !== undefined && object.reserved_name !== null) { + for (const e of object.reserved_name) { + message.reserved_name.push(String(e)); + } + } + return message; + }, + + toJSON(message: DescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.field) { + obj.field = message.field.map((e) => + e ? FieldDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => + e ? FieldDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.extension = []; + } + if (message.nested_type) { + obj.nested_type = message.nested_type.map((e) => + e ? DescriptorProto.toJSON(e) : undefined + ); + } else { + obj.nested_type = []; + } + if (message.enum_type) { + obj.enum_type = message.enum_type.map((e) => + e ? EnumDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.enum_type = []; + } + if (message.extension_range) { + obj.extension_range = message.extension_range.map((e) => + e ? DescriptorProto_ExtensionRange.toJSON(e) : undefined + ); + } else { + obj.extension_range = []; + } + if (message.oneof_decl) { + obj.oneof_decl = message.oneof_decl.map((e) => + e ? OneofDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.oneof_decl = []; + } + message.options !== undefined && + (obj.options = message.options + ? MessageOptions.toJSON(message.options) + : undefined); + if (message.reserved_range) { + obj.reserved_range = message.reserved_range.map((e) => + e ? DescriptorProto_ReservedRange.toJSON(e) : undefined + ); + } else { + obj.reserved_range = []; + } + if (message.reserved_name) { + obj.reserved_name = message.reserved_name.map((e) => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): DescriptorProto { + const message = { ...baseDescriptorProto } as DescriptorProto; + message.field = []; + message.extension = []; + message.nested_type = []; + message.enum_type = []; + message.extension_range = []; + message.oneof_decl = []; + message.reserved_range = []; + message.reserved_name = []; + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.field !== undefined && object.field !== null) { + for (const e of object.field) { + message.field.push(FieldDescriptorProto.fromPartial(e)); + } + } + if (object.extension !== undefined && object.extension !== null) { + for (const e of object.extension) { + message.extension.push(FieldDescriptorProto.fromPartial(e)); + } + } + if (object.nested_type !== undefined && object.nested_type !== null) { + for (const e of object.nested_type) { + message.nested_type.push(DescriptorProto.fromPartial(e)); + } + } + if (object.enum_type !== undefined && object.enum_type !== null) { + for (const e of object.enum_type) { + message.enum_type.push(EnumDescriptorProto.fromPartial(e)); + } + } + if ( + object.extension_range !== undefined && + object.extension_range !== null + ) { + for (const e of object.extension_range) { + message.extension_range.push( + DescriptorProto_ExtensionRange.fromPartial(e) + ); + } + } + if (object.oneof_decl !== undefined && object.oneof_decl !== null) { + for (const e of object.oneof_decl) { + message.oneof_decl.push(OneofDescriptorProto.fromPartial(e)); + } + } + if (object.options !== undefined && object.options !== null) { + message.options = MessageOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + if (object.reserved_range !== undefined && object.reserved_range !== null) { + for (const e of object.reserved_range) { + message.reserved_range.push( + DescriptorProto_ReservedRange.fromPartial(e) + ); + } + } + if (object.reserved_name !== undefined && object.reserved_name !== null) { + for (const e of object.reserved_name) { + message.reserved_name.push(e); + } + } + return message; + }, +}; + +const baseDescriptorProto_ExtensionRange: object = { start: 0, end: 0 }; + +export const DescriptorProto_ExtensionRange = { + encode( + message: DescriptorProto_ExtensionRange, + writer: Writer = Writer.create() + ): Writer { + 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: Reader | Uint8Array, + length?: number + ): DescriptorProto_ExtensionRange { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseDescriptorProto_ExtensionRange, + } as DescriptorProto_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; + }, + + fromJSON(object: any): DescriptorProto_ExtensionRange { + const message = { + ...baseDescriptorProto_ExtensionRange, + } as DescriptorProto_ExtensionRange; + if (object.start !== undefined && object.start !== null) { + message.start = Number(object.start); + } else { + message.start = 0; + } + if (object.end !== undefined && object.end !== null) { + message.end = Number(object.end); + } else { + message.end = 0; + } + if (object.options !== undefined && object.options !== null) { + message.options = ExtensionRangeOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + return message; + }, + + toJSON(message: DescriptorProto_ExtensionRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = message.start); + message.end !== undefined && (obj.end = message.end); + message.options !== undefined && + (obj.options = message.options + ? ExtensionRangeOptions.toJSON(message.options) + : undefined); + return obj; + }, + + fromPartial( + object: DeepPartial + ): DescriptorProto_ExtensionRange { + const message = { + ...baseDescriptorProto_ExtensionRange, + } as DescriptorProto_ExtensionRange; + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } else { + message.start = 0; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } else { + message.end = 0; + } + if (object.options !== undefined && object.options !== null) { + message.options = ExtensionRangeOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + return message; + }, +}; + +const baseDescriptorProto_ReservedRange: object = { start: 0, end: 0 }; + +export const DescriptorProto_ReservedRange = { + encode( + message: DescriptorProto_ReservedRange, + writer: Writer = Writer.create() + ): Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode( + input: Reader | Uint8Array, + length?: number + ): DescriptorProto_ReservedRange { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseDescriptorProto_ReservedRange, + } as DescriptorProto_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; + }, + + fromJSON(object: any): DescriptorProto_ReservedRange { + const message = { + ...baseDescriptorProto_ReservedRange, + } as DescriptorProto_ReservedRange; + if (object.start !== undefined && object.start !== null) { + message.start = Number(object.start); + } else { + message.start = 0; + } + if (object.end !== undefined && object.end !== null) { + message.end = Number(object.end); + } else { + message.end = 0; + } + return message; + }, + + toJSON(message: DescriptorProto_ReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = message.start); + message.end !== undefined && (obj.end = message.end); + return obj; + }, + + fromPartial( + object: DeepPartial + ): DescriptorProto_ReservedRange { + const message = { + ...baseDescriptorProto_ReservedRange, + } as DescriptorProto_ReservedRange; + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } else { + message.start = 0; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } else { + message.end = 0; + } + return message; + }, +}; + +const baseExtensionRangeOptions: object = {}; + +export const ExtensionRangeOptions = { + encode( + message: ExtensionRangeOptions, + writer: Writer = Writer.create() + ): Writer { + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; + message.uninterpreted_option = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions { + const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; + message.uninterpreted_option = []; + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: ExtensionRangeOptions): unknown { + const obj: any = {}; + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial( + object: DeepPartial + ): ExtensionRangeOptions { + const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; + message.uninterpreted_option = []; + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseFieldDescriptorProto: object = { + name: "", + number: 0, + label: 1, + type: 1, + type_name: "", + extendee: "", + default_value: "", + oneof_index: 0, + json_name: "", + proto3_optional: false, +}; + +export const FieldDescriptorProto = { + encode( + message: FieldDescriptorProto, + writer: Writer = Writer.create() + ): Writer { + 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.type_name !== "") { + writer.uint32(50).string(message.type_name); + } + if (message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.default_value !== "") { + writer.uint32(58).string(message.default_value); + } + if (message.oneof_index !== 0) { + writer.uint32(72).int32(message.oneof_index); + } + if (message.json_name !== "") { + writer.uint32(82).string(message.json_name); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.proto3_optional === true) { + writer.uint32(136).bool(message.proto3_optional); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; + 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.type_name = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.default_value = reader.string(); + break; + case 9: + message.oneof_index = reader.int32(); + break; + case 10: + message.json_name = reader.string(); + break; + case 8: + message.options = FieldOptions.decode(reader, reader.uint32()); + break; + case 17: + message.proto3_optional = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FieldDescriptorProto { + const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.number !== undefined && object.number !== null) { + message.number = Number(object.number); + } else { + message.number = 0; + } + if (object.label !== undefined && object.label !== null) { + message.label = fieldDescriptorProto_LabelFromJSON(object.label); + } else { + message.label = 1; + } + if (object.type !== undefined && object.type !== null) { + message.type = fieldDescriptorProto_TypeFromJSON(object.type); + } else { + message.type = 1; + } + if (object.type_name !== undefined && object.type_name !== null) { + message.type_name = String(object.type_name); + } else { + message.type_name = ""; + } + if (object.extendee !== undefined && object.extendee !== null) { + message.extendee = String(object.extendee); + } else { + message.extendee = ""; + } + if (object.default_value !== undefined && object.default_value !== null) { + message.default_value = String(object.default_value); + } else { + message.default_value = ""; + } + if (object.oneof_index !== undefined && object.oneof_index !== null) { + message.oneof_index = Number(object.oneof_index); + } else { + message.oneof_index = 0; + } + if (object.json_name !== undefined && object.json_name !== null) { + message.json_name = String(object.json_name); + } else { + message.json_name = ""; + } + if (object.options !== undefined && object.options !== null) { + message.options = FieldOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + if ( + object.proto3_optional !== undefined && + object.proto3_optional !== null + ) { + message.proto3_optional = Boolean(object.proto3_optional); + } else { + message.proto3_optional = false; + } + return message; + }, + + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = message.number); + message.label !== undefined && + (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); + message.type !== undefined && + (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); + message.type_name !== undefined && (obj.type_name = message.type_name); + message.extendee !== undefined && (obj.extendee = message.extendee); + message.default_value !== undefined && + (obj.default_value = message.default_value); + message.oneof_index !== undefined && + (obj.oneof_index = message.oneof_index); + message.json_name !== undefined && (obj.json_name = message.json_name); + message.options !== undefined && + (obj.options = message.options + ? FieldOptions.toJSON(message.options) + : undefined); + message.proto3_optional !== undefined && + (obj.proto3_optional = message.proto3_optional); + return obj; + }, + + fromPartial(object: DeepPartial): FieldDescriptorProto { + const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } else { + message.number = 0; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } else { + message.label = 1; + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } else { + message.type = 1; + } + if (object.type_name !== undefined && object.type_name !== null) { + message.type_name = object.type_name; + } else { + message.type_name = ""; + } + if (object.extendee !== undefined && object.extendee !== null) { + message.extendee = object.extendee; + } else { + message.extendee = ""; + } + if (object.default_value !== undefined && object.default_value !== null) { + message.default_value = object.default_value; + } else { + message.default_value = ""; + } + if (object.oneof_index !== undefined && object.oneof_index !== null) { + message.oneof_index = object.oneof_index; + } else { + message.oneof_index = 0; + } + if (object.json_name !== undefined && object.json_name !== null) { + message.json_name = object.json_name; + } else { + message.json_name = ""; + } + if (object.options !== undefined && object.options !== null) { + message.options = FieldOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + if ( + object.proto3_optional !== undefined && + object.proto3_optional !== null + ) { + message.proto3_optional = object.proto3_optional; + } else { + message.proto3_optional = false; + } + return message; + }, +}; + +const baseOneofDescriptorProto: object = { name: "" }; + +export const OneofDescriptorProto = { + encode( + message: OneofDescriptorProto, + writer: Writer = Writer.create() + ): Writer { + 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: Reader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; + 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; + }, + + fromJSON(object: any): OneofDescriptorProto { + const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.options !== undefined && object.options !== null) { + message.options = OneofOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + return message; + }, + + toJSON(message: OneofDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.options !== undefined && + (obj.options = message.options + ? OneofOptions.toJSON(message.options) + : undefined); + return obj; + }, + + fromPartial(object: DeepPartial): OneofDescriptorProto { + const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.options !== undefined && object.options !== null) { + message.options = OneofOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + return message; + }, +}; + +const baseEnumDescriptorProto: object = { name: "", reserved_name: "" }; + +export const EnumDescriptorProto = { + encode( + message: EnumDescriptorProto, + writer: Writer = Writer.create() + ): Writer { + 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.reserved_range) { + EnumDescriptorProto_EnumReservedRange.encode( + v!, + writer.uint32(34).fork() + ).ldelim(); + } + for (const v of message.reserved_name) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; + message.value = []; + message.reserved_range = []; + message.reserved_name = []; + 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.reserved_range.push( + EnumDescriptorProto_EnumReservedRange.decode( + reader, + reader.uint32() + ) + ); + break; + case 5: + message.reserved_name.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProto { + const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; + message.value = []; + message.reserved_range = []; + message.reserved_name = []; + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.value !== undefined && object.value !== null) { + for (const e of object.value) { + message.value.push(EnumValueDescriptorProto.fromJSON(e)); + } + } + if (object.options !== undefined && object.options !== null) { + message.options = EnumOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + if (object.reserved_range !== undefined && object.reserved_range !== null) { + for (const e of object.reserved_range) { + message.reserved_range.push( + EnumDescriptorProto_EnumReservedRange.fromJSON(e) + ); + } + } + if (object.reserved_name !== undefined && object.reserved_name !== null) { + for (const e of object.reserved_name) { + message.reserved_name.push(String(e)); + } + } + return message; + }, + + toJSON(message: EnumDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.value) { + obj.value = message.value.map((e) => + e ? EnumValueDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.value = []; + } + message.options !== undefined && + (obj.options = message.options + ? EnumOptions.toJSON(message.options) + : undefined); + if (message.reserved_range) { + obj.reserved_range = message.reserved_range.map((e) => + e ? EnumDescriptorProto_EnumReservedRange.toJSON(e) : undefined + ); + } else { + obj.reserved_range = []; + } + if (message.reserved_name) { + obj.reserved_name = message.reserved_name.map((e) => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): EnumDescriptorProto { + const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; + message.value = []; + message.reserved_range = []; + message.reserved_name = []; + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.value !== undefined && object.value !== null) { + for (const e of object.value) { + message.value.push(EnumValueDescriptorProto.fromPartial(e)); + } + } + if (object.options !== undefined && object.options !== null) { + message.options = EnumOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + if (object.reserved_range !== undefined && object.reserved_range !== null) { + for (const e of object.reserved_range) { + message.reserved_range.push( + EnumDescriptorProto_EnumReservedRange.fromPartial(e) + ); + } + } + if (object.reserved_name !== undefined && object.reserved_name !== null) { + for (const e of object.reserved_name) { + message.reserved_name.push(e); + } + } + return message; + }, +}; + +const baseEnumDescriptorProto_EnumReservedRange: object = { start: 0, end: 0 }; + +export const EnumDescriptorProto_EnumReservedRange = { + encode( + message: EnumDescriptorProto_EnumReservedRange, + writer: Writer = Writer.create() + ): Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode( + input: Reader | Uint8Array, + length?: number + ): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseEnumDescriptorProto_EnumReservedRange, + } as EnumDescriptorProto_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; + }, + + fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { + const message = { + ...baseEnumDescriptorProto_EnumReservedRange, + } as EnumDescriptorProto_EnumReservedRange; + if (object.start !== undefined && object.start !== null) { + message.start = Number(object.start); + } else { + message.start = 0; + } + if (object.end !== undefined && object.end !== null) { + message.end = Number(object.end); + } else { + message.end = 0; + } + return message; + }, + + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = message.start); + message.end !== undefined && (obj.end = message.end); + return obj; + }, + + fromPartial( + object: DeepPartial + ): EnumDescriptorProto_EnumReservedRange { + const message = { + ...baseEnumDescriptorProto_EnumReservedRange, + } as EnumDescriptorProto_EnumReservedRange; + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } else { + message.start = 0; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } else { + message.end = 0; + } + return message; + }, +}; + +const baseEnumValueDescriptorProto: object = { name: "", number: 0 }; + +export const EnumValueDescriptorProto = { + encode( + message: EnumValueDescriptorProto, + writer: Writer = Writer.create() + ): Writer { + 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: Reader | Uint8Array, + length?: number + ): EnumValueDescriptorProto { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseEnumValueDescriptorProto, + } as EnumValueDescriptorProto; + 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; + }, + + fromJSON(object: any): EnumValueDescriptorProto { + const message = { + ...baseEnumValueDescriptorProto, + } as EnumValueDescriptorProto; + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.number !== undefined && object.number !== null) { + message.number = Number(object.number); + } else { + message.number = 0; + } + if (object.options !== undefined && object.options !== null) { + message.options = EnumValueOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + return message; + }, + + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = message.number); + message.options !== undefined && + (obj.options = message.options + ? EnumValueOptions.toJSON(message.options) + : undefined); + return obj; + }, + + fromPartial( + object: DeepPartial + ): EnumValueDescriptorProto { + const message = { + ...baseEnumValueDescriptorProto, + } as EnumValueDescriptorProto; + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } else { + message.number = 0; + } + if (object.options !== undefined && object.options !== null) { + message.options = EnumValueOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + return message; + }, +}; + +const baseServiceDescriptorProto: object = { name: "" }; + +export const ServiceDescriptorProto = { + encode( + message: ServiceDescriptorProto, + writer: Writer = Writer.create() + ): Writer { + 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: Reader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; + message.method = []; + 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; + }, + + fromJSON(object: any): ServiceDescriptorProto { + const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; + message.method = []; + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.method !== undefined && object.method !== null) { + for (const e of object.method) { + message.method.push(MethodDescriptorProto.fromJSON(e)); + } + } + if (object.options !== undefined && object.options !== null) { + message.options = ServiceOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + return message; + }, + + toJSON(message: ServiceDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.method) { + obj.method = message.method.map((e) => + e ? MethodDescriptorProto.toJSON(e) : undefined + ); + } else { + obj.method = []; + } + message.options !== undefined && + (obj.options = message.options + ? ServiceOptions.toJSON(message.options) + : undefined); + return obj; + }, + + fromPartial( + object: DeepPartial + ): ServiceDescriptorProto { + const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; + message.method = []; + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.method !== undefined && object.method !== null) { + for (const e of object.method) { + message.method.push(MethodDescriptorProto.fromPartial(e)); + } + } + if (object.options !== undefined && object.options !== null) { + message.options = ServiceOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + return message; + }, +}; + +const baseMethodDescriptorProto: object = { + name: "", + input_type: "", + output_type: "", + client_streaming: false, + server_streaming: false, +}; + +export const MethodDescriptorProto = { + encode( + message: MethodDescriptorProto, + writer: Writer = Writer.create() + ): Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.input_type !== "") { + writer.uint32(18).string(message.input_type); + } + if (message.output_type !== "") { + writer.uint32(26).string(message.output_type); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + } + if (message.client_streaming === true) { + writer.uint32(40).bool(message.client_streaming); + } + if (message.server_streaming === true) { + writer.uint32(48).bool(message.server_streaming); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.input_type = reader.string(); + break; + case 3: + message.output_type = reader.string(); + break; + case 4: + message.options = MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.client_streaming = reader.bool(); + break; + case 6: + message.server_streaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MethodDescriptorProto { + const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; + if (object.name !== undefined && object.name !== null) { + message.name = String(object.name); + } else { + message.name = ""; + } + if (object.input_type !== undefined && object.input_type !== null) { + message.input_type = String(object.input_type); + } else { + message.input_type = ""; + } + if (object.output_type !== undefined && object.output_type !== null) { + message.output_type = String(object.output_type); + } else { + message.output_type = ""; + } + if (object.options !== undefined && object.options !== null) { + message.options = MethodOptions.fromJSON(object.options); + } else { + message.options = undefined; + } + if ( + object.client_streaming !== undefined && + object.client_streaming !== null + ) { + message.client_streaming = Boolean(object.client_streaming); + } else { + message.client_streaming = false; + } + if ( + object.server_streaming !== undefined && + object.server_streaming !== null + ) { + message.server_streaming = Boolean(object.server_streaming); + } else { + message.server_streaming = false; + } + return message; + }, + + toJSON(message: MethodDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.input_type !== undefined && (obj.input_type = message.input_type); + message.output_type !== undefined && + (obj.output_type = message.output_type); + message.options !== undefined && + (obj.options = message.options + ? MethodOptions.toJSON(message.options) + : undefined); + message.client_streaming !== undefined && + (obj.client_streaming = message.client_streaming); + message.server_streaming !== undefined && + (obj.server_streaming = message.server_streaming); + return obj; + }, + + fromPartial( + object: DeepPartial + ): MethodDescriptorProto { + const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } else { + message.name = ""; + } + if (object.input_type !== undefined && object.input_type !== null) { + message.input_type = object.input_type; + } else { + message.input_type = ""; + } + if (object.output_type !== undefined && object.output_type !== null) { + message.output_type = object.output_type; + } else { + message.output_type = ""; + } + if (object.options !== undefined && object.options !== null) { + message.options = MethodOptions.fromPartial(object.options); + } else { + message.options = undefined; + } + if ( + object.client_streaming !== undefined && + object.client_streaming !== null + ) { + message.client_streaming = object.client_streaming; + } else { + message.client_streaming = false; + } + if ( + object.server_streaming !== undefined && + object.server_streaming !== null + ) { + message.server_streaming = object.server_streaming; + } else { + message.server_streaming = false; + } + return message; + }, +}; + +const baseFileOptions: object = { + java_package: "", + java_outer_classname: "", + java_multiple_files: false, + java_generate_equals_and_hash: false, + java_string_check_utf8: false, + optimize_for: 1, + go_package: "", + cc_generic_services: false, + java_generic_services: false, + py_generic_services: false, + php_generic_services: false, + deprecated: false, + cc_enable_arenas: false, + objc_class_prefix: "", + csharp_namespace: "", + swift_prefix: "", + php_class_prefix: "", + php_namespace: "", + php_metadata_namespace: "", + ruby_package: "", +}; + +export const FileOptions = { + encode(message: FileOptions, writer: Writer = Writer.create()): Writer { + if (message.java_package !== "") { + writer.uint32(10).string(message.java_package); + } + if (message.java_outer_classname !== "") { + writer.uint32(66).string(message.java_outer_classname); + } + if (message.java_multiple_files === true) { + writer.uint32(80).bool(message.java_multiple_files); + } + if (message.java_generate_equals_and_hash === true) { + writer.uint32(160).bool(message.java_generate_equals_and_hash); + } + if (message.java_string_check_utf8 === true) { + writer.uint32(216).bool(message.java_string_check_utf8); + } + if (message.optimize_for !== 1) { + writer.uint32(72).int32(message.optimize_for); + } + if (message.go_package !== "") { + writer.uint32(90).string(message.go_package); + } + if (message.cc_generic_services === true) { + writer.uint32(128).bool(message.cc_generic_services); + } + if (message.java_generic_services === true) { + writer.uint32(136).bool(message.java_generic_services); + } + if (message.py_generic_services === true) { + writer.uint32(144).bool(message.py_generic_services); + } + if (message.php_generic_services === true) { + writer.uint32(336).bool(message.php_generic_services); + } + if (message.deprecated === true) { + writer.uint32(184).bool(message.deprecated); + } + if (message.cc_enable_arenas === true) { + writer.uint32(248).bool(message.cc_enable_arenas); + } + if (message.objc_class_prefix !== "") { + writer.uint32(290).string(message.objc_class_prefix); + } + if (message.csharp_namespace !== "") { + writer.uint32(298).string(message.csharp_namespace); + } + if (message.swift_prefix !== "") { + writer.uint32(314).string(message.swift_prefix); + } + if (message.php_class_prefix !== "") { + writer.uint32(322).string(message.php_class_prefix); + } + if (message.php_namespace !== "") { + writer.uint32(330).string(message.php_namespace); + } + if (message.php_metadata_namespace !== "") { + writer.uint32(354).string(message.php_metadata_namespace); + } + if (message.ruby_package !== "") { + writer.uint32(362).string(message.ruby_package); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseFileOptions } as FileOptions; + message.uninterpreted_option = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.java_package = reader.string(); + break; + case 8: + message.java_outer_classname = reader.string(); + break; + case 10: + message.java_multiple_files = reader.bool(); + break; + case 20: + message.java_generate_equals_and_hash = reader.bool(); + break; + case 27: + message.java_string_check_utf8 = reader.bool(); + break; + case 9: + message.optimize_for = reader.int32() as any; + break; + case 11: + message.go_package = reader.string(); + break; + case 16: + message.cc_generic_services = reader.bool(); + break; + case 17: + message.java_generic_services = reader.bool(); + break; + case 18: + message.py_generic_services = reader.bool(); + break; + case 42: + message.php_generic_services = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.cc_enable_arenas = reader.bool(); + break; + case 36: + message.objc_class_prefix = reader.string(); + break; + case 37: + message.csharp_namespace = reader.string(); + break; + case 39: + message.swift_prefix = reader.string(); + break; + case 40: + message.php_class_prefix = reader.string(); + break; + case 41: + message.php_namespace = reader.string(); + break; + case 44: + message.php_metadata_namespace = reader.string(); + break; + case 45: + message.ruby_package = reader.string(); + break; + case 999: + message.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FileOptions { + const message = { ...baseFileOptions } as FileOptions; + message.uninterpreted_option = []; + if (object.java_package !== undefined && object.java_package !== null) { + message.java_package = String(object.java_package); + } else { + message.java_package = ""; + } + if ( + object.java_outer_classname !== undefined && + object.java_outer_classname !== null + ) { + message.java_outer_classname = String(object.java_outer_classname); + } else { + message.java_outer_classname = ""; + } + if ( + object.java_multiple_files !== undefined && + object.java_multiple_files !== null + ) { + message.java_multiple_files = Boolean(object.java_multiple_files); + } else { + message.java_multiple_files = false; + } + if ( + object.java_generate_equals_and_hash !== undefined && + object.java_generate_equals_and_hash !== null + ) { + message.java_generate_equals_and_hash = Boolean( + object.java_generate_equals_and_hash + ); + } else { + message.java_generate_equals_and_hash = false; + } + if ( + object.java_string_check_utf8 !== undefined && + object.java_string_check_utf8 !== null + ) { + message.java_string_check_utf8 = Boolean(object.java_string_check_utf8); + } else { + message.java_string_check_utf8 = false; + } + if (object.optimize_for !== undefined && object.optimize_for !== null) { + message.optimize_for = fileOptions_OptimizeModeFromJSON( + object.optimize_for + ); + } else { + message.optimize_for = 1; + } + if (object.go_package !== undefined && object.go_package !== null) { + message.go_package = String(object.go_package); + } else { + message.go_package = ""; + } + if ( + object.cc_generic_services !== undefined && + object.cc_generic_services !== null + ) { + message.cc_generic_services = Boolean(object.cc_generic_services); + } else { + message.cc_generic_services = false; + } + if ( + object.java_generic_services !== undefined && + object.java_generic_services !== null + ) { + message.java_generic_services = Boolean(object.java_generic_services); + } else { + message.java_generic_services = false; + } + if ( + object.py_generic_services !== undefined && + object.py_generic_services !== null + ) { + message.py_generic_services = Boolean(object.py_generic_services); + } else { + message.py_generic_services = false; + } + if ( + object.php_generic_services !== undefined && + object.php_generic_services !== null + ) { + message.php_generic_services = Boolean(object.php_generic_services); + } else { + message.php_generic_services = false; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = Boolean(object.deprecated); + } else { + message.deprecated = false; + } + if ( + object.cc_enable_arenas !== undefined && + object.cc_enable_arenas !== null + ) { + message.cc_enable_arenas = Boolean(object.cc_enable_arenas); + } else { + message.cc_enable_arenas = false; + } + if ( + object.objc_class_prefix !== undefined && + object.objc_class_prefix !== null + ) { + message.objc_class_prefix = String(object.objc_class_prefix); + } else { + message.objc_class_prefix = ""; + } + if ( + object.csharp_namespace !== undefined && + object.csharp_namespace !== null + ) { + message.csharp_namespace = String(object.csharp_namespace); + } else { + message.csharp_namespace = ""; + } + if (object.swift_prefix !== undefined && object.swift_prefix !== null) { + message.swift_prefix = String(object.swift_prefix); + } else { + message.swift_prefix = ""; + } + if ( + object.php_class_prefix !== undefined && + object.php_class_prefix !== null + ) { + message.php_class_prefix = String(object.php_class_prefix); + } else { + message.php_class_prefix = ""; + } + if (object.php_namespace !== undefined && object.php_namespace !== null) { + message.php_namespace = String(object.php_namespace); + } else { + message.php_namespace = ""; + } + if ( + object.php_metadata_namespace !== undefined && + object.php_metadata_namespace !== null + ) { + message.php_metadata_namespace = String(object.php_metadata_namespace); + } else { + message.php_metadata_namespace = ""; + } + if (object.ruby_package !== undefined && object.ruby_package !== null) { + message.ruby_package = String(object.ruby_package); + } else { + message.ruby_package = ""; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: FileOptions): unknown { + const obj: any = {}; + message.java_package !== undefined && + (obj.java_package = message.java_package); + message.java_outer_classname !== undefined && + (obj.java_outer_classname = message.java_outer_classname); + message.java_multiple_files !== undefined && + (obj.java_multiple_files = message.java_multiple_files); + message.java_generate_equals_and_hash !== undefined && + (obj.java_generate_equals_and_hash = + message.java_generate_equals_and_hash); + message.java_string_check_utf8 !== undefined && + (obj.java_string_check_utf8 = message.java_string_check_utf8); + message.optimize_for !== undefined && + (obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimize_for)); + message.go_package !== undefined && (obj.go_package = message.go_package); + message.cc_generic_services !== undefined && + (obj.cc_generic_services = message.cc_generic_services); + message.java_generic_services !== undefined && + (obj.java_generic_services = message.java_generic_services); + message.py_generic_services !== undefined && + (obj.py_generic_services = message.py_generic_services); + message.php_generic_services !== undefined && + (obj.php_generic_services = message.php_generic_services); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.cc_enable_arenas !== undefined && + (obj.cc_enable_arenas = message.cc_enable_arenas); + message.objc_class_prefix !== undefined && + (obj.objc_class_prefix = message.objc_class_prefix); + message.csharp_namespace !== undefined && + (obj.csharp_namespace = message.csharp_namespace); + message.swift_prefix !== undefined && + (obj.swift_prefix = message.swift_prefix); + message.php_class_prefix !== undefined && + (obj.php_class_prefix = message.php_class_prefix); + message.php_namespace !== undefined && + (obj.php_namespace = message.php_namespace); + message.php_metadata_namespace !== undefined && + (obj.php_metadata_namespace = message.php_metadata_namespace); + message.ruby_package !== undefined && + (obj.ruby_package = message.ruby_package); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): FileOptions { + const message = { ...baseFileOptions } as FileOptions; + message.uninterpreted_option = []; + if (object.java_package !== undefined && object.java_package !== null) { + message.java_package = object.java_package; + } else { + message.java_package = ""; + } + if ( + object.java_outer_classname !== undefined && + object.java_outer_classname !== null + ) { + message.java_outer_classname = object.java_outer_classname; + } else { + message.java_outer_classname = ""; + } + if ( + object.java_multiple_files !== undefined && + object.java_multiple_files !== null + ) { + message.java_multiple_files = object.java_multiple_files; + } else { + message.java_multiple_files = false; + } + if ( + object.java_generate_equals_and_hash !== undefined && + object.java_generate_equals_and_hash !== null + ) { + message.java_generate_equals_and_hash = + object.java_generate_equals_and_hash; + } else { + message.java_generate_equals_and_hash = false; + } + if ( + object.java_string_check_utf8 !== undefined && + object.java_string_check_utf8 !== null + ) { + message.java_string_check_utf8 = object.java_string_check_utf8; + } else { + message.java_string_check_utf8 = false; + } + if (object.optimize_for !== undefined && object.optimize_for !== null) { + message.optimize_for = object.optimize_for; + } else { + message.optimize_for = 1; + } + if (object.go_package !== undefined && object.go_package !== null) { + message.go_package = object.go_package; + } else { + message.go_package = ""; + } + if ( + object.cc_generic_services !== undefined && + object.cc_generic_services !== null + ) { + message.cc_generic_services = object.cc_generic_services; + } else { + message.cc_generic_services = false; + } + if ( + object.java_generic_services !== undefined && + object.java_generic_services !== null + ) { + message.java_generic_services = object.java_generic_services; + } else { + message.java_generic_services = false; + } + if ( + object.py_generic_services !== undefined && + object.py_generic_services !== null + ) { + message.py_generic_services = object.py_generic_services; + } else { + message.py_generic_services = false; + } + if ( + object.php_generic_services !== undefined && + object.php_generic_services !== null + ) { + message.php_generic_services = object.php_generic_services; + } else { + message.php_generic_services = false; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if ( + object.cc_enable_arenas !== undefined && + object.cc_enable_arenas !== null + ) { + message.cc_enable_arenas = object.cc_enable_arenas; + } else { + message.cc_enable_arenas = false; + } + if ( + object.objc_class_prefix !== undefined && + object.objc_class_prefix !== null + ) { + message.objc_class_prefix = object.objc_class_prefix; + } else { + message.objc_class_prefix = ""; + } + if ( + object.csharp_namespace !== undefined && + object.csharp_namespace !== null + ) { + message.csharp_namespace = object.csharp_namespace; + } else { + message.csharp_namespace = ""; + } + if (object.swift_prefix !== undefined && object.swift_prefix !== null) { + message.swift_prefix = object.swift_prefix; + } else { + message.swift_prefix = ""; + } + if ( + object.php_class_prefix !== undefined && + object.php_class_prefix !== null + ) { + message.php_class_prefix = object.php_class_prefix; + } else { + message.php_class_prefix = ""; + } + if (object.php_namespace !== undefined && object.php_namespace !== null) { + message.php_namespace = object.php_namespace; + } else { + message.php_namespace = ""; + } + if ( + object.php_metadata_namespace !== undefined && + object.php_metadata_namespace !== null + ) { + message.php_metadata_namespace = object.php_metadata_namespace; + } else { + message.php_metadata_namespace = ""; + } + if (object.ruby_package !== undefined && object.ruby_package !== null) { + message.ruby_package = object.ruby_package; + } else { + message.ruby_package = ""; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseMessageOptions: object = { + message_set_wire_format: false, + no_standard_descriptor_accessor: false, + deprecated: false, + map_entry: false, +}; + +export const MessageOptions = { + encode(message: MessageOptions, writer: Writer = Writer.create()): Writer { + if (message.message_set_wire_format === true) { + writer.uint32(8).bool(message.message_set_wire_format); + } + if (message.no_standard_descriptor_accessor === true) { + writer.uint32(16).bool(message.no_standard_descriptor_accessor); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.map_entry === true) { + writer.uint32(56).bool(message.map_entry); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseMessageOptions } as MessageOptions; + message.uninterpreted_option = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message_set_wire_format = reader.bool(); + break; + case 2: + message.no_standard_descriptor_accessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.map_entry = reader.bool(); + break; + case 999: + message.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MessageOptions { + const message = { ...baseMessageOptions } as MessageOptions; + message.uninterpreted_option = []; + if ( + object.message_set_wire_format !== undefined && + object.message_set_wire_format !== null + ) { + message.message_set_wire_format = Boolean(object.message_set_wire_format); + } else { + message.message_set_wire_format = false; + } + if ( + object.no_standard_descriptor_accessor !== undefined && + object.no_standard_descriptor_accessor !== null + ) { + message.no_standard_descriptor_accessor = Boolean( + object.no_standard_descriptor_accessor + ); + } else { + message.no_standard_descriptor_accessor = false; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = Boolean(object.deprecated); + } else { + message.deprecated = false; + } + if (object.map_entry !== undefined && object.map_entry !== null) { + message.map_entry = Boolean(object.map_entry); + } else { + message.map_entry = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: MessageOptions): unknown { + const obj: any = {}; + message.message_set_wire_format !== undefined && + (obj.message_set_wire_format = message.message_set_wire_format); + message.no_standard_descriptor_accessor !== undefined && + (obj.no_standard_descriptor_accessor = + message.no_standard_descriptor_accessor); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.map_entry !== undefined && (obj.map_entry = message.map_entry); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): MessageOptions { + const message = { ...baseMessageOptions } as MessageOptions; + message.uninterpreted_option = []; + if ( + object.message_set_wire_format !== undefined && + object.message_set_wire_format !== null + ) { + message.message_set_wire_format = object.message_set_wire_format; + } else { + message.message_set_wire_format = false; + } + if ( + object.no_standard_descriptor_accessor !== undefined && + object.no_standard_descriptor_accessor !== null + ) { + message.no_standard_descriptor_accessor = + object.no_standard_descriptor_accessor; + } else { + message.no_standard_descriptor_accessor = false; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if (object.map_entry !== undefined && object.map_entry !== null) { + message.map_entry = object.map_entry; + } else { + message.map_entry = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseFieldOptions: object = { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + deprecated: false, + weak: false, +}; + +export const FieldOptions = { + encode(message: FieldOptions, writer: Writer = Writer.create()): Writer { + if (message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== 0) { + 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.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseFieldOptions } as FieldOptions; + message.uninterpreted_option = []; + 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.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): FieldOptions { + const message = { ...baseFieldOptions } as FieldOptions; + message.uninterpreted_option = []; + if (object.ctype !== undefined && object.ctype !== null) { + message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + } else { + message.ctype = 0; + } + if (object.packed !== undefined && object.packed !== null) { + message.packed = Boolean(object.packed); + } else { + message.packed = false; + } + if (object.jstype !== undefined && object.jstype !== null) { + message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + } else { + message.jstype = 0; + } + if (object.lazy !== undefined && object.lazy !== null) { + message.lazy = Boolean(object.lazy); + } else { + message.lazy = false; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = Boolean(object.deprecated); + } else { + message.deprecated = false; + } + if (object.weak !== undefined && object.weak !== null) { + message.weak = Boolean(object.weak); + } else { + message.weak = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: FieldOptions): unknown { + const obj: any = {}; + message.ctype !== undefined && + (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); + message.packed !== undefined && (obj.packed = message.packed); + message.jstype !== undefined && + (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); + message.lazy !== undefined && (obj.lazy = message.lazy); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.weak !== undefined && (obj.weak = message.weak); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): FieldOptions { + const message = { ...baseFieldOptions } as FieldOptions; + message.uninterpreted_option = []; + if (object.ctype !== undefined && object.ctype !== null) { + message.ctype = object.ctype; + } else { + message.ctype = 0; + } + if (object.packed !== undefined && object.packed !== null) { + message.packed = object.packed; + } else { + message.packed = false; + } + if (object.jstype !== undefined && object.jstype !== null) { + message.jstype = object.jstype; + } else { + message.jstype = 0; + } + if (object.lazy !== undefined && object.lazy !== null) { + message.lazy = object.lazy; + } else { + message.lazy = false; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if (object.weak !== undefined && object.weak !== null) { + message.weak = object.weak; + } else { + message.weak = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseOneofOptions: object = {}; + +export const OneofOptions = { + encode(message: OneofOptions, writer: Writer = Writer.create()): Writer { + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseOneofOptions } as OneofOptions; + message.uninterpreted_option = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): OneofOptions { + const message = { ...baseOneofOptions } as OneofOptions; + message.uninterpreted_option = []; + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): OneofOptions { + const message = { ...baseOneofOptions } as OneofOptions; + message.uninterpreted_option = []; + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseEnumOptions: object = { allow_alias: false, deprecated: false }; + +export const EnumOptions = { + encode(message: EnumOptions, writer: Writer = Writer.create()): Writer { + if (message.allow_alias === true) { + writer.uint32(16).bool(message.allow_alias); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseEnumOptions } as EnumOptions; + message.uninterpreted_option = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allow_alias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumOptions { + const message = { ...baseEnumOptions } as EnumOptions; + message.uninterpreted_option = []; + if (object.allow_alias !== undefined && object.allow_alias !== null) { + message.allow_alias = Boolean(object.allow_alias); + } else { + message.allow_alias = false; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = Boolean(object.deprecated); + } else { + message.deprecated = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + message.allow_alias !== undefined && + (obj.allow_alias = message.allow_alias); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): EnumOptions { + const message = { ...baseEnumOptions } as EnumOptions; + message.uninterpreted_option = []; + if (object.allow_alias !== undefined && object.allow_alias !== null) { + message.allow_alias = object.allow_alias; + } else { + message.allow_alias = false; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseEnumValueOptions: object = { deprecated: false }; + +export const EnumValueOptions = { + encode(message: EnumValueOptions, writer: Writer = Writer.create()): Writer { + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseEnumValueOptions } as EnumValueOptions; + message.uninterpreted_option = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): EnumValueOptions { + const message = { ...baseEnumValueOptions } as EnumValueOptions; + message.uninterpreted_option = []; + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = Boolean(object.deprecated); + } else { + message.deprecated = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: EnumValueOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): EnumValueOptions { + const message = { ...baseEnumValueOptions } as EnumValueOptions; + message.uninterpreted_option = []; + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseServiceOptions: object = { deprecated: false }; + +export const ServiceOptions = { + encode(message: ServiceOptions, writer: Writer = Writer.create()): Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseServiceOptions } as ServiceOptions; + message.uninterpreted_option = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ServiceOptions { + const message = { ...baseServiceOptions } as ServiceOptions; + message.uninterpreted_option = []; + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = Boolean(object.deprecated); + } else { + message.deprecated = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: ServiceOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): ServiceOptions { + const message = { ...baseServiceOptions } as ServiceOptions; + message.uninterpreted_option = []; + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseMethodOptions: object = { deprecated: false, idempotency_level: 0 }; + +export const MethodOptions = { + encode(message: MethodOptions, writer: Writer = Writer.create()): Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotency_level !== 0) { + writer.uint32(272).int32(message.idempotency_level); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseMethodOptions } as MethodOptions; + message.uninterpreted_option = []; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 34: + message.idempotency_level = reader.int32() as any; + break; + case 999: + message.uninterpreted_option.push( + UninterpretedOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): MethodOptions { + const message = { ...baseMethodOptions } as MethodOptions; + message.uninterpreted_option = []; + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = Boolean(object.deprecated); + } else { + message.deprecated = false; + } + if ( + object.idempotency_level !== undefined && + object.idempotency_level !== null + ) { + message.idempotency_level = methodOptions_IdempotencyLevelFromJSON( + object.idempotency_level + ); + } else { + message.idempotency_level = 0; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: MethodOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.idempotency_level !== undefined && + (obj.idempotency_level = methodOptions_IdempotencyLevelToJSON( + message.idempotency_level + )); + if (message.uninterpreted_option) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): MethodOptions { + const message = { ...baseMethodOptions } as MethodOptions; + message.uninterpreted_option = []; + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if ( + object.idempotency_level !== undefined && + object.idempotency_level !== null + ) { + message.idempotency_level = object.idempotency_level; + } else { + message.idempotency_level = 0; + } + if ( + object.uninterpreted_option !== undefined && + object.uninterpreted_option !== null + ) { + for (const e of object.uninterpreted_option) { + message.uninterpreted_option.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, +}; + +const baseUninterpretedOption: object = { + identifier_value: "", + positive_int_value: 0, + negative_int_value: 0, + double_value: 0, + aggregate_value: "", +}; + +export const UninterpretedOption = { + encode( + message: UninterpretedOption, + writer: Writer = Writer.create() + ): Writer { + for (const v of message.name) { + UninterpretedOption_NamePart.encode( + v!, + writer.uint32(18).fork() + ).ldelim(); + } + if (message.identifier_value !== "") { + writer.uint32(26).string(message.identifier_value); + } + if (message.positive_int_value !== 0) { + writer.uint32(32).uint64(message.positive_int_value); + } + if (message.negative_int_value !== 0) { + writer.uint32(40).int64(message.negative_int_value); + } + if (message.double_value !== 0) { + writer.uint32(49).double(message.double_value); + } + if (message.string_value.length !== 0) { + writer.uint32(58).bytes(message.string_value); + } + if (message.aggregate_value !== "") { + writer.uint32(66).string(message.aggregate_value); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseUninterpretedOption } as UninterpretedOption; + message.name = []; + 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.identifier_value = reader.string(); + break; + case 4: + message.positive_int_value = longToNumber(reader.uint64() as Long); + break; + case 5: + message.negative_int_value = longToNumber(reader.int64() as Long); + break; + case 6: + message.double_value = reader.double(); + break; + case 7: + message.string_value = reader.bytes(); + break; + case 8: + message.aggregate_value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UninterpretedOption { + const message = { ...baseUninterpretedOption } as UninterpretedOption; + message.name = []; + if (object.name !== undefined && object.name !== null) { + for (const e of object.name) { + message.name.push(UninterpretedOption_NamePart.fromJSON(e)); + } + } + if ( + object.identifier_value !== undefined && + object.identifier_value !== null + ) { + message.identifier_value = String(object.identifier_value); + } else { + message.identifier_value = ""; + } + if ( + object.positive_int_value !== undefined && + object.positive_int_value !== null + ) { + message.positive_int_value = Number(object.positive_int_value); + } else { + message.positive_int_value = 0; + } + if ( + object.negative_int_value !== undefined && + object.negative_int_value !== null + ) { + message.negative_int_value = Number(object.negative_int_value); + } else { + message.negative_int_value = 0; + } + if (object.double_value !== undefined && object.double_value !== null) { + message.double_value = Number(object.double_value); + } else { + message.double_value = 0; + } + if (object.string_value !== undefined && object.string_value !== null) { + message.string_value = bytesFromBase64(object.string_value); + } + if ( + object.aggregate_value !== undefined && + object.aggregate_value !== null + ) { + message.aggregate_value = String(object.aggregate_value); + } else { + message.aggregate_value = ""; + } + return message; + }, + + toJSON(message: UninterpretedOption): unknown { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map((e) => + e ? UninterpretedOption_NamePart.toJSON(e) : undefined + ); + } else { + obj.name = []; + } + message.identifier_value !== undefined && + (obj.identifier_value = message.identifier_value); + message.positive_int_value !== undefined && + (obj.positive_int_value = message.positive_int_value); + message.negative_int_value !== undefined && + (obj.negative_int_value = message.negative_int_value); + message.double_value !== undefined && + (obj.double_value = message.double_value); + message.string_value !== undefined && + (obj.string_value = base64FromBytes( + message.string_value !== undefined + ? message.string_value + : new Uint8Array() + )); + message.aggregate_value !== undefined && + (obj.aggregate_value = message.aggregate_value); + return obj; + }, + + fromPartial(object: DeepPartial): UninterpretedOption { + const message = { ...baseUninterpretedOption } as UninterpretedOption; + message.name = []; + if (object.name !== undefined && object.name !== null) { + for (const e of object.name) { + message.name.push(UninterpretedOption_NamePart.fromPartial(e)); + } + } + if ( + object.identifier_value !== undefined && + object.identifier_value !== null + ) { + message.identifier_value = object.identifier_value; + } else { + message.identifier_value = ""; + } + if ( + object.positive_int_value !== undefined && + object.positive_int_value !== null + ) { + message.positive_int_value = object.positive_int_value; + } else { + message.positive_int_value = 0; + } + if ( + object.negative_int_value !== undefined && + object.negative_int_value !== null + ) { + message.negative_int_value = object.negative_int_value; + } else { + message.negative_int_value = 0; + } + if (object.double_value !== undefined && object.double_value !== null) { + message.double_value = object.double_value; + } else { + message.double_value = 0; + } + if (object.string_value !== undefined && object.string_value !== null) { + message.string_value = object.string_value; + } else { + message.string_value = new Uint8Array(); + } + if ( + object.aggregate_value !== undefined && + object.aggregate_value !== null + ) { + message.aggregate_value = object.aggregate_value; + } else { + message.aggregate_value = ""; + } + return message; + }, +}; + +const baseUninterpretedOption_NamePart: object = { + name_part: "", + is_extension: false, +}; + +export const UninterpretedOption_NamePart = { + encode( + message: UninterpretedOption_NamePart, + writer: Writer = Writer.create() + ): Writer { + if (message.name_part !== "") { + writer.uint32(10).string(message.name_part); + } + if (message.is_extension === true) { + writer.uint32(16).bool(message.is_extension); + } + return writer; + }, + + decode( + input: Reader | Uint8Array, + length?: number + ): UninterpretedOption_NamePart { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseUninterpretedOption_NamePart, + } as UninterpretedOption_NamePart; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name_part = reader.string(); + break; + case 2: + message.is_extension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): UninterpretedOption_NamePart { + const message = { + ...baseUninterpretedOption_NamePart, + } as UninterpretedOption_NamePart; + if (object.name_part !== undefined && object.name_part !== null) { + message.name_part = String(object.name_part); + } else { + message.name_part = ""; + } + if (object.is_extension !== undefined && object.is_extension !== null) { + message.is_extension = Boolean(object.is_extension); + } else { + message.is_extension = false; + } + return message; + }, + + toJSON(message: UninterpretedOption_NamePart): unknown { + const obj: any = {}; + message.name_part !== undefined && (obj.name_part = message.name_part); + message.is_extension !== undefined && + (obj.is_extension = message.is_extension); + return obj; + }, + + fromPartial( + object: DeepPartial + ): UninterpretedOption_NamePart { + const message = { + ...baseUninterpretedOption_NamePart, + } as UninterpretedOption_NamePart; + if (object.name_part !== undefined && object.name_part !== null) { + message.name_part = object.name_part; + } else { + message.name_part = ""; + } + if (object.is_extension !== undefined && object.is_extension !== null) { + message.is_extension = object.is_extension; + } else { + message.is_extension = false; + } + return message; + }, +}; + +const baseSourceCodeInfo: object = {}; + +export const SourceCodeInfo = { + encode(message: SourceCodeInfo, writer: Writer = Writer.create()): Writer { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseSourceCodeInfo } as SourceCodeInfo; + message.location = []; + 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; + }, + + fromJSON(object: any): SourceCodeInfo { + const message = { ...baseSourceCodeInfo } as SourceCodeInfo; + message.location = []; + if (object.location !== undefined && object.location !== null) { + for (const e of object.location) { + message.location.push(SourceCodeInfo_Location.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: SourceCodeInfo): unknown { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map((e) => + e ? SourceCodeInfo_Location.toJSON(e) : undefined + ); + } else { + obj.location = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): SourceCodeInfo { + const message = { ...baseSourceCodeInfo } as SourceCodeInfo; + message.location = []; + if (object.location !== undefined && object.location !== null) { + for (const e of object.location) { + message.location.push(SourceCodeInfo_Location.fromPartial(e)); + } + } + return message; + }, +}; + +const baseSourceCodeInfo_Location: object = { + path: 0, + span: 0, + leading_comments: "", + trailing_comments: "", + leading_detached_comments: "", +}; + +export const SourceCodeInfo_Location = { + encode( + message: SourceCodeInfo_Location, + writer: Writer = Writer.create() + ): Writer { + 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.leading_comments !== "") { + writer.uint32(26).string(message.leading_comments); + } + if (message.trailing_comments !== "") { + writer.uint32(34).string(message.trailing_comments); + } + for (const v of message.leading_detached_comments) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseSourceCodeInfo_Location, + } as SourceCodeInfo_Location; + message.path = []; + message.span = []; + message.leading_detached_comments = []; + 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.leading_comments = reader.string(); + break; + case 4: + message.trailing_comments = reader.string(); + break; + case 6: + message.leading_detached_comments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): SourceCodeInfo_Location { + const message = { + ...baseSourceCodeInfo_Location, + } as SourceCodeInfo_Location; + message.path = []; + message.span = []; + message.leading_detached_comments = []; + if (object.path !== undefined && object.path !== null) { + for (const e of object.path) { + message.path.push(Number(e)); + } + } + if (object.span !== undefined && object.span !== null) { + for (const e of object.span) { + message.span.push(Number(e)); + } + } + if ( + object.leading_comments !== undefined && + object.leading_comments !== null + ) { + message.leading_comments = String(object.leading_comments); + } else { + message.leading_comments = ""; + } + if ( + object.trailing_comments !== undefined && + object.trailing_comments !== null + ) { + message.trailing_comments = String(object.trailing_comments); + } else { + message.trailing_comments = ""; + } + if ( + object.leading_detached_comments !== undefined && + object.leading_detached_comments !== null + ) { + for (const e of object.leading_detached_comments) { + message.leading_detached_comments.push(String(e)); + } + } + return message; + }, + + toJSON(message: SourceCodeInfo_Location): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => e); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map((e) => e); + } else { + obj.span = []; + } + message.leading_comments !== undefined && + (obj.leading_comments = message.leading_comments); + message.trailing_comments !== undefined && + (obj.trailing_comments = message.trailing_comments); + if (message.leading_detached_comments) { + obj.leading_detached_comments = message.leading_detached_comments.map( + (e) => e + ); + } else { + obj.leading_detached_comments = []; + } + return obj; + }, + + fromPartial( + object: DeepPartial + ): SourceCodeInfo_Location { + const message = { + ...baseSourceCodeInfo_Location, + } as SourceCodeInfo_Location; + message.path = []; + message.span = []; + message.leading_detached_comments = []; + if (object.path !== undefined && object.path !== null) { + for (const e of object.path) { + message.path.push(e); + } + } + if (object.span !== undefined && object.span !== null) { + for (const e of object.span) { + message.span.push(e); + } + } + if ( + object.leading_comments !== undefined && + object.leading_comments !== null + ) { + message.leading_comments = object.leading_comments; + } else { + message.leading_comments = ""; + } + if ( + object.trailing_comments !== undefined && + object.trailing_comments !== null + ) { + message.trailing_comments = object.trailing_comments; + } else { + message.trailing_comments = ""; + } + if ( + object.leading_detached_comments !== undefined && + object.leading_detached_comments !== null + ) { + for (const e of object.leading_detached_comments) { + message.leading_detached_comments.push(e); + } + } + return message; + }, +}; + +const baseGeneratedCodeInfo: object = {}; + +export const GeneratedCodeInfo = { + encode(message: GeneratedCodeInfo, writer: Writer = Writer.create()): Writer { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode( + v!, + writer.uint32(10).fork() + ).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; + message.annotation = []; + 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; + }, + + fromJSON(object: any): GeneratedCodeInfo { + const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; + message.annotation = []; + if (object.annotation !== undefined && object.annotation !== null) { + for (const e of object.annotation) { + message.annotation.push(GeneratedCodeInfo_Annotation.fromJSON(e)); + } + } + return message; + }, + + toJSON(message: GeneratedCodeInfo): unknown { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map((e) => + e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined + ); + } else { + obj.annotation = []; + } + return obj; + }, + + fromPartial(object: DeepPartial): GeneratedCodeInfo { + const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; + message.annotation = []; + if (object.annotation !== undefined && object.annotation !== null) { + for (const e of object.annotation) { + message.annotation.push(GeneratedCodeInfo_Annotation.fromPartial(e)); + } + } + return message; + }, +}; + +const baseGeneratedCodeInfo_Annotation: object = { + path: 0, + source_file: "", + begin: 0, + end: 0, +}; + +export const GeneratedCodeInfo_Annotation = { + encode( + message: GeneratedCodeInfo_Annotation, + writer: Writer = Writer.create() + ): Writer { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + if (message.source_file !== "") { + writer.uint32(18).string(message.source_file); + } + if (message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== 0) { + writer.uint32(32).int32(message.end); + } + return writer; + }, + + decode( + input: Reader | Uint8Array, + length?: number + ): GeneratedCodeInfo_Annotation { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { + ...baseGeneratedCodeInfo_Annotation, + } as GeneratedCodeInfo_Annotation; + message.path = []; + 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.source_file = 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; + }, + + fromJSON(object: any): GeneratedCodeInfo_Annotation { + const message = { + ...baseGeneratedCodeInfo_Annotation, + } as GeneratedCodeInfo_Annotation; + message.path = []; + if (object.path !== undefined && object.path !== null) { + for (const e of object.path) { + message.path.push(Number(e)); + } + } + if (object.source_file !== undefined && object.source_file !== null) { + message.source_file = String(object.source_file); + } else { + message.source_file = ""; + } + if (object.begin !== undefined && object.begin !== null) { + message.begin = Number(object.begin); + } else { + message.begin = 0; + } + if (object.end !== undefined && object.end !== null) { + message.end = Number(object.end); + } else { + message.end = 0; + } + return message; + }, + + toJSON(message: GeneratedCodeInfo_Annotation): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => e); + } else { + obj.path = []; + } + message.source_file !== undefined && + (obj.source_file = message.source_file); + message.begin !== undefined && (obj.begin = message.begin); + message.end !== undefined && (obj.end = message.end); + return obj; + }, + + fromPartial( + object: DeepPartial + ): GeneratedCodeInfo_Annotation { + const message = { + ...baseGeneratedCodeInfo_Annotation, + } as GeneratedCodeInfo_Annotation; + message.path = []; + if (object.path !== undefined && object.path !== null) { + for (const e of object.path) { + message.path.push(e); + } + } + if (object.source_file !== undefined && object.source_file !== null) { + message.source_file = object.source_file; + } else { + message.source_file = ""; + } + if (object.begin !== undefined && object.begin !== null) { + message.begin = object.begin; + } else { + message.begin = 0; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } else { + message.end = 0; + } + return message; + }, +}; + +declare var self: any | undefined; +declare var window: 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")); +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")); +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + for (let i = 0; i < arr.byteLength; ++i) { + bin.push(String.fromCharCode(arr[i])); + } + return btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (util.Long !== Long) { + util.Long = Long as any; + configure(); +} diff --git a/vue/src/store/generated/market/market.portal/module/types/portal/genesis.ts b/vue/src/store/generated/market/market.portal/module/types/portal/genesis.ts new file mode 100644 index 00000000..4312cdcf --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/portal/genesis.ts @@ -0,0 +1,96 @@ +/* eslint-disable */ +import { Params } from "../portal/params"; +import { Writer, Reader } from "protobufjs/minimal"; + +export const protobufPackage = "market.portal"; + +/** GenesisState defines the portal module's genesis state. */ +export interface GenesisState { + params: Params | undefined; + /** this line is used by starport scaffolding # genesis/proto/state */ + port_id: string; +} + +const baseGenesisState: object = { port_id: "" }; + +export const GenesisState = { + encode(message: GenesisState, writer: Writer = Writer.create()): Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.port_id !== "") { + writer.uint32(18).string(message.port_id); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseGenesisState } as GenesisState; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.port_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + const message = { ...baseGenesisState } as GenesisState; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromJSON(object.params); + } else { + message.params = undefined; + } + if (object.port_id !== undefined && object.port_id !== null) { + message.port_id = String(object.port_id); + } else { + message.port_id = ""; + } + return message; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.port_id !== undefined && (obj.port_id = message.port_id); + return obj; + }, + + fromPartial(object: DeepPartial): GenesisState { + const message = { ...baseGenesisState } as GenesisState; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } else { + message.params = undefined; + } + if (object.port_id !== undefined && object.port_id !== null) { + message.port_id = object.port_id; + } else { + message.port_id = ""; + } + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/vue/src/store/generated/market/market.portal/module/types/portal/packet.ts b/vue/src/store/generated/market/market.portal/module/types/portal/packet.ts new file mode 100644 index 00000000..7f43c0cd --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/portal/packet.ts @@ -0,0 +1,116 @@ +/* eslint-disable */ +import { Writer, Reader } from "protobufjs/minimal"; + +export const protobufPackage = "market.portal"; + +export interface PortalPacketData { + /** this line is used by starport scaffolding # ibc/packet/proto/field */ + noData: NoData | undefined; +} + +export interface NoData {} + +const basePortalPacketData: object = {}; + +export const PortalPacketData = { + encode(message: PortalPacketData, writer: Writer = Writer.create()): Writer { + if (message.noData !== undefined) { + NoData.encode(message.noData, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): PortalPacketData { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...basePortalPacketData } as PortalPacketData; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.noData = NoData.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): PortalPacketData { + const message = { ...basePortalPacketData } as PortalPacketData; + if (object.noData !== undefined && object.noData !== null) { + message.noData = NoData.fromJSON(object.noData); + } else { + message.noData = undefined; + } + return message; + }, + + toJSON(message: PortalPacketData): unknown { + const obj: any = {}; + message.noData !== undefined && + (obj.noData = message.noData ? NoData.toJSON(message.noData) : undefined); + return obj; + }, + + fromPartial(object: DeepPartial): PortalPacketData { + const message = { ...basePortalPacketData } as PortalPacketData; + if (object.noData !== undefined && object.noData !== null) { + message.noData = NoData.fromPartial(object.noData); + } else { + message.noData = undefined; + } + return message; + }, +}; + +const baseNoData: object = {}; + +export const NoData = { + encode(_: NoData, writer: Writer = Writer.create()): Writer { + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): NoData { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseNoData } as NoData; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): NoData { + const message = { ...baseNoData } as NoData; + return message; + }, + + toJSON(_: NoData): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial(_: DeepPartial): NoData { + const message = { ...baseNoData } as NoData; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/vue/src/store/generated/market/market.portal/module/types/portal/params.ts b/vue/src/store/generated/market/market.portal/module/types/portal/params.ts new file mode 100644 index 00000000..9cfe7a01 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/portal/params.ts @@ -0,0 +1,56 @@ +/* eslint-disable */ +import { Writer, Reader } from "protobufjs/minimal"; + +export const protobufPackage = "market.portal"; + +/** Params defines the parameters for the module. */ +export interface Params {} + +const baseParams: object = {}; + +export const Params = { + encode(_: Params, writer: Writer = Writer.create()): Writer { + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): Params { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseParams } as Params; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): Params { + const message = { ...baseParams } as Params; + return message; + }, + + toJSON(_: Params): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial(_: DeepPartial): Params { + const message = { ...baseParams } as Params; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/vue/src/store/generated/market/market.portal/module/types/portal/query.ts b/vue/src/store/generated/market/market.portal/module/types/portal/query.ts new file mode 100644 index 00000000..633ebde2 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/portal/query.ts @@ -0,0 +1,148 @@ +/* eslint-disable */ +import { Reader, Writer } from "protobufjs/minimal"; +import { Params } from "../portal/params"; + +export const protobufPackage = "market.portal"; + +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} + +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params: Params | undefined; +} + +const baseQueryParamsRequest: object = {}; + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: Writer = Writer.create()): Writer { + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; + return message; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; + return message; + }, +}; + +const baseQueryParamsResponse: object = {}; + +export const QueryParamsResponse = { + encode( + message: QueryParamsResponse, + writer: Writer = Writer.create() + ): Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof Uint8Array ? new Reader(input) : input; + let end = length === undefined ? reader.len : reader.pos + length; + const message = { ...baseQueryParamsResponse } as QueryParamsResponse; + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + const message = { ...baseQueryParamsResponse } as QueryParamsResponse; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromJSON(object.params); + } else { + message.params = undefined; + } + return message; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = { ...baseQueryParamsResponse } as QueryParamsResponse; + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } else { + message.params = undefined; + } + return message; + }, +}; + +/** Query defines the gRPC querier service. */ +export interface Query { + /** Parameters queries the parameters of the module. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("market.portal.Query", "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new Reader(data))); + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | undefined; +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/vue/src/store/generated/market/market.portal/module/types/portal/tx.ts b/vue/src/store/generated/market/market.portal/module/types/portal/tx.ts new file mode 100644 index 00000000..e7f7cddf --- /dev/null +++ b/vue/src/store/generated/market/market.portal/module/types/portal/tx.ts @@ -0,0 +1,20 @@ +/* eslint-disable */ +export const protobufPackage = "market.portal"; + +/** Msg defines the Msg service. */ +export interface Msg {} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } +} + +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} diff --git a/vue/src/store/generated/market/market.portal/package.json b/vue/src/store/generated/market/market.portal/package.json new file mode 100755 index 00000000..61237128 --- /dev/null +++ b/vue/src/store/generated/market/market.portal/package.json @@ -0,0 +1,18 @@ +{ + "name": "market-portal-js", + "version": "0.1.0", + "description": "Autogenerated vuex store for Cosmos module market.portal", + "author": "Starport Codegen ", + "homepage": "http://market/x/portal/types", + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "main": "index.js", + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/vue/src/store/generated/market/market.portal/vuex-root b/vue/src/store/generated/market/market.portal/vuex-root new file mode 100755 index 00000000..0fcc121a --- /dev/null +++ b/vue/src/store/generated/market/market.portal/vuex-root @@ -0,0 +1 @@ +THIS FILE IS GENERATED AUTOMATICALLY. DO NOT DELETE. diff --git a/x/portal/client/cli/query.go b/x/portal/client/cli/query.go new file mode 100644 index 00000000..7f6a97d3 --- /dev/null +++ b/x/portal/client/cli/query.go @@ -0,0 +1,31 @@ +package cli + +import ( + "fmt" + // "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + // sdk "github.com/cosmos/cosmos-sdk/types" + + "market/x/portal/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group portal queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/portal/client/cli/query_params.go b/x/portal/client/cli/query_params.go new file mode 100644 index 00000000..4147d326 --- /dev/null +++ b/x/portal/client/cli/query_params.go @@ -0,0 +1,34 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + "market/x/portal/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/portal/client/cli/tx.go b/x/portal/client/cli/tx.go new file mode 100644 index 00000000..019a1e4f --- /dev/null +++ b/x/portal/client/cli/tx.go @@ -0,0 +1,36 @@ +package cli + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + "market/x/portal/types" +) + +var ( + DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +) + +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/portal/genesis.go b/x/portal/genesis.go new file mode 100644 index 00000000..98434665 --- /dev/null +++ b/x/portal/genesis.go @@ -0,0 +1,36 @@ +package portal + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "market/x/portal/keeper" + "market/x/portal/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // this line is used by starport scaffolding # genesis/module/init + k.SetPort(ctx, genState.PortId) + // Only try to bind to port if it is not already bound, since we may already own + // port capability from capability InitGenesis + if !k.IsBound(ctx, genState.PortId) { + // module binds to the port on InitChain + // and claims the returned capability + err := k.BindPort(ctx, genState.PortId) + if err != nil { + panic("could not claim port capability: " + err.Error()) + } + } + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the capability module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + genesis.PortId = k.GetPort(ctx) + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/portal/genesis_test.go b/x/portal/genesis_test.go new file mode 100644 index 00000000..d6d21131 --- /dev/null +++ b/x/portal/genesis_test.go @@ -0,0 +1,31 @@ +package portal_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + keepertest "market/testutil/keeper" + "market/testutil/nullify" + "market/x/portal" + "market/x/portal/types" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + PortId: types.PortID, + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx := keepertest.PortalKeeper(t) + portal.InitGenesis(ctx, *k, genesisState) + got := portal.ExportGenesis(ctx, *k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + require.Equal(t, genesisState.PortId, got.PortId) + + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/portal/handler.go b/x/portal/handler.go new file mode 100644 index 00000000..e72c8d7d --- /dev/null +++ b/x/portal/handler.go @@ -0,0 +1,26 @@ +package portal + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "market/x/portal/keeper" + "market/x/portal/types" +) + +// NewHandler ... +func NewHandler(k keeper.Keeper) sdk.Handler { + // this line is used by starport scaffolding # handler/msgServer + + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + + switch msg := msg.(type) { + // this line is used by starport scaffolding # 1 + default: + errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + } + } +} diff --git a/x/portal/keeper/grpc_query.go b/x/portal/keeper/grpc_query.go new file mode 100644 index 00000000..7b900399 --- /dev/null +++ b/x/portal/keeper/grpc_query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "market/x/portal/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/portal/keeper/grpc_query_params.go b/x/portal/keeper/grpc_query_params.go new file mode 100644 index 00000000..12a875b1 --- /dev/null +++ b/x/portal/keeper/grpc_query_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "market/x/portal/types" +) + +func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/portal/keeper/grpc_query_params_test.go b/x/portal/keeper/grpc_query_params_test.go new file mode 100644 index 00000000..52061599 --- /dev/null +++ b/x/portal/keeper/grpc_query_params_test.go @@ -0,0 +1,21 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + testkeeper "market/testutil/keeper" + "market/x/portal/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := testkeeper.PortalKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + params := types.DefaultParams() + keeper.SetParams(ctx, params) + + response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/portal/keeper/keeper.go b/x/portal/keeper/keeper.go new file mode 100644 index 00000000..d1d89989 --- /dev/null +++ b/x/portal/keeper/keeper.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "fmt" + + "github.com/tendermint/tendermint/libs/log" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/ignite/cli/ignite/pkg/cosmosibckeeper" + "market/x/portal/types" +) + +type ( + Keeper struct { + *cosmosibckeeper.Keeper + cdc codec.BinaryCodec + storeKey sdk.StoreKey + memKey sdk.StoreKey + paramstore paramtypes.Subspace + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey sdk.StoreKey, + ps paramtypes.Subspace, + channelKeeper cosmosibckeeper.ChannelKeeper, + portKeeper cosmosibckeeper.PortKeeper, + scopedKeeper cosmosibckeeper.ScopedKeeper, + +) *Keeper { + // set KeyTable if it has not already been set + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + + return &Keeper{ + Keeper: cosmosibckeeper.NewKeeper( + types.PortKey, + storeKey, + channelKeeper, + portKeeper, + scopedKeeper, + ), + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramstore: ps, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/portal/keeper/msg_server.go b/x/portal/keeper/msg_server.go new file mode 100644 index 00000000..a2ab8f6d --- /dev/null +++ b/x/portal/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "market/x/portal/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/portal/keeper/msg_server_test.go b/x/portal/keeper/msg_server_test.go new file mode 100644 index 00000000..c4cb266b --- /dev/null +++ b/x/portal/keeper/msg_server_test.go @@ -0,0 +1,16 @@ +package keeper_test + +import ( + "context" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + keepertest "market/testutil/keeper" + "market/x/portal/keeper" + "market/x/portal/types" +) + +func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { + k, ctx := keepertest.PortalKeeper(t) + return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) +} diff --git a/x/portal/keeper/params.go b/x/portal/keeper/params.go new file mode 100644 index 00000000..14a638a2 --- /dev/null +++ b/x/portal/keeper/params.go @@ -0,0 +1,16 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "market/x/portal/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + return types.NewParams() +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} diff --git a/x/portal/keeper/params_test.go b/x/portal/keeper/params_test.go new file mode 100644 index 00000000..f70bda6f --- /dev/null +++ b/x/portal/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + testkeeper "market/testutil/keeper" + "market/x/portal/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := testkeeper.PortalKeeper(t) + params := types.DefaultParams() + + k.SetParams(ctx, params) + + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/portal/module.go b/x/portal/module.go new file mode 100644 index 00000000..a83c292d --- /dev/null +++ b/x/portal/module.go @@ -0,0 +1,177 @@ +package portal + +import ( + "encoding/json" + "fmt" + // this line is used by starport scaffolding # 1 + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + "market/x/portal/client/cli" + "market/x/portal/keeper" + "market/x/portal/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ porttypes.IBCModule = AppModule{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + // this line is used by starport scaffolding # 2 +} + +// GetTxCmd returns the capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// Route returns the capability module's message routing key. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +// QuerierRoute returns the capability module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// LegacyQuerierHandler returns the capability module's Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability module's genesis initialization It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 2 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/portal/module_ibc.go b/x/portal/module_ibc.go new file mode 100644 index 00000000..cdf1f8f6 --- /dev/null +++ b/x/portal/module_ibc.go @@ -0,0 +1,228 @@ +package portal + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" + "market/x/portal/types" +) + +// OnChanOpenInit implements the IBCModule interface +func (am AppModule) OnChanOpenInit( + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID string, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + version string, +) error { + + // Require portID is the portID module is bound to + boundPort := am.keeper.GetPort(ctx) + if boundPort != portID { + return sdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) + } + + if version != types.Version { + return sdkerrors.Wrapf(types.ErrInvalidVersion, "got %s, expected %s", version, types.Version) + } + + // Claim channel capability passed back by IBC module + if err := am.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { + return err + } + + return nil +} + +// OnChanOpenTry implements the IBCModule interface +func (am AppModule) OnChanOpenTry( + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + counterpartyVersion string, +) (string, error) { + + // Require portID is the portID module is bound to + boundPort := am.keeper.GetPort(ctx) + if boundPort != portID { + return "", sdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) + } + + if counterpartyVersion != types.Version { + return "", sdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: got: %s, expected %s", counterpartyVersion, types.Version) + } + + // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos + // (ie chainA and chainB both call ChanOpenInit before one of them calls ChanOpenTry) + // If module can already authenticate the capability then module already owns it so we don't need to claim + // Otherwise, module does not have channel capability and we must claim it from IBC + if !am.keeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { + // Only claim channel capability passed back by IBC module if we do not already own it + if err := am.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { + return "", err + } + } + + return types.Version, nil +} + +// OnChanOpenAck implements the IBCModule interface +func (am AppModule) OnChanOpenAck( + ctx sdk.Context, + portID, + channelID string, + _, + counterpartyVersion string, +) error { + if counterpartyVersion != types.Version { + return sdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, types.Version) + } + return nil +} + +// OnChanOpenConfirm implements the IBCModule interface +func (am AppModule) OnChanOpenConfirm( + ctx sdk.Context, + portID, + channelID string, +) error { + return nil +} + +// OnChanCloseInit implements the IBCModule interface +func (am AppModule) OnChanCloseInit( + ctx sdk.Context, + portID, + channelID string, +) error { + // Disallow user-initiated channel closing for channels + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "user cannot close channel") +} + +// OnChanCloseConfirm implements the IBCModule interface +func (am AppModule) OnChanCloseConfirm( + ctx sdk.Context, + portID, + channelID string, +) error { + return nil +} + +// OnRecvPacket implements the IBCModule interface +func (am AppModule) OnRecvPacket( + ctx sdk.Context, + modulePacket channeltypes.Packet, + relayer sdk.AccAddress, +) ibcexported.Acknowledgement { + var ack channeltypes.Acknowledgement + + // this line is used by starport scaffolding # oracle/packet/module/recv + + var modulePacketData types.PortalPacketData + if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { + return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()).Error()) + } + + // Dispatch packet + switch packet := modulePacketData.Packet.(type) { + // this line is used by starport scaffolding # ibc/packet/module/recv + default: + errMsg := fmt.Sprintf("unrecognized %s packet type: %T", types.ModuleName, packet) + return channeltypes.NewErrorAcknowledgement(errMsg) + } + + // NOTE: acknowledgement will be written synchronously during IBC handler execution. + return ack +} + +// OnAcknowledgementPacket implements the IBCModule interface +func (am AppModule) OnAcknowledgementPacket( + ctx sdk.Context, + modulePacket channeltypes.Packet, + acknowledgement []byte, + relayer sdk.AccAddress, +) error { + var ack channeltypes.Acknowledgement + if err := types.ModuleCdc.UnmarshalJSON(acknowledgement, &ack); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet acknowledgement: %v", err) + } + + // this line is used by starport scaffolding # oracle/packet/module/ack + + var modulePacketData types.PortalPacketData + if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()) + } + + var eventType string + + // Dispatch packet + switch packet := modulePacketData.Packet.(type) { + // this line is used by starport scaffolding # ibc/packet/module/ack + default: + errMsg := fmt.Sprintf("unrecognized %s packet type: %T", types.ModuleName, packet) + return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + eventType, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeyAck, fmt.Sprintf("%v", ack)), + ), + ) + + switch resp := ack.Response.(type) { + case *channeltypes.Acknowledgement_Result: + ctx.EventManager().EmitEvent( + sdk.NewEvent( + eventType, + sdk.NewAttribute(types.AttributeKeyAckSuccess, string(resp.Result)), + ), + ) + case *channeltypes.Acknowledgement_Error: + ctx.EventManager().EmitEvent( + sdk.NewEvent( + eventType, + sdk.NewAttribute(types.AttributeKeyAckError, resp.Error), + ), + ) + } + + return nil +} + +// OnTimeoutPacket implements the IBCModule interface +func (am AppModule) OnTimeoutPacket( + ctx sdk.Context, + modulePacket channeltypes.Packet, + relayer sdk.AccAddress, +) error { + var modulePacketData types.PortalPacketData + if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()) + } + + // Dispatch packet + switch packet := modulePacketData.Packet.(type) { + // this line is used by starport scaffolding # ibc/packet/module/timeout + default: + errMsg := fmt.Sprintf("unrecognized %s packet type: %T", types.ModuleName, packet) + return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + } + + return nil +} diff --git a/x/portal/module_simulation.go b/x/portal/module_simulation.go new file mode 100644 index 00000000..eb74ab0b --- /dev/null +++ b/x/portal/module_simulation.go @@ -0,0 +1,65 @@ +package portal + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + simappparams "github.com/cosmos/cosmos-sdk/simapp/params" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + "market/testutil/sample" + portalsimulation "market/x/portal/simulation" + "market/x/portal/types" +) + +// avoid unused import issue +var ( + _ = sample.AccAddress + _ = portalsimulation.FindAccount + _ = simappparams.StakePerAccount + _ = simulation.MsgEntryKind + _ = baseapp.Paramspace +) + +const ( +// this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + portalGenesis := types.GenesisState{ + Params: types.DefaultParams(), + PortId: types.PortID, + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&portalGenesis) +} + +// ProposalContents doesn't return any content functions for governance proposals +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// RandomizedParams creates randomized param changes for the simulator +func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { + + return []simtypes.ParamChange{} +} + +// RegisterStoreDecoder registers a decoder +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} diff --git a/x/portal/simulation/simap.go b/x/portal/simulation/simap.go new file mode 100644 index 00000000..92c437c0 --- /dev/null +++ b/x/portal/simulation/simap.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/portal/types/codec.go b/x/portal/types/codec.go new file mode 100644 index 00000000..844157a8 --- /dev/null +++ b/x/portal/types/codec.go @@ -0,0 +1,23 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + // this line is used by starport scaffolding # 1 + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + // this line is used by starport scaffolding # 2 +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/portal/types/errors.go b/x/portal/types/errors.go new file mode 100644 index 00000000..ad2363ff --- /dev/null +++ b/x/portal/types/errors.go @@ -0,0 +1,14 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// x/portal module sentinel errors +var ( + ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") + ErrInvalidPacketTimeout = sdkerrors.Register(ModuleName, 1500, "invalid packet timeout") + ErrInvalidVersion = sdkerrors.Register(ModuleName, 1501, "invalid version") +) diff --git a/x/portal/types/events_ibc.go b/x/portal/types/events_ibc.go new file mode 100644 index 00000000..07c66a43 --- /dev/null +++ b/x/portal/types/events_ibc.go @@ -0,0 +1,11 @@ +package types + +// IBC events +const ( + EventTypeTimeout = "timeout" + // this line is used by starport scaffolding # ibc/packet/event + + AttributeKeyAckSuccess = "success" + AttributeKeyAck = "acknowledgement" + AttributeKeyAckError = "error" +) diff --git a/x/portal/types/expected_keepers.go b/x/portal/types/expected_keepers.go new file mode 100644 index 00000000..6aa6e977 --- /dev/null +++ b/x/portal/types/expected_keepers.go @@ -0,0 +1,18 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here +} diff --git a/x/portal/types/genesis.go b/x/portal/types/genesis.go new file mode 100644 index 00000000..abef290f --- /dev/null +++ b/x/portal/types/genesis.go @@ -0,0 +1,29 @@ +package types + +import ( + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + // this line is used by starport scaffolding # genesis/types/import +) + +// DefaultIndex is the default capability global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + PortId: PortID, + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + if err := host.PortIdentifierValidator(gs.PortId); err != nil { + return err + } + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/portal/types/genesis.pb.go b/x/portal/types/genesis.pb.go new file mode 100644 index 00000000..2287d573 --- /dev/null +++ b/x/portal/types/genesis.pb.go @@ -0,0 +1,371 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: portal/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the portal module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + PortId string `protobuf:"bytes,2,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_efea6adab31ad109, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetPortId() string { + if m != nil { + return m.PortId + } + return "" +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "market.portal.GenesisState") +} + +func init() { proto.RegisterFile("portal/genesis.proto", fileDescriptor_efea6adab31ad109) } + +var fileDescriptor_efea6adab31ad109 = []byte{ + // 191 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0xc8, 0x2f, 0x2a, + 0x49, 0xcc, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0xe2, 0xcd, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xd1, 0x83, 0x48, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, + 0xe7, 0x83, 0x65, 0xf4, 0x41, 0x2c, 0x88, 0x22, 0x29, 0x61, 0xa8, 0xd6, 0x82, 0xc4, 0xa2, 0xc4, + 0x5c, 0xa8, 0x4e, 0xa5, 0x18, 0x2e, 0x1e, 0x77, 0x88, 0x51, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, + 0xc6, 0x5c, 0x6c, 0x10, 0x79, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x51, 0x3d, 0x14, 0xa3, + 0xf5, 0x02, 0xc0, 0x92, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x95, 0x0a, 0x89, 0x73, + 0xb1, 0x83, 0xa4, 0xe3, 0x33, 0x53, 0x24, 0x98, 0x14, 0x18, 0x35, 0x38, 0x83, 0xd8, 0x40, 0x5c, + 0xcf, 0x14, 0x27, 0xfd, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, + 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x12, 0x85, + 0x18, 0xab, 0x5f, 0xa1, 0x0f, 0x75, 0x55, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x55, + 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x52, 0x9f, 0x7b, 0x1c, 0xe7, 0x00, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PortId) > 0 { + i -= len(m.PortId) + copy(dAtA[i:], m.PortId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.PortId))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = len(m.PortId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PortId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/portal/types/genesis_test.go b/x/portal/types/genesis_test.go new file mode 100644 index 00000000..714ceb8b --- /dev/null +++ b/x/portal/types/genesis_test.go @@ -0,0 +1,40 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "market/x/portal/types" +) + +func TestGenesisState_Validate(t *testing.T) { + for _, tc := range []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + PortId: types.PortID, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/portal/types/keys.go b/x/portal/types/keys.go new file mode 100644 index 00000000..c32c4aba --- /dev/null +++ b/x/portal/types/keys.go @@ -0,0 +1,33 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "portal" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_portal" + + // Version defines the current version the IBC module supports + Version = "portal-1" + + // PortID is the default port id that module binds to + PortID = "portal" +) + +var ( + // PortKey defines the key to store the port ID in store + PortKey = KeyPrefix("portal-port-") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/portal/types/packet.pb.go b/x/portal/types/packet.pb.go new file mode 100644 index 00000000..50e969a3 --- /dev/null +++ b/x/portal/types/packet.pb.go @@ -0,0 +1,498 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: portal/packet.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type PortalPacketData struct { + // Types that are valid to be assigned to Packet: + // *PortalPacketData_NoData + Packet isPortalPacketData_Packet `protobuf_oneof:"packet"` +} + +func (m *PortalPacketData) Reset() { *m = PortalPacketData{} } +func (m *PortalPacketData) String() string { return proto.CompactTextString(m) } +func (*PortalPacketData) ProtoMessage() {} +func (*PortalPacketData) Descriptor() ([]byte, []int) { + return fileDescriptor_acf0e65d77ee4aa1, []int{0} +} +func (m *PortalPacketData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PortalPacketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PortalPacketData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PortalPacketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_PortalPacketData.Merge(m, src) +} +func (m *PortalPacketData) XXX_Size() int { + return m.Size() +} +func (m *PortalPacketData) XXX_DiscardUnknown() { + xxx_messageInfo_PortalPacketData.DiscardUnknown(m) +} + +var xxx_messageInfo_PortalPacketData proto.InternalMessageInfo + +type isPortalPacketData_Packet interface { + isPortalPacketData_Packet() + MarshalTo([]byte) (int, error) + Size() int +} + +type PortalPacketData_NoData struct { + NoData *NoData `protobuf:"bytes,1,opt,name=noData,proto3,oneof" json:"noData,omitempty"` +} + +func (*PortalPacketData_NoData) isPortalPacketData_Packet() {} + +func (m *PortalPacketData) GetPacket() isPortalPacketData_Packet { + if m != nil { + return m.Packet + } + return nil +} + +func (m *PortalPacketData) GetNoData() *NoData { + if x, ok := m.GetPacket().(*PortalPacketData_NoData); ok { + return x.NoData + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*PortalPacketData) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*PortalPacketData_NoData)(nil), + } +} + +type NoData struct { +} + +func (m *NoData) Reset() { *m = NoData{} } +func (m *NoData) String() string { return proto.CompactTextString(m) } +func (*NoData) ProtoMessage() {} +func (*NoData) Descriptor() ([]byte, []int) { + return fileDescriptor_acf0e65d77ee4aa1, []int{1} +} +func (m *NoData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NoData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NoData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NoData) XXX_Merge(src proto.Message) { + xxx_messageInfo_NoData.Merge(m, src) +} +func (m *NoData) XXX_Size() int { + return m.Size() +} +func (m *NoData) XXX_DiscardUnknown() { + xxx_messageInfo_NoData.DiscardUnknown(m) +} + +var xxx_messageInfo_NoData proto.InternalMessageInfo + +func init() { + proto.RegisterType((*PortalPacketData)(nil), "market.portal.PortalPacketData") + proto.RegisterType((*NoData)(nil), "market.portal.NoData") +} + +func init() { proto.RegisterFile("portal/packet.proto", fileDescriptor_acf0e65d77ee4aa1) } + +var fileDescriptor_acf0e65d77ee4aa1 = []byte{ + // 154 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0xc8, 0x2f, 0x2a, + 0x49, 0xcc, 0xd1, 0x2f, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0xe2, 0xcd, 0x4d, 0x2c, 0x02, 0xf3, 0xc0, 0x72, 0x4a, 0xbe, 0x5c, 0x02, 0x01, 0x60, 0x56, 0x00, + 0x58, 0x91, 0x4b, 0x62, 0x49, 0xa2, 0x90, 0x3e, 0x17, 0x5b, 0x5e, 0x3e, 0x88, 0x25, 0xc1, 0xa8, + 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xaa, 0x87, 0xa2, 0x47, 0xcf, 0x0f, 0x2c, 0xe9, 0xc1, 0x10, 0x04, + 0x55, 0xe6, 0xc4, 0xc1, 0xc5, 0x06, 0xb1, 0x43, 0x89, 0x83, 0x8b, 0x0d, 0x22, 0xeb, 0xa4, 0x7f, + 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, + 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xa2, 0x10, 0xd3, 0xf4, 0x2b, 0xf4, + 0xa1, 0xee, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xbb, 0xcf, 0x18, 0x10, 0x00, 0x00, + 0xff, 0xff, 0xe6, 0xc6, 0xca, 0x49, 0xb6, 0x00, 0x00, 0x00, +} + +func (m *PortalPacketData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PortalPacketData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PortalPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Packet != nil { + { + size := m.Packet.Size() + i -= size + if _, err := m.Packet.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *PortalPacketData_NoData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PortalPacketData_NoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.NoData != nil { + { + size, err := m.NoData.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPacket(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *NoData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NoData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NoData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintPacket(dAtA []byte, offset int, v uint64) int { + offset -= sovPacket(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PortalPacketData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Packet != nil { + n += m.Packet.Size() + } + return n +} + +func (m *PortalPacketData_NoData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NoData != nil { + l = m.NoData.Size() + n += 1 + l + sovPacket(uint64(l)) + } + return n +} +func (m *NoData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovPacket(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPacket(x uint64) (n int) { + return sovPacket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PortalPacketData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PortalPacketData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PortalPacketData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPacket + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPacket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &NoData{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Packet = &PortalPacketData_NoData{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPacket(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPacket + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NoData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPacket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NoData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NoData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipPacket(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPacket + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPacket(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPacket + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPacket + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPacket + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthPacket + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPacket + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPacket + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPacket = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPacket = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPacket = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/portal/types/params.go b/x/portal/types/params.go new file mode 100644 index 00000000..357196ad --- /dev/null +++ b/x/portal/types/params.go @@ -0,0 +1,39 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "gopkg.in/yaml.v2" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/portal/types/params.pb.go b/x/portal/types/params.pb.go new file mode 100644 index 00000000..ffb95c02 --- /dev/null +++ b/x/portal/types/params.pb.go @@ -0,0 +1,263 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: portal/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_1334e718aef311fc, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "market.portal.Params") +} + +func init() { proto.RegisterFile("portal/params.proto", fileDescriptor_1334e718aef311fc) } + +var fileDescriptor_1334e718aef311fc = []byte{ + // 129 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0xc8, 0x2f, 0x2a, + 0x49, 0xcc, 0xd1, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0xe2, 0xcd, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xd1, 0x83, 0xc8, 0x49, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, + 0x83, 0x65, 0xf4, 0x41, 0x2c, 0x88, 0x22, 0x25, 0x3e, 0x2e, 0xb6, 0x00, 0xb0, 0x26, 0x2b, 0x96, + 0x19, 0x0b, 0xe4, 0x19, 0x9c, 0xf4, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, + 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, + 0x4a, 0x14, 0x62, 0x9c, 0x7e, 0x85, 0x3e, 0xd4, 0xb2, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, + 0xb0, 0x39, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x35, 0xb2, 0xba, 0x48, 0x83, 0x00, 0x00, + 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/portal/types/query.pb.go b/x/portal/types/query.pb.go new file mode 100644 index 00000000..3ea69986 --- /dev/null +++ b/x/portal/types/query.pb.go @@ -0,0 +1,536 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: portal/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf9ec60fd245504, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf9ec60fd245504, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "market.portal.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "market.portal.QueryParamsResponse") +} + +func init() { proto.RegisterFile("portal/query.proto", fileDescriptor_ecf9ec60fd245504) } + +var fileDescriptor_ecf9ec60fd245504 = []byte{ + // 278 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xb1, 0x4e, 0xc3, 0x30, + 0x18, 0x84, 0x13, 0x04, 0x19, 0x8c, 0x58, 0xdc, 0x46, 0xa0, 0x08, 0x0c, 0x64, 0x42, 0x0c, 0xf9, + 0xd5, 0xf6, 0x0d, 0x3a, 0x32, 0x41, 0x47, 0xb6, 0x3f, 0xc8, 0x8a, 0x22, 0x1a, 0xff, 0x6e, 0xec, + 0x02, 0x5d, 0x79, 0x02, 0x24, 0x5e, 0xaa, 0x63, 0x25, 0x16, 0x26, 0x84, 0x12, 0x1e, 0x04, 0x35, + 0x36, 0x43, 0x40, 0x62, 0xb3, 0xfe, 0xfb, 0xee, 0x74, 0x67, 0xc6, 0x35, 0xd5, 0x16, 0xe7, 0xb0, + 0x58, 0xca, 0x7a, 0x95, 0xe9, 0x9a, 0x2c, 0xf1, 0x83, 0x0a, 0xeb, 0x7b, 0x69, 0x33, 0x27, 0x25, + 0xc3, 0x82, 0x0a, 0xea, 0x14, 0xd8, 0xbe, 0x1c, 0x94, 0x1c, 0x17, 0x44, 0xc5, 0x5c, 0x02, 0xea, + 0x12, 0x50, 0x29, 0xb2, 0x68, 0x4b, 0x52, 0xc6, 0xab, 0x97, 0x77, 0x64, 0x2a, 0x32, 0x90, 0xa3, + 0x91, 0x2e, 0x1b, 0x1e, 0x46, 0xb9, 0xb4, 0x38, 0x02, 0x8d, 0x45, 0xa9, 0x3a, 0xd8, 0xb3, 0x03, + 0x5f, 0x41, 0x63, 0x8d, 0x95, 0x0f, 0x48, 0x87, 0x8c, 0xdf, 0x6c, 0x6d, 0xd7, 0xdd, 0x71, 0x26, + 0x17, 0x4b, 0x69, 0x6c, 0x7a, 0xc5, 0x06, 0xbd, 0xab, 0xd1, 0xa4, 0x8c, 0xe4, 0x13, 0x16, 0x39, + 0xf3, 0x51, 0x78, 0x16, 0x5e, 0xec, 0x8f, 0xe3, 0xac, 0xb7, 0x20, 0x73, 0xf8, 0x74, 0x77, 0xfd, + 0x71, 0x1a, 0xcc, 0x3c, 0x3a, 0x7e, 0x64, 0x7b, 0x5d, 0x16, 0x57, 0x2c, 0x72, 0x00, 0x3f, 0xff, + 0xe5, 0xfb, 0xdb, 0x20, 0x49, 0xff, 0x43, 0x5c, 0x9d, 0xf4, 0xe4, 0xf9, 0xed, 0xeb, 0x75, 0xe7, + 0x90, 0xc7, 0xe0, 0x58, 0xe8, 0x0d, 0x9c, 0xc2, 0xba, 0x11, 0xe1, 0xa6, 0x11, 0xe1, 0x67, 0x23, + 0xc2, 0x97, 0x56, 0x04, 0x9b, 0x56, 0x04, 0xef, 0xad, 0x08, 0x6e, 0x63, 0xcf, 0x3f, 0xfd, 0x38, + 0xec, 0x4a, 0x4b, 0x93, 0x47, 0xdd, 0x97, 0x4c, 0xbe, 0x03, 0x00, 0x00, 0xff, 0xff, 0x95, 0x21, + 0xd9, 0x9e, 0xac, 0x01, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/market.portal.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/market.portal.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "market.portal.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "portal/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/portal/types/query.pb.gw.go b/x/portal/types/query.pb.gw.go new file mode 100644 index 00000000..4bacc8a9 --- /dev/null +++ b/x/portal/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: portal/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"market", "portal", "params"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/portal/types/tx.pb.go b/x/portal/types/tx.pb.go new file mode 100644 index 00000000..be094077 --- /dev/null +++ b/x/portal/types/tx.pb.go @@ -0,0 +1,79 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: portal/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("portal/tx.proto", fileDescriptor_6fbcff84cb2250fd) } + +var fileDescriptor_6fbcff84cb2250fd = []byte{ + // 105 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0xc8, 0x2f, 0x2a, + 0x49, 0xcc, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcd, 0x4d, 0x2c, + 0xca, 0x4e, 0x2d, 0xd1, 0x83, 0x88, 0x1b, 0xb1, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x3b, 0xe9, 0x9f, + 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, + 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x28, 0x44, 0xbd, 0x7e, 0x85, 0x3e, + 0xcc, 0xa4, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x69, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x57, 0xc0, 0x23, 0x86, 0x60, 0x00, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "market.portal.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "portal/tx.proto", +} diff --git a/x/portal/types/types.go b/x/portal/types/types.go new file mode 100644 index 00000000..ab1254f4 --- /dev/null +++ b/x/portal/types/types.go @@ -0,0 +1 @@ +package types