diff --git a/.gitignore b/.gitignore index 835df4c..bd7cb0e 100644 --- a/.gitignore +++ b/.gitignore @@ -349,7 +349,6 @@ healthchecksdb # Node / environment node_modules/ -dist/ .env .env.* !.env.example \ No newline at end of file diff --git a/dist/main/client/index.d.ts b/dist/main/client/index.d.ts new file mode 100644 index 0000000..ea3cfba --- /dev/null +++ b/dist/main/client/index.d.ts @@ -0,0 +1,82 @@ +import { CoreumNetworkConfig, CoreumNetworkKey } from "../types/coreum"; +import { EncodeObject, OfflineSigner, Registry } from "@cosmjs/proto-signing"; +import { TxRaw } from "../cosmos"; +import { ExtensionWallets, FeeCalculation, ClientQueryClient } from "../types"; +import { DeliverTxResponse, GasPrice, StargateClient } from "@cosmjs/stargate"; +import EventEmitter from "eventemitter3"; +import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; +interface WithExtensionOptions { + withWS?: boolean; +} +interface WithMnemonicOptions { + withWS?: boolean; +} +interface ClientProps { + network?: CoreumNetworkKey | string; + custom_ws_endpoint?: string; + custom_node_endpoint?: string; + tx_memo?: string; + /** Allow http:// and ws:// endpoints (development only). */ + allowInsecureEndpoints?: boolean; +} +export declare class Client { + private _tmClient; + private _queryClient; + private _wsClient; + private _client; + private _address; + private _feeModel; + private _eventSequence; + private readonly _config; + private readonly _customWsEndpoint?; + private readonly _customNodeEndpoint?; + private readonly _txMemo?; + private readonly _endpointOptions; + get config(): Readonly; + get queryClients(): ClientQueryClient | undefined; + constructor(props?: ClientProps); + disconnect(): void; + get address(): string | undefined; + get stargate(): SigningCosmWasmClient | StargateClient | undefined; + addCustomSigner(offlineSigner: OfflineSigner): Promise; + connect(options?: { + withWS?: boolean; + }): Promise; + connectWithExtension(extension?: ExtensionWallets, options?: WithExtensionOptions): Promise; + connectWithMnemonic(mnemonic: string, options?: WithMnemonicOptions): Promise; + getTxFee(msgs: readonly EncodeObject[]): Promise; + calculateGas(msgs: readonly EncodeObject[], options?: { + fromAddress?: string; + gasAdjustment?: number; + }): Promise; + getGasPrice(): Promise; + broadcastTx(transaction: Uint8Array, options?: { + timeoutMs?: number; + pollIntervalMs?: number; + }): Promise; + sendTx(msgs: readonly EncodeObject[], memo?: string): Promise; + signTx(msgs: readonly EncodeObject[], memo?: string, customSequence?: number): Promise; + subscribeToEvent(event: string): Promise<{ + events: EventEmitter; + unsubscribe: () => void; + }>; + createMultisigAccount(addresses: string[], threshold?: number): Promise; + static getRegistry(): Registry; + private _formatMemo; + private _getRpcEndpoint; + private _getWsEndpoint; + private _getWalletConfig; + private _assertConnectedAddress; + private _getGasPrice; + private _buildTxForSimulation; + private _isSigningClientInit; + private _initTendermintClient; + private _initQueryClient; + private _initFeeModel; + private _initWsClient; + private _createClient; + private _getKeplrSigner; + private _getCosmostationSigner; + private _getLeapSigner; +} +export {}; diff --git a/dist/main/client/index.js b/dist/main/client/index.js new file mode 100644 index 0000000..ca404fa --- /dev/null +++ b/dist/main/client/index.js @@ -0,0 +1,498 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Client = void 0; +const coreum_1 = require("../coreum"); +const v1_1 = require("../wasm/v1"); +const ft_1 = require("../coreum/extensions/ft"); +const nft_1 = require("../coreum/extensions/nft"); +const nftbeta_1 = require("../coreum/extensions/nftbeta"); +const dex_1 = require("../coreum/extensions/dex"); +const services_1 = require("../services"); +const coreum_2 = require("../types/coreum"); +const query_1 = require("../coreum/feemodel/v1/query"); +const proto_signing_1 = require("@cosmjs/proto-signing"); +const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc"); +const cosmos_1 = require("../cosmos"); +const signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing"); +const service_1 = require("cosmjs-types/cosmos/tx/v1beta1/service"); +const keys_1 = require("cosmjs-types/cosmos/crypto/secp256k1/keys"); +const tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx"); +const types_1 = require("../types"); +const utils_1 = require("../utils"); +const endpoints_1 = require("../utils/endpoints"); +const errors_1 = require("../errors"); +const stargate_1 = require("@cosmjs/stargate"); +const encoding_1 = require("@cosmjs/encoding"); +const crypto_1 = require("@cosmjs/crypto"); +const extensions_1 = require("../cosmos/extensions"); +const eventemitter3_1 = __importDefault(require("eventemitter3")); +const event_1 = require("../utils/event"); +const extension_client_1 = require("@cosmostation/extension-client"); +const cosmwasm_stargate_1 = require("@cosmjs/cosmwasm-stargate"); +const bignumber_js_1 = __importDefault(require("bignumber.js")); +const MAX_EVENT_QUERY_LENGTH = 512; +function isSigningClient(object) { + return (typeof object === "object" && + object !== null && + "signAndBroadcast" in object); +} +class Client { + get config() { + return this._config; + } + get queryClients() { + return this._queryClient; + } + constructor(props) { + this._eventSequence = 0; + const networkKey = (props?.network ?? "mainnet"); + const baseConfig = coreum_2.COREUM_CONFIG[networkKey]; + if (!baseConfig) { + throw new Error(`Invalid network "${props?.network}". Expected one of: mainnet, testnet, devnet`); + } + if (props?.custom_node_endpoint && !props.network) { + throw new Error("If using a custom node, please specify the type of network."); + } + this._endpointOptions = { + allowInsecure: props?.allowInsecureEndpoints ?? false, + }; + this._config = Object.freeze({ ...baseConfig }); + this._txMemo = props?.tx_memo; + this._customNodeEndpoint = props?.custom_node_endpoint + ? (0, endpoints_1.validateRpcEndpoint)(props.custom_node_endpoint, this._endpointOptions) + : undefined; + this._customWsEndpoint = props?.custom_ws_endpoint + ? (0, endpoints_1.validateWsEndpoint)(props.custom_ws_endpoint, this._endpointOptions) + : undefined; + } + disconnect() { + if (this._client) { + this._client.disconnect(); + this._client = undefined; + } + if (this._tmClient) { + this._tmClient.disconnect(); + this._tmClient = undefined; + } + if (this._wsClient) { + this._wsClient.disconnect(); + this._wsClient = undefined; + } + this._address = undefined; + this._queryClient = undefined; + this._eventSequence = 0; + this._feeModel = undefined; + } + get address() { + return this._address; + } + get stargate() { + return this._client; + } + async addCustomSigner(offlineSigner) { + try { + const accounts = await offlineSigner.getAccounts(); + if (accounts.length === 0) { + throw new Error("Offline signer returned no accounts"); + } + (0, utils_1.assertValidCoreumAddress)(accounts[0].address, this._config.chain_bech32_prefix); + if (!this._tmClient) { + await this._initTendermintClient(this._getRpcEndpoint()); + this._initQueryClient(); + this._initFeeModel(); + } + await this._createClient(offlineSigner); + } + catch (error) { + throw (0, errors_1.toTxJsError)("addCustomSigner", error); + } + } + async connect(options) { + await this._initTendermintClient(this._getRpcEndpoint()); + await this._createClient(); + this._initQueryClient(); + this._initFeeModel(); + if (options?.withWS) { + await this._initWsClient(this._getWsEndpoint()); + } + } + async connectWithExtension(extension = types_1.ExtensionWallets.KEPLR, options) { + try { + const walletConfig = this._getWalletConfig(); + let offlineSigner; + switch (extension) { + case types_1.ExtensionWallets.COSMOSTATION: + offlineSigner = await this._getCosmostationSigner(walletConfig); + break; + case types_1.ExtensionWallets.LEAP: + offlineSigner = await this._getLeapSigner(walletConfig); + break; + default: + offlineSigner = await this._getKeplrSigner(walletConfig); + } + await this._initTendermintClient(this._getRpcEndpoint()); + await this._createClient(offlineSigner); + this._initQueryClient(); + this._initFeeModel(); + if (options?.withWS) { + await this._initWsClient(this._getWsEndpoint()); + } + } + catch (error) { + throw (0, errors_1.normalizeWalletError)("connectWithExtension", error); + } + } + async connectWithMnemonic(mnemonic, options) { + try { + const offlineSigner = await (0, utils_1.generateWalletFromMnemonic)(mnemonic, this._config.chain_bech32_prefix); + await this._initTendermintClient(this._getRpcEndpoint()); + this._initQueryClient(); + this._initFeeModel(); + await this._createClient(offlineSigner); + if (options?.withWS) { + await this._initWsClient(this._getWsEndpoint()); + } + } + catch (error) { + throw (0, errors_1.toTxJsError)("connectWithMnemonic", error); + } + } + async getTxFee(msgs) { + this._isSigningClientInit(); + this._assertConnectedAddress(); + const signer = this._client; + const gasPrice = await this._getGasPrice(); + const gasWanted = await signer.simulate(this._address, msgs, ""); + const totalGasWanted = new bignumber_js_1.default(gasWanted) + .multipliedBy(1.2) + .integerValue() + .toNumber(); + return { + gas_wanted: totalGasWanted, + fee: (0, stargate_1.calculateFee)(totalGasWanted, gasPrice), + }; + } + async calculateGas(msgs, options) { + if (!this._queryClient) { + throw new Error("Query client not initialized. Call connect() first."); + } + const { fromAddress, gasAdjustment = 1.2 } = options || {}; + if (fromAddress) { + (0, utils_1.assertValidCoreumAddress)(fromAddress, this._config.chain_bech32_prefix); + } + let simAddress; + if (fromAddress) { + simAddress = fromAddress; + } + else { + const dummyHash = (0, crypto_1.sha256)(new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])); + const addressBytes = dummyHash.slice(0, 20); + simAddress = (0, encoding_1.toBech32)(this._config.chain_bech32_prefix, addressBytes); + } + let accountNumber = 0; + let sequence = 0; + if (fromAddress && this._client) { + try { + const account = await this._client.getAccount(fromAddress); + if (account) { + accountNumber = account.accountNumber; + sequence = account.sequence; + } + } + catch { + // If account doesn't exist, use defaults (0, 0) + } + } + const txBytes = await this._buildTxForSimulation(msgs, simAddress, accountNumber, sequence); + const rpcClient = (0, stargate_1.createProtobufRpcClient)(this._queryClient); + const txService = new service_1.ServiceClientImpl(rpcClient); + const simulateResponse = await txService.Simulate({ + txBytes: txBytes, + }); + if (!simulateResponse.gasInfo) { + throw new Error("Simulation failed: no gas info returned"); + } + const gasUsed = Number(simulateResponse.gasInfo.gasUsed || 0); + return Math.ceil(gasUsed * gasAdjustment); + } + async getGasPrice() { + return this._getGasPrice(); + } + async broadcastTx(transaction, options) { + try { + if (!this._client) { + throw new Error("Client is not connected"); + } + return await this._client.broadcastTx(transaction, options?.timeoutMs, options?.pollIntervalMs); + } + catch (error) { + throw (0, errors_1.toTxJsError)("broadcastTx", error); + } + } + async sendTx(msgs, memo) { + try { + this._isSigningClientInit(); + this._assertConnectedAddress(); + const { fee } = await this.getTxFee(msgs); + return await this._client.signAndBroadcast(this._address, msgs, fee, this._formatMemo(memo)); + } + catch (error) { + throw (0, errors_1.toTxJsError)("sendTx", error); + } + } + async signTx(msgs, memo = "", customSequence) { + try { + this._isSigningClientInit(); + this._assertConnectedAddress(); + const signingClient = this._client; + const account = await signingClient.getAccount(this._address); + if (!account) { + throw new Error(`Account not found for address ${this._address}`); + } + const { accountNumber, sequence } = account; + const { fee } = await this.getTxFee(msgs); + return signingClient.sign(this._address, msgs, fee, this._formatMemo(memo), { + accountNumber, + sequence: customSequence ?? sequence, + chainId: this._config.chain_id, + }); + } + catch (error) { + throw (0, errors_1.toTxJsError)("signTx", error); + } + } + async subscribeToEvent(event) { + try { + if (!event || event.length > MAX_EVENT_QUERY_LENGTH) { + throw new Error("Invalid event query"); + } + if (this._wsClient === undefined) { + throw new Error("No Websocket client initialized"); + } + const emitter = new eventemitter3_1.default(); + const stream = this._wsClient.listen({ + jsonrpc: "2.0", + method: "subscribe", + id: this._eventSequence, + params: { query: event }, + }); + const listener = { + next: (x) => { + emitter.emit(event, { + data: x.data, + events: x.events ? (0, event_1.parseSubscriptionEvents)(x.events) : x, + }); + }, + error: (err) => { + emitter.emit("subscription-error", err); + }, + complete: () => { + emitter.emit("subscription-complete", { event }); + }, + }; + const subscription = stream.subscribe(listener); + this._eventSequence++; + return { + events: emitter, + unsubscribe: subscription.unsubscribe, + }; + } + catch (error) { + throw (0, errors_1.toTxJsError)("subscribeToEvent", error); + } + } + async createMultisigAccount(addresses, threshold = 2) { + try { + if (addresses.length < 2) { + throw new Error("addresses param must be at least of length: 2"); + } + if (!this._client) { + throw new Error("Client is not connected"); + } + const pubkeys = []; + for (const address of addresses) { + (0, utils_1.assertValidCoreumAddress)(address, this._config.chain_bech32_prefix); + const account = await this._client.getAccount(address); + if (!account?.pubkey) { + throw new Error(`${address} has no pubkey on chain, this address will need to send a transaction to appear on chain.`); + } + pubkeys.push(account.pubkey.value); + } + return (0, utils_1.generateMultisigFromPubkeys)(pubkeys, threshold, this._config.chain_bech32_prefix); + } + catch (error) { + throw (0, errors_1.toTxJsError)("createMultisigAccount", error); + } + } + static getRegistry() { + const registryTypes = [ + ...stargate_1.defaultRegistryTypes, + ...coreum_1.coreumRegistry, + ...v1_1.cosmwasmRegistry, + ]; + return new proto_signing_1.Registry(registryTypes); + } + _formatMemo(memo) { + if (this._txMemo) { + return memo ? `${this._txMemo} - ${memo}` : this._txMemo; + } + return memo || ""; + } + _getRpcEndpoint() { + return this._customNodeEndpoint ?? this._config.chain_rpc_endpoint; + } + _getWsEndpoint() { + return this._customWsEndpoint ?? this._config.chain_ws_endpoint; + } + _getWalletConfig() { + return Object.freeze({ + ...this._config, + chain_rpc_endpoint: this._getRpcEndpoint(), + chain_ws_endpoint: this._getWsEndpoint(), + }); + } + _assertConnectedAddress() { + if (!this._address) { + throw new Error("No connected wallet address"); + } + if (!(0, utils_1.isValidCoreumAddress)(this._address, this._config.chain_bech32_prefix)) { + throw new Error(`Invalid connected address: ${this._address}`); + } + } + async _getGasPrice() { + const gasPriceMultiplier = 1.1; + const feemodelParams = await this._feeModel.Params({}); + const minGasPriceRes = await this._feeModel.MinGasPrice({}); + const minGasPrice = (0, stargate_1.decodeCosmosSdkDecFromProto)(minGasPriceRes.minGasPrice?.amount || ""); + let gasPrice = minGasPrice.toFloatApproximation() * gasPriceMultiplier; + const initialGasPrice = (0, stargate_1.decodeCosmosSdkDecFromProto)(feemodelParams.params?.model?.initialGasPrice || "").toFloatApproximation(); + if (gasPrice > initialGasPrice) { + gasPrice = initialGasPrice; + } + return stargate_1.GasPrice.fromString(`${gasPrice}${minGasPriceRes.minGasPrice?.denom || ""}`); + } + async _buildTxForSimulation(msgs, fromAddress, accountNumber = 0, sequence = 0) { + if (!this._queryClient) { + throw new Error("Query client not initialized. Call connect() first."); + } + const registry = Client.getRegistry(); + const dummyPubKeyBytes = new Uint8Array(33).fill(0); + dummyPubKeyBytes[0] = 0x02; + const dummyPubKey = { + key: dummyPubKeyBytes, + }; + const pubkeyHash = (0, crypto_1.sha256)(dummyPubKeyBytes); + const addressBytes = (0, crypto_1.ripemd160)(pubkeyHash).slice(0, 20); + const derivedAddress = (0, encoding_1.toBech32)(this._config.chain_bech32_prefix, addressBytes); + const finalAddress = fromAddress || derivedAddress; + const signerInfo = { + publicKey: { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: keys_1.PubKey.encode(dummyPubKey).finish(), + }, + modeInfo: { + single: { + mode: signing_1.SignMode.SIGN_MODE_DIRECT, + }, + }, + sequence: BigInt(sequence), + }; + const fee = { + amount: [], + gasLimit: BigInt(0), + payer: "", + granter: "", + }; + const authInfo = { + signerInfos: [signerInfo], + fee: fee, + }; + const body = { + messages: msgs.map((msg) => { + const encoded = registry.encode(msg); + return { + typeUrl: msg.typeUrl, + value: encoded, + }; + }), + memo: "", + timeoutHeight: BigInt(0), + extensionOptions: [], + nonCriticalExtensionOptions: [], + }; + const bodyBytes = tx_1.TxBody.encode(body).finish(); + const authInfoBytes = tx_1.AuthInfo.encode(authInfo).finish(); + const dummySignature = new Uint8Array(64).fill(0); + const txRaw = { + bodyBytes: bodyBytes, + authInfoBytes: authInfoBytes, + signatures: [dummySignature], + }; + return cosmos_1.TxRaw.encode(txRaw).finish(); + } + _isSigningClientInit() { + if (!this._client || !isSigningClient(this._client)) { + throw new Error("Signing Client is not initialized"); + } + } + async _initTendermintClient(rpcEndpoint) { + this._tmClient = await tendermint_rpc_1.Tendermint37Client.connect(rpcEndpoint); + } + _initQueryClient() { + this._queryClient = stargate_1.QueryClient.withExtensions(this._tmClient, ft_1.setupFTExtension, nft_1.setupNFTExtension, nftbeta_1.setupNFTBetaExtension, stargate_1.setupStakingExtension, extensions_1.setupBankExtension, extensions_1.setupDistributionExtension, stargate_1.setupTxExtension, stargate_1.setupAuthExtension, stargate_1.setupMintExtension, stargate_1.setupFeegrantExtension, extensions_1.setupGovExtension, stargate_1.setupIbcExtension, cosmwasm_stargate_1.setupWasmExtension, dex_1.setupDexExtension); + } + _initFeeModel() { + const rpcClient = (0, stargate_1.createProtobufRpcClient)(this._queryClient); + this._feeModel = new query_1.QueryClientImpl(rpcClient); + } + async _initWsClient(wsEndpoint) { + this._wsClient = new tendermint_rpc_1.WebsocketClient(wsEndpoint); + await this.subscribeToEvent("tm.event='NewBlock'"); + } + async _createClient(offlineSigner) { + const registry = Client.getRegistry(); + const clientOptions = { + registry, + gasPrice: stargate_1.GasPrice.fromString(this._config.gas_price), + }; + if (!offlineSigner) { + if (!this._tmClient) { + throw new Error("Tendermint client is not initialized"); + } + this._client = await stargate_1.StargateClient.create(this._tmClient); + return; + } + const [{ address }] = await offlineSigner.getAccounts(); + this._address = address; + if (this._tmClient) { + this._client = await cosmwasm_stargate_1.SigningCosmWasmClient.createWithSigner(this._tmClient, offlineSigner, clientOptions); + } + else { + this._client = await cosmwasm_stargate_1.SigningCosmWasmClient.connectWithSigner(this._getRpcEndpoint(), offlineSigner, clientOptions); + } + const clientWithAmino = this._client; + // CosmJS exposes aminoTypes as a private field; merge Coreum converters at runtime. + clientWithAmino.aminoTypes.register = { + ...clientWithAmino.aminoTypes.register, + ...coreum_1.coreumAminoConverters, + }; + } + async _getKeplrSigner(walletConfig) { + await (0, services_1.connectKeplr)(walletConfig); + return (0, services_1.getKeplrOfflineSigner)(walletConfig.chain_id); + } + async _getCosmostationSigner(walletConfig) { + await (0, services_1.connectCosmostation)(walletConfig); + const provider = await (0, extension_client_1.cosmos)(); + await provider.requestAccount(walletConfig.chain_name); + return (0, services_1.getCosmosOfflineSigner)(walletConfig.chain_id); + } + async _getLeapSigner(walletConfig) { + await (0, services_1.connectLeap)(walletConfig); + return (0, services_1.getLeapOfflineSigner)(walletConfig.chain_id); + } +} +exports.Client = Client; diff --git a/dist/main/coreum/amino/index.d.ts b/dist/main/coreum/amino/index.d.ts new file mode 100644 index 0000000..e927ca0 --- /dev/null +++ b/dist/main/coreum/amino/index.d.ts @@ -0,0 +1 @@ +export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./types"; diff --git a/dist/main/coreum/amino/index.js b/dist/main/coreum/amino/index.js new file mode 100644 index 0000000..ee145ef --- /dev/null +++ b/dist/main/coreum/amino/index.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.nftBetaAminoConverters = exports.nftAminoConverters = exports.dexAminoConverters = exports.ftAminoConverters = exports.coreumAminoConverters = exports.createCoreumAminoTypes = void 0; +var types_1 = require("./types"); +Object.defineProperty(exports, "createCoreumAminoTypes", { enumerable: true, get: function () { return types_1.createCoreumAminoTypes; } }); +Object.defineProperty(exports, "coreumAminoConverters", { enumerable: true, get: function () { return types_1.coreumAminoConverters; } }); +Object.defineProperty(exports, "ftAminoConverters", { enumerable: true, get: function () { return types_1.ftAminoConverters; } }); +Object.defineProperty(exports, "dexAminoConverters", { enumerable: true, get: function () { return types_1.dexAminoConverters; } }); +Object.defineProperty(exports, "nftAminoConverters", { enumerable: true, get: function () { return types_1.nftAminoConverters; } }); +Object.defineProperty(exports, "nftBetaAminoConverters", { enumerable: true, get: function () { return types_1.nftBetaAminoConverters; } }); diff --git a/dist/main/coreum/amino/types.d.ts b/dist/main/coreum/amino/types.d.ts new file mode 100644 index 0000000..70998aa --- /dev/null +++ b/dist/main/coreum/amino/types.d.ts @@ -0,0 +1,7 @@ +import { AminoConverters, AminoTypes } from "@cosmjs/stargate"; +export declare const ftAminoConverters: AminoConverters; +export declare const dexAminoConverters: AminoConverters; +export declare const nftAminoConverters: AminoConverters; +export declare const nftBetaAminoConverters: AminoConverters; +export declare const coreumAminoConverters: AminoConverters; +export declare function createCoreumAminoTypes(): AminoTypes; diff --git a/dist/main/coreum/amino/types.js b/dist/main/coreum/amino/types.js new file mode 100644 index 0000000..f30aed9 --- /dev/null +++ b/dist/main/coreum/amino/types.js @@ -0,0 +1,568 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createCoreumAminoTypes = exports.coreumAminoConverters = exports.nftBetaAminoConverters = exports.nftAminoConverters = exports.dexAminoConverters = exports.ftAminoConverters = void 0; +const stargate_1 = require("@cosmjs/stargate"); +// FT (Fungible Token) Amino Types +exports.ftAminoConverters = { + // MsgIssue - Issue new fungible token + "/coreum.asset.ft.v1.MsgIssue": { + aminoType: "aseestft/MsgIssue", + toAmino: ({ issuer, symbol, subunit, precision, initialAmount, description, features, burnRate, sendCommissionRate, uri, uriHash, extensionSettings, dexSettings, }) => ({ + issuer, + symbol, + subunit, + precision, + initial_amount: initialAmount, + description, + features, + burn_rate: burnRate, + send_commission_rate: sendCommissionRate, + uri, + uri_hash: uriHash, + extension_settings: extensionSettings, + dex_settings: dexSettings, + }), + fromAmino: ({ issuer, symbol, subunit, precision, initial_amount, description, features, burn_rate, send_commission_rate, uri, uri_hash, extension_settings, dex_settings, }) => ({ + issuer, + symbol, + subunit, + precision, + initialAmount: initial_amount, + description, + features, + burnRate: burn_rate, + sendCommissionRate: send_commission_rate, + uri, + uriHash: uri_hash, + extensionSettings: extension_settings, + dexSettings: dex_settings, + }), + }, + // MsgMint - Mint new fungible tokens + "/coreum.asset.ft.v1.MsgMint": { + aminoType: "aseestft/MsgMint", + toAmino: ({ sender, coin, recipient }) => ({ + sender, + coin, + recipient, + }), + fromAmino: ({ sender, coin, recipient }) => ({ + sender, + coin, + recipient, + }), + }, + // MsgBurn - Burn fungible tokens + "/coreum.asset.ft.v1.MsgBurn": { + aminoType: "aseestft/MsgBurn", + toAmino: ({ sender, coin }) => ({ + sender, + coin, + }), + fromAmino: ({ sender, coin }) => ({ + sender, + coin, + }), + }, + // MsgFreeze - Freeze fungible tokens + "/coreum.asset.ft.v1.MsgFreeze": { + aminoType: "aseestft/MsgFreeze", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgUnfreeze - Unfreeze fungible tokens + "/coreum.asset.ft.v1.MsgUnfreeze": { + aminoType: "aseestft/MsgUnfreeze", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgSetFrozen - Set frozen amount + "/coreum.asset.ft.v1.MsgSetFrozen": { + aminoType: "aseestft/MsgSetFrozen", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgGloballyFreeze - Globally freeze token + "/coreum.asset.ft.v1.MsgGloballyFreeze": { + aminoType: "aseestft/MsgGloballyFreeze", + toAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + fromAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + }, + // MsgGloballyUnfreeze - Globally unfreeze token + "/coreum.asset.ft.v1.MsgGloballyUnfreeze": { + aminoType: "aseestft/MsgGloballyUnfreeze", + toAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + fromAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + }, + // MsgClawback - Clawback tokens + "/coreum.asset.ft.v1.MsgClawback": { + aminoType: "aseestft/MsgClawback", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgSetWhitelistedLimit - Set whitelisted limit + "/coreum.asset.ft.v1.MsgSetWhitelistedLimit": { + aminoType: "aseestft/MsgSetWhitelistedLimit", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgTransferAdmin - Transfer admin + "/coreum.asset.ft.v1.MsgTransferAdmin": { + aminoType: "aseestft/MsgTransferAdmin", + toAmino: ({ sender, account, denom }) => ({ + sender, + account, + denom, + }), + fromAmino: ({ sender, account, denom }) => ({ + sender, + account, + denom, + }), + }, + // MsgClearAdmin - Clear admin + "/coreum.asset.ft.v1.MsgClearAdmin": { + aminoType: "aseestft/MsgClearAdmin", + toAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + fromAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + }, + // MsgUpgradeTokenV1 - Upgrade token to V1 + "/coreum.asset.ft.v1.MsgUpgradeTokenV1": { + aminoType: "aseestft/MsgUpgradeTokenV1", + toAmino: ({ sender, denom, ibcEnabled }) => ({ + sender, + denom, + ibc_enabled: ibcEnabled, + }), + fromAmino: ({ sender, denom, ibc_enabled }) => ({ + sender, + denom, + ibcEnabled: ibc_enabled, + }), + }, + // MsgUpdateParams - Update parameters + "/coreum.asset.ft.v1.MsgUpdateParams": { + aminoType: "aseestft/MsgUpdateParams", + toAmino: ({ authority, params }) => ({ + authority, + params, + }), + fromAmino: ({ authority, params }) => ({ + authority, + params, + }), + }, + // MsgUpdateDEXUnifiedRefAmount - Update DEX unified ref amount + "/coreum.asset.ft.v1.MsgUpdateDEXUnifiedRefAmount": { + aminoType: "aseestft/MsgUpdateDEXUnifiedRefAmount", + toAmino: ({ sender, denom, unifiedRefAmount, }) => ({ + sender, + denom, + unified_ref_amount: unifiedRefAmount, + }), + fromAmino: ({ sender, denom, unified_ref_amount, }) => ({ + sender, + denom, + unifiedRefAmount: unified_ref_amount, + }), + }, + // MsgUpdateDEXWhitelistedDenoms - Update DEX whitelisted denoms + "/coreum.asset.ft.v1.MsgUpdateDEXWhitelistedDenoms": { + aminoType: "aseestft/MsgUpdateDEXWhitelistedDenoms", + toAmino: ({ sender, denom, whitelistedDenoms, }) => ({ + sender, + denom, + whitelisted_denoms: whitelistedDenoms, + }), + fromAmino: ({ sender, denom, whitelisted_denoms, }) => ({ + sender, + denom, + whitelistedDenoms: whitelisted_denoms, + }), + }, +}; +// DEX Amino Types +exports.dexAminoConverters = { + // MsgUpdateParams - Update DEX parameters + "/coreum.dex.v1.MsgUpdateParams": { + aminoType: "dex/MsgUpdateParams", + toAmino: ({ authority, params }) => ({ + authority, + params, + }), + fromAmino: ({ authority, params }) => ({ + authority, + params, + }), + }, + // MsgPlaceOrder - Place order on DEX + "/coreum.dex.v1.MsgPlaceOrder": { + aminoType: "dex/MsgPlaceOrder", + toAmino: ({ sender, type, id, baseDenom, quoteDenom, price, quantity, side, goodTil, timeInForce, }) => ({ + sender, + type, + id, + base_denom: baseDenom, + quote_denom: quoteDenom, + price, + quantity, + side, + good_til: goodTil + ? goodTil.goodTilBlockHeight != null + ? { blocks: String(goodTil.goodTilBlockHeight) } + : goodTil.goodTilBlockTime + ? { time: goodTil.goodTilBlockTime.toISOString() } + : undefined + : undefined, + time_in_force: timeInForce, // number + }), + fromAmino: ({ sender, type, id, base_denom, quote_denom, price, quantity, side, good_til, time_in_force, }) => ({ + sender, + type, + id, + baseDenom: base_denom, + quoteDenom: quote_denom, + price, + quantity, + side, + goodTil: good_til + ? good_til.blocks != null + ? { + goodTilBlockHeight: Number(good_til.blocks), + goodTilBlockTime: undefined, + } + : good_til.time != null + ? { + goodTilBlockHeight: 0, + goodTilBlockTime: new Date(good_til.time), + } + : undefined + : undefined, + timeInForce: time_in_force, // number -> enum + }), + }, + // MsgCancelOrder - Cancel order + "/coreum.dex.v1.MsgCancelOrder": { + aminoType: "dex/MsgCancelOrder", + toAmino: ({ sender, id }) => ({ + sender, + id, + }), + fromAmino: ({ sender, id }) => ({ + sender, + id, + }), + }, + // MsgCancelOrdersByDenom - Cancel orders by denom + "/coreum.dex.v1.MsgCancelOrdersByDenom": { + aminoType: "dex/MsgCancelOrdersByDenom", + toAmino: ({ sender, account, denom }) => ({ + sender, + account, + denom, + }), + fromAmino: ({ sender, account, denom }) => ({ + sender, + account, + denom, + }), + }, +}; +// NFT (Non-Fungible Token) Amino Types +exports.nftAminoConverters = { + // MsgIssueClass - Issue new NFT class + "/coreum.asset.nft.v1.MsgIssueClass": { + aminoType: "assetnft/MsgIssueClass", + toAmino: ({ issuer, symbol, name, description, uri, uriHash, data, features, royaltyRate, }) => ({ + issuer, + symbol, + name, + description, + uri, + uri_hash: uriHash, + data, + features, + royalty_rate: royaltyRate, + }), + fromAmino: ({ issuer, symbol, name, description, uri, uri_hash, data, features, royalty_rate, }) => ({ + issuer, + symbol, + name, + description, + uri, + uriHash: uri_hash, + data, + features, + royaltyRate: royalty_rate, + }), + }, + // MsgMint - Mint NFT + "/coreum.asset.nft.v1.MsgMint": { + aminoType: "assetnft/MsgMint", + toAmino: ({ sender, classId, id, uri, uriHash, data, recipient, }) => ({ + sender, + class_id: classId, + id, + uri, + uri_hash: uriHash, + data, + recipient, + }), + fromAmino: ({ sender, class_id, id, uri, uri_hash, data, recipient, }) => ({ + sender, + classId: class_id, + id, + uri, + uriHash: uri_hash, + data, + recipient, + }), + }, + // MsgUpdateData - Update NFT data + "/coreum.asset.nft.v1.MsgUpdateData": { + aminoType: "assetnft/MsgUpdateData", + toAmino: ({ sender, classId, id, items }) => ({ + sender, + class_id: classId, + id, + items, + }), + fromAmino: ({ sender, class_id, id, items }) => ({ + sender, + classId: class_id, + id, + items, + }), + }, + // MsgBurn - Burn NFT + "/coreum.asset.nft.v1.MsgBurn": { + aminoType: "assetnft/MsgBurn", + toAmino: ({ sender, classId, id }) => ({ + sender, + class_id: classId, + id, + }), + fromAmino: ({ sender, class_id, id }) => ({ + sender, + classId: class_id, + id, + }), + }, + // MsgFreeze - Freeze NFT + "/coreum.asset.nft.v1.MsgFreeze": { + aminoType: "assetnft/MsgFreeze", + toAmino: ({ sender, classId, id }) => ({ + sender, + class_id: classId, + id, + }), + fromAmino: ({ sender, class_id, id }) => ({ + sender, + classId: class_id, + id, + }), + }, + // MsgUnfreeze - Unfreeze NFT + "/coreum.asset.nft.v1.MsgUnfreeze": { + aminoType: "assetnft/MsgUnfreeze", + toAmino: ({ sender, classId, id }) => ({ + sender, + class_id: classId, + id, + }), + fromAmino: ({ sender, class_id, id }) => ({ + sender, + classId: class_id, + id, + }), + }, + // MsgClassFreeze - Freeze NFT class for account + "/coreum.asset.nft.v1.MsgClassFreeze": { + aminoType: "assetnft/MsgClassFreeze", + toAmino: ({ sender, classId, account }) => ({ + sender, + class_id: classId, + account, + }), + fromAmino: ({ sender, class_id, account }) => ({ + sender, + classId: class_id, + account, + }), + }, + // MsgClassUnfreeze - Unfreeze NFT class for account + "/coreum.asset.nft.v1.MsgClassUnfreeze": { + aminoType: "assetnft/MsgClassUnfreeze", + toAmino: ({ sender, classId, account }) => ({ + sender, + class_id: classId, + account, + }), + fromAmino: ({ sender, class_id, account }) => ({ + sender, + classId: class_id, + account, + }), + }, + // MsgAddToWhitelist - Add account to NFT whitelist + "/coreum.asset.nft.v1.MsgAddToWhitelist": { + aminoType: "assetnft/MsgAddToWhitelist", + toAmino: ({ sender, classId, id, account }) => ({ + sender, + class_id: classId, + id, + account, + }), + fromAmino: ({ sender, class_id, id, account }) => ({ + sender, + classId: class_id, + id, + account, + }), + }, + // MsgRemoveFromWhitelist - Remove account from NFT whitelist + "/coreum.asset.nft.v1.MsgRemoveFromWhitelist": { + aminoType: "assetnft/MsgRemoveFromWhitelist", + toAmino: ({ sender, classId, id, account }) => ({ + sender, + class_id: classId, + id, + account, + }), + fromAmino: ({ sender, class_id, id, account, }) => ({ + sender, + classId: class_id, + id, + account, + }), + }, + // MsgAddToClassWhitelist - Add account to NFT class whitelist + "/coreum.asset.nft.v1.MsgAddToClassWhitelist": { + aminoType: "assetnft/MsgAddToClassWhitelist", + toAmino: ({ sender, classId, account }) => ({ + sender, + class_id: classId, + account, + }), + fromAmino: ({ sender, class_id, account, }) => ({ + sender, + classId: class_id, + account, + }), + }, + // MsgRemoveFromClassWhitelist - Remove account from NFT class whitelist + "/coreum.asset.nft.v1.MsgRemoveFromClassWhitelist": { + aminoType: "assetnft/MsgRemoveFromClassWhitelist", + toAmino: ({ sender, classId, account }) => ({ + sender, + class_id: classId, + account, + }), + fromAmino: ({ sender, class_id, account, }) => ({ + sender, + classId: class_id, + account, + }), + }, + // MsgUpdateParams - Update NFT module parameters + "/coreum.asset.nft.v1.MsgUpdateParams": { + aminoType: "assetnft/MsgUpdateParams", + toAmino: ({ authority, params }) => ({ + authority, + params, + }), + fromAmino: ({ authority, params }) => ({ + authority, + params, + }), + }, +}; +// NFT Beta Amino Types +exports.nftBetaAminoConverters = { + // MsgSend - Send NFT + "/cosmos.nft.v1beta1.MsgSend": { + aminoType: "cosmos-sdk/MsgSend", + toAmino: ({ classId, id, sender, receiver }) => ({ + class_id: classId, + id, + sender, + receiver, + }), + fromAmino: ({ class_id, id, sender, receiver }) => ({ + classId: class_id, + id, + sender, + receiver, + }), + }, +}; +// Combined Amino Converters +exports.coreumAminoConverters = { + ...exports.ftAminoConverters, + ...exports.dexAminoConverters, + ...exports.nftAminoConverters, + // ...nftBetaAminoConverters, +}; +// Create AminoTypes instance +function createCoreumAminoTypes() { + return new stargate_1.AminoTypes(exports.coreumAminoConverters); +} +exports.createCoreumAminoTypes = createCoreumAminoTypes; diff --git a/dist/main/coreum/asset/ft/v1/authz.d.ts b/dist/main/coreum/asset/ft/v1/authz.d.ts new file mode 100644 index 0000000..154edbc --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/authz.d.ts @@ -0,0 +1,38 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** + * MintAuthorization allows the grantee to mint up to mint_limit coin from + * the granter's account. + */ +export interface MintAuthorization { + mintLimit: Coin[]; +} +/** + * BurnAuthorization allows the grantee to burn up to burn_limit coin from + * the granter's account. + */ +export interface BurnAuthorization { + burnLimit: Coin[]; +} +export declare const MintAuthorization: MessageFns; +export declare const BurnAuthorization: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/ft/v1/authz.js b/dist/main/coreum/asset/ft/v1/authz.js new file mode 100644 index 0000000..6810641 --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/authz.js @@ -0,0 +1,122 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/authz.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BurnAuthorization = exports.MintAuthorization = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +exports.protobufPackage = "coreum.asset.ft.v1"; +function createBaseMintAuthorization() { + return { mintLimit: [] }; +} +exports.MintAuthorization = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.mintLimit) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMintAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.mintLimit.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mintLimit: globalThis.Array.isArray(object?.mintLimit) + ? object.mintLimit.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.mintLimit?.length) { + obj.mintLimit = message.mintLimit.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.MintAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMintAuthorization(); + message.mintLimit = object.mintLimit?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseBurnAuthorization() { + return { burnLimit: [] }; +} +exports.BurnAuthorization = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.burnLimit) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBurnAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.burnLimit.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + burnLimit: globalThis.Array.isArray(object?.burnLimit) + ? object.burnLimit.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.burnLimit?.length) { + obj.burnLimit = message.burnLimit.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.BurnAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBurnAuthorization(); + message.burnLimit = object.burnLimit?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; diff --git a/dist/main/coreum/asset/ft/v1/event.d.ts b/dist/main/coreum/asset/ft/v1/event.d.ts new file mode 100644 index 0000000..8c03d58 --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/event.d.ts @@ -0,0 +1,90 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DEXSettings, Feature } from "./token"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** EventIssued is emitted on MsgIssue. */ +export interface EventIssued { + denom: string; + issuer: string; + symbol: string; + subunit: string; + precision: number; + initialAmount: string; + description: string; + features: Feature[]; + burnRate: string; + sendCommissionRate: string; + uri: string; + uriHash: string; + admin: string; + dexSettings: DEXSettings | undefined; +} +export interface EventFrozenAmountChanged { + account: string; + denom: string; + previousAmount: string; + currentAmount: string; +} +export interface EventAmountClawedBack { + account: string; + denom: string; + amount: string; +} +export interface EventWhitelistedAmountChanged { + account: string; + denom: string; + previousAmount: string; + currentAmount: string; +} +export interface EventDEXLockedAmountChanged { + account: string; + denom: string; + previousAmount: string; + currentAmount: string; +} +export interface EventDEXExpectedToReceiveAmountChanged { + account: string; + denom: string; + previousAmount: string; + currentAmount: string; +} +export interface EventAdminTransferred { + denom: string; + previousAdmin: string; + currentAdmin: string; +} +export interface EventAdminCleared { + denom: string; + previousAdmin: string; +} +export interface EventDEXSettingsChanged { + previousSettings: DEXSettings | undefined; + newSettings: DEXSettings | undefined; +} +export declare const EventIssued: MessageFns; +export declare const EventFrozenAmountChanged: MessageFns; +export declare const EventAmountClawedBack: MessageFns; +export declare const EventWhitelistedAmountChanged: MessageFns; +export declare const EventDEXLockedAmountChanged: MessageFns; +export declare const EventDEXExpectedToReceiveAmountChanged: MessageFns; +export declare const EventAdminTransferred: MessageFns; +export declare const EventAdminCleared: MessageFns; +export declare const EventDEXSettingsChanged: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/ft/v1/event.js b/dist/main/coreum/asset/ft/v1/event.js new file mode 100644 index 0000000..0c6af3d --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/event.js @@ -0,0 +1,1030 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/event.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EventDEXSettingsChanged = exports.EventAdminCleared = exports.EventAdminTransferred = exports.EventDEXExpectedToReceiveAmountChanged = exports.EventDEXLockedAmountChanged = exports.EventWhitelistedAmountChanged = exports.EventAmountClawedBack = exports.EventFrozenAmountChanged = exports.EventIssued = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const token_1 = require("./token"); +exports.protobufPackage = "coreum.asset.ft.v1"; +function createBaseEventIssued() { + return { + denom: "", + issuer: "", + symbol: "", + subunit: "", + precision: 0, + initialAmount: "", + description: "", + features: [], + burnRate: "", + sendCommissionRate: "", + uri: "", + uriHash: "", + admin: "", + dexSettings: undefined, + }; +} +exports.EventIssued = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.subunit !== "") { + writer.uint32(34).string(message.subunit); + } + if (message.precision !== 0) { + writer.uint32(40).uint32(message.precision); + } + if (message.initialAmount !== "") { + writer.uint32(50).string(message.initialAmount); + } + if (message.description !== "") { + writer.uint32(58).string(message.description); + } + writer.uint32(66).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.burnRate !== "") { + writer.uint32(74).string(message.burnRate); + } + if (message.sendCommissionRate !== "") { + writer.uint32(82).string(message.sendCommissionRate); + } + if (message.uri !== "") { + writer.uint32(90).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(98).string(message.uriHash); + } + if (message.admin !== "") { + writer.uint32(106).string(message.admin); + } + if (message.dexSettings !== undefined) { + token_1.DEXSettings.encode(message.dexSettings, writer.uint32(114).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventIssued(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.symbol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.subunit = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.precision = reader.uint32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.initialAmount = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.description = reader.string(); + continue; + } + case 8: { + if (tag === 64) { + message.features.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag !== 74) { + break; + } + message.burnRate = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.sendCommissionRate = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.uri = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.admin = reader.string(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.dexSettings = token_1.DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + subunit: isSet(object.subunit) ? globalThis.String(object.subunit) : "", + precision: isSet(object.precision) + ? globalThis.Number(object.precision) + : 0, + initialAmount: isSet(object.initialAmount) + ? globalThis.String(object.initialAmount) + : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => (0, token_1.featureFromJSON)(e)) + : [], + burnRate: isSet(object.burnRate) + ? globalThis.String(object.burnRate) + : "", + sendCommissionRate: isSet(object.sendCommissionRate) + ? globalThis.String(object.sendCommissionRate) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + dexSettings: isSet(object.dexSettings) + ? token_1.DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.subunit !== "") { + obj.subunit = message.subunit; + } + if (message.precision !== 0) { + obj.precision = Math.round(message.precision); + } + if (message.initialAmount !== "") { + obj.initialAmount = message.initialAmount; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.features?.length) { + obj.features = message.features.map((e) => (0, token_1.featureToJSON)(e)); + } + if (message.burnRate !== "") { + obj.burnRate = message.burnRate; + } + if (message.sendCommissionRate !== "") { + obj.sendCommissionRate = message.sendCommissionRate; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.dexSettings !== undefined) { + obj.dexSettings = token_1.DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return exports.EventIssued.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventIssued(); + message.denom = object.denom ?? ""; + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.subunit = object.subunit ?? ""; + message.precision = object.precision ?? 0; + message.initialAmount = object.initialAmount ?? ""; + message.description = object.description ?? ""; + message.features = object.features?.map((e) => e) || []; + message.burnRate = object.burnRate ?? ""; + message.sendCommissionRate = object.sendCommissionRate ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.admin = object.admin ?? ""; + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? token_1.DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +function createBaseEventFrozenAmountChanged() { + return { account: "", denom: "", previousAmount: "", currentAmount: "" }; +} +exports.EventFrozenAmountChanged = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.previousAmount !== "") { + writer.uint32(26).string(message.previousAmount); + } + if (message.currentAmount !== "") { + writer.uint32(34).string(message.currentAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventFrozenAmountChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.previousAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.currentAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAmount: isSet(object.previousAmount) + ? globalThis.String(object.previousAmount) + : "", + currentAmount: isSet(object.currentAmount) + ? globalThis.String(object.currentAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAmount !== "") { + obj.previousAmount = message.previousAmount; + } + if (message.currentAmount !== "") { + obj.currentAmount = message.currentAmount; + } + return obj; + }, + create(base) { + return exports.EventFrozenAmountChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventFrozenAmountChanged(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.previousAmount = object.previousAmount ?? ""; + message.currentAmount = object.currentAmount ?? ""; + return message; + }, +}; +function createBaseEventAmountClawedBack() { + return { account: "", denom: "", amount: "" }; +} +exports.EventAmountClawedBack = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(26).string(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAmountClawedBack(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.amount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + create(base) { + return exports.EventAmountClawedBack.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAmountClawedBack(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseEventWhitelistedAmountChanged() { + return { account: "", denom: "", previousAmount: "", currentAmount: "" }; +} +exports.EventWhitelistedAmountChanged = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.previousAmount !== "") { + writer.uint32(26).string(message.previousAmount); + } + if (message.currentAmount !== "") { + writer.uint32(34).string(message.currentAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventWhitelistedAmountChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.previousAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.currentAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAmount: isSet(object.previousAmount) + ? globalThis.String(object.previousAmount) + : "", + currentAmount: isSet(object.currentAmount) + ? globalThis.String(object.currentAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAmount !== "") { + obj.previousAmount = message.previousAmount; + } + if (message.currentAmount !== "") { + obj.currentAmount = message.currentAmount; + } + return obj; + }, + create(base) { + return exports.EventWhitelistedAmountChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventWhitelistedAmountChanged(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.previousAmount = object.previousAmount ?? ""; + message.currentAmount = object.currentAmount ?? ""; + return message; + }, +}; +function createBaseEventDEXLockedAmountChanged() { + return { account: "", denom: "", previousAmount: "", currentAmount: "" }; +} +exports.EventDEXLockedAmountChanged = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.previousAmount !== "") { + writer.uint32(26).string(message.previousAmount); + } + if (message.currentAmount !== "") { + writer.uint32(34).string(message.currentAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDEXLockedAmountChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.previousAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.currentAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAmount: isSet(object.previousAmount) + ? globalThis.String(object.previousAmount) + : "", + currentAmount: isSet(object.currentAmount) + ? globalThis.String(object.currentAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAmount !== "") { + obj.previousAmount = message.previousAmount; + } + if (message.currentAmount !== "") { + obj.currentAmount = message.currentAmount; + } + return obj; + }, + create(base) { + return exports.EventDEXLockedAmountChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventDEXLockedAmountChanged(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.previousAmount = object.previousAmount ?? ""; + message.currentAmount = object.currentAmount ?? ""; + return message; + }, +}; +function createBaseEventDEXExpectedToReceiveAmountChanged() { + return { account: "", denom: "", previousAmount: "", currentAmount: "" }; +} +exports.EventDEXExpectedToReceiveAmountChanged = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.previousAmount !== "") { + writer.uint32(26).string(message.previousAmount); + } + if (message.currentAmount !== "") { + writer.uint32(34).string(message.currentAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDEXExpectedToReceiveAmountChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.previousAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.currentAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAmount: isSet(object.previousAmount) + ? globalThis.String(object.previousAmount) + : "", + currentAmount: isSet(object.currentAmount) + ? globalThis.String(object.currentAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAmount !== "") { + obj.previousAmount = message.previousAmount; + } + if (message.currentAmount !== "") { + obj.currentAmount = message.currentAmount; + } + return obj; + }, + create(base) { + return exports.EventDEXExpectedToReceiveAmountChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventDEXExpectedToReceiveAmountChanged(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.previousAmount = object.previousAmount ?? ""; + message.currentAmount = object.currentAmount ?? ""; + return message; + }, +}; +function createBaseEventAdminTransferred() { + return { denom: "", previousAdmin: "", currentAdmin: "" }; +} +exports.EventAdminTransferred = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.previousAdmin !== "") { + writer.uint32(18).string(message.previousAdmin); + } + if (message.currentAdmin !== "") { + writer.uint32(26).string(message.currentAdmin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAdminTransferred(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.previousAdmin = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.currentAdmin = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAdmin: isSet(object.previousAdmin) + ? globalThis.String(object.previousAdmin) + : "", + currentAdmin: isSet(object.currentAdmin) + ? globalThis.String(object.currentAdmin) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAdmin !== "") { + obj.previousAdmin = message.previousAdmin; + } + if (message.currentAdmin !== "") { + obj.currentAdmin = message.currentAdmin; + } + return obj; + }, + create(base) { + return exports.EventAdminTransferred.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAdminTransferred(); + message.denom = object.denom ?? ""; + message.previousAdmin = object.previousAdmin ?? ""; + message.currentAdmin = object.currentAdmin ?? ""; + return message; + }, +}; +function createBaseEventAdminCleared() { + return { denom: "", previousAdmin: "" }; +} +exports.EventAdminCleared = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.previousAdmin !== "") { + writer.uint32(18).string(message.previousAdmin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAdminCleared(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.previousAdmin = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAdmin: isSet(object.previousAdmin) + ? globalThis.String(object.previousAdmin) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAdmin !== "") { + obj.previousAdmin = message.previousAdmin; + } + return obj; + }, + create(base) { + return exports.EventAdminCleared.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAdminCleared(); + message.denom = object.denom ?? ""; + message.previousAdmin = object.previousAdmin ?? ""; + return message; + }, +}; +function createBaseEventDEXSettingsChanged() { + return { previousSettings: undefined, newSettings: undefined }; +} +exports.EventDEXSettingsChanged = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.previousSettings !== undefined) { + token_1.DEXSettings.encode(message.previousSettings, writer.uint32(10).fork()).ldelim(); + } + if (message.newSettings !== undefined) { + token_1.DEXSettings.encode(message.newSettings, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDEXSettingsChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.previousSettings = token_1.DEXSettings.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.newSettings = token_1.DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + previousSettings: isSet(object.previousSettings) + ? token_1.DEXSettings.fromJSON(object.previousSettings) + : undefined, + newSettings: isSet(object.newSettings) + ? token_1.DEXSettings.fromJSON(object.newSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.previousSettings !== undefined) { + obj.previousSettings = token_1.DEXSettings.toJSON(message.previousSettings); + } + if (message.newSettings !== undefined) { + obj.newSettings = token_1.DEXSettings.toJSON(message.newSettings); + } + return obj; + }, + create(base) { + return exports.EventDEXSettingsChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventDEXSettingsChanged(); + message.previousSettings = + object.previousSettings !== undefined && object.previousSettings !== null + ? token_1.DEXSettings.fromPartial(object.previousSettings) + : undefined; + message.newSettings = + object.newSettings !== undefined && object.newSettings !== null + ? token_1.DEXSettings.fromPartial(object.newSettings) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/ft/v1/genesis.d.ts b/dist/main/coreum/asset/ft/v1/genesis.d.ts new file mode 100644 index 0000000..9c8069b --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/genesis.d.ts @@ -0,0 +1,61 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, Token } from "./token"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** GenesisState defines the module genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + /** tokens keep the fungible token state */ + tokens: Token[]; + /** frozen_balances contains the frozen balances on all of the accounts */ + frozenBalances: Balance[]; + /** whitelisted_balances contains the whitelisted balances on all of the accounts */ + whitelistedBalances: Balance[]; + /** pending_token_upgrades contains pending token upgrades. */ + pendingTokenUpgrades: PendingTokenUpgrade[]; + /** dex_locked_balances contains the DEX locked balances on all of the accounts */ + dexLockedBalances: Balance[]; + dexExpectedToReceiveBalances: Balance[]; + dexSettings: DEXSettingsWithDenom[]; +} +/** Balance defines an account address and balance pair used module genesis genesis state. */ +export interface Balance { + /** address is the address of the balance holder. */ + address: string; + /** coins defines the different coins this balance holds. */ + coins: Coin[]; +} +/** PendingTokenUpgrade stores the version of pending token upgrade. */ +export interface PendingTokenUpgrade { + denom: string; + version: number; +} +export interface DEXSettingsWithDenom { + denom: string; + dexSettings: DEXSettings | undefined; +} +export declare const GenesisState: MessageFns; +export declare const Balance: MessageFns; +export declare const PendingTokenUpgrade: MessageFns; +export declare const DEXSettingsWithDenom: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/ft/v1/genesis.js b/dist/main/coreum/asset/ft/v1/genesis.js new file mode 100644 index 0000000..2f66e97 --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/genesis.js @@ -0,0 +1,420 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/genesis.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DEXSettingsWithDenom = exports.PendingTokenUpgrade = exports.Balance = exports.GenesisState = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const params_1 = require("./params"); +const token_1 = require("./token"); +exports.protobufPackage = "coreum.asset.ft.v1"; +function createBaseGenesisState() { + return { + params: undefined, + tokens: [], + frozenBalances: [], + whitelistedBalances: [], + pendingTokenUpgrades: [], + dexLockedBalances: [], + dexExpectedToReceiveBalances: [], + dexSettings: [], + }; +} +exports.GenesisState = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.tokens) { + token_1.Token.encode(v, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.frozenBalances) { + exports.Balance.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.whitelistedBalances) { + exports.Balance.encode(v, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.pendingTokenUpgrades) { + exports.PendingTokenUpgrade.encode(v, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.dexLockedBalances) { + exports.Balance.encode(v, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.dexExpectedToReceiveBalances) { + exports.Balance.encode(v, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.dexSettings) { + exports.DEXSettingsWithDenom.encode(v, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokens.push(token_1.Token.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.frozenBalances.push(exports.Balance.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.whitelistedBalances.push(exports.Balance.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.pendingTokenUpgrades.push(exports.PendingTokenUpgrade.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.dexLockedBalances.push(exports.Balance.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.dexExpectedToReceiveBalances.push(exports.Balance.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.dexSettings.push(exports.DEXSettingsWithDenom.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + tokens: globalThis.Array.isArray(object?.tokens) + ? object.tokens.map((e) => token_1.Token.fromJSON(e)) + : [], + frozenBalances: globalThis.Array.isArray(object?.frozenBalances) + ? object.frozenBalances.map((e) => exports.Balance.fromJSON(e)) + : [], + whitelistedBalances: globalThis.Array.isArray(object?.whitelistedBalances) + ? object.whitelistedBalances.map((e) => exports.Balance.fromJSON(e)) + : [], + pendingTokenUpgrades: globalThis.Array.isArray(object?.pendingTokenUpgrades) + ? object.pendingTokenUpgrades.map((e) => exports.PendingTokenUpgrade.fromJSON(e)) + : [], + dexLockedBalances: globalThis.Array.isArray(object?.dexLockedBalances) + ? object.dexLockedBalances.map((e) => exports.Balance.fromJSON(e)) + : [], + dexExpectedToReceiveBalances: globalThis.Array.isArray(object?.dexExpectedToReceiveBalances) + ? object.dexExpectedToReceiveBalances.map((e) => exports.Balance.fromJSON(e)) + : [], + dexSettings: globalThis.Array.isArray(object?.dexSettings) + ? object.dexSettings.map((e) => exports.DEXSettingsWithDenom.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + if (message.tokens?.length) { + obj.tokens = message.tokens.map((e) => token_1.Token.toJSON(e)); + } + if (message.frozenBalances?.length) { + obj.frozenBalances = message.frozenBalances.map((e) => exports.Balance.toJSON(e)); + } + if (message.whitelistedBalances?.length) { + obj.whitelistedBalances = message.whitelistedBalances.map((e) => exports.Balance.toJSON(e)); + } + if (message.pendingTokenUpgrades?.length) { + obj.pendingTokenUpgrades = message.pendingTokenUpgrades.map((e) => exports.PendingTokenUpgrade.toJSON(e)); + } + if (message.dexLockedBalances?.length) { + obj.dexLockedBalances = message.dexLockedBalances.map((e) => exports.Balance.toJSON(e)); + } + if (message.dexExpectedToReceiveBalances?.length) { + obj.dexExpectedToReceiveBalances = + message.dexExpectedToReceiveBalances.map((e) => exports.Balance.toJSON(e)); + } + if (message.dexSettings?.length) { + obj.dexSettings = message.dexSettings.map((e) => exports.DEXSettingsWithDenom.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + message.tokens = object.tokens?.map((e) => token_1.Token.fromPartial(e)) || []; + message.frozenBalances = + object.frozenBalances?.map((e) => exports.Balance.fromPartial(e)) || []; + message.whitelistedBalances = + object.whitelistedBalances?.map((e) => exports.Balance.fromPartial(e)) || []; + message.pendingTokenUpgrades = + object.pendingTokenUpgrades?.map((e) => exports.PendingTokenUpgrade.fromPartial(e)) || []; + message.dexLockedBalances = + object.dexLockedBalances?.map((e) => exports.Balance.fromPartial(e)) || []; + message.dexExpectedToReceiveBalances = + object.dexExpectedToReceiveBalances?.map((e) => exports.Balance.fromPartial(e)) || + []; + message.dexSettings = + object.dexSettings?.map((e) => exports.DEXSettingsWithDenom.fromPartial(e)) || []; + return message; + }, +}; +function createBaseBalance() { + return { address: "", coins: [] }; +} +exports.Balance = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBalance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.coins.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) + ? object.coins.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.Balance.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBalance(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBasePendingTokenUpgrade() { + return { denom: "", version: 0 }; +} +exports.PendingTokenUpgrade = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.version !== 0) { + writer.uint32(16).uint32(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePendingTokenUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.version = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + create(base) { + return exports.PendingTokenUpgrade.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePendingTokenUpgrade(); + message.denom = object.denom ?? ""; + message.version = object.version ?? 0; + return message; + }, +}; +function createBaseDEXSettingsWithDenom() { + return { denom: "", dexSettings: undefined }; +} +exports.DEXSettingsWithDenom = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.dexSettings !== undefined) { + token_1.DEXSettings.encode(message.dexSettings, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDEXSettingsWithDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dexSettings = token_1.DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + dexSettings: isSet(object.dexSettings) + ? token_1.DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.dexSettings !== undefined) { + obj.dexSettings = token_1.DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return exports.DEXSettingsWithDenom.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDEXSettingsWithDenom(); + message.denom = object.denom ?? ""; + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? token_1.DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/ft/v1/params.d.ts b/dist/main/coreum/asset/ft/v1/params.d.ts new file mode 100644 index 0000000..b854a0f --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/params.d.ts @@ -0,0 +1,33 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Duration } from "cosmjs-types/google/protobuf/duration"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** Params store gov manageable parameters. */ +export interface Params { + /** issue_fee is the fee burnt each time new token is issued. */ + issueFee: Coin | undefined; + /** token_upgrade_decision_timeout defines the end of the decision period for upgrading the token. */ + tokenUpgradeDecisionTimeout: Date | undefined; + /** token_upgrade_grace_period the period after which the token upgrade is executed effectively. */ + tokenUpgradeGracePeriod: Duration | undefined; +} +export declare const Params: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/ft/v1/params.js b/dist/main/coreum/asset/ft/v1/params.js new file mode 100644 index 0000000..7368e70 --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/params.js @@ -0,0 +1,141 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/params.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Params = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const duration_1 = require("cosmjs-types/google/protobuf/duration"); +const timestamp_1 = require("cosmjs-types/google/protobuf/timestamp"); +exports.protobufPackage = "coreum.asset.ft.v1"; +function createBaseParams() { + return { + issueFee: undefined, + tokenUpgradeDecisionTimeout: undefined, + tokenUpgradeGracePeriod: undefined, + }; +} +exports.Params = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.issueFee !== undefined) { + coin_1.Coin.encode(message.issueFee, writer.uint32(10).fork()).ldelim(); + } + if (message.tokenUpgradeDecisionTimeout !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.tokenUpgradeDecisionTimeout), writer.uint32(18).fork()).ldelim(); + } + if (message.tokenUpgradeGracePeriod !== undefined) { + duration_1.Duration.encode(message.tokenUpgradeGracePeriod, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.issueFee = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokenUpgradeDecisionTimeout = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.tokenUpgradeGracePeriod = duration_1.Duration.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + issueFee: isSet(object.issueFee) + ? coin_1.Coin.fromJSON(object.issueFee) + : undefined, + tokenUpgradeDecisionTimeout: isSet(object.tokenUpgradeDecisionTimeout) + ? fromJsonTimestamp(object.tokenUpgradeDecisionTimeout) + : undefined, + tokenUpgradeGracePeriod: isSet(object.tokenUpgradeGracePeriod) + ? duration_1.Duration.fromJSON(object.tokenUpgradeGracePeriod) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.issueFee !== undefined) { + obj.issueFee = coin_1.Coin.toJSON(message.issueFee); + } + if (message.tokenUpgradeDecisionTimeout !== undefined) { + obj.tokenUpgradeDecisionTimeout = + message.tokenUpgradeDecisionTimeout.toISOString(); + } + if (message.tokenUpgradeGracePeriod !== undefined) { + obj.tokenUpgradeGracePeriod = duration_1.Duration.toJSON(message.tokenUpgradeGracePeriod); + } + return obj; + }, + create(base) { + return exports.Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.issueFee = + object.issueFee !== undefined && object.issueFee !== null + ? coin_1.Coin.fromPartial(object.issueFee) + : undefined; + message.tokenUpgradeDecisionTimeout = + object.tokenUpgradeDecisionTimeout ?? undefined; + message.tokenUpgradeGracePeriod = + object.tokenUpgradeGracePeriod !== undefined && + object.tokenUpgradeGracePeriod !== null + ? duration_1.Duration.fromPartial(object.tokenUpgradeGracePeriod) + : undefined; + return message; + }, +}; +function toTimestamp(date) { + const seconds = Math.trunc(date.getTime() / 1000); + const nanos = (date.getTime() % 1000) * 1000000; + return { seconds: BigInt(seconds), nanos }; +} +function fromTimestamp(t) { + const seconds = BigInt(t.seconds || 0); + const nanos = BigInt(t.nanos || 0); + const millis = seconds * BigInt(1000) + nanos / BigInt(1000000); + return new Date(Number(millis)); // Convert bigint to number +} +function fromJsonTimestamp(o) { + if (o instanceof globalThis.Date) { + return o; + } + else if (typeof o === "string") { + return new globalThis.Date(o); + } + else { + return fromTimestamp(timestamp_1.Timestamp.fromJSON(o)); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/ft/v1/query.d.ts b/dist/main/coreum/asset/ft/v1/query.d.ts new file mode 100644 index 0000000..10996db --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/query.d.ts @@ -0,0 +1,191 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, Token, TokenUpgradeStatuses } from "./token"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** QueryParamsRequest defines the request type for querying x/asset/ft parameters. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse defines the response type for querying x/asset/ft parameters. */ +export interface QueryParamsResponse { + params: Params | undefined; +} +export interface QueryTokenRequest { + denom: string; +} +export interface QueryTokenResponse { + token: Token | undefined; +} +export interface QueryTokenUpgradeStatusesRequest { + denom: string; +} +export interface QueryTokenUpgradeStatusesResponse { + statuses: TokenUpgradeStatuses | undefined; +} +export interface QueryTokensRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + issuer: string; +} +export interface QueryTokensResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + tokens: Token[]; +} +export interface QueryBalanceRequest { + /** account specifies the account onto which we query balances */ + account: string; + /** denom specifies balances on a specific denom */ + denom: string; +} +export interface QueryBalanceResponse { + /** balance contains the balance with the queried account and denom */ + balance: string; + /** whitelisted is the whitelisted amount of the denom on the account. */ + whitelisted: string; + /** frozen is the frozen amount of the denom on the account. */ + frozen: string; + /** locked is the balance locked in vesting and DEX. */ + locked: string; + /** locked_in_vesting is the balance locked in bank vesting. */ + lockedInVesting: string; + /** locked_in_dex is the balance locked in DEX. */ + lockedInDex: string; + expectedToReceiveInDex: string; +} +export interface QueryFrozenBalancesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + /** account specifies the account onto which we query frozen balances */ + account: string; +} +export interface QueryFrozenBalancesResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + /** balances contains the frozen balances on the queried account */ + balances: Coin[]; +} +export interface QueryFrozenBalanceRequest { + /** account specifies the account onto which we query frozen balances */ + account: string; + /** denom specifies frozen balances on a specific denom */ + denom: string; +} +export interface QueryFrozenBalanceResponse { + /** balance contains the frozen balance with the queried account and denom */ + balance: Coin | undefined; +} +export interface QueryWhitelistedBalancesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + /** account specifies the account onto which we query whitelisted balances */ + account: string; +} +export interface QueryWhitelistedBalancesResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + /** balances contains the whitelisted balances on the queried account */ + balances: Coin[]; +} +export interface QueryWhitelistedBalanceRequest { + /** account specifies the account onto which we query whitelisted balances */ + account: string; + /** denom specifies whitelisted balances on a specific denom */ + denom: string; +} +export interface QueryWhitelistedBalanceResponse { + /** balance contains the whitelisted balance with the queried account and denom */ + balance: Coin | undefined; +} +export interface QueryDEXSettingsRequest { + /** denom specifies the denom onto which we query DEX settings */ + denom: string; +} +export interface QueryDEXSettingsResponse { + /** dex_settings contains the DEX settings */ + dexSettings: DEXSettings | undefined; +} +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +export declare const QueryTokenRequest: MessageFns; +export declare const QueryTokenResponse: MessageFns; +export declare const QueryTokenUpgradeStatusesRequest: MessageFns; +export declare const QueryTokenUpgradeStatusesResponse: MessageFns; +export declare const QueryTokensRequest: MessageFns; +export declare const QueryTokensResponse: MessageFns; +export declare const QueryBalanceRequest: MessageFns; +export declare const QueryBalanceResponse: MessageFns; +export declare const QueryFrozenBalancesRequest: MessageFns; +export declare const QueryFrozenBalancesResponse: MessageFns; +export declare const QueryFrozenBalanceRequest: MessageFns; +export declare const QueryFrozenBalanceResponse: MessageFns; +export declare const QueryWhitelistedBalancesRequest: MessageFns; +export declare const QueryWhitelistedBalancesResponse: MessageFns; +export declare const QueryWhitelistedBalanceRequest: MessageFns; +export declare const QueryWhitelistedBalanceResponse: MessageFns; +export declare const QueryDEXSettingsRequest: MessageFns; +export declare const QueryDEXSettingsResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/asset/ft module. */ + Params(request: QueryParamsRequest): Promise; + /** Tokens queries the fungible tokens of the module. */ + Tokens(request: QueryTokensRequest): Promise; + /** Token queries the fungible token of the module. */ + Token(request: QueryTokenRequest): Promise; + /** TokenUpgradeStatuses returns token upgrades info. */ + TokenUpgradeStatuses(request: QueryTokenUpgradeStatusesRequest): Promise; + /** Balance returns balance of the denom for the account. */ + Balance(request: QueryBalanceRequest): Promise; + /** FrozenBalances returns all the frozen balances for the account. */ + FrozenBalances(request: QueryFrozenBalancesRequest): Promise; + /** FrozenBalance returns frozen balance of the denom for the account. */ + FrozenBalance(request: QueryFrozenBalanceRequest): Promise; + /** WhitelistedBalances returns all the whitelisted balances for the account. */ + WhitelistedBalances(request: QueryWhitelistedBalancesRequest): Promise; + /** WhitelistedBalance returns whitelisted balance of the denom for the account. */ + WhitelistedBalance(request: QueryWhitelistedBalanceRequest): Promise; + /** DEXSettings returns DEX settings of the denom. */ + DEXSettings(request: QueryDEXSettingsRequest): Promise; +} +export declare const QueryServiceName = "coreum.asset.ft.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Params(request: QueryParamsRequest): Promise; + Tokens(request: QueryTokensRequest): Promise; + Token(request: QueryTokenRequest): Promise; + TokenUpgradeStatuses(request: QueryTokenUpgradeStatusesRequest): Promise; + Balance(request: QueryBalanceRequest): Promise; + FrozenBalances(request: QueryFrozenBalancesRequest): Promise; + FrozenBalance(request: QueryFrozenBalanceRequest): Promise; + WhitelistedBalances(request: QueryWhitelistedBalancesRequest): Promise; + WhitelistedBalance(request: QueryWhitelistedBalanceRequest): Promise; + DEXSettings(request: QueryDEXSettingsRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/ft/v1/query.js b/dist/main/coreum/asset/ft/v1/query.js new file mode 100644 index 0000000..26042aa --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/query.js @@ -0,0 +1,1433 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/query.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QueryClientImpl = exports.QueryServiceName = exports.QueryDEXSettingsResponse = exports.QueryDEXSettingsRequest = exports.QueryWhitelistedBalanceResponse = exports.QueryWhitelistedBalanceRequest = exports.QueryWhitelistedBalancesResponse = exports.QueryWhitelistedBalancesRequest = exports.QueryFrozenBalanceResponse = exports.QueryFrozenBalanceRequest = exports.QueryFrozenBalancesResponse = exports.QueryFrozenBalancesRequest = exports.QueryBalanceResponse = exports.QueryBalanceRequest = exports.QueryTokensResponse = exports.QueryTokensRequest = exports.QueryTokenUpgradeStatusesResponse = exports.QueryTokenUpgradeStatusesRequest = exports.QueryTokenResponse = exports.QueryTokenRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const pagination_1 = require("cosmjs-types/cosmos/base/query/v1beta1/pagination"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const params_1 = require("./params"); +const token_1 = require("./token"); +exports.protobufPackage = "coreum.asset.ft.v1"; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +exports.QueryParamsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseQueryTokenRequest() { + return { denom: "" }; +} +exports.QueryTokenRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.QueryTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokenRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryTokenResponse() { + return { token: undefined }; +} +exports.QueryTokenResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.token !== undefined) { + token_1.Token.encode(message.token, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.token = token_1.Token.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + token: isSet(object.token) ? token_1.Token.fromJSON(object.token) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.token !== undefined) { + obj.token = token_1.Token.toJSON(message.token); + } + return obj; + }, + create(base) { + return exports.QueryTokenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokenResponse(); + message.token = + object.token !== undefined && object.token !== null + ? token_1.Token.fromPartial(object.token) + : undefined; + return message; + }, +}; +function createBaseQueryTokenUpgradeStatusesRequest() { + return { denom: "" }; +} +exports.QueryTokenUpgradeStatusesRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokenUpgradeStatusesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.QueryTokenUpgradeStatusesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokenUpgradeStatusesRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryTokenUpgradeStatusesResponse() { + return { statuses: undefined }; +} +exports.QueryTokenUpgradeStatusesResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.statuses !== undefined) { + token_1.TokenUpgradeStatuses.encode(message.statuses, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokenUpgradeStatusesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.statuses = token_1.TokenUpgradeStatuses.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + statuses: isSet(object.statuses) + ? token_1.TokenUpgradeStatuses.fromJSON(object.statuses) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.statuses !== undefined) { + obj.statuses = token_1.TokenUpgradeStatuses.toJSON(message.statuses); + } + return obj; + }, + create(base) { + return exports.QueryTokenUpgradeStatusesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokenUpgradeStatusesResponse(); + message.statuses = + object.statuses !== undefined && object.statuses !== null + ? token_1.TokenUpgradeStatuses.fromPartial(object.statuses) + : undefined; + return message; + }, +}; +function createBaseQueryTokensRequest() { + return { pagination: undefined, issuer: "" }; +} +exports.QueryTokensRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokensRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + return obj; + }, + create(base) { + return exports.QueryTokensRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokensRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.issuer = object.issuer ?? ""; + return message; + }, +}; +function createBaseQueryTokensResponse() { + return { pagination: undefined, tokens: [] }; +} +exports.QueryTokensResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.tokens) { + token_1.Token.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokensResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokens.push(token_1.Token.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + tokens: globalThis.Array.isArray(object?.tokens) + ? object.tokens.map((e) => token_1.Token.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + if (message.tokens?.length) { + obj.tokens = message.tokens.map((e) => token_1.Token.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.QueryTokensResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokensResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.tokens = object.tokens?.map((e) => token_1.Token.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryBalanceRequest() { + return { account: "", denom: "" }; +} +exports.QueryBalanceRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.QueryBalanceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBalanceRequest(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryBalanceResponse() { + return { + balance: "", + whitelisted: "", + frozen: "", + locked: "", + lockedInVesting: "", + lockedInDex: "", + expectedToReceiveInDex: "", + }; +} +exports.QueryBalanceResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.balance !== "") { + writer.uint32(10).string(message.balance); + } + if (message.whitelisted !== "") { + writer.uint32(18).string(message.whitelisted); + } + if (message.frozen !== "") { + writer.uint32(26).string(message.frozen); + } + if (message.locked !== "") { + writer.uint32(34).string(message.locked); + } + if (message.lockedInVesting !== "") { + writer.uint32(42).string(message.lockedInVesting); + } + if (message.lockedInDex !== "") { + writer.uint32(50).string(message.lockedInDex); + } + if (message.expectedToReceiveInDex !== "") { + writer.uint32(58).string(message.expectedToReceiveInDex); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.balance = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.whitelisted = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.frozen = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.locked = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.lockedInVesting = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.lockedInDex = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.expectedToReceiveInDex = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + whitelisted: isSet(object.whitelisted) + ? globalThis.String(object.whitelisted) + : "", + frozen: isSet(object.frozen) ? globalThis.String(object.frozen) : "", + locked: isSet(object.locked) ? globalThis.String(object.locked) : "", + lockedInVesting: isSet(object.lockedInVesting) + ? globalThis.String(object.lockedInVesting) + : "", + lockedInDex: isSet(object.lockedInDex) + ? globalThis.String(object.lockedInDex) + : "", + expectedToReceiveInDex: isSet(object.expectedToReceiveInDex) + ? globalThis.String(object.expectedToReceiveInDex) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.balance !== "") { + obj.balance = message.balance; + } + if (message.whitelisted !== "") { + obj.whitelisted = message.whitelisted; + } + if (message.frozen !== "") { + obj.frozen = message.frozen; + } + if (message.locked !== "") { + obj.locked = message.locked; + } + if (message.lockedInVesting !== "") { + obj.lockedInVesting = message.lockedInVesting; + } + if (message.lockedInDex !== "") { + obj.lockedInDex = message.lockedInDex; + } + if (message.expectedToReceiveInDex !== "") { + obj.expectedToReceiveInDex = message.expectedToReceiveInDex; + } + return obj; + }, + create(base) { + return exports.QueryBalanceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBalanceResponse(); + message.balance = object.balance ?? ""; + message.whitelisted = object.whitelisted ?? ""; + message.frozen = object.frozen ?? ""; + message.locked = object.locked ?? ""; + message.lockedInVesting = object.lockedInVesting ?? ""; + message.lockedInDex = object.lockedInDex ?? ""; + message.expectedToReceiveInDex = object.expectedToReceiveInDex ?? ""; + return message; + }, +}; +function createBaseQueryFrozenBalancesRequest() { + return { pagination: undefined, account: "" }; +} +exports.QueryFrozenBalancesRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.QueryFrozenBalancesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenBalancesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseQueryFrozenBalancesResponse() { + return { pagination: undefined, balances: [] }; +} +exports.QueryFrozenBalancesResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.balances) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.balances.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + balances: globalThis.Array.isArray(object?.balances) + ? object.balances.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.QueryFrozenBalancesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenBalancesResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.balances = object.balances?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryFrozenBalanceRequest() { + return { account: "", denom: "" }; +} +exports.QueryFrozenBalanceRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.QueryFrozenBalanceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenBalanceRequest(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryFrozenBalanceResponse() { + return { balance: undefined }; +} +exports.QueryFrozenBalanceResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.balance !== undefined) { + coin_1.Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.balance = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + balance: isSet(object.balance) + ? coin_1.Coin.fromJSON(object.balance) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.balance !== undefined) { + obj.balance = coin_1.Coin.toJSON(message.balance); + } + return obj; + }, + create(base) { + return exports.QueryFrozenBalanceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenBalanceResponse(); + message.balance = + object.balance !== undefined && object.balance !== null + ? coin_1.Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; +function createBaseQueryWhitelistedBalancesRequest() { + return { pagination: undefined, account: "" }; +} +exports.QueryWhitelistedBalancesRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.QueryWhitelistedBalancesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedBalancesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseQueryWhitelistedBalancesResponse() { + return { pagination: undefined, balances: [] }; +} +exports.QueryWhitelistedBalancesResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.balances) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.balances.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + balances: globalThis.Array.isArray(object?.balances) + ? object.balances.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.QueryWhitelistedBalancesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedBalancesResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.balances = object.balances?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryWhitelistedBalanceRequest() { + return { account: "", denom: "" }; +} +exports.QueryWhitelistedBalanceRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.QueryWhitelistedBalanceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedBalanceRequest(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryWhitelistedBalanceResponse() { + return { balance: undefined }; +} +exports.QueryWhitelistedBalanceResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.balance !== undefined) { + coin_1.Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.balance = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + balance: isSet(object.balance) + ? coin_1.Coin.fromJSON(object.balance) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.balance !== undefined) { + obj.balance = coin_1.Coin.toJSON(message.balance); + } + return obj; + }, + create(base) { + return exports.QueryWhitelistedBalanceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedBalanceResponse(); + message.balance = + object.balance !== undefined && object.balance !== null + ? coin_1.Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; +function createBaseQueryDEXSettingsRequest() { + return { denom: "" }; +} +exports.QueryDEXSettingsRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDEXSettingsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.QueryDEXSettingsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryDEXSettingsRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryDEXSettingsResponse() { + return { dexSettings: undefined }; +} +exports.QueryDEXSettingsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.dexSettings !== undefined) { + token_1.DEXSettings.encode(message.dexSettings, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDEXSettingsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dexSettings = token_1.DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dexSettings: isSet(object.dexSettings) + ? token_1.DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.dexSettings !== undefined) { + obj.dexSettings = token_1.DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return exports.QueryDEXSettingsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryDEXSettingsResponse(); + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? token_1.DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +exports.QueryServiceName = "coreum.asset.ft.v1.Query"; +class QueryClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Tokens = this.Tokens.bind(this); + this.Token = this.Token.bind(this); + this.TokenUpgradeStatuses = this.TokenUpgradeStatuses.bind(this); + this.Balance = this.Balance.bind(this); + this.FrozenBalances = this.FrozenBalances.bind(this); + this.FrozenBalance = this.FrozenBalance.bind(this); + this.WhitelistedBalances = this.WhitelistedBalances.bind(this); + this.WhitelistedBalance = this.WhitelistedBalance.bind(this); + this.DEXSettings = this.DEXSettings.bind(this); + } + Params(request) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new binary_1.BinaryReader(data))); + } + Tokens(request) { + const data = exports.QueryTokensRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Tokens", data); + return promise.then((data) => exports.QueryTokensResponse.decode(new binary_1.BinaryReader(data))); + } + Token(request) { + const data = exports.QueryTokenRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Token", data); + return promise.then((data) => exports.QueryTokenResponse.decode(new binary_1.BinaryReader(data))); + } + TokenUpgradeStatuses(request) { + const data = exports.QueryTokenUpgradeStatusesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TokenUpgradeStatuses", data); + return promise.then((data) => exports.QueryTokenUpgradeStatusesResponse.decode(new binary_1.BinaryReader(data))); + } + Balance(request) { + const data = exports.QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => exports.QueryBalanceResponse.decode(new binary_1.BinaryReader(data))); + } + FrozenBalances(request) { + const data = exports.QueryFrozenBalancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FrozenBalances", data); + return promise.then((data) => exports.QueryFrozenBalancesResponse.decode(new binary_1.BinaryReader(data))); + } + FrozenBalance(request) { + const data = exports.QueryFrozenBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FrozenBalance", data); + return promise.then((data) => exports.QueryFrozenBalanceResponse.decode(new binary_1.BinaryReader(data))); + } + WhitelistedBalances(request) { + const data = exports.QueryWhitelistedBalancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "WhitelistedBalances", data); + return promise.then((data) => exports.QueryWhitelistedBalancesResponse.decode(new binary_1.BinaryReader(data))); + } + WhitelistedBalance(request) { + const data = exports.QueryWhitelistedBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "WhitelistedBalance", data); + return promise.then((data) => exports.QueryWhitelistedBalanceResponse.decode(new binary_1.BinaryReader(data))); + } + DEXSettings(request) { + const data = exports.QueryDEXSettingsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DEXSettings", data); + return promise.then((data) => exports.QueryDEXSettingsResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/ft/v1/token.d.ts b/dist/main/coreum/asset/ft/v1/token.d.ts new file mode 100644 index 0000000..6e3d5ac --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/token.d.ts @@ -0,0 +1,114 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** Feature defines possible features of fungible token. */ +export declare enum Feature { + minting = 0, + burning = 1, + freezing = 2, + whitelisting = 3, + ibc = 4, + block_smart_contracts = 5, + clawback = 6, + extension = 7, + dex_block = 8, + dex_whitelisted_denoms = 9, + dex_order_cancellation = 10, + dex_unified_ref_amount_change = 11, + UNRECOGNIZED = -1 +} +export declare function featureFromJSON(object: any): Feature; +export declare function featureToJSON(object: Feature): string; +/** Definition defines the fungible token settings to store. */ +export interface Definition { + denom: string; + issuer: string; + features: Feature[]; + /** + * burn_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * burn_amount. This value will be burnt on top of the send amount. + */ + burnRate: string; + /** + * send_commission_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * amount sent to the token admin account. + */ + sendCommissionRate: string; + version: number; + uri: string; + uriHash: string; + extensionCwAddress: string; + admin: string; +} +/** Token is a full representation of the fungible token. */ +export interface Token { + denom: string; + issuer: string; + symbol: string; + subunit: string; + precision: number; + description: string; + globallyFrozen: boolean; + features: Feature[]; + /** + * burn_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * burn_amount. This value will be burnt on top of the send amount. + */ + burnRate: string; + /** + * send_commission_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * amount sent to the token admin account. + */ + sendCommissionRate: string; + version: number; + uri: string; + uriHash: string; + extensionCwAddress: string; + admin: string; + dexSettings: DEXSettings | undefined; +} +/** DelayedTokenUpgradeV1 is executed by the delay module when it's time to enable IBC. */ +export interface DelayedTokenUpgradeV1 { + denom: string; +} +/** TokenUpgradeV1Status defines the current status of the v1 token migration. */ +export interface TokenUpgradeV1Status { + ibcEnabled: boolean; + startTime: Date | undefined; + endTime: Date | undefined; +} +/** TokenUpgradeStatuses defines all statuses of the token migrations. */ +export interface TokenUpgradeStatuses { + v1: TokenUpgradeV1Status | undefined; +} +/** DEXSettings defines the token settings of the dex. */ +export interface DEXSettings { + /** unified_ref_amount is the approximate amount you need to buy 1USD, used to define the price tick size */ + unifiedRefAmount: string; + /** whitelisted_denoms is the list of denoms to trade with. */ + whitelistedDenoms: string[]; +} +export declare const Definition: MessageFns; +export declare const Token: MessageFns; +export declare const DelayedTokenUpgradeV1: MessageFns; +export declare const TokenUpgradeV1Status: MessageFns; +export declare const TokenUpgradeStatuses: MessageFns; +export declare const DEXSettings: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/ft/v1/token.js b/dist/main/coreum/asset/ft/v1/token.js new file mode 100644 index 0000000..9e38248 --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/token.js @@ -0,0 +1,942 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/token.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DEXSettings = exports.TokenUpgradeStatuses = exports.TokenUpgradeV1Status = exports.DelayedTokenUpgradeV1 = exports.Token = exports.Definition = exports.featureToJSON = exports.featureFromJSON = exports.Feature = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const timestamp_1 = require("cosmjs-types/google/protobuf/timestamp"); +exports.protobufPackage = "coreum.asset.ft.v1"; +/** Feature defines possible features of fungible token. */ +var Feature; +(function (Feature) { + Feature[Feature["minting"] = 0] = "minting"; + Feature[Feature["burning"] = 1] = "burning"; + Feature[Feature["freezing"] = 2] = "freezing"; + Feature[Feature["whitelisting"] = 3] = "whitelisting"; + Feature[Feature["ibc"] = 4] = "ibc"; + Feature[Feature["block_smart_contracts"] = 5] = "block_smart_contracts"; + Feature[Feature["clawback"] = 6] = "clawback"; + Feature[Feature["extension"] = 7] = "extension"; + Feature[Feature["dex_block"] = 8] = "dex_block"; + Feature[Feature["dex_whitelisted_denoms"] = 9] = "dex_whitelisted_denoms"; + Feature[Feature["dex_order_cancellation"] = 10] = "dex_order_cancellation"; + Feature[Feature["dex_unified_ref_amount_change"] = 11] = "dex_unified_ref_amount_change"; + Feature[Feature["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(Feature || (exports.Feature = Feature = {})); +function featureFromJSON(object) { + switch (object) { + case 0: + case "minting": + return Feature.minting; + case 1: + case "burning": + return Feature.burning; + case 2: + case "freezing": + return Feature.freezing; + case 3: + case "whitelisting": + return Feature.whitelisting; + case 4: + case "ibc": + return Feature.ibc; + case 5: + case "block_smart_contracts": + return Feature.block_smart_contracts; + case 6: + case "clawback": + return Feature.clawback; + case 7: + case "extension": + return Feature.extension; + case 8: + case "dex_block": + return Feature.dex_block; + case 9: + case "dex_whitelisted_denoms": + return Feature.dex_whitelisted_denoms; + case 10: + case "dex_order_cancellation": + return Feature.dex_order_cancellation; + case 11: + case "dex_unified_ref_amount_change": + return Feature.dex_unified_ref_amount_change; + case -1: + case "UNRECOGNIZED": + default: + return Feature.UNRECOGNIZED; + } +} +exports.featureFromJSON = featureFromJSON; +function featureToJSON(object) { + switch (object) { + case Feature.minting: + return "minting"; + case Feature.burning: + return "burning"; + case Feature.freezing: + return "freezing"; + case Feature.whitelisting: + return "whitelisting"; + case Feature.ibc: + return "ibc"; + case Feature.block_smart_contracts: + return "block_smart_contracts"; + case Feature.clawback: + return "clawback"; + case Feature.extension: + return "extension"; + case Feature.dex_block: + return "dex_block"; + case Feature.dex_whitelisted_denoms: + return "dex_whitelisted_denoms"; + case Feature.dex_order_cancellation: + return "dex_order_cancellation"; + case Feature.dex_unified_ref_amount_change: + return "dex_unified_ref_amount_change"; + case Feature.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureToJSON = featureToJSON; +function createBaseDefinition() { + return { + denom: "", + issuer: "", + features: [], + burnRate: "", + sendCommissionRate: "", + version: 0, + uri: "", + uriHash: "", + extensionCwAddress: "", + admin: "", + }; +} +exports.Definition = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + writer.uint32(26).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.burnRate !== "") { + writer.uint32(34).string(message.burnRate); + } + if (message.sendCommissionRate !== "") { + writer.uint32(42).string(message.sendCommissionRate); + } + if (message.version !== 0) { + writer.uint32(48).uint32(message.version); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + if (message.extensionCwAddress !== "") { + writer.uint32(74).string(message.extensionCwAddress); + } + if (message.admin !== "") { + writer.uint32(82).string(message.admin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefinition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.features.push(reader.int32()); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 4: { + if (tag !== 34) { + break; + } + message.burnRate = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.sendCommissionRate = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.version = reader.uint32(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.uri = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.extensionCwAddress = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.admin = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => featureFromJSON(e)) + : [], + burnRate: isSet(object.burnRate) + ? globalThis.String(object.burnRate) + : "", + sendCommissionRate: isSet(object.sendCommissionRate) + ? globalThis.String(object.sendCommissionRate) + : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + extensionCwAddress: isSet(object.extensionCwAddress) + ? globalThis.String(object.extensionCwAddress) + : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.features?.length) { + obj.features = message.features.map((e) => featureToJSON(e)); + } + if (message.burnRate !== "") { + obj.burnRate = message.burnRate; + } + if (message.sendCommissionRate !== "") { + obj.sendCommissionRate = message.sendCommissionRate; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.extensionCwAddress !== "") { + obj.extensionCwAddress = message.extensionCwAddress; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + return obj; + }, + create(base) { + return exports.Definition.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDefinition(); + message.denom = object.denom ?? ""; + message.issuer = object.issuer ?? ""; + message.features = object.features?.map((e) => e) || []; + message.burnRate = object.burnRate ?? ""; + message.sendCommissionRate = object.sendCommissionRate ?? ""; + message.version = object.version ?? 0; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.extensionCwAddress = object.extensionCwAddress ?? ""; + message.admin = object.admin ?? ""; + return message; + }, +}; +function createBaseToken() { + return { + denom: "", + issuer: "", + symbol: "", + subunit: "", + precision: 0, + description: "", + globallyFrozen: false, + features: [], + burnRate: "", + sendCommissionRate: "", + version: 0, + uri: "", + uriHash: "", + extensionCwAddress: "", + admin: "", + dexSettings: undefined, + }; +} +exports.Token = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.subunit !== "") { + writer.uint32(34).string(message.subunit); + } + if (message.precision !== 0) { + writer.uint32(40).uint32(message.precision); + } + if (message.description !== "") { + writer.uint32(50).string(message.description); + } + if (message.globallyFrozen !== false) { + writer.uint32(56).bool(message.globallyFrozen); + } + writer.uint32(66).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.burnRate !== "") { + writer.uint32(74).string(message.burnRate); + } + if (message.sendCommissionRate !== "") { + writer.uint32(82).string(message.sendCommissionRate); + } + if (message.version !== 0) { + writer.uint32(88).uint32(message.version); + } + if (message.uri !== "") { + writer.uint32(98).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(106).string(message.uriHash); + } + if (message.extensionCwAddress !== "") { + writer.uint32(114).string(message.extensionCwAddress); + } + if (message.admin !== "") { + writer.uint32(122).string(message.admin); + } + if (message.dexSettings !== undefined) { + exports.DEXSettings.encode(message.dexSettings, writer.uint32(130).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.symbol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.subunit = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.precision = reader.uint32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.description = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.globallyFrozen = reader.bool(); + continue; + } + case 8: { + if (tag === 64) { + message.features.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag !== 74) { + break; + } + message.burnRate = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.sendCommissionRate = reader.string(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.version = reader.uint32(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.uri = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.extensionCwAddress = reader.string(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.admin = reader.string(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.dexSettings = exports.DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + subunit: isSet(object.subunit) ? globalThis.String(object.subunit) : "", + precision: isSet(object.precision) + ? globalThis.Number(object.precision) + : 0, + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + globallyFrozen: isSet(object.globallyFrozen) + ? globalThis.Boolean(object.globallyFrozen) + : false, + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => featureFromJSON(e)) + : [], + burnRate: isSet(object.burnRate) + ? globalThis.String(object.burnRate) + : "", + sendCommissionRate: isSet(object.sendCommissionRate) + ? globalThis.String(object.sendCommissionRate) + : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + extensionCwAddress: isSet(object.extensionCwAddress) + ? globalThis.String(object.extensionCwAddress) + : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + dexSettings: isSet(object.dexSettings) + ? exports.DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.subunit !== "") { + obj.subunit = message.subunit; + } + if (message.precision !== 0) { + obj.precision = Math.round(message.precision); + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.globallyFrozen !== false) { + obj.globallyFrozen = message.globallyFrozen; + } + if (message.features?.length) { + obj.features = message.features.map((e) => featureToJSON(e)); + } + if (message.burnRate !== "") { + obj.burnRate = message.burnRate; + } + if (message.sendCommissionRate !== "") { + obj.sendCommissionRate = message.sendCommissionRate; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.extensionCwAddress !== "") { + obj.extensionCwAddress = message.extensionCwAddress; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.dexSettings !== undefined) { + obj.dexSettings = exports.DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return exports.Token.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseToken(); + message.denom = object.denom ?? ""; + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.subunit = object.subunit ?? ""; + message.precision = object.precision ?? 0; + message.description = object.description ?? ""; + message.globallyFrozen = object.globallyFrozen ?? false; + message.features = object.features?.map((e) => e) || []; + message.burnRate = object.burnRate ?? ""; + message.sendCommissionRate = object.sendCommissionRate ?? ""; + message.version = object.version ?? 0; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.extensionCwAddress = object.extensionCwAddress ?? ""; + message.admin = object.admin ?? ""; + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? exports.DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +function createBaseDelayedTokenUpgradeV1() { + return { denom: "" }; +} +exports.DelayedTokenUpgradeV1 = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedTokenUpgradeV1(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.DelayedTokenUpgradeV1.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDelayedTokenUpgradeV1(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseTokenUpgradeV1Status() { + return { ibcEnabled: false, startTime: undefined, endTime: undefined }; +} +exports.TokenUpgradeV1Status = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.ibcEnabled !== false) { + writer.uint32(8).bool(message.ibcEnabled); + } + if (message.startTime !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.startTime), writer.uint32(18).fork()).ldelim(); + } + if (message.endTime !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.endTime), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenUpgradeV1Status(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.ibcEnabled = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.startTime = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.endTime = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + ibcEnabled: isSet(object.ibcEnabled) + ? globalThis.Boolean(object.ibcEnabled) + : false, + startTime: isSet(object.startTime) + ? fromJsonTimestamp(object.startTime) + : undefined, + endTime: isSet(object.endTime) + ? fromJsonTimestamp(object.endTime) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.ibcEnabled !== false) { + obj.ibcEnabled = message.ibcEnabled; + } + if (message.startTime !== undefined) { + obj.startTime = message.startTime.toISOString(); + } + if (message.endTime !== undefined) { + obj.endTime = message.endTime.toISOString(); + } + return obj; + }, + create(base) { + return exports.TokenUpgradeV1Status.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenUpgradeV1Status(); + message.ibcEnabled = object.ibcEnabled ?? false; + message.startTime = object.startTime ?? undefined; + message.endTime = object.endTime ?? undefined; + return message; + }, +}; +function createBaseTokenUpgradeStatuses() { + return { v1: undefined }; +} +exports.TokenUpgradeStatuses = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.v1 !== undefined) { + exports.TokenUpgradeV1Status.encode(message.v1, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenUpgradeStatuses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.v1 = exports.TokenUpgradeV1Status.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + v1: isSet(object.v1) + ? exports.TokenUpgradeV1Status.fromJSON(object.v1) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.v1 !== undefined) { + obj.v1 = exports.TokenUpgradeV1Status.toJSON(message.v1); + } + return obj; + }, + create(base) { + return exports.TokenUpgradeStatuses.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenUpgradeStatuses(); + message.v1 = + object.v1 !== undefined && object.v1 !== null + ? exports.TokenUpgradeV1Status.fromPartial(object.v1) + : undefined; + return message; + }, +}; +function createBaseDEXSettings() { + return { unifiedRefAmount: "", whitelistedDenoms: [] }; +} +exports.DEXSettings = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.unifiedRefAmount !== "") { + writer.uint32(10).string(message.unifiedRefAmount); + } + for (const v of message.whitelistedDenoms) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDEXSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.unifiedRefAmount = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.whitelistedDenoms.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + unifiedRefAmount: isSet(object.unifiedRefAmount) + ? globalThis.String(object.unifiedRefAmount) + : "", + whitelistedDenoms: globalThis.Array.isArray(object?.whitelistedDenoms) + ? object.whitelistedDenoms.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.unifiedRefAmount !== "") { + obj.unifiedRefAmount = message.unifiedRefAmount; + } + if (message.whitelistedDenoms?.length) { + obj.whitelistedDenoms = message.whitelistedDenoms; + } + return obj; + }, + create(base) { + return exports.DEXSettings.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDEXSettings(); + message.unifiedRefAmount = object.unifiedRefAmount ?? ""; + message.whitelistedDenoms = object.whitelistedDenoms?.map((e) => e) || []; + return message; + }, +}; +function toTimestamp(date) { + const seconds = Math.trunc(date.getTime() / 1000); + const nanos = (date.getTime() % 1000) * 1000000; + return { seconds: BigInt(seconds), nanos }; +} +function fromTimestamp(t) { + const seconds = BigInt(t.seconds || 0); + const nanos = BigInt(t.nanos || 0); + const millis = seconds * BigInt(1000) + nanos / BigInt(1000000); + return new Date(Number(millis)); +} +function fromJsonTimestamp(o) { + if (o instanceof globalThis.Date) { + return o; + } + else if (typeof o === "string") { + return new globalThis.Date(o); + } + else { + return fromTimestamp(timestamp_1.Timestamp.fromJSON(o)); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/ft/v1/tx.d.ts b/dist/main/coreum/asset/ft/v1/tx.d.ts new file mode 100644 index 0000000..d2bbd26 --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/tx.d.ts @@ -0,0 +1,237 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, Feature } from "./token"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** MsgIssue defines message to issue new fungible token. */ +export interface MsgIssue { + issuer: string; + symbol: string; + subunit: string; + precision: number; + initialAmount: string; + description: string; + features: Feature[]; + /** + * burn_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * burn_amount. This value will be burnt on top of the send amount. + */ + burnRate: string; + /** + * send_commission_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * amount sent to the token admin account. + */ + sendCommissionRate: string; + uri: string; + uriHash: string; + /** extension_settings must be provided in case wasm extensions are enabled. */ + extensionSettings: ExtensionIssueSettings | undefined; + /** dex_settings allowed to be customized by issuer */ + dexSettings: DEXSettings | undefined; +} +/** + * ExtensionIssueSettings are settings that will be used to Instantiate the smart contract which contains + * the source code for the extension. + */ +export interface ExtensionIssueSettings { + /** code_id is the reference to the stored WASM code */ + codeId: number; + /** label is optional metadata to be stored with a contract instance. */ + label: string; + /** funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** optional json encoded data to pass to WASM on instantiation by the ft issuer */ + issuanceMsg: Uint8Array; +} +export interface MsgMint { + sender: string; + coin: Coin | undefined; + recipient: string; +} +export interface MsgBurn { + sender: string; + coin: Coin | undefined; +} +export interface MsgFreeze { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgUnfreeze { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgSetFrozen { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgGloballyFreeze { + sender: string; + denom: string; +} +export interface MsgGloballyUnfreeze { + sender: string; + denom: string; +} +export interface MsgClawback { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgSetWhitelistedLimit { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgTransferAdmin { + sender: string; + account: string; + denom: string; +} +export interface MsgClearAdmin { + sender: string; + denom: string; +} +/** MsgUpgradeTokenV1 is the message upgrading token to V1. */ +export interface MsgUpgradeTokenV1 { + sender: string; + denom: string; + ibcEnabled: boolean; +} +export interface MsgUpdateParams { + authority: string; + params: Params | undefined; +} +export interface MsgUpdateDEXUnifiedRefAmount { + sender: string; + denom: string; + /** unified_ref_amount is the approximate amount you need to buy 1USD, used to define the price tick size */ + unifiedRefAmount: string; +} +export interface MsgUpdateDEXWhitelistedDenoms { + sender: string; + denom: string; + /** whitelisted_denoms is the list of denoms to trade with. */ + whitelistedDenoms: string[]; +} +export interface EmptyResponse { +} +export declare const MsgIssue: MessageFns; +export declare const ExtensionIssueSettings: MessageFns; +export declare const MsgMint: MessageFns; +export declare const MsgBurn: MessageFns; +export declare const MsgFreeze: MessageFns; +export declare const MsgUnfreeze: MessageFns; +export declare const MsgSetFrozen: MessageFns; +export declare const MsgGloballyFreeze: MessageFns; +export declare const MsgGloballyUnfreeze: MessageFns; +export declare const MsgClawback: MessageFns; +export declare const MsgSetWhitelistedLimit: MessageFns; +export declare const MsgTransferAdmin: MessageFns; +export declare const MsgClearAdmin: MessageFns; +export declare const MsgUpgradeTokenV1: MessageFns; +export declare const MsgUpdateParams: MessageFns; +export declare const MsgUpdateDEXUnifiedRefAmount: MessageFns; +export declare const MsgUpdateDEXWhitelistedDenoms: MessageFns; +export declare const EmptyResponse: MessageFns; +/** Msg defines the Msg service. */ +export interface Msg { + /** Issue defines a method to issue a new fungible token. */ + Issue(request: MsgIssue): Promise; + /** Mint mints new fungible tokens. */ + Mint(request: MsgMint): Promise; + /** Burn burns the specified fungible tokens from senders balance if the sender has enough balance. */ + Burn(request: MsgBurn): Promise; + /** + * Freeze freezes a part of the fungible tokens in an + * account, only if the freezable feature is enabled on that token. + */ + Freeze(request: MsgFreeze): Promise; + /** + * Unfreeze unfreezes a part of the frozen fungible tokens in an + * account, only if there are such frozen tokens on that account. + */ + Unfreeze(request: MsgUnfreeze): Promise; + /** SetFrozen sets the absolute value of frozen amount. */ + SetFrozen(request: MsgSetFrozen): Promise; + /** + * GloballyFreeze freezes fungible token so no operations are allowed with it before unfrozen. + * This operation is idempotent so global freeze of already frozen token does nothing. + */ + GloballyFreeze(request: MsgGloballyFreeze): Promise; + /** + * GloballyUnfreeze unfreezes fungible token and unblocks basic operations on it. + * This operation is idempotent so global unfreezing of non-frozen token does nothing. + */ + GloballyUnfreeze(request: MsgGloballyUnfreeze): Promise; + /** + * Clawback confiscates a part of fungible tokens from an account + * to the admin, only if the clawback feature is enabled on that token. + */ + Clawback(request: MsgClawback): Promise; + /** SetWhitelistedLimit sets the limit of how many tokens a specific account may hold. */ + SetWhitelistedLimit(request: MsgSetWhitelistedLimit): Promise; + /** TransferAdmin changes admin of a fungible token. */ + TransferAdmin(request: MsgTransferAdmin): Promise; + /** ClearAdmin removes admin of a fungible token. */ + ClearAdmin(request: MsgClearAdmin): Promise; + /** TokenUpgradeV1 upgrades token to version V1. */ + UpgradeTokenV1(request: MsgUpgradeTokenV1): Promise; + /** + * UpdateParams is a governance operation to modify the parameters of the module. + * NOTE: all parameters must be provided. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** UpdateDEXUnifiedRefAmount updates DEX unified ref amount. */ + UpdateDEXUnifiedRefAmount(request: MsgUpdateDEXUnifiedRefAmount): Promise; + /** UpdateDEXWhitelistedDenoms updates DEX whitelisted denoms. */ + UpdateDEXWhitelistedDenoms(request: MsgUpdateDEXWhitelistedDenoms): Promise; +} +export declare const MsgServiceName = "coreum.asset.ft.v1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Issue(request: MsgIssue): Promise; + Mint(request: MsgMint): Promise; + Burn(request: MsgBurn): Promise; + Freeze(request: MsgFreeze): Promise; + Unfreeze(request: MsgUnfreeze): Promise; + SetFrozen(request: MsgSetFrozen): Promise; + GloballyFreeze(request: MsgGloballyFreeze): Promise; + GloballyUnfreeze(request: MsgGloballyUnfreeze): Promise; + Clawback(request: MsgClawback): Promise; + SetWhitelistedLimit(request: MsgSetWhitelistedLimit): Promise; + TransferAdmin(request: MsgTransferAdmin): Promise; + ClearAdmin(request: MsgClearAdmin): Promise; + UpgradeTokenV1(request: MsgUpgradeTokenV1): Promise; + UpdateParams(request: MsgUpdateParams): Promise; + UpdateDEXUnifiedRefAmount(request: MsgUpdateDEXUnifiedRefAmount): Promise; + UpdateDEXWhitelistedDenoms(request: MsgUpdateDEXWhitelistedDenoms): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/ft/v1/tx.js b/dist/main/coreum/asset/ft/v1/tx.js new file mode 100644 index 0000000..50d5450 --- /dev/null +++ b/dist/main/coreum/asset/ft/v1/tx.js @@ -0,0 +1,1779 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/tx.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MsgClientImpl = exports.MsgServiceName = exports.EmptyResponse = exports.MsgUpdateDEXWhitelistedDenoms = exports.MsgUpdateDEXUnifiedRefAmount = exports.MsgUpdateParams = exports.MsgUpgradeTokenV1 = exports.MsgClearAdmin = exports.MsgTransferAdmin = exports.MsgSetWhitelistedLimit = exports.MsgClawback = exports.MsgGloballyUnfreeze = exports.MsgGloballyFreeze = exports.MsgSetFrozen = exports.MsgUnfreeze = exports.MsgFreeze = exports.MsgBurn = exports.MsgMint = exports.ExtensionIssueSettings = exports.MsgIssue = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const params_1 = require("./params"); +const token_1 = require("./token"); +exports.protobufPackage = "coreum.asset.ft.v1"; +function createBaseMsgIssue() { + return { + issuer: "", + symbol: "", + subunit: "", + precision: 0, + initialAmount: "", + description: "", + features: [], + burnRate: "", + sendCommissionRate: "", + uri: "", + uriHash: "", + extensionSettings: undefined, + dexSettings: undefined, + }; +} +exports.MsgIssue = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.issuer !== "") { + writer.uint32(10).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(18).string(message.symbol); + } + if (message.subunit !== "") { + writer.uint32(26).string(message.subunit); + } + if (message.precision !== 0) { + writer.uint32(32).uint32(message.precision); + } + if (message.initialAmount !== "") { + writer.uint32(42).string(message.initialAmount); + } + if (message.description !== "") { + writer.uint32(50).string(message.description); + } + writer.uint32(58).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.burnRate !== "") { + writer.uint32(66).string(message.burnRate); + } + if (message.sendCommissionRate !== "") { + writer.uint32(74).string(message.sendCommissionRate); + } + if (message.uri !== "") { + writer.uint32(82).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(90).string(message.uriHash); + } + if (message.extensionSettings !== undefined) { + exports.ExtensionIssueSettings.encode(message.extensionSettings, writer.uint32(98).fork()).ldelim(); + } + if (message.dexSettings !== undefined) { + token_1.DEXSettings.encode(message.dexSettings, writer.uint32(106).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIssue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.issuer = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.symbol = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.subunit = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.precision = reader.uint32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.initialAmount = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.description = reader.string(); + continue; + } + case 7: { + if (tag === 56) { + message.features.push(reader.int32()); + continue; + } + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 8: { + if (tag !== 66) { + break; + } + message.burnRate = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.sendCommissionRate = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.uri = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.extensionSettings = exports.ExtensionIssueSettings.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.dexSettings = token_1.DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + subunit: isSet(object.subunit) ? globalThis.String(object.subunit) : "", + precision: isSet(object.precision) + ? globalThis.Number(object.precision) + : 0, + initialAmount: isSet(object.initialAmount) + ? globalThis.String(object.initialAmount) + : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => (0, token_1.featureFromJSON)(e)) + : [], + burnRate: isSet(object.burnRate) + ? globalThis.String(object.burnRate) + : "", + sendCommissionRate: isSet(object.sendCommissionRate) + ? globalThis.String(object.sendCommissionRate) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + extensionSettings: isSet(object.extensionSettings) + ? exports.ExtensionIssueSettings.fromJSON(object.extensionSettings) + : undefined, + dexSettings: isSet(object.dexSettings) + ? token_1.DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.subunit !== "") { + obj.subunit = message.subunit; + } + if (message.precision !== 0) { + obj.precision = Math.round(message.precision); + } + if (message.initialAmount !== "") { + obj.initialAmount = message.initialAmount; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.features?.length) { + obj.features = message.features.map((e) => (0, token_1.featureToJSON)(e)); + } + if (message.burnRate !== "") { + obj.burnRate = message.burnRate; + } + if (message.sendCommissionRate !== "") { + obj.sendCommissionRate = message.sendCommissionRate; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.extensionSettings !== undefined) { + obj.extensionSettings = exports.ExtensionIssueSettings.toJSON(message.extensionSettings); + } + if (message.dexSettings !== undefined) { + obj.dexSettings = token_1.DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return exports.MsgIssue.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIssue(); + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.subunit = object.subunit ?? ""; + message.precision = object.precision ?? 0; + message.initialAmount = object.initialAmount ?? ""; + message.description = object.description ?? ""; + message.features = object.features?.map((e) => e) || []; + message.burnRate = object.burnRate ?? ""; + message.sendCommissionRate = object.sendCommissionRate ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.extensionSettings = + object.extensionSettings !== undefined && + object.extensionSettings !== null + ? exports.ExtensionIssueSettings.fromPartial(object.extensionSettings) + : undefined; + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? token_1.DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +function createBaseExtensionIssueSettings() { + return { codeId: 0, label: "", funds: [], issuanceMsg: new Uint8Array(0) }; +} +exports.ExtensionIssueSettings = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(18).string(message.label); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(26).fork()).ldelim(); + } + if (message.issuanceMsg.length !== 0) { + writer.uint32(34).bytes(message.issuanceMsg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionIssueSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.label = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.issuanceMsg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + issuanceMsg: isSet(object.issuanceMsg) + ? bytesFromBase64(object.issuanceMsg) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + if (message.issuanceMsg.length !== 0) { + obj.issuanceMsg = base64FromBytes(message.issuanceMsg); + } + return obj; + }, + create(base) { + return exports.ExtensionIssueSettings.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtensionIssueSettings(); + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.issuanceMsg = object.issuanceMsg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgMint() { + return { sender: "", coin: undefined, recipient: "" }; +} +exports.MsgMint = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.coin !== undefined) { + coin_1.Coin.encode(message.coin, writer.uint32(18).fork()).ldelim(); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.coin = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.recipient = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + coin: isSet(object.coin) ? coin_1.Coin.fromJSON(object.coin) : undefined, + recipient: isSet(object.recipient) + ? globalThis.String(object.recipient) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.coin !== undefined) { + obj.coin = coin_1.Coin.toJSON(message.coin); + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + return obj; + }, + create(base) { + return exports.MsgMint.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgMint(); + message.sender = object.sender ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? coin_1.Coin.fromPartial(object.coin) + : undefined; + message.recipient = object.recipient ?? ""; + return message; + }, +}; +function createBaseMsgBurn() { + return { sender: "", coin: undefined }; +} +exports.MsgBurn = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.coin !== undefined) { + coin_1.Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + coin: isSet(object.coin) ? coin_1.Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.coin !== undefined) { + obj.coin = coin_1.Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return exports.MsgBurn.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgBurn(); + message.sender = object.sender ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? coin_1.Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgFreeze() { + return { sender: "", account: "", coin: undefined }; +} +exports.MsgFreeze = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + coin_1.Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? coin_1.Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = coin_1.Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return exports.MsgFreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgFreeze(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? coin_1.Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgUnfreeze() { + return { sender: "", account: "", coin: undefined }; +} +exports.MsgUnfreeze = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + coin_1.Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnfreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? coin_1.Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = coin_1.Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return exports.MsgUnfreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUnfreeze(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? coin_1.Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgSetFrozen() { + return { sender: "", account: "", coin: undefined }; +} +exports.MsgSetFrozen = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + coin_1.Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetFrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? coin_1.Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = coin_1.Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return exports.MsgSetFrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSetFrozen(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? coin_1.Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgGloballyFreeze() { + return { sender: "", denom: "" }; +} +exports.MsgGloballyFreeze = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGloballyFreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.MsgGloballyFreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgGloballyFreeze(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseMsgGloballyUnfreeze() { + return { sender: "", denom: "" }; +} +exports.MsgGloballyUnfreeze = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGloballyUnfreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.MsgGloballyUnfreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgGloballyUnfreeze(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseMsgClawback() { + return { sender: "", account: "", coin: undefined }; +} +exports.MsgClawback = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + coin_1.Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClawback(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? coin_1.Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = coin_1.Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return exports.MsgClawback.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClawback(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? coin_1.Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgSetWhitelistedLimit() { + return { sender: "", account: "", coin: undefined }; +} +exports.MsgSetWhitelistedLimit = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + coin_1.Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWhitelistedLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? coin_1.Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = coin_1.Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return exports.MsgSetWhitelistedLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSetWhitelistedLimit(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? coin_1.Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgTransferAdmin() { + return { sender: "", account: "", denom: "" }; +} +exports.MsgTransferAdmin = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.denom !== "") { + writer.uint32(26).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransferAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.MsgTransferAdmin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgTransferAdmin(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseMsgClearAdmin() { + return { sender: "", denom: "" }; +} +exports.MsgClearAdmin = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.MsgClearAdmin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClearAdmin(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseMsgUpgradeTokenV1() { + return { sender: "", denom: "", ibcEnabled: false }; +} +exports.MsgUpgradeTokenV1 = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.ibcEnabled !== false) { + writer.uint32(24).bool(message.ibcEnabled); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeTokenV1(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.ibcEnabled = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + ibcEnabled: isSet(object.ibcEnabled) + ? globalThis.Boolean(object.ibcEnabled) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.ibcEnabled !== false) { + obj.ibcEnabled = message.ibcEnabled; + } + return obj; + }, + create(base) { + return exports.MsgUpgradeTokenV1.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpgradeTokenV1(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.ibcEnabled = object.ibcEnabled ?? false; + return message; + }, +}; +function createBaseMsgUpdateParams() { + return { authority: "", params: undefined }; +} +exports.MsgUpdateParams = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.MsgUpdateParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseMsgUpdateDEXUnifiedRefAmount() { + return { sender: "", denom: "", unifiedRefAmount: "" }; +} +exports.MsgUpdateDEXUnifiedRefAmount = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.unifiedRefAmount !== "") { + writer.uint32(26).string(message.unifiedRefAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateDEXUnifiedRefAmount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.unifiedRefAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + unifiedRefAmount: isSet(object.unifiedRefAmount) + ? globalThis.String(object.unifiedRefAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.unifiedRefAmount !== "") { + obj.unifiedRefAmount = message.unifiedRefAmount; + } + return obj; + }, + create(base) { + return exports.MsgUpdateDEXUnifiedRefAmount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateDEXUnifiedRefAmount(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.unifiedRefAmount = object.unifiedRefAmount ?? ""; + return message; + }, +}; +function createBaseMsgUpdateDEXWhitelistedDenoms() { + return { sender: "", denom: "", whitelistedDenoms: [] }; +} +exports.MsgUpdateDEXWhitelistedDenoms = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + for (const v of message.whitelistedDenoms) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateDEXWhitelistedDenoms(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.whitelistedDenoms.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + whitelistedDenoms: globalThis.Array.isArray(object?.whitelistedDenoms) + ? object.whitelistedDenoms.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.whitelistedDenoms?.length) { + obj.whitelistedDenoms = message.whitelistedDenoms; + } + return obj; + }, + create(base) { + return exports.MsgUpdateDEXWhitelistedDenoms.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateDEXWhitelistedDenoms(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.whitelistedDenoms = object.whitelistedDenoms?.map((e) => e) || []; + return message; + }, +}; +function createBaseEmptyResponse() { + return {}; +} +exports.EmptyResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmptyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.EmptyResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseEmptyResponse(); + return message; + }, +}; +exports.MsgServiceName = "coreum.asset.ft.v1.Msg"; +class MsgClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.MsgServiceName; + this.rpc = rpc; + this.Issue = this.Issue.bind(this); + this.Mint = this.Mint.bind(this); + this.Burn = this.Burn.bind(this); + this.Freeze = this.Freeze.bind(this); + this.Unfreeze = this.Unfreeze.bind(this); + this.SetFrozen = this.SetFrozen.bind(this); + this.GloballyFreeze = this.GloballyFreeze.bind(this); + this.GloballyUnfreeze = this.GloballyUnfreeze.bind(this); + this.Clawback = this.Clawback.bind(this); + this.SetWhitelistedLimit = this.SetWhitelistedLimit.bind(this); + this.TransferAdmin = this.TransferAdmin.bind(this); + this.ClearAdmin = this.ClearAdmin.bind(this); + this.UpgradeTokenV1 = this.UpgradeTokenV1.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.UpdateDEXUnifiedRefAmount = this.UpdateDEXUnifiedRefAmount.bind(this); + this.UpdateDEXWhitelistedDenoms = + this.UpdateDEXWhitelistedDenoms.bind(this); + } + Issue(request) { + const data = exports.MsgIssue.encode(request).finish(); + const promise = this.rpc.request(this.service, "Issue", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Mint(request) { + const data = exports.MsgMint.encode(request).finish(); + const promise = this.rpc.request(this.service, "Mint", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Burn(request) { + const data = exports.MsgBurn.encode(request).finish(); + const promise = this.rpc.request(this.service, "Burn", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Freeze(request) { + const data = exports.MsgFreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "Freeze", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Unfreeze(request) { + const data = exports.MsgUnfreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "Unfreeze", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + SetFrozen(request) { + const data = exports.MsgSetFrozen.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetFrozen", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + GloballyFreeze(request) { + const data = exports.MsgGloballyFreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "GloballyFreeze", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + GloballyUnfreeze(request) { + const data = exports.MsgGloballyUnfreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "GloballyUnfreeze", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Clawback(request) { + const data = exports.MsgClawback.encode(request).finish(); + const promise = this.rpc.request(this.service, "Clawback", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + SetWhitelistedLimit(request) { + const data = exports.MsgSetWhitelistedLimit.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetWhitelistedLimit", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + TransferAdmin(request) { + const data = exports.MsgTransferAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "TransferAdmin", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + ClearAdmin(request) { + const data = exports.MsgClearAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClearAdmin", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + UpgradeTokenV1(request) { + const data = exports.MsgUpgradeTokenV1.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpgradeTokenV1", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + UpdateParams(request) { + const data = exports.MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + UpdateDEXUnifiedRefAmount(request) { + const data = exports.MsgUpdateDEXUnifiedRefAmount.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateDEXUnifiedRefAmount", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + UpdateDEXWhitelistedDenoms(request) { + const data = exports.MsgUpdateDEXWhitelistedDenoms.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateDEXWhitelistedDenoms", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/index.d.ts b/dist/main/coreum/asset/index.d.ts new file mode 100644 index 0000000..73495db --- /dev/null +++ b/dist/main/coreum/asset/index.d.ts @@ -0,0 +1,2 @@ +export declare const assetNftRegistry: ReadonlyArray<[string, any]>; +export declare const assetFtRegistry: ReadonlyArray<[string, any]>; diff --git a/dist/main/coreum/asset/index.js b/dist/main/coreum/asset/index.js new file mode 100644 index 0000000..ed15823 --- /dev/null +++ b/dist/main/coreum/asset/index.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assetFtRegistry = exports.assetNftRegistry = void 0; +const types_1 = require("../../types"); +const tx_1 = require("./nft/v1/tx"); +const tx_2 = require("./ft/v1/tx"); +exports.assetNftRegistry = [ + [types_1.CoreumTypeUrl.NFT + "MsgIssueClass", tx_1.MsgIssueClass], + [types_1.CoreumTypeUrl.NFT + "MsgAddToWhitelist", tx_1.MsgAddToWhitelist], + [types_1.CoreumTypeUrl.NFT + "MsgRemoveFromWhitelist", tx_1.MsgRemoveFromWhitelist], + [types_1.CoreumTypeUrl.NFT + "MsgMint", tx_1.MsgMint], + [types_1.CoreumTypeUrl.NFT + "MsgBurn", tx_1.MsgBurn], + [types_1.CoreumTypeUrl.NFT + "MsgFreeze", tx_1.MsgFreeze], + [types_1.CoreumTypeUrl.NFT + "MsgUnfreeze", tx_1.MsgUnfreeze], +]; +exports.assetFtRegistry = [ + [types_1.CoreumTypeUrl.FT + "MsgIssue", tx_2.MsgIssue], + [types_1.CoreumTypeUrl.FT + "MsgFreeze", tx_2.MsgFreeze], + [types_1.CoreumTypeUrl.FT + "MsgMint", tx_2.MsgMint], + [types_1.CoreumTypeUrl.FT + "MsgBurn", tx_2.MsgBurn], + [types_1.CoreumTypeUrl.FT + "MsgUnfreeze", tx_2.MsgUnfreeze], + [types_1.CoreumTypeUrl.FT + "MsgGloballyFreeze", tx_2.MsgGloballyFreeze], + [types_1.CoreumTypeUrl.FT + "MsgGloballyUnfreeze", tx_2.MsgGloballyUnfreeze], + [types_1.CoreumTypeUrl.FT + "MsgSetWhitelistedLimit", tx_2.MsgSetWhitelistedLimit], + [types_1.CoreumTypeUrl.FT + "MsgClawback", tx_2.MsgClawback], + [ + types_1.CoreumTypeUrl.FT + "MsgUpdateDEXWhitelistedDenoms", + tx_2.MsgUpdateDEXWhitelistedDenoms, + ], + [ + types_1.CoreumTypeUrl.FT + "MsgUpdateDEXUnifiedRefAmount", + tx_2.MsgUpdateDEXUnifiedRefAmount, + ], +]; diff --git a/dist/main/coreum/asset/nft/v1/authz.d.ts b/dist/main/coreum/asset/nft/v1/authz.d.ts new file mode 100644 index 0000000..8459ca0 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/authz.d.ts @@ -0,0 +1,33 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** SendAuthorization allows the grantee to send specific NFTs from the granter's account. */ +export interface SendAuthorization { + nfts: NFTIdentifier[]; +} +export interface NFTIdentifier { + /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ + classId: string; + /** id defines the unique identification of nft */ + id: string; +} +export declare const SendAuthorization: MessageFns; +export declare const NFTIdentifier: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/nft/v1/authz.js b/dist/main/coreum/asset/nft/v1/authz.js new file mode 100644 index 0000000..52bc6c6 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/authz.js @@ -0,0 +1,137 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/authz.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NFTIdentifier = exports.SendAuthorization = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +exports.protobufPackage = "coreum.asset.nft.v1"; +function createBaseSendAuthorization() { + return { nfts: [] }; +} +exports.SendAuthorization = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.nfts) { + exports.NFTIdentifier.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.nfts.push(exports.NFTIdentifier.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nfts: globalThis.Array.isArray(object?.nfts) + ? object.nfts.map((e) => exports.NFTIdentifier.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => exports.NFTIdentifier.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.SendAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSendAuthorization(); + message.nfts = object.nfts?.map((e) => exports.NFTIdentifier.fromPartial(e)) || []; + return message; + }, +}; +function createBaseNFTIdentifier() { + return { classId: "", id: "" }; +} +exports.NFTIdentifier = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNFTIdentifier(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.NFTIdentifier.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNFTIdentifier(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/nft/v1/event.d.ts b/dist/main/coreum/asset/nft/v1/event.d.ts new file mode 100644 index 0000000..0202ec3 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/event.d.ts @@ -0,0 +1,79 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { ClassFeature } from "./nft"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** EventClassIssued is emitted on MsgIssueClass. */ +export interface EventClassIssued { + id: string; + issuer: string; + symbol: string; + name: string; + description: string; + uri: string; + uriHash: string; + features: ClassFeature[]; + royaltyRate: string; +} +export interface EventFrozen { + classId: string; + id: string; + owner: string; +} +export interface EventUnfrozen { + classId: string; + id: string; + owner: string; +} +export interface EventClassFrozen { + classId: string; + account: string; +} +export interface EventClassUnfrozen { + classId: string; + account: string; +} +export interface EventAddedToWhitelist { + classId: string; + id: string; + account: string; +} +export interface EventRemovedFromWhitelist { + classId: string; + id: string; + account: string; +} +export interface EventAddedToClassWhitelist { + classId: string; + account: string; +} +export interface EventRemovedFromClassWhitelist { + classId: string; + account: string; +} +export declare const EventClassIssued: MessageFns; +export declare const EventFrozen: MessageFns; +export declare const EventUnfrozen: MessageFns; +export declare const EventClassFrozen: MessageFns; +export declare const EventClassUnfrozen: MessageFns; +export declare const EventAddedToWhitelist: MessageFns; +export declare const EventRemovedFromWhitelist: MessageFns; +export declare const EventAddedToClassWhitelist: MessageFns; +export declare const EventRemovedFromClassWhitelist: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/nft/v1/event.js b/dist/main/coreum/asset/nft/v1/event.js new file mode 100644 index 0000000..1ac5354 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/event.js @@ -0,0 +1,817 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/event.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EventRemovedFromClassWhitelist = exports.EventAddedToClassWhitelist = exports.EventRemovedFromWhitelist = exports.EventAddedToWhitelist = exports.EventClassUnfrozen = exports.EventClassFrozen = exports.EventUnfrozen = exports.EventFrozen = exports.EventClassIssued = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const nft_1 = require("./nft"); +exports.protobufPackage = "coreum.asset.nft.v1"; +function createBaseEventClassIssued() { + return { + id: "", + issuer: "", + symbol: "", + name: "", + description: "", + uri: "", + uriHash: "", + features: [], + royaltyRate: "", + }; +} +exports.EventClassIssued = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.name !== "") { + writer.uint32(34).string(message.name); + } + if (message.description !== "") { + writer.uint32(42).string(message.description); + } + if (message.uri !== "") { + writer.uint32(50).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(58).string(message.uriHash); + } + writer.uint32(66).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.royaltyRate !== "") { + writer.uint32(74).string(message.royaltyRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventClassIssued(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.symbol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.name = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.description = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.uri = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 8: { + if (tag === 64) { + message.features.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag !== 74) { + break; + } + message.royaltyRate = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => (0, nft_1.classFeatureFromJSON)(e)) + : [], + royaltyRate: isSet(object.royaltyRate) + ? globalThis.String(object.royaltyRate) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.features?.length) { + obj.features = message.features.map((e) => (0, nft_1.classFeatureToJSON)(e)); + } + if (message.royaltyRate !== "") { + obj.royaltyRate = message.royaltyRate; + } + return obj; + }, + create(base) { + return exports.EventClassIssued.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventClassIssued(); + message.id = object.id ?? ""; + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.features = object.features?.map((e) => e) || []; + message.royaltyRate = object.royaltyRate ?? ""; + return message; + }, +}; +function createBaseEventFrozen() { + return { classId: "", id: "", owner: "" }; +} +exports.EventFrozen = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventFrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return exports.EventFrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventFrozen(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseEventUnfrozen() { + return { classId: "", id: "", owner: "" }; +} +exports.EventUnfrozen = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUnfrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return exports.EventUnfrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventUnfrozen(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseEventClassFrozen() { + return { classId: "", account: "" }; +} +exports.EventClassFrozen = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventClassFrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.EventClassFrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventClassFrozen(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventClassUnfrozen() { + return { classId: "", account: "" }; +} +exports.EventClassUnfrozen = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventClassUnfrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.EventClassUnfrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventClassUnfrozen(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventAddedToWhitelist() { + return { classId: "", id: "", account: "" }; +} +exports.EventAddedToWhitelist = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAddedToWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.EventAddedToWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAddedToWhitelist(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventRemovedFromWhitelist() { + return { classId: "", id: "", account: "" }; +} +exports.EventRemovedFromWhitelist = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRemovedFromWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.EventRemovedFromWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventRemovedFromWhitelist(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventAddedToClassWhitelist() { + return { classId: "", account: "" }; +} +exports.EventAddedToClassWhitelist = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAddedToClassWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.EventAddedToClassWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAddedToClassWhitelist(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventRemovedFromClassWhitelist() { + return { classId: "", account: "" }; +} +exports.EventRemovedFromClassWhitelist = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRemovedFromClassWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.EventRemovedFromClassWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventRemovedFromClassWhitelist(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/nft/v1/genesis.d.ts b/dist/main/coreum/asset/nft/v1/genesis.d.ts new file mode 100644 index 0000000..eea09ae --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/genesis.d.ts @@ -0,0 +1,62 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { ClassDefinition } from "./nft"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** GenesisState defines the nftasset module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + /** class_definitions keep the non-fungible token class definitions state */ + classDefinitions: ClassDefinition[]; + frozenNfts: FrozenNFT[]; + whitelistedNftAccounts: WhitelistedNFTAccounts[]; + burntNfts: BurntNFT[]; + classWhitelistedAccounts: ClassWhitelistedAccounts[]; + classFrozenAccounts: ClassFrozenAccounts[]; +} +export interface FrozenNFT { + classID: string; + nftIDs: string[]; +} +export interface WhitelistedNFTAccounts { + classID: string; + nftID: string; + accounts: string[]; +} +export interface ClassWhitelistedAccounts { + classID: string; + accounts: string[]; +} +export interface ClassFrozenAccounts { + classID: string; + accounts: string[]; +} +export interface BurntNFT { + classID: string; + nftIDs: string[]; +} +export declare const GenesisState: MessageFns; +export declare const FrozenNFT: MessageFns; +export declare const WhitelistedNFTAccounts: MessageFns; +export declare const ClassWhitelistedAccounts: MessageFns; +export declare const ClassFrozenAccounts: MessageFns; +export declare const BurntNFT: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/nft/v1/genesis.js b/dist/main/coreum/asset/nft/v1/genesis.js new file mode 100644 index 0000000..8df8276 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/genesis.js @@ -0,0 +1,553 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/genesis.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BurntNFT = exports.ClassFrozenAccounts = exports.ClassWhitelistedAccounts = exports.WhitelistedNFTAccounts = exports.FrozenNFT = exports.GenesisState = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const nft_1 = require("./nft"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.asset.nft.v1"; +function createBaseGenesisState() { + return { + params: undefined, + classDefinitions: [], + frozenNfts: [], + whitelistedNftAccounts: [], + burntNfts: [], + classWhitelistedAccounts: [], + classFrozenAccounts: [], + }; +} +exports.GenesisState = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.classDefinitions) { + nft_1.ClassDefinition.encode(v, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.frozenNfts) { + exports.FrozenNFT.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.whitelistedNftAccounts) { + exports.WhitelistedNFTAccounts.encode(v, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.burntNfts) { + exports.BurntNFT.encode(v, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.classWhitelistedAccounts) { + exports.ClassWhitelistedAccounts.encode(v, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.classFrozenAccounts) { + exports.ClassFrozenAccounts.encode(v, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classDefinitions.push(nft_1.ClassDefinition.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.frozenNfts.push(exports.FrozenNFT.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.whitelistedNftAccounts.push(exports.WhitelistedNFTAccounts.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.burntNfts.push(exports.BurntNFT.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.classWhitelistedAccounts.push(exports.ClassWhitelistedAccounts.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.classFrozenAccounts.push(exports.ClassFrozenAccounts.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + classDefinitions: globalThis.Array.isArray(object?.classDefinitions) + ? object.classDefinitions.map((e) => nft_1.ClassDefinition.fromJSON(e)) + : [], + frozenNfts: globalThis.Array.isArray(object?.frozenNfts) + ? object.frozenNfts.map((e) => exports.FrozenNFT.fromJSON(e)) + : [], + whitelistedNftAccounts: globalThis.Array.isArray(object?.whitelistedNftAccounts) + ? object.whitelistedNftAccounts.map((e) => exports.WhitelistedNFTAccounts.fromJSON(e)) + : [], + burntNfts: globalThis.Array.isArray(object?.burntNfts) + ? object.burntNfts.map((e) => exports.BurntNFT.fromJSON(e)) + : [], + classWhitelistedAccounts: globalThis.Array.isArray(object?.classWhitelistedAccounts) + ? object.classWhitelistedAccounts.map((e) => exports.ClassWhitelistedAccounts.fromJSON(e)) + : [], + classFrozenAccounts: globalThis.Array.isArray(object?.classFrozenAccounts) + ? object.classFrozenAccounts.map((e) => exports.ClassFrozenAccounts.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + if (message.classDefinitions?.length) { + obj.classDefinitions = message.classDefinitions.map((e) => nft_1.ClassDefinition.toJSON(e)); + } + if (message.frozenNfts?.length) { + obj.frozenNfts = message.frozenNfts.map((e) => exports.FrozenNFT.toJSON(e)); + } + if (message.whitelistedNftAccounts?.length) { + obj.whitelistedNftAccounts = message.whitelistedNftAccounts.map((e) => exports.WhitelistedNFTAccounts.toJSON(e)); + } + if (message.burntNfts?.length) { + obj.burntNfts = message.burntNfts.map((e) => exports.BurntNFT.toJSON(e)); + } + if (message.classWhitelistedAccounts?.length) { + obj.classWhitelistedAccounts = message.classWhitelistedAccounts.map((e) => exports.ClassWhitelistedAccounts.toJSON(e)); + } + if (message.classFrozenAccounts?.length) { + obj.classFrozenAccounts = message.classFrozenAccounts.map((e) => exports.ClassFrozenAccounts.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + message.classDefinitions = + object.classDefinitions?.map((e) => nft_1.ClassDefinition.fromPartial(e)) || []; + message.frozenNfts = + object.frozenNfts?.map((e) => exports.FrozenNFT.fromPartial(e)) || []; + message.whitelistedNftAccounts = + object.whitelistedNftAccounts?.map((e) => exports.WhitelistedNFTAccounts.fromPartial(e)) || []; + message.burntNfts = + object.burntNfts?.map((e) => exports.BurntNFT.fromPartial(e)) || []; + message.classWhitelistedAccounts = + object.classWhitelistedAccounts?.map((e) => exports.ClassWhitelistedAccounts.fromPartial(e)) || []; + message.classFrozenAccounts = + object.classFrozenAccounts?.map((e) => exports.ClassFrozenAccounts.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFrozenNFT() { + return { classID: "", nftIDs: [] }; +} +exports.FrozenNFT = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + for (const v of message.nftIDs) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFrozenNFT(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftIDs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + nftIDs: globalThis.Array.isArray(object?.nftIDs) + ? object.nftIDs.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.nftIDs?.length) { + obj.nftIDs = message.nftIDs; + } + return obj; + }, + create(base) { + return exports.FrozenNFT.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFrozenNFT(); + message.classID = object.classID ?? ""; + message.nftIDs = object.nftIDs?.map((e) => e) || []; + return message; + }, +}; +function createBaseWhitelistedNFTAccounts() { + return { classID: "", nftID: "", accounts: [] }; +} +exports.WhitelistedNFTAccounts = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + if (message.nftID !== "") { + writer.uint32(18).string(message.nftID); + } + for (const v of message.accounts) { + writer.uint32(34).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWhitelistedNFTAccounts(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftID = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + nftID: isSet(object.nftID) ? globalThis.String(object.nftID) : "", + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.nftID !== "") { + obj.nftID = message.nftID; + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return exports.WhitelistedNFTAccounts.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWhitelistedNFTAccounts(); + message.classID = object.classID ?? ""; + message.nftID = object.nftID ?? ""; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseClassWhitelistedAccounts() { + return { classID: "", accounts: [] }; +} +exports.ClassWhitelistedAccounts = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClassWhitelistedAccounts(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return exports.ClassWhitelistedAccounts.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassWhitelistedAccounts(); + message.classID = object.classID ?? ""; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseClassFrozenAccounts() { + return { classID: "", accounts: [] }; +} +exports.ClassFrozenAccounts = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClassFrozenAccounts(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return exports.ClassFrozenAccounts.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassFrozenAccounts(); + message.classID = object.classID ?? ""; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseBurntNFT() { + return { classID: "", nftIDs: [] }; +} +exports.BurntNFT = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + for (const v of message.nftIDs) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBurntNFT(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftIDs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + nftIDs: globalThis.Array.isArray(object?.nftIDs) + ? object.nftIDs.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.nftIDs?.length) { + obj.nftIDs = message.nftIDs; + } + return obj; + }, + create(base) { + return exports.BurntNFT.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBurntNFT(); + message.classID = object.classID ?? ""; + message.nftIDs = object.nftIDs?.map((e) => e) || []; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/nft/v1/nft.d.ts b/dist/main/coreum/asset/nft/v1/nft.d.ts new file mode 100644 index 0000000..e59c31d --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/nft.d.ts @@ -0,0 +1,65 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** ClassFeature defines possible features of non-fungible token class. */ +export declare enum ClassFeature { + burning = 0, + freezing = 1, + whitelisting = 2, + disable_sending = 3, + soulbound = 4, + UNRECOGNIZED = -1 +} +export declare function classFeatureFromJSON(object: any): ClassFeature; +export declare function classFeatureToJSON(object: ClassFeature): string; +/** ClassDefinition defines the non-fungible token class settings to store. */ +export interface ClassDefinition { + id: string; + issuer: string; + features: ClassFeature[]; + /** + * royalty_rate is a number between 0 and 1,which will be used in coreum native DEX. + * whenever an NFT this class is traded on the DEX, the traded amount will be multiplied by this value + * that will be transferred to the issuer of the NFT. + */ + royaltyRate: string; +} +/** Class is a full representation of the non-fungible token class. */ +export interface Class { + id: string; + issuer: string; + name: string; + symbol: string; + description: string; + uri: string; + uriHash: string; + data: Any | undefined; + features: ClassFeature[]; + /** + * royalty_rate is a number between 0 and 1,which will be used in coreum native DEX. + * whenever an NFT this class is traded on the DEX, the traded amount will be multiplied by this value + * that will be transferred to the issuer of the NFT. + */ + royaltyRate: string; +} +export declare const ClassDefinition: MessageFns; +export declare const Class: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/nft/v1/nft.js b/dist/main/coreum/asset/nft/v1/nft.js new file mode 100644 index 0000000..9d8898b --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/nft.js @@ -0,0 +1,395 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/nft.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Class = exports.ClassDefinition = exports.classFeatureToJSON = exports.classFeatureFromJSON = exports.ClassFeature = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const any_1 = require("cosmjs-types/google/protobuf/any"); +exports.protobufPackage = "coreum.asset.nft.v1"; +/** ClassFeature defines possible features of non-fungible token class. */ +var ClassFeature; +(function (ClassFeature) { + ClassFeature[ClassFeature["burning"] = 0] = "burning"; + ClassFeature[ClassFeature["freezing"] = 1] = "freezing"; + ClassFeature[ClassFeature["whitelisting"] = 2] = "whitelisting"; + ClassFeature[ClassFeature["disable_sending"] = 3] = "disable_sending"; + ClassFeature[ClassFeature["soulbound"] = 4] = "soulbound"; + ClassFeature[ClassFeature["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ClassFeature || (exports.ClassFeature = ClassFeature = {})); +function classFeatureFromJSON(object) { + switch (object) { + case 0: + case "burning": + return ClassFeature.burning; + case 1: + case "freezing": + return ClassFeature.freezing; + case 2: + case "whitelisting": + return ClassFeature.whitelisting; + case 3: + case "disable_sending": + return ClassFeature.disable_sending; + case 4: + case "soulbound": + return ClassFeature.soulbound; + case -1: + case "UNRECOGNIZED": + default: + return ClassFeature.UNRECOGNIZED; + } +} +exports.classFeatureFromJSON = classFeatureFromJSON; +function classFeatureToJSON(object) { + switch (object) { + case ClassFeature.burning: + return "burning"; + case ClassFeature.freezing: + return "freezing"; + case ClassFeature.whitelisting: + return "whitelisting"; + case ClassFeature.disable_sending: + return "disable_sending"; + case ClassFeature.soulbound: + return "soulbound"; + case ClassFeature.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.classFeatureToJSON = classFeatureToJSON; +function createBaseClassDefinition() { + return { id: "", issuer: "", features: [], royaltyRate: "" }; +} +exports.ClassDefinition = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + writer.uint32(26).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.royaltyRate !== "") { + writer.uint32(34).string(message.royaltyRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClassDefinition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.features.push(reader.int32()); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 4: { + if (tag !== 34) { + break; + } + message.royaltyRate = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => classFeatureFromJSON(e)) + : [], + royaltyRate: isSet(object.royaltyRate) + ? globalThis.String(object.royaltyRate) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.features?.length) { + obj.features = message.features.map((e) => classFeatureToJSON(e)); + } + if (message.royaltyRate !== "") { + obj.royaltyRate = message.royaltyRate; + } + return obj; + }, + create(base) { + return exports.ClassDefinition.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassDefinition(); + message.id = object.id ?? ""; + message.issuer = object.issuer ?? ""; + message.features = object.features?.map((e) => e) || []; + message.royaltyRate = object.royaltyRate ?? ""; + return message; + }, +}; +function createBaseClass() { + return { + id: "", + issuer: "", + name: "", + symbol: "", + description: "", + uri: "", + uriHash: "", + data: undefined, + features: [], + royaltyRate: "", + }; +} +exports.Class = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(34).string(message.symbol); + } + if (message.description !== "") { + writer.uint32(42).string(message.description); + } + if (message.uri !== "") { + writer.uint32(50).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(58).string(message.uriHash); + } + if (message.data !== undefined) { + any_1.Any.encode(message.data, writer.uint32(66).fork()).ldelim(); + } + writer.uint32(74).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.royaltyRate !== "") { + writer.uint32(82).string(message.royaltyRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.symbol = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.description = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.uri = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.data = any_1.Any.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag === 72) { + message.features.push(reader.int32()); + continue; + } + if (tag === 74) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 10: { + if (tag !== 82) { + break; + } + message.royaltyRate = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? any_1.Any.fromJSON(object.data) : undefined, + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => classFeatureFromJSON(e)) + : [], + royaltyRate: isSet(object.royaltyRate) + ? globalThis.String(object.royaltyRate) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = any_1.Any.toJSON(message.data); + } + if (message.features?.length) { + obj.features = message.features.map((e) => classFeatureToJSON(e)); + } + if (message.royaltyRate !== "") { + obj.royaltyRate = message.royaltyRate; + } + return obj; + }, + create(base) { + return exports.Class.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClass(); + message.id = object.id ?? ""; + message.issuer = object.issuer ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? any_1.Any.fromPartial(object.data) + : undefined; + message.features = object.features?.map((e) => e) || []; + message.royaltyRate = object.royaltyRate ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/nft/v1/params.d.ts b/dist/main/coreum/asset/nft/v1/params.d.ts new file mode 100644 index 0000000..4ab5c0f --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/params.d.ts @@ -0,0 +1,28 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** Params store gov manageable parameters. */ +export interface Params { + /** mint_fee is the fee burnt each time new NFT is minted */ + mintFee: Coin | undefined; +} +export declare const Params: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/nft/v1/params.js b/dist/main/coreum/asset/nft/v1/params.js new file mode 100644 index 0000000..9cceca5 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/params.js @@ -0,0 +1,73 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/params.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Params = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +exports.protobufPackage = "coreum.asset.nft.v1"; +function createBaseParams() { + return { mintFee: undefined }; +} +exports.Params = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.mintFee !== undefined) { + coin_1.Coin.encode(message.mintFee, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.mintFee = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mintFee: isSet(object.mintFee) + ? coin_1.Coin.fromJSON(object.mintFee) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.mintFee !== undefined) { + obj.mintFee = coin_1.Coin.toJSON(message.mintFee); + } + return obj; + }, + create(base) { + return exports.Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.mintFee = + object.mintFee !== undefined && object.mintFee !== null + ? coin_1.Coin.fromPartial(object.mintFee) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/nft/v1/query.d.ts b/dist/main/coreum/asset/nft/v1/query.d.ts new file mode 100644 index 0000000..314b751 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/query.d.ts @@ -0,0 +1,189 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Class } from "./nft"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** QueryParamsRequest defines the request type for querying x/asset/nft parameters. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse defines the response type for querying x/asset/nft parameters. */ +export interface QueryParamsResponse { + params: Params | undefined; +} +/** QueryTokenRequest is request type for the Query/Class RPC method. */ +export interface QueryClassRequest { + /** we don't use the gogoproto.customname here since the google.api.http ignores it and generates invalid code. */ + id: string; +} +/** QueryClassResponse is response type for the Query/Class RPC method. */ +export interface QueryClassResponse { + class: Class | undefined; +} +/** QueryTokenRequest is request type for the Query/Classes RPC method. */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + issuer: string; +} +/** QueryClassResponse is response type for the Query/Classes RPC method. */ +export interface QueryClassesResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + classes: Class[]; +} +export interface QueryFrozenRequest { + id: string; + classId: string; +} +export interface QueryFrozenResponse { + frozen: boolean; +} +export interface QueryClassFrozenRequest { + classId: string; + account: string; +} +export interface QueryClassFrozenResponse { + frozen: boolean; +} +export interface QueryWhitelistedRequest { + id: string; + classId: string; + account: string; +} +export interface QueryWhitelistedResponse { + whitelisted: boolean; +} +export interface QueryWhitelistedAccountsForNFTRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + id: string; + classId: string; +} +export interface QueryWhitelistedAccountsForNFTResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + accounts: string[]; +} +export interface QueryClassWhitelistedAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + classId: string; +} +export interface QueryClassWhitelistedAccountsResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + accounts: string[]; +} +export interface QueryClassFrozenAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + classId: string; +} +export interface QueryClassFrozenAccountsResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + accounts: string[]; +} +export interface QueryBurntNFTRequest { + classId: string; + nftId: string; +} +export interface QueryBurntNFTResponse { + burnt: boolean; +} +export interface QueryBurntNFTsInClassRequest { + pagination: PageRequest | undefined; + classId: string; +} +export interface QueryBurntNFTsInClassResponse { + pagination: PageResponse | undefined; + nftIds: string[]; +} +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +export declare const QueryClassRequest: MessageFns; +export declare const QueryClassResponse: MessageFns; +export declare const QueryClassesRequest: MessageFns; +export declare const QueryClassesResponse: MessageFns; +export declare const QueryFrozenRequest: MessageFns; +export declare const QueryFrozenResponse: MessageFns; +export declare const QueryClassFrozenRequest: MessageFns; +export declare const QueryClassFrozenResponse: MessageFns; +export declare const QueryWhitelistedRequest: MessageFns; +export declare const QueryWhitelistedResponse: MessageFns; +export declare const QueryWhitelistedAccountsForNFTRequest: MessageFns; +export declare const QueryWhitelistedAccountsForNFTResponse: MessageFns; +export declare const QueryClassWhitelistedAccountsRequest: MessageFns; +export declare const QueryClassWhitelistedAccountsResponse: MessageFns; +export declare const QueryClassFrozenAccountsRequest: MessageFns; +export declare const QueryClassFrozenAccountsResponse: MessageFns; +export declare const QueryBurntNFTRequest: MessageFns; +export declare const QueryBurntNFTResponse: MessageFns; +export declare const QueryBurntNFTsInClassRequest: MessageFns; +export declare const QueryBurntNFTsInClassResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/asset/nft module. */ + Params(request: QueryParamsRequest): Promise; + /** Class queries the non-fungible token class of the module. */ + Class(request: QueryClassRequest): Promise; + /** Classes queries the non-fungible token classes of the module. */ + Classes(request: QueryClassesRequest): Promise; + /** Frozen queries to check if an NFT is frozen or not. */ + Frozen(request: QueryFrozenRequest): Promise; + /** ClassFrozen queries to check if an account if frozen for an NFT class. */ + ClassFrozen(request: QueryClassFrozenRequest): Promise; + /** QueryClassFrozenAccountsRequest returns the list of accounts which are frozen to hold NFTs in this class. */ + ClassFrozenAccounts(request: QueryClassFrozenAccountsRequest): Promise; + /** Whitelisted queries to check if an account is whitelited to hold an NFT or not. */ + Whitelisted(request: QueryWhitelistedRequest): Promise; + /** WhitelistedAccountsForNFT returns the list of accounts which are whitelisted to hold this NFT. */ + WhitelistedAccountsForNFT(request: QueryWhitelistedAccountsForNFTRequest): Promise; + /** ClassWhitelistedAccounts returns the list of accounts which are whitelisted to hold NFTs in this class. */ + ClassWhitelistedAccounts(request: QueryClassWhitelistedAccountsRequest): Promise; + /** BurntNFTsInClass checks if an nft if is in burnt NFTs list. */ + BurntNFT(request: QueryBurntNFTRequest): Promise; + /** BurntNFTsInClass returns the list of burnt nfts in a class. */ + BurntNFTsInClass(request: QueryBurntNFTsInClassRequest): Promise; +} +export declare const QueryServiceName = "coreum.asset.nft.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Params(request: QueryParamsRequest): Promise; + Class(request: QueryClassRequest): Promise; + Classes(request: QueryClassesRequest): Promise; + Frozen(request: QueryFrozenRequest): Promise; + ClassFrozen(request: QueryClassFrozenRequest): Promise; + ClassFrozenAccounts(request: QueryClassFrozenAccountsRequest): Promise; + Whitelisted(request: QueryWhitelistedRequest): Promise; + WhitelistedAccountsForNFT(request: QueryWhitelistedAccountsForNFTRequest): Promise; + ClassWhitelistedAccounts(request: QueryClassWhitelistedAccountsRequest): Promise; + BurntNFT(request: QueryBurntNFTRequest): Promise; + BurntNFTsInClass(request: QueryBurntNFTsInClassRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/nft/v1/query.js b/dist/main/coreum/asset/nft/v1/query.js new file mode 100644 index 0000000..7e59ce3 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/query.js @@ -0,0 +1,1547 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/query.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QueryClientImpl = exports.QueryServiceName = exports.QueryBurntNFTsInClassResponse = exports.QueryBurntNFTsInClassRequest = exports.QueryBurntNFTResponse = exports.QueryBurntNFTRequest = exports.QueryClassFrozenAccountsResponse = exports.QueryClassFrozenAccountsRequest = exports.QueryClassWhitelistedAccountsResponse = exports.QueryClassWhitelistedAccountsRequest = exports.QueryWhitelistedAccountsForNFTResponse = exports.QueryWhitelistedAccountsForNFTRequest = exports.QueryWhitelistedResponse = exports.QueryWhitelistedRequest = exports.QueryClassFrozenResponse = exports.QueryClassFrozenRequest = exports.QueryFrozenResponse = exports.QueryFrozenRequest = exports.QueryClassesResponse = exports.QueryClassesRequest = exports.QueryClassResponse = exports.QueryClassRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const pagination_1 = require("cosmjs-types/cosmos/base/query/v1beta1/pagination"); +const nft_1 = require("./nft"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.asset.nft.v1"; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +exports.QueryParamsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseQueryClassRequest() { + return { id: "" }; +} +exports.QueryClassRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.QueryClassRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassRequest(); + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseQueryClassResponse() { + return { class: undefined }; +} +exports.QueryClassResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.class !== undefined) { + nft_1.Class.encode(message.class, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.class = nft_1.Class.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + class: isSet(object.class) ? nft_1.Class.fromJSON(object.class) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.class !== undefined) { + obj.class = nft_1.Class.toJSON(message.class); + } + return obj; + }, + create(base) { + return exports.QueryClassResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassResponse(); + message.class = + object.class !== undefined && object.class !== null + ? nft_1.Class.fromPartial(object.class) + : undefined; + return message; + }, +}; +function createBaseQueryClassesRequest() { + return { pagination: undefined, issuer: "" }; +} +exports.QueryClassesRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + return obj; + }, + create(base) { + return exports.QueryClassesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.issuer = object.issuer ?? ""; + return message; + }, +}; +function createBaseQueryClassesResponse() { + return { pagination: undefined, classes: [] }; +} +exports.QueryClassesResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.classes) { + nft_1.Class.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classes.push(nft_1.Class.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + classes: globalThis.Array.isArray(object?.classes) + ? object.classes.map((e) => nft_1.Class.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + if (message.classes?.length) { + obj.classes = message.classes.map((e) => nft_1.Class.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.QueryClassesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassesResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.classes = object.classes?.map((e) => nft_1.Class.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryFrozenRequest() { + return { id: "", classId: "" }; +} +exports.QueryFrozenRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return exports.QueryFrozenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenRequest(); + message.id = object.id ?? ""; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryFrozenResponse() { + return { frozen: false }; +} +exports.QueryFrozenResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.frozen !== false) { + writer.uint32(8).bool(message.frozen); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.frozen = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + frozen: isSet(object.frozen) ? globalThis.Boolean(object.frozen) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.frozen !== false) { + obj.frozen = message.frozen; + } + return obj; + }, + create(base) { + return exports.QueryFrozenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenResponse(); + message.frozen = object.frozen ?? false; + return message; + }, +}; +function createBaseQueryClassFrozenRequest() { + return { classId: "", account: "" }; +} +exports.QueryClassFrozenRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassFrozenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.QueryClassFrozenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassFrozenRequest(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseQueryClassFrozenResponse() { + return { frozen: false }; +} +exports.QueryClassFrozenResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.frozen !== false) { + writer.uint32(8).bool(message.frozen); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassFrozenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.frozen = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + frozen: isSet(object.frozen) ? globalThis.Boolean(object.frozen) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.frozen !== false) { + obj.frozen = message.frozen; + } + return obj; + }, + create(base) { + return exports.QueryClassFrozenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassFrozenResponse(); + message.frozen = object.frozen ?? false; + return message; + }, +}; +function createBaseQueryWhitelistedRequest() { + return { id: "", classId: "", account: "" }; +} +exports.QueryWhitelistedRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.QueryWhitelistedRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedRequest(); + message.id = object.id ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseQueryWhitelistedResponse() { + return { whitelisted: false }; +} +exports.QueryWhitelistedResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.whitelisted !== false) { + writer.uint32(8).bool(message.whitelisted); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.whitelisted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + whitelisted: isSet(object.whitelisted) + ? globalThis.Boolean(object.whitelisted) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.whitelisted !== false) { + obj.whitelisted = message.whitelisted; + } + return obj; + }, + create(base) { + return exports.QueryWhitelistedResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedResponse(); + message.whitelisted = object.whitelisted ?? false; + return message; + }, +}; +function createBaseQueryWhitelistedAccountsForNFTRequest() { + return { pagination: undefined, id: "", classId: "" }; +} +exports.QueryWhitelistedAccountsForNFTRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.classId !== "") { + writer.uint32(26).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedAccountsForNFTRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + id: isSet(object.id) ? globalThis.String(object.id) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return exports.QueryWhitelistedAccountsForNFTRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedAccountsForNFTRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.id = object.id ?? ""; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryWhitelistedAccountsForNFTResponse() { + return { pagination: undefined, accounts: [] }; +} +exports.QueryWhitelistedAccountsForNFTResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedAccountsForNFTResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return exports.QueryWhitelistedAccountsForNFTResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedAccountsForNFTResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseQueryClassWhitelistedAccountsRequest() { + return { pagination: undefined, classId: "" }; +} +exports.QueryClassWhitelistedAccountsRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassWhitelistedAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return exports.QueryClassWhitelistedAccountsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassWhitelistedAccountsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryClassWhitelistedAccountsResponse() { + return { pagination: undefined, accounts: [] }; +} +exports.QueryClassWhitelistedAccountsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassWhitelistedAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return exports.QueryClassWhitelistedAccountsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassWhitelistedAccountsResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseQueryClassFrozenAccountsRequest() { + return { pagination: undefined, classId: "" }; +} +exports.QueryClassFrozenAccountsRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassFrozenAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return exports.QueryClassFrozenAccountsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassFrozenAccountsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryClassFrozenAccountsResponse() { + return { pagination: undefined, accounts: [] }; +} +exports.QueryClassFrozenAccountsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassFrozenAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return exports.QueryClassFrozenAccountsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassFrozenAccountsResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseQueryBurntNFTRequest() { + return { classId: "", nftId: "" }; +} +exports.QueryBurntNFTRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.nftId !== "") { + writer.uint32(18).string(message.nftId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBurntNFTRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + nftId: isSet(object.nftId) ? globalThis.String(object.nftId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.nftId !== "") { + obj.nftId = message.nftId; + } + return obj; + }, + create(base) { + return exports.QueryBurntNFTRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBurntNFTRequest(); + message.classId = object.classId ?? ""; + message.nftId = object.nftId ?? ""; + return message; + }, +}; +function createBaseQueryBurntNFTResponse() { + return { burnt: false }; +} +exports.QueryBurntNFTResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.burnt !== false) { + writer.uint32(8).bool(message.burnt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBurntNFTResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.burnt = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + burnt: isSet(object.burnt) ? globalThis.Boolean(object.burnt) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.burnt !== false) { + obj.burnt = message.burnt; + } + return obj; + }, + create(base) { + return exports.QueryBurntNFTResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBurntNFTResponse(); + message.burnt = object.burnt ?? false; + return message; + }, +}; +function createBaseQueryBurntNFTsInClassRequest() { + return { pagination: undefined, classId: "" }; +} +exports.QueryBurntNFTsInClassRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBurntNFTsInClassRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return exports.QueryBurntNFTsInClassRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBurntNFTsInClassRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryBurntNFTsInClassResponse() { + return { pagination: undefined, nftIds: [] }; +} +exports.QueryBurntNFTsInClassResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.nftIds) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBurntNFTsInClassResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftIds.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + nftIds: globalThis.Array.isArray(object?.nftIds) + ? object.nftIds.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + if (message.nftIds?.length) { + obj.nftIds = message.nftIds; + } + return obj; + }, + create(base) { + return exports.QueryBurntNFTsInClassResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBurntNFTsInClassResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + message.nftIds = object.nftIds?.map((e) => e) || []; + return message; + }, +}; +exports.QueryServiceName = "coreum.asset.nft.v1.Query"; +class QueryClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Class = this.Class.bind(this); + this.Classes = this.Classes.bind(this); + this.Frozen = this.Frozen.bind(this); + this.ClassFrozen = this.ClassFrozen.bind(this); + this.ClassFrozenAccounts = this.ClassFrozenAccounts.bind(this); + this.Whitelisted = this.Whitelisted.bind(this); + this.WhitelistedAccountsForNFT = this.WhitelistedAccountsForNFT.bind(this); + this.ClassWhitelistedAccounts = this.ClassWhitelistedAccounts.bind(this); + this.BurntNFT = this.BurntNFT.bind(this); + this.BurntNFTsInClass = this.BurntNFTsInClass.bind(this); + } + Params(request) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new binary_1.BinaryReader(data))); + } + Class(request) { + const data = exports.QueryClassRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Class", data); + return promise.then((data) => exports.QueryClassResponse.decode(new binary_1.BinaryReader(data))); + } + Classes(request) { + const data = exports.QueryClassesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Classes", data); + return promise.then((data) => exports.QueryClassesResponse.decode(new binary_1.BinaryReader(data))); + } + Frozen(request) { + const data = exports.QueryFrozenRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Frozen", data); + return promise.then((data) => exports.QueryFrozenResponse.decode(new binary_1.BinaryReader(data))); + } + ClassFrozen(request) { + const data = exports.QueryClassFrozenRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassFrozen", data); + return promise.then((data) => exports.QueryClassFrozenResponse.decode(new binary_1.BinaryReader(data))); + } + ClassFrozenAccounts(request) { + const data = exports.QueryClassFrozenAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassFrozenAccounts", data); + return promise.then((data) => exports.QueryClassFrozenAccountsResponse.decode(new binary_1.BinaryReader(data))); + } + Whitelisted(request) { + const data = exports.QueryWhitelistedRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Whitelisted", data); + return promise.then((data) => exports.QueryWhitelistedResponse.decode(new binary_1.BinaryReader(data))); + } + WhitelistedAccountsForNFT(request) { + const data = exports.QueryWhitelistedAccountsForNFTRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "WhitelistedAccountsForNFT", data); + return promise.then((data) => exports.QueryWhitelistedAccountsForNFTResponse.decode(new binary_1.BinaryReader(data))); + } + ClassWhitelistedAccounts(request) { + const data = exports.QueryClassWhitelistedAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassWhitelistedAccounts", data); + return promise.then((data) => exports.QueryClassWhitelistedAccountsResponse.decode(new binary_1.BinaryReader(data))); + } + BurntNFT(request) { + const data = exports.QueryBurntNFTRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "BurntNFT", data); + return promise.then((data) => exports.QueryBurntNFTResponse.decode(new binary_1.BinaryReader(data))); + } + BurntNFTsInClass(request) { + const data = exports.QueryBurntNFTsInClassRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "BurntNFTsInClass", data); + return promise.then((data) => exports.QueryBurntNFTsInClassResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/nft/v1/tx.d.ts b/dist/main/coreum/asset/nft/v1/tx.d.ts new file mode 100644 index 0000000..63e658e --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/tx.d.ts @@ -0,0 +1,192 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +import { ClassFeature } from "./nft"; +import { Params } from "./params"; +import { DataDynamicIndexedItem } from "./types"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** MsgIssueClass defines message for the IssueClass method. */ +export interface MsgIssueClass { + issuer: string; + symbol: string; + name: string; + description: string; + uri: string; + uriHash: string; + data: Any | undefined; + features: ClassFeature[]; + royaltyRate: string; +} +/** MsgMint defines message for the Mint method. */ +export interface MsgMint { + sender: string; + classId: string; + id: string; + uri: string; + uriHash: string; + /** Data can be DataBytes or DataDynamic. */ + data: Any | undefined; + recipient: string; +} +/** MsgUpdateData defines message to update the dynamic data. */ +export interface MsgUpdateData { + sender: string; + classId: string; + id: string; + items: DataDynamicIndexedItem[]; +} +/** MsgBurn defines message for the Burn method. */ +export interface MsgBurn { + sender: string; + classId: string; + id: string; +} +export interface MsgFreeze { + sender: string; + classId: string; + id: string; +} +export interface MsgUnfreeze { + sender: string; + classId: string; + id: string; +} +export interface MsgClassFreeze { + sender: string; + classId: string; + account: string; +} +export interface MsgClassUnfreeze { + sender: string; + classId: string; + account: string; +} +export interface MsgAddToWhitelist { + sender: string; + classId: string; + id: string; + account: string; +} +export interface MsgRemoveFromWhitelist { + sender: string; + classId: string; + id: string; + account: string; +} +export interface MsgAddToClassWhitelist { + sender: string; + classId: string; + account: string; +} +export interface MsgRemoveFromClassWhitelist { + sender: string; + classId: string; + account: string; +} +export interface MsgUpdateParams { + authority: string; + params: Params | undefined; +} +export interface EmptyResponse { +} +export declare const MsgIssueClass: MessageFns; +export declare const MsgMint: MessageFns; +export declare const MsgUpdateData: MessageFns; +export declare const MsgBurn: MessageFns; +export declare const MsgFreeze: MessageFns; +export declare const MsgUnfreeze: MessageFns; +export declare const MsgClassFreeze: MessageFns; +export declare const MsgClassUnfreeze: MessageFns; +export declare const MsgAddToWhitelist: MessageFns; +export declare const MsgRemoveFromWhitelist: MessageFns; +export declare const MsgAddToClassWhitelist: MessageFns; +export declare const MsgRemoveFromClassWhitelist: MessageFns; +export declare const MsgUpdateParams: MessageFns; +export declare const EmptyResponse: MessageFns; +/** Msg defines the Msg service. */ +export interface Msg { + /** IssueClass creates new non-fungible token class. */ + IssueClass(request: MsgIssueClass): Promise; + /** Mint mints new non-fungible token in the class. */ + Mint(request: MsgMint): Promise; + /** UpdateData updates the existing non-fungible token data in the class. */ + UpdateData(request: MsgUpdateData): Promise; + /** Burn burns the existing non-fungible token in the class. */ + Burn(request: MsgBurn): Promise; + /** Freeze freezes an NFT */ + Freeze(request: MsgFreeze): Promise; + /** Unfreeze removes the freeze effect already put on an NFT */ + Unfreeze(request: MsgUnfreeze): Promise; + /** AddToWhitelist sets the account as whitelisted to hold the NFT */ + AddToWhitelist(request: MsgAddToWhitelist): Promise; + /** RemoveFromWhitelist removes an account from whitelisted list of the NFT */ + RemoveFromWhitelist(request: MsgRemoveFromWhitelist): Promise; + /** + * AddToClassWhitelist adds account as whitelist for all the NFTs in the class + * NOTE: class whitelist does not affect the individual nft whitelisting. + */ + AddToClassWhitelist(request: MsgAddToClassWhitelist): Promise; + /** + * RemoveFromClassWhitelist removes account as whitelist for the entire class + * NOTE: + * class whitelist does not affect the individual nft whitelisting. + * ie. if specific whitelist is granted for an NFT, that whitelist will + * still be valid, ater we add and remove it from the class whitelist. + */ + RemoveFromClassWhitelist(request: MsgRemoveFromClassWhitelist): Promise; + /** ClassFreeze freezes all NFTs of a class held by an account. */ + ClassFreeze(request: MsgClassFreeze): Promise; + /** + * ClassUnfreeze removes class-freeze on an account for an NFT class. + * NOTE: + * class unfreeze does not affect the individual nft freeze. + */ + ClassUnfreeze(request: MsgClassUnfreeze): Promise; + /** + * UpdateParams is a governance operation that sets the parameters of the module. + * NOTE: all parameters must be provided. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} +export declare const MsgServiceName = "coreum.asset.nft.v1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + IssueClass(request: MsgIssueClass): Promise; + Mint(request: MsgMint): Promise; + UpdateData(request: MsgUpdateData): Promise; + Burn(request: MsgBurn): Promise; + Freeze(request: MsgFreeze): Promise; + Unfreeze(request: MsgUnfreeze): Promise; + AddToWhitelist(request: MsgAddToWhitelist): Promise; + RemoveFromWhitelist(request: MsgRemoveFromWhitelist): Promise; + AddToClassWhitelist(request: MsgAddToClassWhitelist): Promise; + RemoveFromClassWhitelist(request: MsgRemoveFromClassWhitelist): Promise; + ClassFreeze(request: MsgClassFreeze): Promise; + ClassUnfreeze(request: MsgClassUnfreeze): Promise; + UpdateParams(request: MsgUpdateParams): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/nft/v1/tx.js b/dist/main/coreum/asset/nft/v1/tx.js new file mode 100644 index 0000000..32f587a --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/tx.js @@ -0,0 +1,1449 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/tx.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MsgClientImpl = exports.MsgServiceName = exports.EmptyResponse = exports.MsgUpdateParams = exports.MsgRemoveFromClassWhitelist = exports.MsgAddToClassWhitelist = exports.MsgRemoveFromWhitelist = exports.MsgAddToWhitelist = exports.MsgClassUnfreeze = exports.MsgClassFreeze = exports.MsgUnfreeze = exports.MsgFreeze = exports.MsgBurn = exports.MsgUpdateData = exports.MsgMint = exports.MsgIssueClass = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const any_1 = require("cosmjs-types/google/protobuf/any"); +const nft_1 = require("./nft"); +const params_1 = require("./params"); +const types_1 = require("./types"); +exports.protobufPackage = "coreum.asset.nft.v1"; +function createBaseMsgIssueClass() { + return { + issuer: "", + symbol: "", + name: "", + description: "", + uri: "", + uriHash: "", + data: undefined, + features: [], + royaltyRate: "", + }; +} +exports.MsgIssueClass = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.issuer !== "") { + writer.uint32(10).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(18).string(message.symbol); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + if (message.uri !== "") { + writer.uint32(42).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(50).string(message.uriHash); + } + if (message.data !== undefined) { + any_1.Any.encode(message.data, writer.uint32(58).fork()).ldelim(); + } + writer.uint32(66).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.royaltyRate !== "") { + writer.uint32(74).string(message.royaltyRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIssueClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.issuer = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.symbol = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.description = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.uri = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.data = any_1.Any.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag === 64) { + message.features.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag !== 74) { + break; + } + message.royaltyRate = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? any_1.Any.fromJSON(object.data) : undefined, + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => (0, nft_1.classFeatureFromJSON)(e)) + : [], + royaltyRate: isSet(object.royaltyRate) + ? globalThis.String(object.royaltyRate) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = any_1.Any.toJSON(message.data); + } + if (message.features?.length) { + obj.features = message.features.map((e) => (0, nft_1.classFeatureToJSON)(e)); + } + if (message.royaltyRate !== "") { + obj.royaltyRate = message.royaltyRate; + } + return obj; + }, + create(base) { + return exports.MsgIssueClass.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIssueClass(); + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? any_1.Any.fromPartial(object.data) + : undefined; + message.features = object.features?.map((e) => e) || []; + message.royaltyRate = object.royaltyRate ?? ""; + return message; + }, +}; +function createBaseMsgMint() { + return { + sender: "", + classId: "", + id: "", + uri: "", + uriHash: "", + data: undefined, + recipient: "", + }; +} +exports.MsgMint = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.uri !== "") { + writer.uint32(34).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(42).string(message.uriHash); + } + if (message.data !== undefined) { + any_1.Any.encode(message.data, writer.uint32(50).fork()).ldelim(); + } + if (message.recipient !== "") { + writer.uint32(58).string(message.recipient); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.uri = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.data = any_1.Any.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.recipient = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? any_1.Any.fromJSON(object.data) : undefined, + recipient: isSet(object.recipient) + ? globalThis.String(object.recipient) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = any_1.Any.toJSON(message.data); + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + return obj; + }, + create(base) { + return exports.MsgMint.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgMint(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? any_1.Any.fromPartial(object.data) + : undefined; + message.recipient = object.recipient ?? ""; + return message; + }, +}; +function createBaseMsgUpdateData() { + return { sender: "", classId: "", id: "", items: [] }; +} +exports.MsgUpdateData = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + for (const v of message.items) { + types_1.DataDynamicIndexedItem.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.items.push(types_1.DataDynamicIndexedItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e) => types_1.DataDynamicIndexedItem.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.items?.length) { + obj.items = message.items.map((e) => types_1.DataDynamicIndexedItem.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.MsgUpdateData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateData(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.items = + object.items?.map((e) => types_1.DataDynamicIndexedItem.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgBurn() { + return { sender: "", classId: "", id: "" }; +} +exports.MsgBurn = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.MsgBurn.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgBurn(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseMsgFreeze() { + return { sender: "", classId: "", id: "" }; +} +exports.MsgFreeze = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.MsgFreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgFreeze(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseMsgUnfreeze() { + return { sender: "", classId: "", id: "" }; +} +exports.MsgUnfreeze = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnfreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.MsgUnfreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUnfreeze(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseMsgClassFreeze() { + return { sender: "", classId: "", account: "" }; +} +exports.MsgClassFreeze = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClassFreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.MsgClassFreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClassFreeze(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgClassUnfreeze() { + return { sender: "", classId: "", account: "" }; +} +exports.MsgClassUnfreeze = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClassUnfreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.MsgClassUnfreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClassUnfreeze(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgAddToWhitelist() { + return { sender: "", classId: "", id: "", account: "" }; +} +exports.MsgAddToWhitelist = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.account !== "") { + writer.uint32(34).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddToWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.MsgAddToWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgAddToWhitelist(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgRemoveFromWhitelist() { + return { sender: "", classId: "", id: "", account: "" }; +} +exports.MsgRemoveFromWhitelist = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.account !== "") { + writer.uint32(34).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveFromWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.MsgRemoveFromWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgRemoveFromWhitelist(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgAddToClassWhitelist() { + return { sender: "", classId: "", account: "" }; +} +exports.MsgAddToClassWhitelist = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddToClassWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.MsgAddToClassWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgAddToClassWhitelist(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgRemoveFromClassWhitelist() { + return { sender: "", classId: "", account: "" }; +} +exports.MsgRemoveFromClassWhitelist = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveFromClassWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return exports.MsgRemoveFromClassWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgRemoveFromClassWhitelist(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgUpdateParams() { + return { authority: "", params: undefined }; +} +exports.MsgUpdateParams = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.MsgUpdateParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseEmptyResponse() { + return {}; +} +exports.EmptyResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmptyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.EmptyResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseEmptyResponse(); + return message; + }, +}; +exports.MsgServiceName = "coreum.asset.nft.v1.Msg"; +class MsgClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.MsgServiceName; + this.rpc = rpc; + this.IssueClass = this.IssueClass.bind(this); + this.Mint = this.Mint.bind(this); + this.UpdateData = this.UpdateData.bind(this); + this.Burn = this.Burn.bind(this); + this.Freeze = this.Freeze.bind(this); + this.Unfreeze = this.Unfreeze.bind(this); + this.AddToWhitelist = this.AddToWhitelist.bind(this); + this.RemoveFromWhitelist = this.RemoveFromWhitelist.bind(this); + this.AddToClassWhitelist = this.AddToClassWhitelist.bind(this); + this.RemoveFromClassWhitelist = this.RemoveFromClassWhitelist.bind(this); + this.ClassFreeze = this.ClassFreeze.bind(this); + this.ClassUnfreeze = this.ClassUnfreeze.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + IssueClass(request) { + const data = exports.MsgIssueClass.encode(request).finish(); + const promise = this.rpc.request(this.service, "IssueClass", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Mint(request) { + const data = exports.MsgMint.encode(request).finish(); + const promise = this.rpc.request(this.service, "Mint", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + UpdateData(request) { + const data = exports.MsgUpdateData.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateData", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Burn(request) { + const data = exports.MsgBurn.encode(request).finish(); + const promise = this.rpc.request(this.service, "Burn", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Freeze(request) { + const data = exports.MsgFreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "Freeze", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + Unfreeze(request) { + const data = exports.MsgUnfreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "Unfreeze", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + AddToWhitelist(request) { + const data = exports.MsgAddToWhitelist.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddToWhitelist", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + RemoveFromWhitelist(request) { + const data = exports.MsgRemoveFromWhitelist.encode(request).finish(); + const promise = this.rpc.request(this.service, "RemoveFromWhitelist", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + AddToClassWhitelist(request) { + const data = exports.MsgAddToClassWhitelist.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddToClassWhitelist", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + RemoveFromClassWhitelist(request) { + const data = exports.MsgRemoveFromClassWhitelist.encode(request).finish(); + const promise = this.rpc.request(this.service, "RemoveFromClassWhitelist", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + ClassFreeze(request) { + const data = exports.MsgClassFreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassFreeze", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + ClassUnfreeze(request) { + const data = exports.MsgClassUnfreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassUnfreeze", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } + UpdateParams(request) { + const data = exports.MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => exports.EmptyResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/asset/nft/v1/types.d.ts b/dist/main/coreum/asset/nft/v1/types.d.ts new file mode 100644 index 0000000..b4d7c18 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/types.d.ts @@ -0,0 +1,52 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** DataEditor defines possible data editors. */ +export declare enum DataEditor { + admin = 0, + owner = 1, + UNRECOGNIZED = -1 +} +export declare function dataEditorFromJSON(object: any): DataEditor; +export declare function dataEditorToJSON(object: DataEditor): string; +/** DataBytes represents the immutable data. */ +export interface DataBytes { + Data: Uint8Array; +} +/** DataDynamicItem contains the updatable data and modification types. */ +export interface DataDynamicItem { + /** contains the set of the data editors, if empty no one can update. */ + editors: DataEditor[]; + data: Uint8Array; +} +/** DataDynamicIndexed contains the data and it's index in the DataDynamic. */ +export interface DataDynamicIndexedItem { + index: number; + data: Uint8Array; +} +/** DataDynamic is dynamic data which contains the list of the items allowed to be modified base on their modification types. */ +export interface DataDynamic { + items: DataDynamicItem[]; +} +export declare const DataBytes: MessageFns; +export declare const DataDynamicItem: MessageFns; +export declare const DataDynamicIndexedItem: MessageFns; +export declare const DataDynamic: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/asset/nft/v1/types.js b/dist/main/coreum/asset/nft/v1/types.js new file mode 100644 index 0000000..f1ac687 --- /dev/null +++ b/dist/main/coreum/asset/nft/v1/types.js @@ -0,0 +1,335 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/types.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DataDynamic = exports.DataDynamicIndexedItem = exports.DataDynamicItem = exports.DataBytes = exports.dataEditorToJSON = exports.dataEditorFromJSON = exports.DataEditor = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +exports.protobufPackage = "coreum.asset.nft.v1"; +/** DataEditor defines possible data editors. */ +var DataEditor; +(function (DataEditor) { + DataEditor[DataEditor["admin"] = 0] = "admin"; + DataEditor[DataEditor["owner"] = 1] = "owner"; + DataEditor[DataEditor["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(DataEditor || (exports.DataEditor = DataEditor = {})); +function dataEditorFromJSON(object) { + switch (object) { + case 0: + case "admin": + return DataEditor.admin; + case 1: + case "owner": + return DataEditor.owner; + case -1: + case "UNRECOGNIZED": + default: + return DataEditor.UNRECOGNIZED; + } +} +exports.dataEditorFromJSON = dataEditorFromJSON; +function dataEditorToJSON(object) { + switch (object) { + case DataEditor.admin: + return "admin"; + case DataEditor.owner: + return "owner"; + case DataEditor.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.dataEditorToJSON = dataEditorToJSON; +function createBaseDataBytes() { + return { Data: new Uint8Array(0) }; +} +exports.DataBytes = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.Data.length !== 0) { + writer.uint32(10).bytes(message.Data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDataBytes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.Data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + Data: isSet(object.Data) + ? bytesFromBase64(object.Data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.Data.length !== 0) { + obj.Data = base64FromBytes(message.Data); + } + return obj; + }, + create(base) { + return exports.DataBytes.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataBytes(); + message.Data = object.Data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseDataDynamicItem() { + return { editors: [], data: new Uint8Array(0) }; +} +exports.DataDynamicItem = { + encode(message, writer = new binary_1.BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.editors) { + writer.int32(v); + } + writer.ldelim(); + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDataDynamicItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.editors.push(reader.int32()); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.editors.push(reader.int32()); + } + continue; + } + break; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + editors: globalThis.Array.isArray(object?.editors) + ? object.editors.map((e) => dataEditorFromJSON(e)) + : [], + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.editors?.length) { + obj.editors = message.editors.map((e) => dataEditorToJSON(e)); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.DataDynamicItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataDynamicItem(); + message.editors = object.editors?.map((e) => e) || []; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseDataDynamicIndexedItem() { + return { index: 0, data: new Uint8Array(0) }; +} +exports.DataDynamicIndexedItem = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDataDynamicIndexedItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.index = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.DataDynamicIndexedItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataDynamicIndexedItem(); + message.index = object.index ?? 0; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseDataDynamic() { + return { items: [] }; +} +exports.DataDynamic = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.items) { + exports.DataDynamicItem.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDataDynamic(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(exports.DataDynamicItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e) => exports.DataDynamicItem.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => exports.DataDynamicItem.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.DataDynamic.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataDynamic(); + message.items = + object.items?.map((e) => exports.DataDynamicItem.fromPartial(e)) || []; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/customparams/v1/genesis.d.ts b/dist/main/coreum/customparams/v1/genesis.d.ts new file mode 100644 index 0000000..a8b69c7 --- /dev/null +++ b/dist/main/coreum/customparams/v1/genesis.d.ts @@ -0,0 +1,28 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { StakingParams } from "./params"; +export declare const protobufPackage = "coreum.customparams.v1"; +/** GenesisState defines the module's genesis state. */ +export interface GenesisState { + /** staking_params defines staking parameters of the module. */ + stakingParams: StakingParams | undefined; +} +export declare const GenesisState: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/customparams/v1/genesis.js b/dist/main/coreum/customparams/v1/genesis.js new file mode 100644 index 0000000..60d1b3f --- /dev/null +++ b/dist/main/coreum/customparams/v1/genesis.js @@ -0,0 +1,73 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/customparams/genesis.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GenesisState = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.customparams.v1"; +function createBaseGenesisState() { + return { stakingParams: undefined }; +} +exports.GenesisState = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.stakingParams !== undefined) { + params_1.StakingParams.encode(message.stakingParams, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.stakingParams = params_1.StakingParams.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + stakingParams: isSet(object.stakingParams) + ? params_1.StakingParams.fromJSON(object.stakingParams) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.stakingParams !== undefined) { + obj.stakingParams = params_1.StakingParams.toJSON(message.stakingParams); + } + return obj; + }, + create(base) { + return exports.GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.stakingParams = + object.stakingParams !== undefined && object.stakingParams !== null + ? params_1.StakingParams.fromPartial(object.stakingParams) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/customparams/v1/params.d.ts b/dist/main/coreum/customparams/v1/params.d.ts new file mode 100644 index 0000000..126725e --- /dev/null +++ b/dist/main/coreum/customparams/v1/params.d.ts @@ -0,0 +1,27 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.customparams.v1"; +/** StakingParams defines the set of additional staking params for the staking module wrapper. */ +export interface StakingParams { + /** min_self_delegation is the validators global self declared minimum for delegation. */ + minSelfDelegation: string; +} +export declare const StakingParams: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/customparams/v1/params.js b/dist/main/coreum/customparams/v1/params.js new file mode 100644 index 0000000..050b588 --- /dev/null +++ b/dist/main/coreum/customparams/v1/params.js @@ -0,0 +1,69 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/customparams/params.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StakingParams = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +exports.protobufPackage = "coreum.customparams.v1"; +function createBaseStakingParams() { + return { minSelfDelegation: "" }; +} +exports.StakingParams = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.minSelfDelegation !== "") { + writer.uint32(10).string(message.minSelfDelegation); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.minSelfDelegation = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + minSelfDelegation: isSet(object.minSelfDelegation) + ? globalThis.String(object.minSelfDelegation) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + return obj; + }, + create(base) { + return exports.StakingParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStakingParams(); + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/customparams/v1/query.d.ts b/dist/main/coreum/customparams/v1/query.d.ts new file mode 100644 index 0000000..603bb20 --- /dev/null +++ b/dist/main/coreum/customparams/v1/query.d.ts @@ -0,0 +1,48 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { StakingParams } from "./params"; +export declare const protobufPackage = "coreum.customparams.v1"; +/** QueryStakingParamsRequest defines the request type for querying x/customparams staking parameters. */ +export interface QueryStakingParamsRequest { +} +/** QueryStakingParamsResponse defines the response type for querying x/customparams staking parameters. */ +export interface QueryStakingParamsResponse { + params: StakingParams | undefined; +} +export declare const QueryStakingParamsRequest: MessageFns; +export declare const QueryStakingParamsResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** StakingParams queries the staking parameters of the module. */ + StakingParams(request: QueryStakingParamsRequest): Promise; +} +export declare const QueryServiceName = "coreum.customparams.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + StakingParams(request: QueryStakingParamsRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/customparams/v1/query.js b/dist/main/coreum/customparams/v1/query.js new file mode 100644 index 0000000..c316a03 --- /dev/null +++ b/dist/main/coreum/customparams/v1/query.js @@ -0,0 +1,124 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/customparams/query.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QueryClientImpl = exports.QueryServiceName = exports.QueryStakingParamsResponse = exports.QueryStakingParamsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.customparams.v1"; +function createBaseQueryStakingParamsRequest() { + return {}; +} +exports.QueryStakingParamsRequest = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakingParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.QueryStakingParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryStakingParamsRequest(); + return message; + }, +}; +function createBaseQueryStakingParamsResponse() { + return { params: undefined }; +} +exports.QueryStakingParamsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.StakingParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakingParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.StakingParams.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) + ? params_1.StakingParams.fromJSON(object.params) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.StakingParams.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.QueryStakingParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryStakingParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.StakingParams.fromPartial(object.params) + : undefined; + return message; + }, +}; +exports.QueryServiceName = "coreum.customparams.v1.Query"; +class QueryClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.QueryServiceName; + this.rpc = rpc; + this.StakingParams = this.StakingParams.bind(this); + } + StakingParams(request) { + const data = exports.QueryStakingParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StakingParams", data); + return promise.then((data) => exports.QueryStakingParamsResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/index.d.ts b/dist/main/coreum/dex/index.d.ts new file mode 100644 index 0000000..7a12ee2 --- /dev/null +++ b/dist/main/coreum/dex/index.d.ts @@ -0,0 +1 @@ +export declare const dexRegistry: ReadonlyArray<[string, any]>; diff --git a/dist/main/coreum/dex/index.js b/dist/main/coreum/dex/index.js new file mode 100644 index 0000000..666478a --- /dev/null +++ b/dist/main/coreum/dex/index.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dexRegistry = void 0; +const types_1 = require("../../types"); +const tx_1 = require("./v1/tx"); +exports.dexRegistry = [ + [types_1.CoreumTypeUrl.DEX + "MsgCancelOrder", tx_1.MsgCancelOrder], + [types_1.CoreumTypeUrl.DEX + "MsgPlaceOrder", tx_1.MsgPlaceOrder], + [types_1.CoreumTypeUrl.DEX + "MsgUpdateParams", tx_1.MsgUpdateParams], + [types_1.CoreumTypeUrl.DEX + "MsgCancelOrdersByDenom", tx_1.MsgCancelOrdersByDenom], +]; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.d.ts b/dist/main/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.d.ts new file mode 100644 index 0000000..8ba02e9 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.d.ts @@ -0,0 +1,80 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "cosmos_proto"; +export declare enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1 +} +export declare function scalarTypeFromJSON(object: any): ScalarType; +export declare function scalarTypeToJSON(object: ScalarType): string; +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} +export declare const InterfaceDescriptor: MessageFns; +export declare const ScalarDescriptor: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.js b/dist/main/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.js new file mode 100644 index 0000000..d970d40 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.js @@ -0,0 +1,215 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-proto/proto/cosmos_proto/cosmos.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ScalarDescriptor = exports.InterfaceDescriptor = exports.scalarTypeToJSON = exports.scalarTypeFromJSON = exports.ScalarType = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +exports.protobufPackage = "cosmos_proto"; +var ScalarType; +(function (ScalarType) { + ScalarType[ScalarType["SCALAR_TYPE_UNSPECIFIED"] = 0] = "SCALAR_TYPE_UNSPECIFIED"; + ScalarType[ScalarType["SCALAR_TYPE_STRING"] = 1] = "SCALAR_TYPE_STRING"; + ScalarType[ScalarType["SCALAR_TYPE_BYTES"] = 2] = "SCALAR_TYPE_BYTES"; + ScalarType[ScalarType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ScalarType || (exports.ScalarType = ScalarType = {})); +function scalarTypeFromJSON(object) { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} +exports.scalarTypeFromJSON = scalarTypeFromJSON; +function scalarTypeToJSON(object) { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.scalarTypeToJSON = scalarTypeToJSON; +function createBaseInterfaceDescriptor() { + return { name: "", description: "" }; +} +exports.InterfaceDescriptor = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + create(base) { + return exports.InterfaceDescriptor.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; +function createBaseScalarDescriptor() { + return { name: "", description: "", fieldType: [] }; +} +exports.ScalarDescriptor = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.fieldType.push(reader.int32()); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e) => scalarTypeFromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.fieldType?.length) { + obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e)); + } + return obj; + }, + create(base) { + return exports.ScalarDescriptor.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map((e) => e) || []; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.d.ts b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.d.ts new file mode 100644 index 0000000..dbf887c --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "amino"; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.js b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.js new file mode 100644 index 0000000..5812962 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.js @@ -0,0 +1,10 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/amino/amino.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.protobufPackage = void 0; +/* eslint-disable */ +exports.protobufPackage = "amino"; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.d.ts b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.d.ts new file mode 100644 index 0000000..6a15cbc --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.d.ts @@ -0,0 +1,86 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare 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. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} +export declare const PageRequest: MessageFns; +export declare const PageResponse: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.js b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.js new file mode 100644 index 0000000..f16d4bb --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.js @@ -0,0 +1,230 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageResponse = exports.PageRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +exports.protobufPackage = "cosmos.base.query.v1beta1"; +function createBasePageRequest() { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} +exports.PageRequest = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.offset = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.limit = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.countTotal = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.reverse = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + obj.reverse = message.reverse; + } + return obj; + }, + create(base) { + return exports.PageRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; +function createBasePageResponse() { + return { nextKey: new Uint8Array(0), total: 0 }; +} +exports.PageResponse = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.nextKey = reader.bytes(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.total = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + create(base) { + return exports.PageResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.d.ts b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.d.ts new file mode 100644 index 0000000..5a0a4d6 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.d.ts @@ -0,0 +1,53 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "cosmos.base.v1beta1"; +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProto { + int: string; +} +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProto { + dec: string; +} +export declare const Coin: MessageFns; +export declare const DecCoin: MessageFns; +export declare const IntProto: MessageFns; +export declare const DecProto: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.js b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.js new file mode 100644 index 0000000..45c41a1 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.js @@ -0,0 +1,252 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DecProto = exports.IntProto = exports.DecCoin = exports.Coin = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +exports.protobufPackage = "cosmos.base.v1beta1"; +function createBaseCoin() { + return { denom: "", amount: "" }; +} +exports.Coin = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.amount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + create(base) { + return exports.Coin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseDecCoin() { + return { denom: "", amount: "" }; +} +exports.DecCoin = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.amount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + create(base) { + return exports.DecCoin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseIntProto() { + return { int: "" }; +} +exports.IntProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.int = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.int !== "") { + obj.int = message.int; + } + return obj; + }, + create(base) { + return exports.IntProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; +function createBaseDecProto() { + return { dec: "" }; +} +exports.DecProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dec = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dec !== "") { + obj.dec = message.dec; + } + return obj; + }, + create(base) { + return exports.DecProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.d.ts b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.d.ts new file mode 100644 index 0000000..5e50803 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "cosmos.msg.v1"; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.js b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.js new file mode 100644 index 0000000..b539482 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.js @@ -0,0 +1,10 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.protobufPackage = void 0; +/* eslint-disable */ +exports.protobufPackage = "cosmos.msg.v1"; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.d.ts b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.d.ts new file mode 100644 index 0000000..6ebcef9 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "cosmos.query.v1"; diff --git a/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.js b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.js new file mode 100644 index 0000000..d478fe7 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.js @@ -0,0 +1,10 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/cosmos/query/v1/query.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.protobufPackage = void 0; +/* eslint-disable */ +exports.protobufPackage = "cosmos.query.v1"; diff --git a/dist/main/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.d.ts b/dist/main/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.d.ts new file mode 100644 index 0000000..885d30b --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "gogoproto"; diff --git a/dist/main/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.js b/dist/main/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.js new file mode 100644 index 0000000..de32af9 --- /dev/null +++ b/dist/main/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.js @@ -0,0 +1,10 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/gogoproto/gogoproto/gogo.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.protobufPackage = void 0; +/* eslint-disable */ +exports.protobufPackage = "gogoproto"; diff --git a/dist/main/coreum/dex/v1/event.d.ts b/dist/main/coreum/dex/v1/event.d.ts new file mode 100644 index 0000000..9cae3c3 --- /dev/null +++ b/dist/main/coreum/dex/v1/event.d.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "coreum.dex.v1"; +/** EventOrderPlaced is emitted when a new order is placed and new sequence is generated for it. */ +export interface EventOrderPlaced { + /** creator is order creator address. */ + creator: string; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence. */ + sequence: number; +} +/** EventOrderReduced is emitted when the order is reduced during the matching. */ +export interface EventOrderReduced { + /** creator is order creator address. */ + creator: string; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence. */ + sequence: number; + /** sent_coin is coin sent during matching. */ + sentCoin: string; + /** received_coin is coin received during matching. */ + receivedCoin: string; +} +/** EventOrderCreated is emitted when the limit order is saved to the order book. */ +export interface EventOrderCreated { + /** creator is order creator address. */ + creator: string; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence. */ + sequence: number; + /** remaining_base_quantity - is remaining quantity of base denom which user wants to sell or buy. */ + remainingBaseQuantity: string; + /** remaining_spendable_balance - is balance up to which user wants to spend to execute the order. */ + remainingSpendableBalance: string; +} +/** EventOrderClosed is emitted when the order is closed during matching or manually, and removed from the order book. */ +export interface EventOrderClosed { + /** creator is order creator address. */ + creator: string; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence. */ + sequence: number; + /** remaining_base_quantity - is remaining quantity of base denom which user wants to sell or buy. */ + remainingBaseQuantity: string; + /** remaining_spendable_balance - is balance up to which user wants to spend to execute the order. */ + remainingSpendableBalance: string; +} +export declare const EventOrderPlaced: MessageFns; +export declare const EventOrderReduced: MessageFns; +export declare const EventOrderCreated: MessageFns; +export declare const EventOrderClosed: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/event.js b/dist/main/coreum/dex/v1/event.js new file mode 100644 index 0000000..561ea19 --- /dev/null +++ b/dist/main/coreum/dex/v1/event.js @@ -0,0 +1,450 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/event.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EventOrderClosed = exports.EventOrderCreated = exports.EventOrderReduced = exports.EventOrderPlaced = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +exports.protobufPackage = "coreum.dex.v1"; +function createBaseEventOrderPlaced() { + return { creator: "", id: "", sequence: 0 }; +} +exports.EventOrderPlaced = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventOrderPlaced(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + create(base) { + return exports.EventOrderPlaced.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventOrderPlaced(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + return message; + }, +}; +function createBaseEventOrderReduced() { + return { creator: "", id: "", sequence: 0, sentCoin: "", receivedCoin: "" }; +} +exports.EventOrderReduced = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + if (message.sentCoin !== "") { + writer.uint32(34).string(message.sentCoin); + } + if (message.receivedCoin !== "") { + writer.uint32(42).string(message.receivedCoin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventOrderReduced(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.sentCoin = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.receivedCoin = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + sentCoin: isSet(object.sentCoin) ? globalThis.String(object.sentCoin) : "", + receivedCoin: isSet(object.receivedCoin) ? globalThis.String(object.receivedCoin) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.sentCoin !== "") { + obj.sentCoin = message.sentCoin; + } + if (message.receivedCoin !== "") { + obj.receivedCoin = message.receivedCoin; + } + return obj; + }, + create(base) { + return exports.EventOrderReduced.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventOrderReduced(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + message.sentCoin = object.sentCoin ?? ""; + message.receivedCoin = object.receivedCoin ?? ""; + return message; + }, +}; +function createBaseEventOrderCreated() { + return { creator: "", id: "", sequence: 0, remainingBaseQuantity: "", remainingSpendableBalance: "" }; +} +exports.EventOrderCreated = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + if (message.remainingBaseQuantity !== "") { + writer.uint32(34).string(message.remainingBaseQuantity); + } + if (message.remainingSpendableBalance !== "") { + writer.uint32(42).string(message.remainingSpendableBalance); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventOrderCreated(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.remainingBaseQuantity = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.remainingSpendableBalance = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + remainingBaseQuantity: isSet(object.remainingBaseQuantity) ? globalThis.String(object.remainingBaseQuantity) : "", + remainingSpendableBalance: isSet(object.remainingSpendableBalance) + ? globalThis.String(object.remainingSpendableBalance) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.remainingBaseQuantity !== "") { + obj.remainingBaseQuantity = message.remainingBaseQuantity; + } + if (message.remainingSpendableBalance !== "") { + obj.remainingSpendableBalance = message.remainingSpendableBalance; + } + return obj; + }, + create(base) { + return exports.EventOrderCreated.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventOrderCreated(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + message.remainingBaseQuantity = object.remainingBaseQuantity ?? ""; + message.remainingSpendableBalance = object.remainingSpendableBalance ?? ""; + return message; + }, +}; +function createBaseEventOrderClosed() { + return { creator: "", id: "", sequence: 0, remainingBaseQuantity: "", remainingSpendableBalance: "" }; +} +exports.EventOrderClosed = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + if (message.remainingBaseQuantity !== "") { + writer.uint32(34).string(message.remainingBaseQuantity); + } + if (message.remainingSpendableBalance !== "") { + writer.uint32(42).string(message.remainingSpendableBalance); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventOrderClosed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.remainingBaseQuantity = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.remainingSpendableBalance = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + remainingBaseQuantity: isSet(object.remainingBaseQuantity) ? globalThis.String(object.remainingBaseQuantity) : "", + remainingSpendableBalance: isSet(object.remainingSpendableBalance) + ? globalThis.String(object.remainingSpendableBalance) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.remainingBaseQuantity !== "") { + obj.remainingBaseQuantity = message.remainingBaseQuantity; + } + if (message.remainingSpendableBalance !== "") { + obj.remainingSpendableBalance = message.remainingSpendableBalance; + } + return obj; + }, + create(base) { + return exports.EventOrderClosed.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventOrderClosed(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + message.remainingBaseQuantity = object.remainingBaseQuantity ?? ""; + message.remainingSpendableBalance = object.remainingSpendableBalance ?? ""; + return message; + }, +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/genesis.d.ts b/dist/main/coreum/dex/v1/genesis.d.ts new file mode 100644 index 0000000..19c6808 --- /dev/null +++ b/dist/main/coreum/dex/v1/genesis.d.ts @@ -0,0 +1,50 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Order, OrderBookData } from "./order"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.dex.v1"; +/** GenesisState defines the module genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + orderBooks: OrderBookDataWithID[]; + orders: Order[]; + /** order_sequence is current order sequence; */ + orderSequence: number; + accountsDenomsOrdersCounts: AccountDenomOrdersCount[]; + reservedOrderIds: Uint8Array[]; +} +/** OrderBookDataWithID is a order book data with it's corresponding ID. */ +export interface OrderBookDataWithID { + /** id is order book ID. */ + id: number; + /** data is order book data. */ + data: OrderBookData | undefined; +} +/** AccountDenomOrderCount is a count of orders per account and denom. */ +export interface AccountDenomOrdersCount { + accountNumber: number; + denom: string; + ordersCount: number; +} +export declare const GenesisState: MessageFns; +export declare const OrderBookDataWithID: MessageFns; +export declare const AccountDenomOrdersCount: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/genesis.js b/dist/main/coreum/dex/v1/genesis.js new file mode 100644 index 0000000..475f4a6 --- /dev/null +++ b/dist/main/coreum/dex/v1/genesis.js @@ -0,0 +1,361 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/genesis.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AccountDenomOrdersCount = exports.OrderBookDataWithID = exports.GenesisState = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +const order_1 = require("./order"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.dex.v1"; +function createBaseGenesisState() { + return { + params: undefined, + orderBooks: [], + orders: [], + orderSequence: 0, + accountsDenomsOrdersCounts: [], + reservedOrderIds: [], + }; +} +exports.GenesisState = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.orderBooks) { + exports.OrderBookDataWithID.encode(v, writer.uint32(18).fork()).join(); + } + for (const v of message.orders) { + order_1.Order.encode(v, writer.uint32(26).fork()).join(); + } + if (message.orderSequence !== 0) { + writer.uint32(32).uint64(message.orderSequence); + } + for (const v of message.accountsDenomsOrdersCounts) { + exports.AccountDenomOrdersCount.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.reservedOrderIds) { + writer.uint32(50).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.orderBooks.push(exports.OrderBookDataWithID.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.orders.push(order_1.Order.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.orderSequence = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.accountsDenomsOrdersCounts.push(exports.AccountDenomOrdersCount.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.reservedOrderIds.push(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + orderBooks: globalThis.Array.isArray(object?.orderBooks) + ? object.orderBooks.map((e) => exports.OrderBookDataWithID.fromJSON(e)) + : [], + orders: globalThis.Array.isArray(object?.orders) + ? object.orders.map((e) => order_1.Order.fromJSON(e)) + : [], + orderSequence: isSet(object.orderSequence) + ? globalThis.Number(object.orderSequence) + : 0, + accountsDenomsOrdersCounts: globalThis.Array.isArray(object?.accountsDenomsOrdersCounts) + ? object.accountsDenomsOrdersCounts.map((e) => exports.AccountDenomOrdersCount.fromJSON(e)) + : [], + reservedOrderIds: globalThis.Array.isArray(object?.reservedOrderIds) + ? object.reservedOrderIds.map((e) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + if (message.orderBooks?.length) { + obj.orderBooks = message.orderBooks.map((e) => exports.OrderBookDataWithID.toJSON(e)); + } + if (message.orders?.length) { + obj.orders = message.orders.map((e) => order_1.Order.toJSON(e)); + } + if (message.orderSequence !== 0) { + obj.orderSequence = Math.round(message.orderSequence); + } + if (message.accountsDenomsOrdersCounts?.length) { + obj.accountsDenomsOrdersCounts = message.accountsDenomsOrdersCounts.map((e) => exports.AccountDenomOrdersCount.toJSON(e)); + } + if (message.reservedOrderIds?.length) { + obj.reservedOrderIds = message.reservedOrderIds.map((e) => base64FromBytes(e)); + } + return obj; + }, + create(base) { + return exports.GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + message.orderBooks = + object.orderBooks?.map((e) => exports.OrderBookDataWithID.fromPartial(e)) || []; + message.orders = object.orders?.map((e) => order_1.Order.fromPartial(e)) || []; + message.orderSequence = object.orderSequence ?? 0; + message.accountsDenomsOrdersCounts = + object.accountsDenomsOrdersCounts?.map((e) => exports.AccountDenomOrdersCount.fromPartial(e)) || []; + message.reservedOrderIds = object.reservedOrderIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseOrderBookDataWithID() { + return { id: 0, data: undefined }; +} +exports.OrderBookDataWithID = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.data !== undefined) { + order_1.OrderBookData.encode(message.data, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderBookDataWithID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.id = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = order_1.OrderBookData.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + data: isSet(object.data) + ? order_1.OrderBookData.fromJSON(object.data) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.data !== undefined) { + obj.data = order_1.OrderBookData.toJSON(message.data); + } + return obj; + }, + create(base) { + return exports.OrderBookDataWithID.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrderBookDataWithID(); + message.id = object.id ?? 0; + message.data = + object.data !== undefined && object.data !== null + ? order_1.OrderBookData.fromPartial(object.data) + : undefined; + return message; + }, +}; +function createBaseAccountDenomOrdersCount() { + return { accountNumber: 0, denom: "", ordersCount: 0 }; +} +exports.AccountDenomOrdersCount = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.accountNumber !== 0) { + writer.uint32(8).uint64(message.accountNumber); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.ordersCount !== 0) { + writer.uint32(24).uint64(message.ordersCount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountDenomOrdersCount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.ordersCount = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + accountNumber: isSet(object.accountNumber) + ? globalThis.Number(object.accountNumber) + : 0, + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + ordersCount: isSet(object.ordersCount) + ? globalThis.Number(object.ordersCount) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.ordersCount !== 0) { + obj.ordersCount = Math.round(message.ordersCount); + } + return obj; + }, + create(base) { + return exports.AccountDenomOrdersCount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAccountDenomOrdersCount(); + message.accountNumber = object.accountNumber ?? 0; + message.denom = object.denom ?? ""; + message.ordersCount = object.ordersCount ?? 0; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/google/googleapis/google/api/annotations.d.ts b/dist/main/coreum/dex/v1/google/googleapis/google/api/annotations.d.ts new file mode 100644 index 0000000..a64daf0 --- /dev/null +++ b/dist/main/coreum/dex/v1/google/googleapis/google/api/annotations.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "google.api"; diff --git a/dist/main/coreum/dex/v1/google/googleapis/google/api/annotations.js b/dist/main/coreum/dex/v1/google/googleapis/google/api/annotations.js new file mode 100644 index 0000000..97be1a4 --- /dev/null +++ b/dist/main/coreum/dex/v1/google/googleapis/google/api/annotations.js @@ -0,0 +1,10 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: google/googleapis/google/api/annotations.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.protobufPackage = void 0; +/* eslint-disable */ +exports.protobufPackage = "google.api"; diff --git a/dist/main/coreum/dex/v1/google/googleapis/google/api/http.d.ts b/dist/main/coreum/dex/v1/google/googleapis/google/api/http.d.ts new file mode 100644 index 0000000..e7250ba --- /dev/null +++ b/dist/main/coreum/dex/v1/google/googleapis/google/api/http.d.ts @@ -0,0 +1,379 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "google.api"; +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fullyDecodeReservedExpansion: boolean; +} +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRule { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: string | undefined; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: string | undefined; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: string | undefined; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: string | undefined; + /** Maps to HTTP PATCH. 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 request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} +export declare const Http: MessageFns; +export declare const HttpRule: MessageFns; +export declare const CustomHttpPattern: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/google/googleapis/google/api/http.js b/dist/main/coreum/dex/v1/google/googleapis/google/api/http.js new file mode 100644 index 0000000..a315f1c --- /dev/null +++ b/dist/main/coreum/dex/v1/google/googleapis/google/api/http.js @@ -0,0 +1,355 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: google/googleapis/google/api/http.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CustomHttpPattern = exports.HttpRule = exports.Http = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +exports.protobufPackage = "google.api"; +function createBaseHttp() { + return { rules: [], fullyDecodeReservedExpansion: false }; +} +exports.Http = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.rules) { + exports.HttpRule.encode(v, writer.uint32(10).fork()).join(); + } + if (message.fullyDecodeReservedExpansion !== false) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.rules.push(exports.HttpRule.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.fullyDecodeReservedExpansion = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => exports.HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => exports.HttpRule.toJSON(e)); + } + if (message.fullyDecodeReservedExpansion !== false) { + obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + } + return obj; + }, + create(base) { + return exports.Http.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => exports.HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; +function createBaseHttpRule() { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} +exports.HttpRule = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + exports.CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + exports.HttpRule.encode(v, writer.uint32(90).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.selector = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.get = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.put = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.post = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.delete = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.patch = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.custom = exports.CustomHttpPattern.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.body = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.responseBody = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.additionalBindings.push(exports.HttpRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + selector: isSet(object.selector) ? globalThis.String(object.selector) : "", + get: isSet(object.get) ? globalThis.String(object.get) : undefined, + put: isSet(object.put) ? globalThis.String(object.put) : undefined, + post: isSet(object.post) ? globalThis.String(object.post) : undefined, + delete: isSet(object.delete) ? globalThis.String(object.delete) : undefined, + patch: isSet(object.patch) ? globalThis.String(object.patch) : undefined, + custom: isSet(object.custom) ? exports.CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e) => exports.HttpRule.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.selector !== "") { + obj.selector = message.selector; + } + if (message.get !== undefined) { + obj.get = message.get; + } + if (message.put !== undefined) { + obj.put = message.put; + } + if (message.post !== undefined) { + obj.post = message.post; + } + if (message.delete !== undefined) { + obj.delete = message.delete; + } + if (message.patch !== undefined) { + obj.patch = message.patch; + } + if (message.custom !== undefined) { + obj.custom = exports.CustomHttpPattern.toJSON(message.custom); + } + if (message.body !== "") { + obj.body = message.body; + } + if (message.responseBody !== "") { + obj.responseBody = message.responseBody; + } + if (message.additionalBindings?.length) { + obj.additionalBindings = message.additionalBindings.map((e) => exports.HttpRule.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.HttpRule.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = (object.custom !== undefined && object.custom !== null) + ? exports.CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map((e) => exports.HttpRule.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCustomHttpPattern() { + return { kind: "", path: "" }; +} +exports.CustomHttpPattern = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + path: isSet(object.path) ? globalThis.String(object.path) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + create(base) { + return exports.CustomHttpPattern.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/google/protobuf/descriptor.d.ts b/dist/main/coreum/dex/v1/google/protobuf/descriptor.d.ts new file mode 100644 index 0000000..67ba410 --- /dev/null +++ b/dist/main/coreum/dex/v1/google/protobuf/descriptor.d.ts @@ -0,0 +1,1336 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export declare enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relied on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1 +} +export declare function editionFromJSON(object: any): Edition; +export declare function editionToJSON(object: Edition): string; +/** + * Describes the 'visibility' of a symbol with respect to the proto import + * system. Symbols can only be imported when the visibility rules do not prevent + * it (ex: local symbols cannot be imported). Visibility modifiers can only set + * on `message` and `enum` as they are the only types available to be referenced + * from other files. + */ +export declare enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2, + UNRECOGNIZED = -1 +} +export declare function symbolVisibilityFromJSON(object: any): SymbolVisibility; +export declare function symbolVisibilityToJSON(object: SymbolVisibility): string; +/** + * 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 | undefined; + /** e.g. "foo", "foo.bar", etc. */ + package?: string | undefined; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** + * Names of files imported by this file purely for the purpose of providing + * option extensions. These are excluded from the dependency list above. + */ + optionDependency: string[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: 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. + */ + sourceCodeInfo?: SourceCodeInfo | undefined; + /** + * The syntax of the proto file. + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + syntax?: string | undefined; + /** + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + edition?: Edition | undefined; +} +/** Describes a message type. */ +export interface DescriptorProto { + name?: string | undefined; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions | undefined; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; + /** Support for `export` and `local` keywords on enums. */ + visibility?: SymbolVisibility | undefined; +} +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start?: number | undefined; + /** Exclusive. */ + end?: number | undefined; + 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 | undefined; + /** Exclusive. */ + end?: number | undefined; +} +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} +/** The verification state of the extension range. */ +export declare enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1 +} +export declare function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState; +export declare function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string; +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: number | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: string | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: string | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: boolean | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name?: string | undefined; + number?: number | undefined; + label?: FieldDescriptorProto_Label | undefined; + /** + * 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 | undefined; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + typeName?: string | undefined; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee?: string | undefined; + /** + * 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. + */ + defaultValue?: string | undefined; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex?: number | undefined; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + jsonName?: string | undefined; + 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 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`. + */ + proto3Optional?: boolean | undefined; +} +export declare 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 after google.protobuf. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1 +} +export declare function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type; +export declare function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Type): string; +export declare enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, + UNRECOGNIZED = -1 +} +export declare function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label; +export declare function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string; +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name?: string | undefined; + options?: OneofOptions | undefined; +} +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name?: string | undefined; + 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. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; + /** Support for `export` and `local` keywords on enums. */ + visibility?: SymbolVisibility | undefined; +} +/** + * 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 | undefined; + /** Inclusive. */ + end?: number | undefined; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; +} +/** Describes a service. */ +export interface ServiceDescriptorProto { + name?: string | undefined; + method: MethodDescriptorProto[]; + options?: ServiceOptions | undefined; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name?: string | undefined; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType?: string | undefined; + outputType?: string | undefined; + options?: MethodOptions | undefined; + /** Identifies if client streams multiple client messages */ + clientStreaming?: boolean | undefined; + /** Identifies if server streams multiple server messages */ + serverStreaming?: boolean | undefined; +} +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage?: string | undefined; + /** + * 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. + */ + javaOuterClassname?: string | undefined; + /** + * 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. + */ + javaMultipleFiles?: boolean | undefined; + /** + * This option does nothing. + * + * @deprecated + */ + javaGenerateEqualsAndHash?: boolean | undefined; + /** + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. + */ + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: FileOptions_OptimizeMode | undefined; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage?: string | undefined; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: boolean | undefined; + /** + * 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 | undefined; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas?: boolean | undefined; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix?: string | undefined; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace?: string | undefined; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix?: string | undefined; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix?: string | undefined; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace?: string | undefined; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace?: string | undefined; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage?: string | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} +/** Generated classes can be optimized for speed or code size. */ +export declare 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 declare function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode; +export declare function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode): string; +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + messageSetWireFormat?: boolean | undefined; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor?: boolean | undefined; + /** + * 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 | undefined; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry?: boolean | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: boolean | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface FieldOptions { + /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. + */ + ctype?: FieldOptions_CType | undefined; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. + */ + packed?: boolean | undefined; + /** + * 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 | undefined; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: boolean | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverifiedLazy?: boolean | undefined; + /** + * 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 | undefined; + /** + * DEPRECATED. DO NOT USE! + * For Google-internal migration only. Do not use. + * + * @deprecated + */ + weak?: boolean | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + featureSupport?: FieldOptions_FeatureSupport | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export declare enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1 +} +export declare function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType; +export declare function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string; +export declare 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 declare function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType; +export declare function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string; +/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ +export declare enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1 +} +export declare function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention; +export declare function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string; +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. + */ +export declare enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1 +} +export declare function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType; +export declare function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string; +export interface FieldOptions_EditionDefault { + edition?: Edition | undefined; + /** Textproto value. */ + value?: string | undefined; +} +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: Edition | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: Edition | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: string | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} +export interface OneofOptions { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias?: boolean | undefined; + /** + * 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 | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: boolean | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: 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 | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: boolean | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: FieldOptions_FeatureSupport | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface ServiceOptions { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** + * 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 | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: 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 | undefined; + idempotencyLevel?: MethodOptions_IdempotencyLevel | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: 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 declare 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 declare function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel; +export declare function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_IdempotencyLevel): string; +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; +} +/** + * 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], ["moo", false] } represents + * "foo.(bar.baz).moo". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} +/** + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. + */ +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; + enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined; + defaultSymbolVisibility?: FeatureSet_VisibilityFeature_DefaultSymbolVisibility | undefined; +} +export declare enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1 +} +export declare function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence; +export declare function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string; +export declare enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType; +export declare function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string; +export declare enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding; +export declare function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string; +export declare enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1 +} +export declare function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation; +export declare function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string; +export declare enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding; +export declare function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string; +export declare enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat; +export declare function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string; +export declare enum FeatureSet_EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle; +export declare function featureSet_EnforceNamingStyleToJSON(object: FeatureSet_EnforceNamingStyle): string; +export interface FeatureSet_VisibilityFeature { +} +export declare enum FeatureSet_VisibilityFeature_DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + /** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */ + EXPORT_ALL = 1, + /** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */ + EXPORT_TOP_LEVEL = 2, + /** LOCAL_ALL - All symbols default to local. */ + LOCAL_ALL = 3, + /** + * STRICT - All symbols local by default. Nested types cannot be exported. + * With special case caveat for message { enum {} reserved 1 to max; } + * This is the recommended setting for new protos. + */ + STRICT = 4, + UNRECOGNIZED = -1 +} +export declare function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object: any): FeatureSet_VisibilityFeature_DefaultSymbolVisibility; +export declare function featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(object: FeatureSet_VisibilityFeature_DefaultSymbolVisibility): string; +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: Edition | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: Edition | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: FeatureSet | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} +/** + * 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 appears. + * For example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to moo. + * // + * // Another line attached to moo. + * optional double moo = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to moo or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. * / + * /* Block comment attached to + * * grault. * / + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments?: string | undefined; + trailingComments?: string | undefined; + leadingDetachedComments: 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. */ + sourceFile?: string | undefined; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin?: number | undefined; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified object. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export declare enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1 +} +export declare function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic; +export declare function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string; +export declare const FileDescriptorSet: MessageFns; +export declare const FileDescriptorProto: MessageFns; +export declare const DescriptorProto: MessageFns; +export declare const DescriptorProto_ExtensionRange: MessageFns; +export declare const DescriptorProto_ReservedRange: MessageFns; +export declare const ExtensionRangeOptions: MessageFns; +export declare const ExtensionRangeOptions_Declaration: MessageFns; +export declare const FieldDescriptorProto: MessageFns; +export declare const OneofDescriptorProto: MessageFns; +export declare const EnumDescriptorProto: MessageFns; +export declare const EnumDescriptorProto_EnumReservedRange: MessageFns; +export declare const EnumValueDescriptorProto: MessageFns; +export declare const ServiceDescriptorProto: MessageFns; +export declare const MethodDescriptorProto: MessageFns; +export declare const FileOptions: MessageFns; +export declare const MessageOptions: MessageFns; +export declare const FieldOptions: MessageFns; +export declare const FieldOptions_EditionDefault: MessageFns; +export declare const FieldOptions_FeatureSupport: MessageFns; +export declare const OneofOptions: MessageFns; +export declare const EnumOptions: MessageFns; +export declare const EnumValueOptions: MessageFns; +export declare const ServiceOptions: MessageFns; +export declare const MethodOptions: MessageFns; +export declare const UninterpretedOption: MessageFns; +export declare const UninterpretedOption_NamePart: MessageFns; +export declare const FeatureSet: MessageFns; +export declare const FeatureSet_VisibilityFeature: MessageFns; +export declare const FeatureSetDefaults: MessageFns; +export declare const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns; +export declare const SourceCodeInfo: MessageFns; +export declare const SourceCodeInfo_Location: MessageFns; +export declare const GeneratedCodeInfo: MessageFns; +export declare const GeneratedCodeInfo_Annotation: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/google/protobuf/descriptor.js b/dist/main/coreum/dex/v1/google/protobuf/descriptor.js new file mode 100644 index 0000000..795e63f --- /dev/null +++ b/dist/main/coreum/dex/v1/google/protobuf/descriptor.js @@ -0,0 +1,5373 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: google/protobuf/descriptor.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FeatureSet_JsonFormat = exports.featureSet_MessageEncodingToJSON = exports.featureSet_MessageEncodingFromJSON = exports.FeatureSet_MessageEncoding = exports.featureSet_Utf8ValidationToJSON = exports.featureSet_Utf8ValidationFromJSON = exports.FeatureSet_Utf8Validation = exports.featureSet_RepeatedFieldEncodingToJSON = exports.featureSet_RepeatedFieldEncodingFromJSON = exports.FeatureSet_RepeatedFieldEncoding = exports.featureSet_EnumTypeToJSON = exports.featureSet_EnumTypeFromJSON = exports.FeatureSet_EnumType = exports.featureSet_FieldPresenceToJSON = exports.featureSet_FieldPresenceFromJSON = exports.FeatureSet_FieldPresence = exports.methodOptions_IdempotencyLevelToJSON = exports.methodOptions_IdempotencyLevelFromJSON = exports.MethodOptions_IdempotencyLevel = exports.fieldOptions_OptionTargetTypeToJSON = exports.fieldOptions_OptionTargetTypeFromJSON = exports.FieldOptions_OptionTargetType = exports.fieldOptions_OptionRetentionToJSON = exports.fieldOptions_OptionRetentionFromJSON = exports.FieldOptions_OptionRetention = exports.fieldOptions_JSTypeToJSON = exports.fieldOptions_JSTypeFromJSON = exports.FieldOptions_JSType = exports.fieldOptions_CTypeToJSON = exports.fieldOptions_CTypeFromJSON = exports.FieldOptions_CType = exports.fileOptions_OptimizeModeToJSON = exports.fileOptions_OptimizeModeFromJSON = exports.FileOptions_OptimizeMode = exports.fieldDescriptorProto_LabelToJSON = exports.fieldDescriptorProto_LabelFromJSON = exports.FieldDescriptorProto_Label = exports.fieldDescriptorProto_TypeToJSON = exports.fieldDescriptorProto_TypeFromJSON = exports.FieldDescriptorProto_Type = exports.extensionRangeOptions_VerificationStateToJSON = exports.extensionRangeOptions_VerificationStateFromJSON = exports.ExtensionRangeOptions_VerificationState = exports.symbolVisibilityToJSON = exports.symbolVisibilityFromJSON = exports.SymbolVisibility = exports.editionToJSON = exports.editionFromJSON = exports.Edition = exports.protobufPackage = void 0; +exports.GeneratedCodeInfo_Annotation = exports.GeneratedCodeInfo = exports.SourceCodeInfo_Location = exports.SourceCodeInfo = exports.FeatureSetDefaults_FeatureSetEditionDefault = exports.FeatureSetDefaults = exports.FeatureSet_VisibilityFeature = exports.FeatureSet = exports.UninterpretedOption_NamePart = exports.UninterpretedOption = exports.MethodOptions = exports.ServiceOptions = exports.EnumValueOptions = exports.EnumOptions = exports.OneofOptions = exports.FieldOptions_FeatureSupport = exports.FieldOptions_EditionDefault = exports.FieldOptions = exports.MessageOptions = exports.FileOptions = exports.MethodDescriptorProto = exports.ServiceDescriptorProto = exports.EnumValueDescriptorProto = exports.EnumDescriptorProto_EnumReservedRange = exports.EnumDescriptorProto = exports.OneofDescriptorProto = exports.FieldDescriptorProto = exports.ExtensionRangeOptions_Declaration = exports.ExtensionRangeOptions = exports.DescriptorProto_ReservedRange = exports.DescriptorProto_ExtensionRange = exports.DescriptorProto = exports.FileDescriptorProto = exports.FileDescriptorSet = exports.generatedCodeInfo_Annotation_SemanticToJSON = exports.generatedCodeInfo_Annotation_SemanticFromJSON = exports.GeneratedCodeInfo_Annotation_Semantic = exports.featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON = exports.featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON = exports.FeatureSet_VisibilityFeature_DefaultSymbolVisibility = exports.featureSet_EnforceNamingStyleToJSON = exports.featureSet_EnforceNamingStyleFromJSON = exports.FeatureSet_EnforceNamingStyle = exports.featureSet_JsonFormatToJSON = exports.featureSet_JsonFormatFromJSON = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +exports.protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +var Edition; +(function (Edition) { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + Edition[Edition["EDITION_UNKNOWN"] = 0] = "EDITION_UNKNOWN"; + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + Edition[Edition["EDITION_LEGACY"] = 900] = "EDITION_LEGACY"; + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + Edition[Edition["EDITION_PROTO2"] = 998] = "EDITION_PROTO2"; + Edition[Edition["EDITION_PROTO3"] = 999] = "EDITION_PROTO3"; + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + Edition[Edition["EDITION_2023"] = 1000] = "EDITION_2023"; + Edition[Edition["EDITION_2024"] = 1001] = "EDITION_2024"; + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relied on outside of tests. + */ + Edition[Edition["EDITION_1_TEST_ONLY"] = 1] = "EDITION_1_TEST_ONLY"; + Edition[Edition["EDITION_2_TEST_ONLY"] = 2] = "EDITION_2_TEST_ONLY"; + Edition[Edition["EDITION_99997_TEST_ONLY"] = 99997] = "EDITION_99997_TEST_ONLY"; + Edition[Edition["EDITION_99998_TEST_ONLY"] = 99998] = "EDITION_99998_TEST_ONLY"; + Edition[Edition["EDITION_99999_TEST_ONLY"] = 99999] = "EDITION_99999_TEST_ONLY"; + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + Edition[Edition["EDITION_MAX"] = 2147483647] = "EDITION_MAX"; + Edition[Edition["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(Edition || (exports.Edition = Edition = {})); +function editionFromJSON(object) { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} +exports.editionFromJSON = editionFromJSON; +function editionToJSON(object) { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.editionToJSON = editionToJSON; +/** + * Describes the 'visibility' of a symbol with respect to the proto import + * system. Symbols can only be imported when the visibility rules do not prevent + * it (ex: local symbols cannot be imported). Visibility modifiers can only set + * on `message` and `enum` as they are the only types available to be referenced + * from other files. + */ +var SymbolVisibility; +(function (SymbolVisibility) { + SymbolVisibility[SymbolVisibility["VISIBILITY_UNSET"] = 0] = "VISIBILITY_UNSET"; + SymbolVisibility[SymbolVisibility["VISIBILITY_LOCAL"] = 1] = "VISIBILITY_LOCAL"; + SymbolVisibility[SymbolVisibility["VISIBILITY_EXPORT"] = 2] = "VISIBILITY_EXPORT"; + SymbolVisibility[SymbolVisibility["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(SymbolVisibility || (exports.SymbolVisibility = SymbolVisibility = {})); +function symbolVisibilityFromJSON(object) { + switch (object) { + case 0: + case "VISIBILITY_UNSET": + return SymbolVisibility.VISIBILITY_UNSET; + case 1: + case "VISIBILITY_LOCAL": + return SymbolVisibility.VISIBILITY_LOCAL; + case 2: + case "VISIBILITY_EXPORT": + return SymbolVisibility.VISIBILITY_EXPORT; + case -1: + case "UNRECOGNIZED": + default: + return SymbolVisibility.UNRECOGNIZED; + } +} +exports.symbolVisibilityFromJSON = symbolVisibilityFromJSON; +function symbolVisibilityToJSON(object) { + switch (object) { + case SymbolVisibility.VISIBILITY_UNSET: + return "VISIBILITY_UNSET"; + case SymbolVisibility.VISIBILITY_LOCAL: + return "VISIBILITY_LOCAL"; + case SymbolVisibility.VISIBILITY_EXPORT: + return "VISIBILITY_EXPORT"; + case SymbolVisibility.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.symbolVisibilityToJSON = symbolVisibilityToJSON; +/** The verification state of the extension range. */ +var ExtensionRangeOptions_VerificationState; +(function (ExtensionRangeOptions_VerificationState) { + /** DECLARATION - All the extensions of the range must be declared. */ + ExtensionRangeOptions_VerificationState[ExtensionRangeOptions_VerificationState["DECLARATION"] = 0] = "DECLARATION"; + ExtensionRangeOptions_VerificationState[ExtensionRangeOptions_VerificationState["UNVERIFIED"] = 1] = "UNVERIFIED"; + ExtensionRangeOptions_VerificationState[ExtensionRangeOptions_VerificationState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ExtensionRangeOptions_VerificationState || (exports.ExtensionRangeOptions_VerificationState = ExtensionRangeOptions_VerificationState = {})); +function extensionRangeOptions_VerificationStateFromJSON(object) { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} +exports.extensionRangeOptions_VerificationStateFromJSON = extensionRangeOptions_VerificationStateFromJSON; +function extensionRangeOptions_VerificationStateToJSON(object) { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.extensionRangeOptions_VerificationStateToJSON = extensionRangeOptions_VerificationStateToJSON; +var FieldDescriptorProto_Type; +(function (FieldDescriptorProto_Type) { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_DOUBLE"] = 1] = "TYPE_DOUBLE"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FLOAT"] = 2] = "TYPE_FLOAT"; + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_INT64"] = 3] = "TYPE_INT64"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_UINT64"] = 4] = "TYPE_UINT64"; + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_INT32"] = 5] = "TYPE_INT32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FIXED64"] = 6] = "TYPE_FIXED64"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FIXED32"] = 7] = "TYPE_FIXED32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_BOOL"] = 8] = "TYPE_BOOL"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_STRING"] = 9] = "TYPE_STRING"; + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported after google.protobuf. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_GROUP"] = 10] = "TYPE_GROUP"; + /** TYPE_MESSAGE - Length-delimited aggregate. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_MESSAGE"] = 11] = "TYPE_MESSAGE"; + /** TYPE_BYTES - New in version 2. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_BYTES"] = 12] = "TYPE_BYTES"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_UINT32"] = 13] = "TYPE_UINT32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_ENUM"] = 14] = "TYPE_ENUM"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SFIXED32"] = 15] = "TYPE_SFIXED32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SFIXED64"] = 16] = "TYPE_SFIXED64"; + /** TYPE_SINT32 - Uses ZigZag encoding. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SINT32"] = 17] = "TYPE_SINT32"; + /** TYPE_SINT64 - Uses ZigZag encoding. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SINT64"] = 18] = "TYPE_SINT64"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldDescriptorProto_Type || (exports.FieldDescriptorProto_Type = FieldDescriptorProto_Type = {})); +function fieldDescriptorProto_TypeFromJSON(object) { + 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; + } +} +exports.fieldDescriptorProto_TypeFromJSON = fieldDescriptorProto_TypeFromJSON; +function fieldDescriptorProto_TypeToJSON(object) { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.fieldDescriptorProto_TypeToJSON = fieldDescriptorProto_TypeToJSON; +var FieldDescriptorProto_Label; +(function (FieldDescriptorProto_Label) { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_OPTIONAL"] = 1] = "LABEL_OPTIONAL"; + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_REPEATED"] = 3] = "LABEL_REPEATED"; + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_REQUIRED"] = 2] = "LABEL_REQUIRED"; + FieldDescriptorProto_Label[FieldDescriptorProto_Label["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldDescriptorProto_Label || (exports.FieldDescriptorProto_Label = FieldDescriptorProto_Label = {})); +function fieldDescriptorProto_LabelFromJSON(object) { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} +exports.fieldDescriptorProto_LabelFromJSON = fieldDescriptorProto_LabelFromJSON; +function fieldDescriptorProto_LabelToJSON(object) { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.fieldDescriptorProto_LabelToJSON = fieldDescriptorProto_LabelToJSON; +/** Generated classes can be optimized for speed or code size. */ +var FileOptions_OptimizeMode; +(function (FileOptions_OptimizeMode) { + /** SPEED - Generate complete code for parsing, serialization, */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["SPEED"] = 1] = "SPEED"; + /** CODE_SIZE - etc. */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["CODE_SIZE"] = 2] = "CODE_SIZE"; + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["LITE_RUNTIME"] = 3] = "LITE_RUNTIME"; + FileOptions_OptimizeMode[FileOptions_OptimizeMode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FileOptions_OptimizeMode || (exports.FileOptions_OptimizeMode = FileOptions_OptimizeMode = {})); +function fileOptions_OptimizeModeFromJSON(object) { + 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; + } +} +exports.fileOptions_OptimizeModeFromJSON = fileOptions_OptimizeModeFromJSON; +function fileOptions_OptimizeModeToJSON(object) { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.fileOptions_OptimizeModeToJSON = fileOptions_OptimizeModeToJSON; +var FieldOptions_CType; +(function (FieldOptions_CType) { + /** STRING - Default mode. */ + FieldOptions_CType[FieldOptions_CType["STRING"] = 0] = "STRING"; + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ + FieldOptions_CType[FieldOptions_CType["CORD"] = 1] = "CORD"; + FieldOptions_CType[FieldOptions_CType["STRING_PIECE"] = 2] = "STRING_PIECE"; + FieldOptions_CType[FieldOptions_CType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldOptions_CType || (exports.FieldOptions_CType = FieldOptions_CType = {})); +function fieldOptions_CTypeFromJSON(object) { + 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; + } +} +exports.fieldOptions_CTypeFromJSON = fieldOptions_CTypeFromJSON; +function fieldOptions_CTypeToJSON(object) { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptions_CType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.fieldOptions_CTypeToJSON = fieldOptions_CTypeToJSON; +var FieldOptions_JSType; +(function (FieldOptions_JSType) { + /** JS_NORMAL - Use the default type. */ + FieldOptions_JSType[FieldOptions_JSType["JS_NORMAL"] = 0] = "JS_NORMAL"; + /** JS_STRING - Use JavaScript strings. */ + FieldOptions_JSType[FieldOptions_JSType["JS_STRING"] = 1] = "JS_STRING"; + /** JS_NUMBER - Use JavaScript numbers. */ + FieldOptions_JSType[FieldOptions_JSType["JS_NUMBER"] = 2] = "JS_NUMBER"; + FieldOptions_JSType[FieldOptions_JSType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldOptions_JSType || (exports.FieldOptions_JSType = FieldOptions_JSType = {})); +function fieldOptions_JSTypeFromJSON(object) { + 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; + } +} +exports.fieldOptions_JSTypeFromJSON = fieldOptions_JSTypeFromJSON; +function fieldOptions_JSTypeToJSON(object) { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.fieldOptions_JSTypeToJSON = fieldOptions_JSTypeToJSON; +/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ +var FieldOptions_OptionRetention; +(function (FieldOptions_OptionRetention) { + FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_UNKNOWN"] = 0] = "RETENTION_UNKNOWN"; + FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_RUNTIME"] = 1] = "RETENTION_RUNTIME"; + FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_SOURCE"] = 2] = "RETENTION_SOURCE"; + FieldOptions_OptionRetention[FieldOptions_OptionRetention["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldOptions_OptionRetention || (exports.FieldOptions_OptionRetention = FieldOptions_OptionRetention = {})); +function fieldOptions_OptionRetentionFromJSON(object) { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} +exports.fieldOptions_OptionRetentionFromJSON = fieldOptions_OptionRetentionFromJSON; +function fieldOptions_OptionRetentionToJSON(object) { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.fieldOptions_OptionRetentionToJSON = fieldOptions_OptionRetentionToJSON; +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. + */ +var FieldOptions_OptionTargetType; +(function (FieldOptions_OptionTargetType) { + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_UNKNOWN"] = 0] = "TARGET_TYPE_UNKNOWN"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_FILE"] = 1] = "TARGET_TYPE_FILE"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_EXTENSION_RANGE"] = 2] = "TARGET_TYPE_EXTENSION_RANGE"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_MESSAGE"] = 3] = "TARGET_TYPE_MESSAGE"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_FIELD"] = 4] = "TARGET_TYPE_FIELD"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ONEOF"] = 5] = "TARGET_TYPE_ONEOF"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ENUM"] = 6] = "TARGET_TYPE_ENUM"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ENUM_ENTRY"] = 7] = "TARGET_TYPE_ENUM_ENTRY"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_SERVICE"] = 8] = "TARGET_TYPE_SERVICE"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_METHOD"] = 9] = "TARGET_TYPE_METHOD"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldOptions_OptionTargetType || (exports.FieldOptions_OptionTargetType = FieldOptions_OptionTargetType = {})); +function fieldOptions_OptionTargetTypeFromJSON(object) { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} +exports.fieldOptions_OptionTargetTypeFromJSON = fieldOptions_OptionTargetTypeFromJSON; +function fieldOptions_OptionTargetTypeToJSON(object) { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.fieldOptions_OptionTargetTypeToJSON = fieldOptions_OptionTargetTypeToJSON; +/** + * 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. + */ +var MethodOptions_IdempotencyLevel; +(function (MethodOptions_IdempotencyLevel) { + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["IDEMPOTENCY_UNKNOWN"] = 0] = "IDEMPOTENCY_UNKNOWN"; + /** NO_SIDE_EFFECTS - implies idempotent */ + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["NO_SIDE_EFFECTS"] = 1] = "NO_SIDE_EFFECTS"; + /** IDEMPOTENT - idempotent, but may have side effects */ + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["IDEMPOTENT"] = 2] = "IDEMPOTENT"; + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(MethodOptions_IdempotencyLevel || (exports.MethodOptions_IdempotencyLevel = MethodOptions_IdempotencyLevel = {})); +function methodOptions_IdempotencyLevelFromJSON(object) { + 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; + } +} +exports.methodOptions_IdempotencyLevelFromJSON = methodOptions_IdempotencyLevelFromJSON; +function methodOptions_IdempotencyLevelToJSON(object) { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.methodOptions_IdempotencyLevelToJSON = methodOptions_IdempotencyLevelToJSON; +var FeatureSet_FieldPresence; +(function (FeatureSet_FieldPresence) { + FeatureSet_FieldPresence[FeatureSet_FieldPresence["FIELD_PRESENCE_UNKNOWN"] = 0] = "FIELD_PRESENCE_UNKNOWN"; + FeatureSet_FieldPresence[FeatureSet_FieldPresence["EXPLICIT"] = 1] = "EXPLICIT"; + FeatureSet_FieldPresence[FeatureSet_FieldPresence["IMPLICIT"] = 2] = "IMPLICIT"; + FeatureSet_FieldPresence[FeatureSet_FieldPresence["LEGACY_REQUIRED"] = 3] = "LEGACY_REQUIRED"; + FeatureSet_FieldPresence[FeatureSet_FieldPresence["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_FieldPresence || (exports.FeatureSet_FieldPresence = FeatureSet_FieldPresence = {})); +function featureSet_FieldPresenceFromJSON(object) { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} +exports.featureSet_FieldPresenceFromJSON = featureSet_FieldPresenceFromJSON; +function featureSet_FieldPresenceToJSON(object) { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureSet_FieldPresenceToJSON = featureSet_FieldPresenceToJSON; +var FeatureSet_EnumType; +(function (FeatureSet_EnumType) { + FeatureSet_EnumType[FeatureSet_EnumType["ENUM_TYPE_UNKNOWN"] = 0] = "ENUM_TYPE_UNKNOWN"; + FeatureSet_EnumType[FeatureSet_EnumType["OPEN"] = 1] = "OPEN"; + FeatureSet_EnumType[FeatureSet_EnumType["CLOSED"] = 2] = "CLOSED"; + FeatureSet_EnumType[FeatureSet_EnumType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_EnumType || (exports.FeatureSet_EnumType = FeatureSet_EnumType = {})); +function featureSet_EnumTypeFromJSON(object) { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} +exports.featureSet_EnumTypeFromJSON = featureSet_EnumTypeFromJSON; +function featureSet_EnumTypeToJSON(object) { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureSet_EnumTypeToJSON = featureSet_EnumTypeToJSON; +var FeatureSet_RepeatedFieldEncoding; +(function (FeatureSet_RepeatedFieldEncoding) { + FeatureSet_RepeatedFieldEncoding[FeatureSet_RepeatedFieldEncoding["REPEATED_FIELD_ENCODING_UNKNOWN"] = 0] = "REPEATED_FIELD_ENCODING_UNKNOWN"; + FeatureSet_RepeatedFieldEncoding[FeatureSet_RepeatedFieldEncoding["PACKED"] = 1] = "PACKED"; + FeatureSet_RepeatedFieldEncoding[FeatureSet_RepeatedFieldEncoding["EXPANDED"] = 2] = "EXPANDED"; + FeatureSet_RepeatedFieldEncoding[FeatureSet_RepeatedFieldEncoding["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_RepeatedFieldEncoding || (exports.FeatureSet_RepeatedFieldEncoding = FeatureSet_RepeatedFieldEncoding = {})); +function featureSet_RepeatedFieldEncodingFromJSON(object) { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} +exports.featureSet_RepeatedFieldEncodingFromJSON = featureSet_RepeatedFieldEncodingFromJSON; +function featureSet_RepeatedFieldEncodingToJSON(object) { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureSet_RepeatedFieldEncodingToJSON = featureSet_RepeatedFieldEncodingToJSON; +var FeatureSet_Utf8Validation; +(function (FeatureSet_Utf8Validation) { + FeatureSet_Utf8Validation[FeatureSet_Utf8Validation["UTF8_VALIDATION_UNKNOWN"] = 0] = "UTF8_VALIDATION_UNKNOWN"; + FeatureSet_Utf8Validation[FeatureSet_Utf8Validation["VERIFY"] = 2] = "VERIFY"; + FeatureSet_Utf8Validation[FeatureSet_Utf8Validation["NONE"] = 3] = "NONE"; + FeatureSet_Utf8Validation[FeatureSet_Utf8Validation["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_Utf8Validation || (exports.FeatureSet_Utf8Validation = FeatureSet_Utf8Validation = {})); +function featureSet_Utf8ValidationFromJSON(object) { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} +exports.featureSet_Utf8ValidationFromJSON = featureSet_Utf8ValidationFromJSON; +function featureSet_Utf8ValidationToJSON(object) { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureSet_Utf8ValidationToJSON = featureSet_Utf8ValidationToJSON; +var FeatureSet_MessageEncoding; +(function (FeatureSet_MessageEncoding) { + FeatureSet_MessageEncoding[FeatureSet_MessageEncoding["MESSAGE_ENCODING_UNKNOWN"] = 0] = "MESSAGE_ENCODING_UNKNOWN"; + FeatureSet_MessageEncoding[FeatureSet_MessageEncoding["LENGTH_PREFIXED"] = 1] = "LENGTH_PREFIXED"; + FeatureSet_MessageEncoding[FeatureSet_MessageEncoding["DELIMITED"] = 2] = "DELIMITED"; + FeatureSet_MessageEncoding[FeatureSet_MessageEncoding["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_MessageEncoding || (exports.FeatureSet_MessageEncoding = FeatureSet_MessageEncoding = {})); +function featureSet_MessageEncodingFromJSON(object) { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} +exports.featureSet_MessageEncodingFromJSON = featureSet_MessageEncodingFromJSON; +function featureSet_MessageEncodingToJSON(object) { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureSet_MessageEncodingToJSON = featureSet_MessageEncodingToJSON; +var FeatureSet_JsonFormat; +(function (FeatureSet_JsonFormat) { + FeatureSet_JsonFormat[FeatureSet_JsonFormat["JSON_FORMAT_UNKNOWN"] = 0] = "JSON_FORMAT_UNKNOWN"; + FeatureSet_JsonFormat[FeatureSet_JsonFormat["ALLOW"] = 1] = "ALLOW"; + FeatureSet_JsonFormat[FeatureSet_JsonFormat["LEGACY_BEST_EFFORT"] = 2] = "LEGACY_BEST_EFFORT"; + FeatureSet_JsonFormat[FeatureSet_JsonFormat["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_JsonFormat || (exports.FeatureSet_JsonFormat = FeatureSet_JsonFormat = {})); +function featureSet_JsonFormatFromJSON(object) { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} +exports.featureSet_JsonFormatFromJSON = featureSet_JsonFormatFromJSON; +function featureSet_JsonFormatToJSON(object) { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureSet_JsonFormatToJSON = featureSet_JsonFormatToJSON; +var FeatureSet_EnforceNamingStyle; +(function (FeatureSet_EnforceNamingStyle) { + FeatureSet_EnforceNamingStyle[FeatureSet_EnforceNamingStyle["ENFORCE_NAMING_STYLE_UNKNOWN"] = 0] = "ENFORCE_NAMING_STYLE_UNKNOWN"; + FeatureSet_EnforceNamingStyle[FeatureSet_EnforceNamingStyle["STYLE2024"] = 1] = "STYLE2024"; + FeatureSet_EnforceNamingStyle[FeatureSet_EnforceNamingStyle["STYLE_LEGACY"] = 2] = "STYLE_LEGACY"; + FeatureSet_EnforceNamingStyle[FeatureSet_EnforceNamingStyle["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_EnforceNamingStyle || (exports.FeatureSet_EnforceNamingStyle = FeatureSet_EnforceNamingStyle = {})); +function featureSet_EnforceNamingStyleFromJSON(object) { + switch (object) { + case 0: + case "ENFORCE_NAMING_STYLE_UNKNOWN": + return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; + case 1: + case "STYLE2024": + return FeatureSet_EnforceNamingStyle.STYLE2024; + case 2: + case "STYLE_LEGACY": + return FeatureSet_EnforceNamingStyle.STYLE_LEGACY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnforceNamingStyle.UNRECOGNIZED; + } +} +exports.featureSet_EnforceNamingStyleFromJSON = featureSet_EnforceNamingStyleFromJSON; +function featureSet_EnforceNamingStyleToJSON(object) { + switch (object) { + case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN: + return "ENFORCE_NAMING_STYLE_UNKNOWN"; + case FeatureSet_EnforceNamingStyle.STYLE2024: + return "STYLE2024"; + case FeatureSet_EnforceNamingStyle.STYLE_LEGACY: + return "STYLE_LEGACY"; + case FeatureSet_EnforceNamingStyle.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureSet_EnforceNamingStyleToJSON = featureSet_EnforceNamingStyleToJSON; +var FeatureSet_VisibilityFeature_DefaultSymbolVisibility; +(function (FeatureSet_VisibilityFeature_DefaultSymbolVisibility) { + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"; + /** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */ + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["EXPORT_ALL"] = 1] = "EXPORT_ALL"; + /** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */ + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["EXPORT_TOP_LEVEL"] = 2] = "EXPORT_TOP_LEVEL"; + /** LOCAL_ALL - All symbols default to local. */ + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["LOCAL_ALL"] = 3] = "LOCAL_ALL"; + /** + * STRICT - All symbols local by default. Nested types cannot be exported. + * With special case caveat for message { enum {} reserved 1 to max; } + * This is the recommended setting for new protos. + */ + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["STRICT"] = 4] = "STRICT"; + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_VisibilityFeature_DefaultSymbolVisibility || (exports.FeatureSet_VisibilityFeature_DefaultSymbolVisibility = FeatureSet_VisibilityFeature_DefaultSymbolVisibility = {})); +function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object) { + switch (object) { + case 0: + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN; + case 1: + case "EXPORT_ALL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL; + case 2: + case "EXPORT_TOP_LEVEL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL; + case 3: + case "LOCAL_ALL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL; + case 4: + case "STRICT": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED; + } +} +exports.featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON = featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON; +function featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(object) { + switch (object) { + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN: + return "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL: + return "EXPORT_ALL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL: + return "EXPORT_TOP_LEVEL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL: + return "LOCAL_ALL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT: + return "STRICT"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON = featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON; +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +var GeneratedCodeInfo_Annotation_Semantic; +(function (GeneratedCodeInfo_Annotation_Semantic) { + /** NONE - There is no effect or the effect is indescribable. */ + GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["NONE"] = 0] = "NONE"; + /** SET - The element is set or otherwise mutated. */ + GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["SET"] = 1] = "SET"; + /** ALIAS - An alias to the element is returned. */ + GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["ALIAS"] = 2] = "ALIAS"; + GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(GeneratedCodeInfo_Annotation_Semantic || (exports.GeneratedCodeInfo_Annotation_Semantic = GeneratedCodeInfo_Annotation_Semantic = {})); +function generatedCodeInfo_Annotation_SemanticFromJSON(object) { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} +exports.generatedCodeInfo_Annotation_SemanticFromJSON = generatedCodeInfo_Annotation_SemanticFromJSON; +function generatedCodeInfo_Annotation_SemanticToJSON(object) { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.generatedCodeInfo_Annotation_SemanticToJSON = generatedCodeInfo_Annotation_SemanticToJSON; +function createBaseFileDescriptorSet() { + return { file: [] }; +} +exports.FileDescriptorSet = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.file) { + exports.FileDescriptorProto.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.file.push(exports.FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e) => exports.FileDescriptorProto.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.file?.length) { + obj.file = message.file.map((e) => exports.FileDescriptorProto.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.FileDescriptorSet.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map((e) => exports.FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFileDescriptorProto() { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + optionDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "", + edition: 0, + }; +} +exports.FileDescriptorProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== undefined && message.package !== "") { + writer.uint32(18).string(message.package); + } + for (const v of message.dependency) { + writer.uint32(26).string(v); + } + writer.uint32(82).fork(); + for (const v of message.publicDependency) { + writer.int32(v); + } + writer.join(); + writer.uint32(90).fork(); + for (const v of message.weakDependency) { + writer.int32(v); + } + writer.join(); + for (const v of message.optionDependency) { + writer.uint32(122).string(v); + } + for (const v of message.messageType) { + exports.DescriptorProto.encode(v, writer.uint32(34).fork()).join(); + } + for (const v of message.enumType) { + exports.EnumDescriptorProto.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.service) { + exports.ServiceDescriptorProto.encode(v, writer.uint32(50).fork()).join(); + } + for (const v of message.extension) { + exports.FieldDescriptorProto.encode(v, writer.uint32(58).fork()).join(); + } + if (message.options !== undefined) { + exports.FileOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.sourceCodeInfo !== undefined) { + exports.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); + } + if (message.syntax !== undefined && message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.package = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dependency.push(reader.string()); + continue; + } + case 10: { + if (tag === 80) { + message.publicDependency.push(reader.int32()); + continue; + } + if (tag === 82) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.publicDependency.push(reader.int32()); + } + continue; + } + break; + } + case 11: { + if (tag === 88) { + message.weakDependency.push(reader.int32()); + continue; + } + if (tag === 90) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weakDependency.push(reader.int32()); + } + continue; + } + break; + } + case 15: { + if (tag !== 122) { + break; + } + message.optionDependency.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.messageType.push(exports.DescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.enumType.push(exports.EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.service.push(exports.ServiceDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.extension.push(exports.FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.options = exports.FileOptions.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.sourceCodeInfo = exports.SourceCodeInfo.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.syntax = reader.string(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + message.edition = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e) => globalThis.Number(e)) + : [], + optionDependency: globalThis.Array.isArray(object?.optionDependency) + ? object.optionDependency.map((e) => globalThis.String(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) + ? object.messageType.map((e) => exports.DescriptorProto.fromJSON(e)) + : [], + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e) => exports.EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e) => exports.ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) + ? object.extension.map((e) => exports.FieldDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? exports.FileOptions.fromJSON(object.options) : undefined, + sourceCodeInfo: isSet(object.sourceCodeInfo) ? exports.SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.package !== undefined && message.package !== "") { + obj.package = message.package; + } + if (message.dependency?.length) { + obj.dependency = message.dependency; + } + if (message.publicDependency?.length) { + obj.publicDependency = message.publicDependency.map((e) => Math.round(e)); + } + if (message.weakDependency?.length) { + obj.weakDependency = message.weakDependency.map((e) => Math.round(e)); + } + if (message.optionDependency?.length) { + obj.optionDependency = message.optionDependency; + } + if (message.messageType?.length) { + obj.messageType = message.messageType.map((e) => exports.DescriptorProto.toJSON(e)); + } + if (message.enumType?.length) { + obj.enumType = message.enumType.map((e) => exports.EnumDescriptorProto.toJSON(e)); + } + if (message.service?.length) { + obj.service = message.service.map((e) => exports.ServiceDescriptorProto.toJSON(e)); + } + if (message.extension?.length) { + obj.extension = message.extension.map((e) => exports.FieldDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = exports.FileOptions.toJSON(message.options); + } + if (message.sourceCodeInfo !== undefined) { + obj.sourceCodeInfo = exports.SourceCodeInfo.toJSON(message.sourceCodeInfo); + } + if (message.syntax !== undefined && message.syntax !== "") { + obj.syntax = message.syntax; + } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + return obj; + }, + create(base) { + return exports.FileDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map((e) => e) || []; + message.publicDependency = object.publicDependency?.map((e) => e) || []; + message.weakDependency = object.weakDependency?.map((e) => e) || []; + message.optionDependency = object.optionDependency?.map((e) => e) || []; + message.messageType = object.messageType?.map((e) => exports.DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map((e) => exports.EnumDescriptorProto.fromPartial(e)) || []; + message.service = object.service?.map((e) => exports.ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => exports.FieldDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? exports.FileOptions.fromPartial(object.options) + : undefined; + message.sourceCodeInfo = (object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null) + ? exports.SourceCodeInfo.fromPartial(object.sourceCodeInfo) + : undefined; + message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; + return message; + }, +}; +function createBaseDescriptorProto() { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [], + visibility: 0, + }; +} +exports.DescriptorProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + exports.FieldDescriptorProto.encode(v, writer.uint32(18).fork()).join(); + } + for (const v of message.extension) { + exports.FieldDescriptorProto.encode(v, writer.uint32(50).fork()).join(); + } + for (const v of message.nestedType) { + exports.DescriptorProto.encode(v, writer.uint32(26).fork()).join(); + } + for (const v of message.enumType) { + exports.EnumDescriptorProto.encode(v, writer.uint32(34).fork()).join(); + } + for (const v of message.extensionRange) { + exports.DescriptorProto_ExtensionRange.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.oneofDecl) { + exports.OneofDescriptorProto.encode(v, writer.uint32(66).fork()).join(); + } + if (message.options !== undefined) { + exports.MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); + } + for (const v of message.reservedRange) { + exports.DescriptorProto_ReservedRange.encode(v, writer.uint32(74).fork()).join(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v); + } + if (message.visibility !== undefined && message.visibility !== 0) { + writer.uint32(88).int32(message.visibility); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.field.push(exports.FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.extension.push(exports.FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.nestedType.push(exports.DescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.enumType.push(exports.EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.extensionRange.push(exports.DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.oneofDecl.push(exports.OneofDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.options = exports.MessageOptions.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.reservedRange.push(exports.DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.reservedName.push(reader.string()); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.visibility = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e) => exports.FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) + ? object.extension.map((e) => exports.FieldDescriptorProto.fromJSON(e)) + : [], + nestedType: globalThis.Array.isArray(object?.nestedType) + ? object.nestedType.map((e) => exports.DescriptorProto.fromJSON(e)) + : [], + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e) => exports.EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) + ? object.extensionRange.map((e) => exports.DescriptorProto_ExtensionRange.fromJSON(e)) + : [], + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) + ? object.oneofDecl.map((e) => exports.OneofDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? exports.MessageOptions.fromJSON(object.options) : undefined, + reservedRange: globalThis.Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e) => exports.DescriptorProto_ReservedRange.fromJSON(e)) + : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e) => globalThis.String(e)) + : [], + visibility: isSet(object.visibility) ? symbolVisibilityFromJSON(object.visibility) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.field?.length) { + obj.field = message.field.map((e) => exports.FieldDescriptorProto.toJSON(e)); + } + if (message.extension?.length) { + obj.extension = message.extension.map((e) => exports.FieldDescriptorProto.toJSON(e)); + } + if (message.nestedType?.length) { + obj.nestedType = message.nestedType.map((e) => exports.DescriptorProto.toJSON(e)); + } + if (message.enumType?.length) { + obj.enumType = message.enumType.map((e) => exports.EnumDescriptorProto.toJSON(e)); + } + if (message.extensionRange?.length) { + obj.extensionRange = message.extensionRange.map((e) => exports.DescriptorProto_ExtensionRange.toJSON(e)); + } + if (message.oneofDecl?.length) { + obj.oneofDecl = message.oneofDecl.map((e) => exports.OneofDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = exports.MessageOptions.toJSON(message.options); + } + if (message.reservedRange?.length) { + obj.reservedRange = message.reservedRange.map((e) => exports.DescriptorProto_ReservedRange.toJSON(e)); + } + if (message.reservedName?.length) { + obj.reservedName = message.reservedName; + } + if (message.visibility !== undefined && message.visibility !== 0) { + obj.visibility = symbolVisibilityToJSON(message.visibility); + } + return obj; + }, + create(base) { + return exports.DescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = object.field?.map((e) => exports.FieldDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => exports.FieldDescriptorProto.fromPartial(e)) || []; + message.nestedType = object.nestedType?.map((e) => exports.DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map((e) => exports.EnumDescriptorProto.fromPartial(e)) || []; + message.extensionRange = object.extensionRange?.map((e) => exports.DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneofDecl = object.oneofDecl?.map((e) => exports.OneofDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? exports.MessageOptions.fromPartial(object.options) + : undefined; + message.reservedRange = object.reservedRange?.map((e) => exports.DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map((e) => e) || []; + message.visibility = object.visibility ?? 0; + return message; + }, +}; +function createBaseDescriptorProto_ExtensionRange() { + return { start: 0, end: 0, options: undefined }; +} +exports.DescriptorProto_ExtensionRange = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + exports.ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.end = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.options = exports.ExtensionRangeOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + options: isSet(object.options) ? exports.ExtensionRangeOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.options !== undefined) { + obj.options = exports.ExtensionRangeOptions.toJSON(message.options); + } + return obj; + }, + create(base) { + return exports.DescriptorProto_ExtensionRange.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDescriptorProto_ExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.options = (object.options !== undefined && object.options !== null) + ? exports.ExtensionRangeOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; +function createBaseDescriptorProto_ReservedRange() { + return { start: 0, end: 0 }; +} +exports.DescriptorProto_ReservedRange = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.end = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + return obj; + }, + create(base) { + return exports.DescriptorProto_ReservedRange.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; +function createBaseExtensionRangeOptions() { + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; +} +exports.ExtensionRangeOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + exports.ExtensionRangeOptions_Declaration.encode(v, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.declaration.push(exports.ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.verification = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e) => exports.ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, + }; + }, + toJSON(message) { + const obj = {}; + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => exports.ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } + return obj; + }, + create(base) { + return exports.ExtensionRangeOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => exports.ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; +function createBaseExtensionRangeOptions_Declaration() { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} +exports.ExtensionRangeOptions_Declaration = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.number = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.fullName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.type = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.reserved = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.repeated = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + create(base) { + return exports.ExtensionRangeOptions_Declaration.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; +function createBaseFieldDescriptorProto() { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} +exports.FieldDescriptorProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } + if (message.options !== undefined) { + exports.FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { + writer.uint32(136).bool(message.proto3Optional); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.number = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.label = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.type = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.typeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.extendee = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.defaultValue = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.oneofIndex = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.jsonName = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.options = exports.FieldOptions.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.proto3Optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", + options: isSet(object.options) ? exports.FieldOptions.fromJSON(object.options) : undefined, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.label !== undefined && message.label !== 1) { + obj.label = fieldDescriptorProto_LabelToJSON(message.label); + } + if (message.type !== undefined && message.type !== 1) { + obj.type = fieldDescriptorProto_TypeToJSON(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + obj.typeName = message.typeName; + } + if (message.extendee !== undefined && message.extendee !== "") { + obj.extendee = message.extendee; + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + obj.defaultValue = message.defaultValue; + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + obj.oneofIndex = Math.round(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + obj.jsonName = message.jsonName; + } + if (message.options !== undefined) { + obj.options = exports.FieldOptions.toJSON(message.options); + } + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { + obj.proto3Optional = message.proto3Optional; + } + return obj; + }, + create(base) { + return exports.FieldDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.typeName = object.typeName ?? ""; + message.extendee = object.extendee ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.oneofIndex = object.oneofIndex ?? 0; + message.jsonName = object.jsonName ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? exports.FieldOptions.fromPartial(object.options) + : undefined; + message.proto3Optional = object.proto3Optional ?? false; + return message; + }, +}; +function createBaseOneofDescriptorProto() { + return { name: "", options: undefined }; +} +exports.OneofDescriptorProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + exports.OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.options = exports.OneofOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + options: isSet(object.options) ? exports.OneofOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.options !== undefined) { + obj.options = exports.OneofOptions.toJSON(message.options); + } + return obj; + }, + create(base) { + return exports.OneofDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? exports.OneofOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; +function createBaseEnumDescriptorProto() { + return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [], visibility: 0 }; +} +exports.EnumDescriptorProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + exports.EnumValueDescriptorProto.encode(v, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + exports.EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + for (const v of message.reservedRange) { + exports.EnumDescriptorProto_EnumReservedRange.encode(v, writer.uint32(34).fork()).join(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v); + } + if (message.visibility !== undefined && message.visibility !== 0) { + writer.uint32(48).int32(message.visibility); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value.push(exports.EnumValueDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.options = exports.EnumOptions.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.reservedRange.push(exports.EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.reservedName.push(reader.string()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.visibility = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e) => exports.EnumValueDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? exports.EnumOptions.fromJSON(object.options) : undefined, + reservedRange: globalThis.Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e) => exports.EnumDescriptorProto_EnumReservedRange.fromJSON(e)) + : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e) => globalThis.String(e)) + : [], + visibility: isSet(object.visibility) ? symbolVisibilityFromJSON(object.visibility) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.value?.length) { + obj.value = message.value.map((e) => exports.EnumValueDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = exports.EnumOptions.toJSON(message.options); + } + if (message.reservedRange?.length) { + obj.reservedRange = message.reservedRange.map((e) => exports.EnumDescriptorProto_EnumReservedRange.toJSON(e)); + } + if (message.reservedName?.length) { + obj.reservedName = message.reservedName; + } + if (message.visibility !== undefined && message.visibility !== 0) { + obj.visibility = symbolVisibilityToJSON(message.visibility); + } + return obj; + }, + create(base) { + return exports.EnumDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = object.value?.map((e) => exports.EnumValueDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? exports.EnumOptions.fromPartial(object.options) + : undefined; + message.reservedRange = object.reservedRange?.map((e) => exports.EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || + []; + message.reservedName = object.reservedName?.map((e) => e) || []; + message.visibility = object.visibility ?? 0; + return message; + }, +}; +function createBaseEnumDescriptorProto_EnumReservedRange() { + return { start: 0, end: 0 }; +} +exports.EnumDescriptorProto_EnumReservedRange = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.end = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + return obj; + }, + create(base) { + return exports.EnumDescriptorProto_EnumReservedRange.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; +function createBaseEnumValueDescriptorProto() { + return { name: "", number: 0, options: undefined }; +} +exports.EnumValueDescriptorProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + exports.EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.number = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.options = exports.EnumValueOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + options: isSet(object.options) ? exports.EnumValueOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.options !== undefined) { + obj.options = exports.EnumValueOptions.toJSON(message.options); + } + return obj; + }, + create(base) { + return exports.EnumValueDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.options = (object.options !== undefined && object.options !== null) + ? exports.EnumValueOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; +function createBaseServiceDescriptorProto() { + return { name: "", method: [], options: undefined }; +} +exports.ServiceDescriptorProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + exports.MethodDescriptorProto.encode(v, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + exports.ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.method.push(exports.MethodDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.options = exports.ServiceOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.Array.isArray(object?.method) + ? object.method.map((e) => exports.MethodDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? exports.ServiceOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.method?.length) { + obj.method = message.method.map((e) => exports.MethodDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = exports.ServiceOptions.toJSON(message.options); + } + return obj; + }, + create(base) { + return exports.ServiceDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = object.method?.map((e) => exports.MethodDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? exports.ServiceOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; +function createBaseMethodDescriptorProto() { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false, + }; +} +exports.MethodDescriptorProto = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== undefined && message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== undefined && message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } + if (message.options !== undefined) { + exports.MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); + } + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.inputType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.outputType = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.options = exports.MethodOptions.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.clientStreaming = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.serverStreaming = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", + options: isSet(object.options) ? exports.MethodOptions.fromJSON(object.options) : undefined, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.inputType !== undefined && message.inputType !== "") { + obj.inputType = message.inputType; + } + if (message.outputType !== undefined && message.outputType !== "") { + obj.outputType = message.outputType; + } + if (message.options !== undefined) { + obj.options = exports.MethodOptions.toJSON(message.options); + } + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { + obj.clientStreaming = message.clientStreaming; + } + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { + obj.serverStreaming = message.serverStreaming; + } + return obj; + }, + create(base) { + return exports.MethodDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.inputType = object.inputType ?? ""; + message.outputType = object.outputType ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? exports.MethodOptions.fromPartial(object.options) + : undefined; + message.clientStreaming = object.clientStreaming ?? false; + message.serverStreaming = object.serverStreaming ?? false; + return message; + }, +}; +function createBaseFileOptions() { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + deprecated: false, + ccEnableArenas: true, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + features: undefined, + uninterpretedOption: [], + }; +} +exports.FileOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.javaPackage !== undefined && message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { + writer.uint32(72).int32(message.optimizeFor); + } + if (message.goPackage !== undefined && message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.javaPackage = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.javaOuterClassname = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.javaMultipleFiles = reader.bool(); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + message.javaGenerateEqualsAndHash = reader.bool(); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + message.javaStringCheckUtf8 = reader.bool(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.optimizeFor = reader.int32(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.goPackage = reader.string(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + message.ccGenericServices = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.javaGenericServices = reader.bool(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + message.pyGenericServices = reader.bool(); + continue; + } + case 23: { + if (tag !== 184) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 31: { + if (tag !== 248) { + break; + } + message.ccEnableArenas = reader.bool(); + continue; + } + case 36: { + if (tag !== 290) { + break; + } + message.objcClassPrefix = reader.string(); + continue; + } + case 37: { + if (tag !== 298) { + break; + } + message.csharpNamespace = reader.string(); + continue; + } + case 39: { + if (tag !== 314) { + break; + } + message.swiftPrefix = reader.string(); + continue; + } + case 40: { + if (tag !== 322) { + break; + } + message.phpClassPrefix = reader.string(); + continue; + } + case 41: { + if (tag !== 330) { + break; + } + message.phpNamespace = reader.string(); + continue; + } + case 44: { + if (tag !== 354) { + break; + } + message.phpMetadataNamespace = reader.string(); + continue; + } + case 45: { + if (tag !== 362) { + break; + } + message.rubyPackage = reader.string(); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, + javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) + : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, + optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.javaPackage !== undefined && message.javaPackage !== "") { + obj.javaPackage = message.javaPackage; + } + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { + obj.javaOuterClassname = message.javaOuterClassname; + } + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { + obj.javaMultipleFiles = message.javaMultipleFiles; + } + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { + obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + } + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { + obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; + } + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { + obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); + } + if (message.goPackage !== undefined && message.goPackage !== "") { + obj.goPackage = message.goPackage; + } + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { + obj.ccGenericServices = message.ccGenericServices; + } + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { + obj.javaGenericServices = message.javaGenericServices; + } + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { + obj.pyGenericServices = message.pyGenericServices; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { + obj.ccEnableArenas = message.ccEnableArenas; + } + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { + obj.objcClassPrefix = message.objcClassPrefix; + } + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { + obj.csharpNamespace = message.csharpNamespace; + } + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { + obj.swiftPrefix = message.swiftPrefix; + } + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { + obj.phpClassPrefix = message.phpClassPrefix; + } + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { + obj.phpNamespace = message.phpNamespace; + } + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { + obj.phpMetadataNamespace = message.phpMetadataNamespace; + } + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { + obj.rubyPackage = message.rubyPackage; + } + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.FileOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFileOptions(); + message.javaPackage = object.javaPackage ?? ""; + message.javaOuterClassname = object.javaOuterClassname ?? ""; + message.javaMultipleFiles = object.javaMultipleFiles ?? false; + message.javaGenerateEqualsAndHash = object.javaGenerateEqualsAndHash ?? false; + message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; + message.optimizeFor = object.optimizeFor ?? 1; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; + message.objcClassPrefix = object.objcClassPrefix ?? ""; + message.csharpNamespace = object.csharpNamespace ?? ""; + message.swiftPrefix = object.swiftPrefix ?? ""; + message.phpClassPrefix = object.phpClassPrefix ?? ""; + message.phpNamespace = object.phpNamespace ?? ""; + message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; + message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMessageOptions() { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} +exports.MessageOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry !== undefined && message.mapEntry !== false) { + writer.uint32(56).bool(message.mapEntry); + } + if (message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.messageSetWireFormat = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.noStandardDescriptorAccessor = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.mapEntry = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, + noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { + obj.messageSetWireFormat = message.messageSetWireFormat; + } + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { + obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.mapEntry !== undefined && message.mapEntry !== false) { + obj.mapEntry = message.mapEntry; + } + if (message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.MessageOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMessageOptions(); + message.messageSetWireFormat = object.messageSetWireFormat ?? false; + message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; + message.deprecated = object.deprecated ?? false; + message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFieldOptions() { + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; +} +exports.FieldOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.ctype !== undefined && message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed !== undefined && message.packed !== false) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== undefined && message.jstype !== 0) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy !== undefined && message.lazy !== false) { + writer.uint32(40).bool(message.lazy); + } + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak !== undefined && message.weak !== false) { + writer.uint32(80).bool(message.weak); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + exports.FieldOptions_EditionDefault.encode(v, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + exports.FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.ctype = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.packed = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.jstype = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.lazy = reader.bool(); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + message.unverifiedLazy = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.weak = reader.bool(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + message.debugRedact = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.retention = reader.int32(); + continue; + } + case 19: { + if (tag === 152) { + message.targets.push(reader.int32()); + continue; + } + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32()); + } + continue; + } + break; + } + case 20: { + if (tag !== 162) { + break; + } + message.editionDefaults.push(exports.FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + message.featureSupport = exports.FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + packed: isSet(object.packed) ? globalThis.Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e) => exports.FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? exports.FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.ctype !== undefined && message.ctype !== 0) { + obj.ctype = fieldOptions_CTypeToJSON(message.ctype); + } + if (message.packed !== undefined && message.packed !== false) { + obj.packed = message.packed; + } + if (message.jstype !== undefined && message.jstype !== 0) { + obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); + } + if (message.lazy !== undefined && message.lazy !== false) { + obj.lazy = message.lazy; + } + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.weak !== undefined && message.weak !== false) { + obj.weak = message.weak; + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => exports.FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = exports.FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.FieldOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 0; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 0; + message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => exports.FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? exports.FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFieldOptions_EditionDefault() { + return { edition: 0, value: "" }; +} +exports.FieldOptions_EditionDefault = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + message.edition = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return exports.FieldOptions_EditionDefault.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; +function createBaseFieldOptions_FeatureSupport() { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; +} +exports.FieldOptions_FeatureSupport = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); + } + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_FeatureSupport(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.editionIntroduced = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.editionDeprecated = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.deprecationWarning = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.editionRemoved = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); + } + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + create(base) { + return exports.FieldOptions_FeatureSupport.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; +function createBaseOneofOptions() { + return { features: undefined, uninterpretedOption: [] }; +} +exports.OneofOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.OneofOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEnumOptions() { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} +exports.EnumOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 16) { + break; + } + message.allowAlias = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.EnumOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumOptions(); + message.allowAlias = object.allowAlias ?? false; + message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEnumValueOptions() { + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; +} +exports.EnumValueOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(8).bool(message.deprecated); + } + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + exports.FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.debugRedact = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.featureSupport = exports.FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? exports.FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = exports.FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.EnumValueOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? exports.FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseServiceOptions() { + return { features: undefined, deprecated: false, uninterpretedOption: [] }; +} +exports.ServiceOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 34: { + if (tag !== 274) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 33: { + if (tag !== 264) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.ServiceOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMethodOptions() { + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; +} +exports.MethodOptions = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { + writer.uint32(272).int32(message.idempotencyLevel); + } + if (message.features !== undefined) { + exports.FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } + for (const v of message.uninterpretedOption) { + exports.UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + if (tag !== 264) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 34: { + if (tag !== 272) { + break; + } + message.idempotencyLevel = reader.int32(); + continue; + } + case 35: { + if (tag !== 282) { + break; + } + message.features = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(exports.UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + idempotencyLevel: isSet(object.idempotencyLevel) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) + : 0, + features: isSet(object.features) ? exports.FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { + obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + } + if (message.features !== undefined) { + obj.features = exports.FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => exports.UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.MethodOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? exports.FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => exports.UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseUninterpretedOption() { + return { + name: [], + identifierValue: "", + positiveIntValue: 0, + negativeIntValue: 0, + doubleValue: 0, + stringValue: new Uint8Array(0), + aggregateValue: "", + }; +} +exports.UninterpretedOption = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.name) { + exports.UninterpretedOption_NamePart.encode(v, writer.uint32(18).fork()).join(); + } + if (message.identifierValue !== undefined && message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== undefined && message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue !== undefined && message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.name.push(exports.UninterpretedOption_NamePart.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.identifierValue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.positiveIntValue = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.negativeIntValue = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + message.doubleValue = reader.double(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.stringValue = reader.bytes(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.aggregateValue = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e) => exports.UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, + stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.name?.length) { + obj.name = message.name.map((e) => exports.UninterpretedOption_NamePart.toJSON(e)); + } + if (message.identifierValue !== undefined && message.identifierValue !== "") { + obj.identifierValue = message.identifierValue; + } + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { + obj.positiveIntValue = Math.round(message.positiveIntValue); + } + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { + obj.negativeIntValue = Math.round(message.negativeIntValue); + } + if (message.doubleValue !== undefined && message.doubleValue !== 0) { + obj.doubleValue = message.doubleValue; + } + if (message.stringValue !== undefined && message.stringValue.length !== 0) { + obj.stringValue = base64FromBytes(message.stringValue); + } + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { + obj.aggregateValue = message.aggregateValue; + } + return obj; + }, + create(base) { + return exports.UninterpretedOption.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map((e) => exports.UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifierValue = object.identifierValue ?? ""; + message.positiveIntValue = object.positiveIntValue ?? 0; + message.negativeIntValue = object.negativeIntValue ?? 0; + message.doubleValue = object.doubleValue ?? 0; + message.stringValue = object.stringValue ?? new Uint8Array(0); + message.aggregateValue = object.aggregateValue ?? ""; + return message; + }, +}; +function createBaseUninterpretedOption_NamePart() { + return { namePart: "", isExtension: false }; +} +exports.UninterpretedOption_NamePart = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension !== false) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption_NamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.namePart = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.isExtension = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.namePart !== "") { + obj.namePart = message.namePart; + } + if (message.isExtension !== false) { + obj.isExtension = message.isExtension; + } + return obj; + }, + create(base) { + return exports.UninterpretedOption_NamePart.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUninterpretedOption_NamePart(); + message.namePart = object.namePart ?? ""; + message.isExtension = object.isExtension ?? false; + return message; + }, +}; +function createBaseFeatureSet() { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + enforceNamingStyle: 0, + defaultSymbolVisibility: 0, + }; +} +exports.FeatureSet = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + if (message.enforceNamingStyle !== undefined && message.enforceNamingStyle !== 0) { + writer.uint32(56).int32(message.enforceNamingStyle); + } + if (message.defaultSymbolVisibility !== undefined && message.defaultSymbolVisibility !== 0) { + writer.uint32(64).int32(message.defaultSymbolVisibility); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.fieldPresence = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.enumType = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.repeatedFieldEncoding = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.utf8Validation = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.messageEncoding = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.jsonFormat = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.enforceNamingStyle = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.defaultSymbolVisibility = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + enforceNamingStyle: isSet(object.enforceNamingStyle) + ? featureSet_EnforceNamingStyleFromJSON(object.enforceNamingStyle) + : 0, + defaultSymbolVisibility: isSet(object.defaultSymbolVisibility) + ? featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object.defaultSymbolVisibility) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + if (message.enforceNamingStyle !== undefined && message.enforceNamingStyle !== 0) { + obj.enforceNamingStyle = featureSet_EnforceNamingStyleToJSON(message.enforceNamingStyle); + } + if (message.defaultSymbolVisibility !== undefined && message.defaultSymbolVisibility !== 0) { + obj.defaultSymbolVisibility = featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(message.defaultSymbolVisibility); + } + return obj; + }, + create(base) { + return exports.FeatureSet.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + message.enforceNamingStyle = object.enforceNamingStyle ?? 0; + message.defaultSymbolVisibility = object.defaultSymbolVisibility ?? 0; + return message; + }, +}; +function createBaseFeatureSet_VisibilityFeature() { + return {}; +} +exports.FeatureSet_VisibilityFeature = { + encode(_, writer = new wire_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet_VisibilityFeature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.FeatureSet_VisibilityFeature.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseFeatureSet_VisibilityFeature(); + return message; + }, +}; +function createBaseFeatureSetDefaults() { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} +exports.FeatureSetDefaults = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.defaults) { + exports.FeatureSetDefaults_FeatureSetEditionDefault.encode(v, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.defaults.push(exports.FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.minimumEdition = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.maximumEdition = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e) => exports.FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => exports.FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + create(base) { + return exports.FeatureSetDefaults.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => exports.FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; +function createBaseFeatureSetDefaults_FeatureSetEditionDefault() { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} +exports.FeatureSetDefaults_FeatureSetEditionDefault = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + exports.FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + exports.FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + message.edition = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.overridableFeatures = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.fixedFeatures = exports.FeatureSet.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? exports.FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? exports.FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = exports.FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = exports.FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + create(base) { + return exports.FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? exports.FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? exports.FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; +function createBaseSourceCodeInfo() { + return { location: [] }; +} +exports.SourceCodeInfo = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.location) { + exports.SourceCodeInfo_Location.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.location.push(exports.SourceCodeInfo_Location.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + location: globalThis.Array.isArray(object?.location) + ? object.location.map((e) => exports.SourceCodeInfo_Location.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.location?.length) { + obj.location = message.location.map((e) => exports.SourceCodeInfo_Location.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.SourceCodeInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map((e) => exports.SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, +}; +function createBaseSourceCodeInfo_Location() { + return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; +} +exports.SourceCodeInfo_Location = { + encode(message, writer = new wire_1.BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== undefined && message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } + for (const v of message.leadingDetachedComments) { + writer.uint32(50).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo_Location(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.path.push(reader.int32()); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + continue; + } + break; + } + case 2: { + if (tag === 16) { + message.span.push(reader.int32()); + continue; + } + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + continue; + } + break; + } + case 3: { + if (tag !== 26) { + break; + } + message.leadingComments = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.trailingComments = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.leadingDetachedComments.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: globalThis.Array.isArray(object?.path) ? object.path.map((e) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + if (message.span?.length) { + obj.span = message.span.map((e) => Math.round(e)); + } + if (message.leadingComments !== undefined && message.leadingComments !== "") { + obj.leadingComments = message.leadingComments; + } + if (message.trailingComments !== undefined && message.trailingComments !== "") { + obj.trailingComments = message.trailingComments; + } + if (message.leadingDetachedComments?.length) { + obj.leadingDetachedComments = message.leadingDetachedComments; + } + return obj; + }, + create(base) { + return exports.SourceCodeInfo_Location.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map((e) => e) || []; + message.span = object.span?.map((e) => e) || []; + message.leadingComments = object.leadingComments ?? ""; + message.trailingComments = object.trailingComments ?? ""; + message.leadingDetachedComments = object.leadingDetachedComments?.map((e) => e) || []; + return message; + }, +}; +function createBaseGeneratedCodeInfo() { + return { annotation: [] }; +} +exports.GeneratedCodeInfo = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.annotation) { + exports.GeneratedCodeInfo_Annotation.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.annotation.push(exports.GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + annotation: globalThis.Array.isArray(object?.annotation) + ? object.annotation.map((e) => exports.GeneratedCodeInfo_Annotation.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.annotation?.length) { + obj.annotation = message.annotation.map((e) => exports.GeneratedCodeInfo_Annotation.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.GeneratedCodeInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map((e) => exports.GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, +}; +function createBaseGeneratedCodeInfo_Annotation() { + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; +} +exports.GeneratedCodeInfo_Annotation = { + encode(message, writer = new wire_1.BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== undefined && message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(32).int32(message.end); + } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo_Annotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.path.push(reader.int32()); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + continue; + } + break; + } + case 2: { + if (tag !== 18) { + break; + } + message.sourceFile = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.begin = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.end = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.semantic = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: globalThis.Array.isArray(object?.path) ? object.path.map((e) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + if (message.sourceFile !== undefined && message.sourceFile !== "") { + obj.sourceFile = message.sourceFile; + } + if (message.begin !== undefined && message.begin !== 0) { + obj.begin = Math.round(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } + return obj; + }, + create(base) { + return exports.GeneratedCodeInfo_Annotation.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map((e) => e) || []; + message.sourceFile = object.sourceFile ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/google/protobuf/timestamp.d.ts b/dist/main/coreum/dex/v1/google/protobuf/timestamp.d.ts new file mode 100644 index 0000000..28a0c47 --- /dev/null +++ b/dist/main/coreum/dex/v1/google/protobuf/timestamp.d.ts @@ -0,0 +1,128 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "google.protobuf"; +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} +export declare const Timestamp: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/google/protobuf/timestamp.js b/dist/main/coreum/dex/v1/google/protobuf/timestamp.js new file mode 100644 index 0000000..01f8d7a --- /dev/null +++ b/dist/main/coreum/dex/v1/google/protobuf/timestamp.js @@ -0,0 +1,92 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: google/protobuf/timestamp.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Timestamp = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +exports.protobufPackage = "google.protobuf"; +function createBaseTimestamp() { + return { seconds: 0, nanos: 0 }; +} +exports.Timestamp = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + create(base) { + return exports.Timestamp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/order.d.ts b/dist/main/coreum/dex/v1/order.d.ts new file mode 100644 index 0000000..602edbc --- /dev/null +++ b/dist/main/coreum/dex/v1/order.d.ts @@ -0,0 +1,152 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "./cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin"; +export declare const protobufPackage = "coreum.dex.v1"; +/** Side is order side. */ +export declare enum Side { + /** SIDE_UNSPECIFIED - SIDE_UNSPECIFIED reserves the default value, to protect against unexpected settings. */ + SIDE_UNSPECIFIED = 0, + /** SIDE_BUY - SIDE_BUY means that the order is to buy base_denom quantity with the price. */ + SIDE_BUY = 1, + /** SIDE_SELL - SIDE_SELL means that the order is to sell base_denom quantity with the price. */ + SIDE_SELL = 2, + UNRECOGNIZED = -1 +} +export declare function sideFromJSON(object: any): Side; +export declare function sideToJSON(object: Side): string; +/** Type is order type. */ +export declare enum OrderType { + /** ORDER_TYPE_UNSPECIFIED - order_type_unspecified reserves the default value, to protect against unexpected settings. */ + ORDER_TYPE_UNSPECIFIED = 0, + /** ORDER_TYPE_LIMIT - order_type_limit means that the order is limit order. */ + ORDER_TYPE_LIMIT = 1, + /** ORDER_TYPE_MARKET - limit order_type_market that the order is market order. */ + ORDER_TYPE_MARKET = 2, + UNRECOGNIZED = -1 +} +export declare function orderTypeFromJSON(object: any): OrderType; +export declare function orderTypeToJSON(object: OrderType): string; +/** TimeInForce is order time in force. */ +export declare enum TimeInForce { + /** TIME_IN_FORCE_UNSPECIFIED - time_in_force_unspecified reserves the default value, to protect against unexpected settings. */ + TIME_IN_FORCE_UNSPECIFIED = 0, + /** TIME_IN_FORCE_GTC - time_in_force_gtc means that the order remains active until it is fully executed or manually canceled. */ + TIME_IN_FORCE_GTC = 1, + /** + * TIME_IN_FORCE_IOC - time_in_force_ioc means that order must be executed immediately, either in full or partially. Any portion of the + * order that cannot be filled immediately is canceled. + */ + TIME_IN_FORCE_IOC = 2, + /** TIME_IN_FORCE_FOK - time_in_force_fok means that order must be fully executed or canceled. */ + TIME_IN_FORCE_FOK = 3, + UNRECOGNIZED = -1 +} +export declare function timeInForceFromJSON(object: any): TimeInForce; +export declare function timeInForceToJSON(object: TimeInForce): string; +/** GoodTil is a good til order settings. */ +export interface GoodTil { + /** good_til_block_height means that order remains active until a specific blockchain block height is reached. */ + goodTilBlockHeight: number; + /** good_til_block_time means that order remains active until a specific blockchain block time is reached. */ + goodTilBlockTime: Date | undefined; +} +/** CancelGoodTil is a cancel good til message for the delay router. */ +export interface CancelGoodTil { + /** creator is order creator address. */ + creator: string; + /** order_sequence is order sequence. */ + orderSequence: number; +} +/** + * Order represents a DEX order, encapsulating both limit and market orders. It contains comprehensive information about + * the order's state. + */ +export interface Order { + /** creator is order creator address. */ + creator: string; + /** type is order type. */ + type: OrderType; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence generated at the time of the order placement. */ + sequence: number; + /** base_denom is base order denom. */ + baseDenom: string; + /** quote_denom is quote order denom */ + quoteDenom: string; + /** price is value of one unit of the base_denom expressed in terms of the quote_denom. */ + price: string; + /** quantity is amount of the base base_denom being traded. */ + quantity: string; + /** side is order side. */ + side: Side; + /** remaining_base_quantity - is remaining quantity of base denom which user wants to sell or buy. */ + remainingBaseQuantity: string; + /** remaining_spendable_balance - is balance up to which user wants to spend to execute the order. */ + remainingSpendableBalance: string; + /** good_til is order good til */ + goodTil: GoodTil | undefined; + /** time_in_force is order time in force */ + timeInForce: TimeInForce; + /** reserve is the reserve required to save the order in the order book */ + reserve: Coin | undefined; +} +/** OrderData represents the order information for the store missing in the order book record. */ +export interface OrderData { + /** order ID provided by the creator. */ + orderId: string; + /** order_book_id is order book ID. */ + orderBookId: number; + /** price is value of one unit of the base_denom expressed in terms of the quote_denom. */ + price: string; + /** quantity is amount of the base base_denom being traded. */ + quantity: string; + /** side is order side. */ + side: Side; + /** good_til is order good til */ + goodTil: GoodTil | undefined; + /** reserve is the reserve required to save the order in the order book */ + reserve: Coin | undefined; +} +/** OrderBookData is a order book data used by order for the store. */ +export interface OrderBookData { + /** base_denom is base order book denom. */ + baseDenom: string; + /** quote_denom is quote order book denom */ + quoteDenom: string; +} +/** OrderBookRecordData is a single order book record used for the store. */ +export interface OrderBookRecordData { + /** order ID provided by the creator. */ + orderId: string; + /** account_number is account number which corresponds the order creator. */ + accountNumber: number; + /** remaining_base_quantity - is remaining quantity of base denom which user wants to sell or buy. */ + remainingBaseQuantity: string; + /** remaining_spendable_balance - is balance up to which user wants to spend to execute the order. */ + remainingSpendableBalance: string; +} +export declare const GoodTil: MessageFns; +export declare const CancelGoodTil: MessageFns; +export declare const Order: MessageFns; +export declare const OrderData: MessageFns; +export declare const OrderBookData: MessageFns; +export declare const OrderBookRecordData: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/order.js b/dist/main/coreum/dex/v1/order.js new file mode 100644 index 0000000..22ad2a5 --- /dev/null +++ b/dist/main/coreum/dex/v1/order.js @@ -0,0 +1,959 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/order.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OrderBookRecordData = exports.OrderBookData = exports.OrderData = exports.Order = exports.CancelGoodTil = exports.GoodTil = exports.timeInForceToJSON = exports.timeInForceFromJSON = exports.TimeInForce = exports.orderTypeToJSON = exports.orderTypeFromJSON = exports.OrderType = exports.sideToJSON = exports.sideFromJSON = exports.Side = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +const coin_1 = require("./cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin"); +const timestamp_1 = require("./google/protobuf/timestamp"); +exports.protobufPackage = "coreum.dex.v1"; +/** Side is order side. */ +var Side; +(function (Side) { + /** SIDE_UNSPECIFIED - SIDE_UNSPECIFIED reserves the default value, to protect against unexpected settings. */ + Side[Side["SIDE_UNSPECIFIED"] = 0] = "SIDE_UNSPECIFIED"; + /** SIDE_BUY - SIDE_BUY means that the order is to buy base_denom quantity with the price. */ + Side[Side["SIDE_BUY"] = 1] = "SIDE_BUY"; + /** SIDE_SELL - SIDE_SELL means that the order is to sell base_denom quantity with the price. */ + Side[Side["SIDE_SELL"] = 2] = "SIDE_SELL"; + Side[Side["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(Side || (exports.Side = Side = {})); +function sideFromJSON(object) { + switch (object) { + case 0: + case "SIDE_UNSPECIFIED": + return Side.SIDE_UNSPECIFIED; + case 1: + case "SIDE_BUY": + return Side.SIDE_BUY; + case 2: + case "SIDE_SELL": + return Side.SIDE_SELL; + case -1: + case "UNRECOGNIZED": + default: + return Side.UNRECOGNIZED; + } +} +exports.sideFromJSON = sideFromJSON; +function sideToJSON(object) { + switch (object) { + case Side.SIDE_UNSPECIFIED: + return "SIDE_UNSPECIFIED"; + case Side.SIDE_BUY: + return "SIDE_BUY"; + case Side.SIDE_SELL: + return "SIDE_SELL"; + case Side.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.sideToJSON = sideToJSON; +/** Type is order type. */ +var OrderType; +(function (OrderType) { + /** ORDER_TYPE_UNSPECIFIED - order_type_unspecified reserves the default value, to protect against unexpected settings. */ + OrderType[OrderType["ORDER_TYPE_UNSPECIFIED"] = 0] = "ORDER_TYPE_UNSPECIFIED"; + /** ORDER_TYPE_LIMIT - order_type_limit means that the order is limit order. */ + OrderType[OrderType["ORDER_TYPE_LIMIT"] = 1] = "ORDER_TYPE_LIMIT"; + /** ORDER_TYPE_MARKET - limit order_type_market that the order is market order. */ + OrderType[OrderType["ORDER_TYPE_MARKET"] = 2] = "ORDER_TYPE_MARKET"; + OrderType[OrderType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(OrderType || (exports.OrderType = OrderType = {})); +function orderTypeFromJSON(object) { + switch (object) { + case 0: + case "ORDER_TYPE_UNSPECIFIED": + return OrderType.ORDER_TYPE_UNSPECIFIED; + case 1: + case "ORDER_TYPE_LIMIT": + return OrderType.ORDER_TYPE_LIMIT; + case 2: + case "ORDER_TYPE_MARKET": + return OrderType.ORDER_TYPE_MARKET; + case -1: + case "UNRECOGNIZED": + default: + return OrderType.UNRECOGNIZED; + } +} +exports.orderTypeFromJSON = orderTypeFromJSON; +function orderTypeToJSON(object) { + switch (object) { + case OrderType.ORDER_TYPE_UNSPECIFIED: + return "ORDER_TYPE_UNSPECIFIED"; + case OrderType.ORDER_TYPE_LIMIT: + return "ORDER_TYPE_LIMIT"; + case OrderType.ORDER_TYPE_MARKET: + return "ORDER_TYPE_MARKET"; + case OrderType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.orderTypeToJSON = orderTypeToJSON; +/** TimeInForce is order time in force. */ +var TimeInForce; +(function (TimeInForce) { + /** TIME_IN_FORCE_UNSPECIFIED - time_in_force_unspecified reserves the default value, to protect against unexpected settings. */ + TimeInForce[TimeInForce["TIME_IN_FORCE_UNSPECIFIED"] = 0] = "TIME_IN_FORCE_UNSPECIFIED"; + /** TIME_IN_FORCE_GTC - time_in_force_gtc means that the order remains active until it is fully executed or manually canceled. */ + TimeInForce[TimeInForce["TIME_IN_FORCE_GTC"] = 1] = "TIME_IN_FORCE_GTC"; + /** + * TIME_IN_FORCE_IOC - time_in_force_ioc means that order must be executed immediately, either in full or partially. Any portion of the + * order that cannot be filled immediately is canceled. + */ + TimeInForce[TimeInForce["TIME_IN_FORCE_IOC"] = 2] = "TIME_IN_FORCE_IOC"; + /** TIME_IN_FORCE_FOK - time_in_force_fok means that order must be fully executed or canceled. */ + TimeInForce[TimeInForce["TIME_IN_FORCE_FOK"] = 3] = "TIME_IN_FORCE_FOK"; + TimeInForce[TimeInForce["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(TimeInForce || (exports.TimeInForce = TimeInForce = {})); +function timeInForceFromJSON(object) { + switch (object) { + case 0: + case "TIME_IN_FORCE_UNSPECIFIED": + return TimeInForce.TIME_IN_FORCE_UNSPECIFIED; + case 1: + case "TIME_IN_FORCE_GTC": + return TimeInForce.TIME_IN_FORCE_GTC; + case 2: + case "TIME_IN_FORCE_IOC": + return TimeInForce.TIME_IN_FORCE_IOC; + case 3: + case "TIME_IN_FORCE_FOK": + return TimeInForce.TIME_IN_FORCE_FOK; + case -1: + case "UNRECOGNIZED": + default: + return TimeInForce.UNRECOGNIZED; + } +} +exports.timeInForceFromJSON = timeInForceFromJSON; +function timeInForceToJSON(object) { + switch (object) { + case TimeInForce.TIME_IN_FORCE_UNSPECIFIED: + return "TIME_IN_FORCE_UNSPECIFIED"; + case TimeInForce.TIME_IN_FORCE_GTC: + return "TIME_IN_FORCE_GTC"; + case TimeInForce.TIME_IN_FORCE_IOC: + return "TIME_IN_FORCE_IOC"; + case TimeInForce.TIME_IN_FORCE_FOK: + return "TIME_IN_FORCE_FOK"; + case TimeInForce.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.timeInForceToJSON = timeInForceToJSON; +function createBaseGoodTil() { + return { goodTilBlockHeight: 0, goodTilBlockTime: undefined }; +} +exports.GoodTil = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.goodTilBlockHeight !== 0) { + writer.uint32(8).uint64(message.goodTilBlockHeight); + } + if (message.goodTilBlockTime !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.goodTilBlockTime), writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGoodTil(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.goodTilBlockHeight = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.goodTilBlockTime = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + goodTilBlockHeight: isSet(object.goodTilBlockHeight) + ? globalThis.Number(object.goodTilBlockHeight) + : 0, + goodTilBlockTime: isSet(object.goodTilBlockTime) + ? fromJsonTimestamp(object.goodTilBlockTime) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.goodTilBlockHeight !== 0) { + obj.goodTilBlockHeight = Math.round(message.goodTilBlockHeight); + } + if (message.goodTilBlockTime !== undefined) { + obj.goodTilBlockTime = message.goodTilBlockTime.toISOString(); + } + return obj; + }, + create(base) { + return exports.GoodTil.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGoodTil(); + message.goodTilBlockHeight = object.goodTilBlockHeight ?? 0; + message.goodTilBlockTime = object.goodTilBlockTime ?? undefined; + return message; + }, +}; +function createBaseCancelGoodTil() { + return { creator: "", orderSequence: 0 }; +} +exports.CancelGoodTil = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.orderSequence !== 0) { + writer.uint32(16).uint64(message.orderSequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelGoodTil(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.orderSequence = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + orderSequence: isSet(object.orderSequence) + ? globalThis.Number(object.orderSequence) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.orderSequence !== 0) { + obj.orderSequence = Math.round(message.orderSequence); + } + return obj; + }, + create(base) { + return exports.CancelGoodTil.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCancelGoodTil(); + message.creator = object.creator ?? ""; + message.orderSequence = object.orderSequence ?? 0; + return message; + }, +}; +function createBaseOrder() { + return { + creator: "", + type: 0, + id: "", + sequence: 0, + baseDenom: "", + quoteDenom: "", + price: "", + quantity: "", + side: 0, + remainingBaseQuantity: "", + remainingSpendableBalance: "", + goodTil: undefined, + timeInForce: 0, + reserve: undefined, + }; +} +exports.Order = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + if (message.baseDenom !== "") { + writer.uint32(42).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(50).string(message.quoteDenom); + } + if (message.price !== "") { + writer.uint32(58).string(message.price); + } + if (message.quantity !== "") { + writer.uint32(66).string(message.quantity); + } + if (message.side !== 0) { + writer.uint32(72).int32(message.side); + } + if (message.remainingBaseQuantity !== "") { + writer.uint32(82).string(message.remainingBaseQuantity); + } + if (message.remainingSpendableBalance !== "") { + writer.uint32(90).string(message.remainingSpendableBalance); + } + if (message.goodTil !== undefined) { + exports.GoodTil.encode(message.goodTil, writer.uint32(98).fork()).join(); + } + if (message.timeInForce !== 0) { + writer.uint32(104).int32(message.timeInForce); + } + if (message.reserve !== undefined) { + coin_1.Coin.encode(message.reserve, writer.uint32(114).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.price = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.quantity = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.side = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.remainingBaseQuantity = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.remainingSpendableBalance = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.goodTil = exports.GoodTil.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + message.timeInForce = reader.int32(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.reserve = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + type: isSet(object.type) ? orderTypeFromJSON(object.type) : 0, + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + baseDenom: isSet(object.baseDenom) + ? globalThis.String(object.baseDenom) + : "", + quoteDenom: isSet(object.quoteDenom) + ? globalThis.String(object.quoteDenom) + : "", + price: isSet(object.price) ? globalThis.String(object.price) : "", + quantity: isSet(object.quantity) + ? globalThis.String(object.quantity) + : "", + side: isSet(object.side) ? sideFromJSON(object.side) : 0, + remainingBaseQuantity: isSet(object.remainingBaseQuantity) + ? globalThis.String(object.remainingBaseQuantity) + : "", + remainingSpendableBalance: isSet(object.remainingSpendableBalance) + ? globalThis.String(object.remainingSpendableBalance) + : "", + goodTil: isSet(object.goodTil) + ? exports.GoodTil.fromJSON(object.goodTil) + : undefined, + timeInForce: isSet(object.timeInForce) + ? timeInForceFromJSON(object.timeInForce) + : 0, + reserve: isSet(object.reserve) + ? coin_1.Coin.fromJSON(object.reserve) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.type !== 0) { + obj.type = orderTypeToJSON(message.type); + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + if (message.price !== "") { + obj.price = message.price; + } + if (message.quantity !== "") { + obj.quantity = message.quantity; + } + if (message.side !== 0) { + obj.side = sideToJSON(message.side); + } + if (message.remainingBaseQuantity !== "") { + obj.remainingBaseQuantity = message.remainingBaseQuantity; + } + if (message.remainingSpendableBalance !== "") { + obj.remainingSpendableBalance = message.remainingSpendableBalance; + } + if (message.goodTil !== undefined) { + obj.goodTil = exports.GoodTil.toJSON(message.goodTil); + } + if (message.timeInForce !== 0) { + obj.timeInForce = timeInForceToJSON(message.timeInForce); + } + if (message.reserve !== undefined) { + obj.reserve = coin_1.Coin.toJSON(message.reserve); + } + return obj; + }, + create(base) { + return exports.Order.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrder(); + message.creator = object.creator ?? ""; + message.type = object.type ?? 0; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + message.price = object.price ?? ""; + message.quantity = object.quantity ?? ""; + message.side = object.side ?? 0; + message.remainingBaseQuantity = object.remainingBaseQuantity ?? ""; + message.remainingSpendableBalance = object.remainingSpendableBalance ?? ""; + message.goodTil = + object.goodTil !== undefined && object.goodTil !== null + ? exports.GoodTil.fromPartial(object.goodTil) + : undefined; + message.timeInForce = object.timeInForce ?? 0; + message.reserve = + object.reserve !== undefined && object.reserve !== null + ? coin_1.Coin.fromPartial(object.reserve) + : undefined; + return message; + }, +}; +function createBaseOrderData() { + return { + orderId: "", + orderBookId: 0, + price: "", + quantity: "", + side: 0, + goodTil: undefined, + reserve: undefined, + }; +} +exports.OrderData = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.orderId !== "") { + writer.uint32(10).string(message.orderId); + } + if (message.orderBookId !== 0) { + writer.uint32(16).uint32(message.orderBookId); + } + if (message.price !== "") { + writer.uint32(26).string(message.price); + } + if (message.quantity !== "") { + writer.uint32(34).string(message.quantity); + } + if (message.side !== 0) { + writer.uint32(40).int32(message.side); + } + if (message.goodTil !== undefined) { + exports.GoodTil.encode(message.goodTil, writer.uint32(50).fork()).join(); + } + if (message.reserve !== undefined) { + coin_1.Coin.encode(message.reserve, writer.uint32(58).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orderId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.orderBookId = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.price = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.quantity = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.side = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.goodTil = exports.GoodTil.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.reserve = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orderId: isSet(object.orderId) ? globalThis.String(object.orderId) : "", + orderBookId: isSet(object.orderBookId) + ? globalThis.Number(object.orderBookId) + : 0, + price: isSet(object.price) ? globalThis.String(object.price) : "", + quantity: isSet(object.quantity) + ? globalThis.String(object.quantity) + : "", + side: isSet(object.side) ? sideFromJSON(object.side) : 0, + goodTil: isSet(object.goodTil) + ? exports.GoodTil.fromJSON(object.goodTil) + : undefined, + reserve: isSet(object.reserve) + ? coin_1.Coin.fromJSON(object.reserve) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.orderId !== "") { + obj.orderId = message.orderId; + } + if (message.orderBookId !== 0) { + obj.orderBookId = Math.round(message.orderBookId); + } + if (message.price !== "") { + obj.price = message.price; + } + if (message.quantity !== "") { + obj.quantity = message.quantity; + } + if (message.side !== 0) { + obj.side = sideToJSON(message.side); + } + if (message.goodTil !== undefined) { + obj.goodTil = exports.GoodTil.toJSON(message.goodTil); + } + if (message.reserve !== undefined) { + obj.reserve = coin_1.Coin.toJSON(message.reserve); + } + return obj; + }, + create(base) { + return exports.OrderData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrderData(); + message.orderId = object.orderId ?? ""; + message.orderBookId = object.orderBookId ?? 0; + message.price = object.price ?? ""; + message.quantity = object.quantity ?? ""; + message.side = object.side ?? 0; + message.goodTil = + object.goodTil !== undefined && object.goodTil !== null + ? exports.GoodTil.fromPartial(object.goodTil) + : undefined; + message.reserve = + object.reserve !== undefined && object.reserve !== null + ? coin_1.Coin.fromPartial(object.reserve) + : undefined; + return message; + }, +}; +function createBaseOrderBookData() { + return { baseDenom: "", quoteDenom: "" }; +} +exports.OrderBookData = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.baseDenom !== "") { + writer.uint32(10).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(18).string(message.quoteDenom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderBookData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseDenom: isSet(object.baseDenom) + ? globalThis.String(object.baseDenom) + : "", + quoteDenom: isSet(object.quoteDenom) + ? globalThis.String(object.quoteDenom) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + return obj; + }, + create(base) { + return exports.OrderBookData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrderBookData(); + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + return message; + }, +}; +function createBaseOrderBookRecordData() { + return { + orderId: "", + accountNumber: 0, + remainingBaseQuantity: "", + remainingSpendableBalance: "", + }; +} +exports.OrderBookRecordData = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.orderId !== "") { + writer.uint32(10).string(message.orderId); + } + if (message.accountNumber !== 0) { + writer.uint32(16).uint64(message.accountNumber); + } + if (message.remainingBaseQuantity !== "") { + writer.uint32(26).string(message.remainingBaseQuantity); + } + if (message.remainingSpendableBalance !== "") { + writer.uint32(34).string(message.remainingSpendableBalance); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderBookRecordData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orderId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.remainingBaseQuantity = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.remainingSpendableBalance = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orderId: isSet(object.orderId) ? globalThis.String(object.orderId) : "", + accountNumber: isSet(object.accountNumber) + ? globalThis.Number(object.accountNumber) + : 0, + remainingBaseQuantity: isSet(object.remainingBaseQuantity) + ? globalThis.String(object.remainingBaseQuantity) + : "", + remainingSpendableBalance: isSet(object.remainingSpendableBalance) + ? globalThis.String(object.remainingSpendableBalance) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.orderId !== "") { + obj.orderId = message.orderId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.remainingBaseQuantity !== "") { + obj.remainingBaseQuantity = message.remainingBaseQuantity; + } + if (message.remainingSpendableBalance !== "") { + obj.remainingSpendableBalance = message.remainingSpendableBalance; + } + return obj; + }, + create(base) { + return exports.OrderBookRecordData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrderBookRecordData(); + message.orderId = object.orderId ?? ""; + message.accountNumber = object.accountNumber ?? 0; + message.remainingBaseQuantity = object.remainingBaseQuantity ?? ""; + message.remainingSpendableBalance = object.remainingSpendableBalance ?? ""; + return message; + }, +}; +function toTimestamp(date) { + const seconds = Math.trunc(date.getTime() / 1000); + const nanos = (date.getTime() % 1000) * 1000000; + return { seconds, nanos }; +} +function fromTimestamp(t) { + let millis = (t.seconds || 0) * 1000; + millis += (t.nanos || 0) / 1000000; + return new globalThis.Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof globalThis.Date) { + return o; + } + else if (typeof o === "string") { + return new globalThis.Date(o); + } + else { + return fromTimestamp(timestamp_1.Timestamp.fromJSON(o)); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/params.d.ts b/dist/main/coreum/dex/v1/params.d.ts new file mode 100644 index 0000000..cc68cdf --- /dev/null +++ b/dist/main/coreum/dex/v1/params.d.ts @@ -0,0 +1,36 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "./cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin"; +export declare const protobufPackage = "coreum.dex.v1"; +/** Params keeps gov manageable parameters. */ +export interface Params { + /** default_unified_ref_amount is the default approximate amount you need to buy 1USD, used to for tokens without custom value */ + defaultUnifiedRefAmount: string; + /** price_tick_exponent is the exponent used in price tick calculation formula */ + priceTickExponent: number; + /** quantity_step_exponent is the exponent used in quantity step calculation formula */ + quantityStepExponent: number; + /** max_orders_per_denom is the maximum number of orders per denom the user can have */ + maxOrdersPerDenom: number; + /** order_reserve is the reserve required to save the order in the order book */ + orderReserve: Coin | undefined; +} +export declare const Params: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/params.js b/dist/main/coreum/dex/v1/params.js new file mode 100644 index 0000000..db84a5a --- /dev/null +++ b/dist/main/coreum/dex/v1/params.js @@ -0,0 +1,157 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/params.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Params = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +const coin_1 = require("./cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin"); +exports.protobufPackage = "coreum.dex.v1"; +function createBaseParams() { + return { + defaultUnifiedRefAmount: "", + priceTickExponent: 0, + quantityStepExponent: 0, + maxOrdersPerDenom: 0, + orderReserve: undefined, + }; +} +exports.Params = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.defaultUnifiedRefAmount !== "") { + writer.uint32(10).string(message.defaultUnifiedRefAmount); + } + if (message.priceTickExponent !== 0) { + writer.uint32(16).int32(message.priceTickExponent); + } + if (message.quantityStepExponent !== 0) { + writer.uint32(40).int32(message.quantityStepExponent); + } + if (message.maxOrdersPerDenom !== 0) { + writer.uint32(24).uint64(message.maxOrdersPerDenom); + } + if (message.orderReserve !== undefined) { + coin_1.Coin.encode(message.orderReserve, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.defaultUnifiedRefAmount = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.priceTickExponent = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.quantityStepExponent = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxOrdersPerDenom = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.orderReserve = coin_1.Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + defaultUnifiedRefAmount: isSet(object.defaultUnifiedRefAmount) + ? globalThis.String(object.defaultUnifiedRefAmount) + : "", + priceTickExponent: isSet(object.priceTickExponent) + ? globalThis.Number(object.priceTickExponent) + : 0, + quantityStepExponent: isSet(object.quantityStepExponent) + ? globalThis.Number(object.quantityStepExponent) + : 0, + maxOrdersPerDenom: isSet(object.maxOrdersPerDenom) + ? globalThis.Number(object.maxOrdersPerDenom) + : 0, + orderReserve: isSet(object.orderReserve) + ? coin_1.Coin.fromJSON(object.orderReserve) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.defaultUnifiedRefAmount !== "") { + obj.defaultUnifiedRefAmount = message.defaultUnifiedRefAmount; + } + if (message.priceTickExponent !== 0) { + obj.priceTickExponent = Math.round(message.priceTickExponent); + } + if (message.quantityStepExponent !== 0) { + obj.quantityStepExponent = Math.round(message.quantityStepExponent); + } + if (message.maxOrdersPerDenom !== 0) { + obj.maxOrdersPerDenom = Math.round(message.maxOrdersPerDenom); + } + if (message.orderReserve !== undefined) { + obj.orderReserve = coin_1.Coin.toJSON(message.orderReserve); + } + return obj; + }, + create(base) { + return exports.Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.defaultUnifiedRefAmount = object.defaultUnifiedRefAmount ?? ""; + message.priceTickExponent = object.priceTickExponent ?? 0; + message.quantityStepExponent = object.quantityStepExponent ?? 0; + message.maxOrdersPerDenom = object.maxOrdersPerDenom ?? 0; + message.orderReserve = + object.orderReserve !== undefined && object.orderReserve !== null + ? coin_1.Coin.fromPartial(object.orderReserve) + : undefined; + return message; + }, +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/query.d.ts b/dist/main/coreum/dex/v1/query.d.ts new file mode 100644 index 0000000..242479a --- /dev/null +++ b/dist/main/coreum/dex/v1/query.d.ts @@ -0,0 +1,156 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "./cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination"; +import { Order, OrderBookData, Side } from "./order"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.dex.v1"; +/** QueryParamsRequest defines the request type for querying x/dex parameters. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse defines the response type for querying x/dex parameters. */ +export interface QueryParamsResponse { + params: Params | undefined; +} +/** QueryOrderRequest defines the request type for the `Order` query. */ +export interface QueryOrderRequest { + /** creator is order creator's account. */ + creator: string; + /** id is order ID. */ + id: string; +} +/** QueryOrderRequestResponse defines the response type for the `Order` query. */ +export interface QueryOrderResponse { + order: Order | undefined; +} +/** QueryOrdersRequest defines the request type for the `Orders` query. */ +export interface QueryOrdersRequest { + /** creator is order creator's account. */ + creator: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryOrdersRequestResponse defines the response type for the `Order` query. */ +export interface QueryOrdersResponse { + orders: Order[]; + pagination: PageResponse | undefined; +} +/** QueryOrderBooksRequest defines the request type for the `OrderBooks` query. */ +export interface QueryOrderBooksRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryOrderBooksResponse defines the response type for the `OrderBooks` query. */ +export interface QueryOrderBooksResponse { + orderBooks: OrderBookData[]; + pagination: PageResponse | undefined; +} +/** QueryOrderBookParamsRequest defines the request type for the `OrderBookParams` query. */ +export interface QueryOrderBookParamsRequest { + /** base_denom is base order book denom. */ + baseDenom: string; + /** quote_denom is quote order book denom */ + quoteDenom: string; +} +/** QueryOrderBookParamsResponse defines the response type for the `OrderBookParams` query. */ +export interface QueryOrderBookParamsResponse { + /** price_tick is the minimum price movement an asset price can make, either upward or downward. */ + priceTick: string; + /** quantity_step is the the smallest allowable step for the base asset inside a market. */ + quantityStep: string; + /** base_denom_unified_ref_amount is needed to define price tick & quantity step of base denom */ + baseDenomUnifiedRefAmount: string; + /** quote_denom_unified_ref_amount is needed to define price tick & quantity step of quote denom */ + quoteDenomUnifiedRefAmount: string; +} +/** QueryOrderBookOrdersRequest defines the request type for the `OrderBookOrders` query. */ +export interface QueryOrderBookOrdersRequest { + /** base_denom is base order denom. */ + baseDenom: string; + /** quote_denom is quote order denom */ + quoteDenom: string; + /** side is order side. */ + side: Side; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryOrderBookOrdersResponse defines the response type for the `OrderBookOrders` query. */ +export interface QueryOrderBookOrdersResponse { + orders: Order[]; + pagination: PageResponse | undefined; +} +/** QueryAccountDenomOrdersCountRequest defines the request type for the `AccountDenomOrdersCount` query. */ +export interface QueryAccountDenomOrdersCountRequest { + account: string; + denom: string; +} +/** QueryAccountDenomOrdersCountResponse defines the response type for the `AccountDenomOrdersCount` query. */ +export interface QueryAccountDenomOrdersCountResponse { + count: number; +} +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +export declare const QueryOrderRequest: MessageFns; +export declare const QueryOrderResponse: MessageFns; +export declare const QueryOrdersRequest: MessageFns; +export declare const QueryOrdersResponse: MessageFns; +export declare const QueryOrderBooksRequest: MessageFns; +export declare const QueryOrderBooksResponse: MessageFns; +export declare const QueryOrderBookParamsRequest: MessageFns; +export declare const QueryOrderBookParamsResponse: MessageFns; +export declare const QueryOrderBookOrdersRequest: MessageFns; +export declare const QueryOrderBookOrdersResponse: MessageFns; +export declare const QueryAccountDenomOrdersCountRequest: MessageFns; +export declare const QueryAccountDenomOrdersCountResponse: MessageFns; +/** Query defines the gRPC query service. */ +export interface Query { + /** Params queries the parameters of x/dex module. */ + Params(request: QueryParamsRequest): Promise; + /** Order queries order by creator and ID. */ + Order(request: QueryOrderRequest): Promise; + /** Orders queries creator orders. */ + Orders(request: QueryOrdersRequest): Promise; + /** OrderBooks queries order books. */ + OrderBooks(request: QueryOrderBooksRequest): Promise; + /** OrderBookParams queries order book params. */ + OrderBookParams(request: QueryOrderBookParamsRequest): Promise; + /** OrderBookOrders queries order book orders. */ + OrderBookOrders(request: QueryOrderBookOrdersRequest): Promise; + /** AccountDenomOrdersCount queries account denom orders count. */ + AccountDenomOrdersCount(request: QueryAccountDenomOrdersCountRequest): Promise; +} +export declare const QueryServiceName = "coreum.dex.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Params(request: QueryParamsRequest): Promise; + Order(request: QueryOrderRequest): Promise; + Orders(request: QueryOrdersRequest): Promise; + OrderBooks(request: QueryOrderBooksRequest): Promise; + OrderBookParams(request: QueryOrderBookParamsRequest): Promise; + OrderBookOrders(request: QueryOrderBookOrdersRequest): Promise; + AccountDenomOrdersCount(request: QueryAccountDenomOrdersCountRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/query.js b/dist/main/coreum/dex/v1/query.js new file mode 100644 index 0000000..6c6c1c0 --- /dev/null +++ b/dist/main/coreum/dex/v1/query.js @@ -0,0 +1,1064 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/query.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QueryClientImpl = exports.QueryServiceName = exports.QueryAccountDenomOrdersCountResponse = exports.QueryAccountDenomOrdersCountRequest = exports.QueryOrderBookOrdersResponse = exports.QueryOrderBookOrdersRequest = exports.QueryOrderBookParamsResponse = exports.QueryOrderBookParamsRequest = exports.QueryOrderBooksResponse = exports.QueryOrderBooksRequest = exports.QueryOrdersResponse = exports.QueryOrdersRequest = exports.QueryOrderResponse = exports.QueryOrderRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +const pagination_1 = require("./cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination"); +const order_1 = require("./order"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.dex.v1"; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = new wire_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +exports.QueryParamsResponse = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseQueryOrderRequest() { + return { creator: "", id: "" }; +} +exports.QueryOrderRequest = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.QueryOrderRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderRequest(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseQueryOrderResponse() { + return { order: undefined }; +} +exports.QueryOrderResponse = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.order !== undefined) { + order_1.Order.encode(message.order, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.order = order_1.Order.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + order: isSet(object.order) ? order_1.Order.fromJSON(object.order) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.order !== undefined) { + obj.order = order_1.Order.toJSON(message.order); + } + return obj; + }, + create(base) { + return exports.QueryOrderResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderResponse(); + message.order = + object.order !== undefined && object.order !== null + ? order_1.Order.fromPartial(object.order) + : undefined; + return message; + }, +}; +function createBaseQueryOrdersRequest() { + return { creator: "", pagination: undefined }; +} +exports.QueryOrdersRequest = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrdersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryOrdersRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrdersRequest(); + message.creator = object.creator ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrdersResponse() { + return { orders: [], pagination: undefined }; +} +exports.QueryOrdersResponse = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.orders) { + order_1.Order.encode(v, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrdersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orders.push(order_1.Order.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orders: globalThis.Array.isArray(object?.orders) + ? object.orders.map((e) => order_1.Order.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.orders?.length) { + obj.orders = message.orders.map((e) => order_1.Order.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryOrdersResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrdersResponse(); + message.orders = object.orders?.map((e) => order_1.Order.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrderBooksRequest() { + return { pagination: undefined }; +} +exports.QueryOrderBooksRequest = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBooksRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryOrderBooksRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBooksRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrderBooksResponse() { + return { orderBooks: [], pagination: undefined }; +} +exports.QueryOrderBooksResponse = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.orderBooks) { + order_1.OrderBookData.encode(v, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBooksResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orderBooks.push(order_1.OrderBookData.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orderBooks: globalThis.Array.isArray(object?.orderBooks) + ? object.orderBooks.map((e) => order_1.OrderBookData.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.orderBooks?.length) { + obj.orderBooks = message.orderBooks.map((e) => order_1.OrderBookData.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryOrderBooksResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBooksResponse(); + message.orderBooks = + object.orderBooks?.map((e) => order_1.OrderBookData.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrderBookParamsRequest() { + return { baseDenom: "", quoteDenom: "" }; +} +exports.QueryOrderBookParamsRequest = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.baseDenom !== "") { + writer.uint32(10).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(18).string(message.quoteDenom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBookParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseDenom: isSet(object.baseDenom) + ? globalThis.String(object.baseDenom) + : "", + quoteDenom: isSet(object.quoteDenom) + ? globalThis.String(object.quoteDenom) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + return obj; + }, + create(base) { + return exports.QueryOrderBookParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBookParamsRequest(); + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + return message; + }, +}; +function createBaseQueryOrderBookParamsResponse() { + return { + priceTick: "", + quantityStep: "", + baseDenomUnifiedRefAmount: "", + quoteDenomUnifiedRefAmount: "", + }; +} +exports.QueryOrderBookParamsResponse = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.priceTick !== "") { + writer.uint32(10).string(message.priceTick); + } + if (message.quantityStep !== "") { + writer.uint32(18).string(message.quantityStep); + } + if (message.baseDenomUnifiedRefAmount !== "") { + writer.uint32(26).string(message.baseDenomUnifiedRefAmount); + } + if (message.quoteDenomUnifiedRefAmount !== "") { + writer.uint32(34).string(message.quoteDenomUnifiedRefAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBookParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.priceTick = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.quantityStep = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.baseDenomUnifiedRefAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.quoteDenomUnifiedRefAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + priceTick: isSet(object.priceTick) + ? globalThis.String(object.priceTick) + : "", + quantityStep: isSet(object.quantityStep) + ? globalThis.String(object.quantityStep) + : "", + baseDenomUnifiedRefAmount: isSet(object.baseDenomUnifiedRefAmount) + ? globalThis.String(object.baseDenomUnifiedRefAmount) + : "", + quoteDenomUnifiedRefAmount: isSet(object.quoteDenomUnifiedRefAmount) + ? globalThis.String(object.quoteDenomUnifiedRefAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.priceTick !== "") { + obj.priceTick = message.priceTick; + } + if (message.quantityStep !== "") { + obj.quantityStep = message.quantityStep; + } + if (message.baseDenomUnifiedRefAmount !== "") { + obj.baseDenomUnifiedRefAmount = message.baseDenomUnifiedRefAmount; + } + if (message.quoteDenomUnifiedRefAmount !== "") { + obj.quoteDenomUnifiedRefAmount = message.quoteDenomUnifiedRefAmount; + } + return obj; + }, + create(base) { + return exports.QueryOrderBookParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBookParamsResponse(); + message.priceTick = object.priceTick ?? ""; + message.quantityStep = object.quantityStep ?? ""; + message.baseDenomUnifiedRefAmount = + object.baseDenomUnifiedRefAmount ?? ""; + message.quoteDenomUnifiedRefAmount = + object.quoteDenomUnifiedRefAmount ?? ""; + return message; + }, +}; +function createBaseQueryOrderBookOrdersRequest() { + return { baseDenom: "", quoteDenom: "", side: 0, pagination: undefined }; +} +exports.QueryOrderBookOrdersRequest = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.baseDenom !== "") { + writer.uint32(10).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(18).string(message.quoteDenom); + } + if (message.side !== 0) { + writer.uint32(24).int32(message.side); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBookOrdersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.side = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseDenom: isSet(object.baseDenom) + ? globalThis.String(object.baseDenom) + : "", + quoteDenom: isSet(object.quoteDenom) + ? globalThis.String(object.quoteDenom) + : "", + side: isSet(object.side) ? (0, order_1.sideFromJSON)(object.side) : 0, + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + if (message.side !== 0) { + obj.side = (0, order_1.sideToJSON)(message.side); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryOrderBookOrdersRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBookOrdersRequest(); + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + message.side = object.side ?? 0; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrderBookOrdersResponse() { + return { orders: [], pagination: undefined }; +} +exports.QueryOrderBookOrdersResponse = { + encode(message, writer = new wire_1.BinaryWriter()) { + for (const v of message.orders) { + order_1.Order.encode(v, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBookOrdersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orders.push(order_1.Order.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orders: globalThis.Array.isArray(object?.orders) + ? object.orders.map((e) => order_1.Order.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.orders?.length) { + obj.orders = message.orders.map((e) => order_1.Order.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryOrderBookOrdersResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBookOrdersResponse(); + message.orders = object.orders?.map((e) => order_1.Order.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAccountDenomOrdersCountRequest() { + return { account: "", denom: "" }; +} +exports.QueryAccountDenomOrdersCountRequest = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountDenomOrdersCountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.QueryAccountDenomOrdersCountRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryAccountDenomOrdersCountRequest(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryAccountDenomOrdersCountResponse() { + return { count: 0 }; +} +exports.QueryAccountDenomOrdersCountResponse = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.count !== 0) { + writer.uint32(8).uint64(message.count); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountDenomOrdersCountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + create(base) { + return exports.QueryAccountDenomOrdersCountResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryAccountDenomOrdersCountResponse(); + message.count = object.count ?? 0; + return message; + }, +}; +exports.QueryServiceName = "coreum.dex.v1.Query"; +class QueryClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Order = this.Order.bind(this); + this.Orders = this.Orders.bind(this); + this.OrderBooks = this.OrderBooks.bind(this); + this.OrderBookParams = this.OrderBookParams.bind(this); + this.OrderBookOrders = this.OrderBookOrders.bind(this); + this.AccountDenomOrdersCount = this.AccountDenomOrdersCount.bind(this); + } + Params(request) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new wire_1.BinaryReader(data))); + } + Order(request) { + const data = exports.QueryOrderRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Order", data); + return promise.then((data) => exports.QueryOrderResponse.decode(new wire_1.BinaryReader(data))); + } + Orders(request) { + const data = exports.QueryOrdersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Orders", data); + return promise.then((data) => exports.QueryOrdersResponse.decode(new wire_1.BinaryReader(data))); + } + OrderBooks(request) { + const data = exports.QueryOrderBooksRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "OrderBooks", data); + return promise.then((data) => exports.QueryOrderBooksResponse.decode(new wire_1.BinaryReader(data))); + } + OrderBookParams(request) { + const data = exports.QueryOrderBookParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "OrderBookParams", data); + return promise.then((data) => exports.QueryOrderBookParamsResponse.decode(new wire_1.BinaryReader(data))); + } + OrderBookOrders(request) { + const data = exports.QueryOrderBookOrdersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "OrderBookOrders", data); + return promise.then((data) => exports.QueryOrderBookOrdersResponse.decode(new wire_1.BinaryReader(data))); + } + AccountDenomOrdersCount(request) { + const data = exports.QueryAccountDenomOrdersCountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountDenomOrdersCount", data); + return promise.then((data) => exports.QueryAccountDenomOrdersCountResponse.decode(new wire_1.BinaryReader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/dex/v1/tx.d.ts b/dist/main/coreum/dex/v1/tx.d.ts new file mode 100644 index 0000000..68ef3eb --- /dev/null +++ b/dist/main/coreum/dex/v1/tx.d.ts @@ -0,0 +1,102 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { GoodTil, OrderType, Side, TimeInForce } from "./order"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.dex.v1"; +export interface MsgUpdateParams { + authority: string; + params: Params | undefined; +} +/** MsgPlaceOrder defines message to place an order on orderbook. */ +export interface MsgPlaceOrder { + /** sender is order creator address. */ + sender: string; + /** type is order type. */ + type: OrderType; + /** id is unique order ID. */ + id: string; + /** base_denom is base order denom. */ + baseDenom: string; + /** quote_denom is quote order denom */ + quoteDenom: string; + /** price is value of one unit of the base_denom expressed in terms of the quote_denom. */ + price: string; + /** quantity is amount of the base base_denom being traded. */ + quantity: string; + /** side is order side. */ + side: Side; + /** good_til is order good til */ + goodTil: GoodTil | undefined; + /** time_in_force is order time in force */ + timeInForce: TimeInForce; +} +/** MsgCancelOrder defines message to cancel the order in the orderbook. */ +export interface MsgCancelOrder { + /** sender is order creator address. */ + sender: string; + /** id is unique order ID. */ + id: string; +} +/** MsgCancelOrdersByDenom defines message to cancel all orders by denom and account. */ +export interface MsgCancelOrdersByDenom { + /** sender is order creator address. */ + sender: string; + /** account is order creator address. */ + account: string; + /** denom is orders denom. */ + denom: string; +} +export interface EmptyResponse { +} +export declare const MsgUpdateParams: MessageFns; +export declare const MsgPlaceOrder: MessageFns; +export declare const MsgCancelOrder: MessageFns; +export declare const MsgCancelOrdersByDenom: MessageFns; +export declare const EmptyResponse: MessageFns; +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams is a governance operation to modify the parameters of the module. + * NOTE: all parameters must be provided. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** PlaceOrder place an order on orderbook. */ + PlaceOrder(request: MsgPlaceOrder): Promise; + /** CancelOrder cancels an order in the orderbook. */ + CancelOrder(request: MsgCancelOrder): Promise; + /** CancelOrdersByDenom cancels all orders by denom and account. */ + CancelOrdersByDenom(request: MsgCancelOrdersByDenom): Promise; +} +export declare const MsgServiceName = "coreum.dex.v1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + UpdateParams(request: MsgUpdateParams): Promise; + PlaceOrder(request: MsgPlaceOrder): Promise; + CancelOrder(request: MsgCancelOrder): Promise; + CancelOrdersByDenom(request: MsgCancelOrdersByDenom): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/dex/v1/tx.js b/dist/main/coreum/dex/v1/tx.js new file mode 100644 index 0000000..7a94a55 --- /dev/null +++ b/dist/main/coreum/dex/v1/tx.js @@ -0,0 +1,507 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/tx.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MsgClientImpl = exports.MsgServiceName = exports.EmptyResponse = exports.MsgCancelOrdersByDenom = exports.MsgCancelOrder = exports.MsgPlaceOrder = exports.MsgUpdateParams = exports.protobufPackage = void 0; +/* eslint-disable */ +const wire_1 = require("@bufbuild/protobuf/wire"); +const order_1 = require("./order"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.dex.v1"; +function createBaseMsgUpdateParams() { + return { authority: "", params: undefined }; +} +exports.MsgUpdateParams = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.MsgUpdateParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? params_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseMsgPlaceOrder() { + return { + sender: "", + type: 0, + id: "", + baseDenom: "", + quoteDenom: "", + price: "", + quantity: "", + side: 0, + goodTil: undefined, + timeInForce: 0, + }; +} +exports.MsgPlaceOrder = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.baseDenom !== "") { + writer.uint32(34).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(42).string(message.quoteDenom); + } + if (message.price !== "") { + writer.uint32(50).string(message.price); + } + if (message.quantity !== "") { + writer.uint32(58).string(message.quantity); + } + if (message.side !== 0) { + writer.uint32(64).int32(message.side); + } + if (message.goodTil !== undefined) { + order_1.GoodTil.encode(message.goodTil, writer.uint32(74).fork()).join(); + } + if (message.timeInForce !== 0) { + writer.uint32(80).int32(message.timeInForce); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPlaceOrder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.price = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.quantity = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.side = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.goodTil = order_1.GoodTil.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.timeInForce = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + type: isSet(object.type) ? (0, order_1.orderTypeFromJSON)(object.type) : 0, + id: isSet(object.id) ? globalThis.String(object.id) : "", + baseDenom: isSet(object.baseDenom) ? globalThis.String(object.baseDenom) : "", + quoteDenom: isSet(object.quoteDenom) ? globalThis.String(object.quoteDenom) : "", + price: isSet(object.price) ? globalThis.String(object.price) : "", + quantity: isSet(object.quantity) ? globalThis.String(object.quantity) : "", + side: isSet(object.side) ? (0, order_1.sideFromJSON)(object.side) : 0, + goodTil: isSet(object.goodTil) ? order_1.GoodTil.fromJSON(object.goodTil) : undefined, + timeInForce: isSet(object.timeInForce) ? (0, order_1.timeInForceFromJSON)(object.timeInForce) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.type !== 0) { + obj.type = (0, order_1.orderTypeToJSON)(message.type); + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + if (message.price !== "") { + obj.price = message.price; + } + if (message.quantity !== "") { + obj.quantity = message.quantity; + } + if (message.side !== 0) { + obj.side = (0, order_1.sideToJSON)(message.side); + } + if (message.goodTil !== undefined) { + obj.goodTil = order_1.GoodTil.toJSON(message.goodTil); + } + if (message.timeInForce !== 0) { + obj.timeInForce = (0, order_1.timeInForceToJSON)(message.timeInForce); + } + return obj; + }, + create(base) { + return exports.MsgPlaceOrder.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgPlaceOrder(); + message.sender = object.sender ?? ""; + message.type = object.type ?? 0; + message.id = object.id ?? ""; + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + message.price = object.price ?? ""; + message.quantity = object.quantity ?? ""; + message.side = object.side ?? 0; + message.goodTil = (object.goodTil !== undefined && object.goodTil !== null) + ? order_1.GoodTil.fromPartial(object.goodTil) + : undefined; + message.timeInForce = object.timeInForce ?? 0; + return message; + }, +}; +function createBaseMsgCancelOrder() { + return { sender: "", id: "" }; +} +exports.MsgCancelOrder = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelOrder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.MsgCancelOrder.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgCancelOrder(); + message.sender = object.sender ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseMsgCancelOrdersByDenom() { + return { sender: "", account: "", denom: "" }; +} +exports.MsgCancelOrdersByDenom = { + encode(message, writer = new wire_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.denom !== "") { + writer.uint32(26).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelOrdersByDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return exports.MsgCancelOrdersByDenom.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgCancelOrdersByDenom(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseEmptyResponse() { + return {}; +} +exports.EmptyResponse = { + encode(_, writer = new wire_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmptyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.EmptyResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseEmptyResponse(); + return message; + }, +}; +exports.MsgServiceName = "coreum.dex.v1.Msg"; +class MsgClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.PlaceOrder = this.PlaceOrder.bind(this); + this.CancelOrder = this.CancelOrder.bind(this); + this.CancelOrdersByDenom = this.CancelOrdersByDenom.bind(this); + } + UpdateParams(request) { + const data = exports.MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => exports.EmptyResponse.decode(new wire_1.BinaryReader(data))); + } + PlaceOrder(request) { + const data = exports.MsgPlaceOrder.encode(request).finish(); + const promise = this.rpc.request(this.service, "PlaceOrder", data); + return promise.then((data) => exports.EmptyResponse.decode(new wire_1.BinaryReader(data))); + } + CancelOrder(request) { + const data = exports.MsgCancelOrder.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelOrder", data); + return promise.then((data) => exports.EmptyResponse.decode(new wire_1.BinaryReader(data))); + } + CancelOrdersByDenom(request) { + const data = exports.MsgCancelOrdersByDenom.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelOrdersByDenom", data); + return promise.then((data) => exports.EmptyResponse.decode(new wire_1.BinaryReader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/extensions/dex.d.ts b/dist/main/coreum/extensions/dex.d.ts new file mode 100644 index 0000000..9390e23 --- /dev/null +++ b/dist/main/coreum/extensions/dex.d.ts @@ -0,0 +1,13 @@ +import { QueryParamsResponse, QueryOrderRequest, QueryAccountDenomOrdersCountRequest, QueryAccountDenomOrdersCountResponse, QueryOrderBookOrdersRequest, QueryOrderBookOrdersResponse, QueryOrderBooksRequest, QueryOrderBooksResponse, QueryOrderResponse, QueryOrdersRequest, QueryOrdersResponse, QueryParamsRequest, QueryOrderBookParamsRequest, QueryOrderBookParamsResponse } from "../dex/v1/query"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupDexExtension(base: QueryClient): { + dex: { + params: (params: QueryParamsRequest) => Promise; + order: (params: QueryOrderRequest) => Promise; + orders: (params: QueryOrdersRequest) => Promise; + ordersCountByDenomAndAccount: (params: QueryAccountDenomOrdersCountRequest) => Promise; + orderbook: (params: QueryOrderBookOrdersRequest) => Promise; + orderbooks: (params: QueryOrderBooksRequest) => Promise; + orderbookParams: (params: QueryOrderBookParamsRequest) => Promise; + }; +}; diff --git a/dist/main/coreum/extensions/dex.js b/dist/main/coreum/extensions/dex.js new file mode 100644 index 0000000..eb33721 --- /dev/null +++ b/dist/main/coreum/extensions/dex.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupDexExtension = void 0; +const query_1 = require("../dex/v1/query"); +const stargate_1 = require("@cosmjs/stargate"); +function setupDexExtension(base) { + const rpc = (0, stargate_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + dex: { + params: async (params) => { + return await queryService.Params(params); + }, + order: async (params) => { + return await queryService.Order(params); + }, + orders: async (params) => { + return await queryService.Orders(params); + }, + ordersCountByDenomAndAccount: async (params) => { + return await queryService.AccountDenomOrdersCount(params); + }, + orderbook: async (params) => { + return await queryService.OrderBookOrders(params); + }, + orderbooks: async (params) => { + return await queryService.OrderBooks(params); + }, + orderbookParams: async (params) => { + return await queryService.OrderBookParams(params); + }, + }, + }; +} +exports.setupDexExtension = setupDexExtension; diff --git a/dist/main/coreum/extensions/ft.d.ts b/dist/main/coreum/extensions/ft.d.ts new file mode 100644 index 0000000..169ec09 --- /dev/null +++ b/dist/main/coreum/extensions/ft.d.ts @@ -0,0 +1,14 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryParamsResponse, QueryFrozenBalanceResponse, QueryFrozenBalancesResponse, QueryTokenResponse, QueryTokensResponse, QueryWhitelistedBalanceResponse, QueryWhitelistedBalancesResponse } from "../asset/ft/v1/query"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupFTExtension(base: QueryClient): { + ft: { + params: () => Promise; + tokens: (issuer: string, pagination?: PageRequest) => Promise; + token: (denom: string) => Promise; + frozenBalances: (account: string, pagination?: PageRequest) => Promise; + frozenBalance: (account: string, denom: string) => Promise; + whitelistedBalances: (account: string, pagination?: PageRequest) => Promise; + whitelistedBalance: (account: string, denom: string) => Promise; + }; +}; diff --git a/dist/main/coreum/extensions/ft.js b/dist/main/coreum/extensions/ft.js new file mode 100644 index 0000000..caa1490 --- /dev/null +++ b/dist/main/coreum/extensions/ft.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupFTExtension = void 0; +const query_1 = require("../asset/ft/v1/query"); +const stargate_1 = require("@cosmjs/stargate"); +function setupFTExtension(base) { + const rpc = (0, stargate_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + ft: { + params: async () => { + return await queryService.Params({}); + }, + tokens: async (issuer, pagination) => { + return await queryService.Tokens({ issuer, pagination }); + }, + token: async (denom) => { + return await queryService.Token({ denom }); + }, + frozenBalances: async (account, pagination) => { + return await queryService.FrozenBalances({ account, pagination }); + }, + frozenBalance: async (account, denom) => { + return await queryService.FrozenBalance({ account, denom }); + }, + whitelistedBalances: async (account, pagination) => { + return await queryService.WhitelistedBalances({ account, pagination }); + }, + whitelistedBalance: async (account, denom) => { + return await queryService.WhitelistedBalance({ account, denom }); + }, + }, + }; +} +exports.setupFTExtension = setupFTExtension; diff --git a/dist/main/coreum/extensions/nft.d.ts b/dist/main/coreum/extensions/nft.d.ts new file mode 100644 index 0000000..b22ea56 --- /dev/null +++ b/dist/main/coreum/extensions/nft.d.ts @@ -0,0 +1,12 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryClassResponse, QueryFrozenResponse, QueryWhitelistedAccountsForNFTResponse, QueryWhitelistedResponse, QueryParamsResponse } from "../asset/nft/v1/query"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupNFTExtension(base: QueryClient): { + nft: { + params: () => Promise; + class: (class_id: string) => Promise; + frozen: (nft_id: string, class_id: string) => Promise; + whitelisted: (nft_id: string, class_id: string, account: string) => Promise; + whitelistedAccountsForNFT: (nft_id: string, class_id: string, pagination?: PageRequest) => Promise; + }; +}; diff --git a/dist/main/coreum/extensions/nft.js b/dist/main/coreum/extensions/nft.js new file mode 100644 index 0000000..8ad74bd --- /dev/null +++ b/dist/main/coreum/extensions/nft.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupNFTExtension = void 0; +const query_1 = require("../asset/nft/v1/query"); +const stargate_1 = require("@cosmjs/stargate"); +function setupNFTExtension(base) { + const rpc = (0, stargate_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + nft: { + params: async () => { + return await queryService.Params({}); + }, + class: async (class_id) => { + return await queryService.Class({ id: class_id }); + }, + frozen: async (nft_id, class_id) => { + return await queryService.Frozen({ id: nft_id, classId: class_id }); + }, + whitelisted: async (nft_id, class_id, account) => { + return await queryService.Whitelisted({ + id: nft_id, + classId: class_id, + account, + }); + }, + whitelistedAccountsForNFT: async (nft_id, class_id, pagination) => { + return await queryService.WhitelistedAccountsForNFT({ + id: nft_id, + classId: class_id, + pagination, + }); + }, + }, + }; +} +exports.setupNFTExtension = setupNFTExtension; diff --git a/dist/main/coreum/extensions/nftbeta.d.ts b/dist/main/coreum/extensions/nftbeta.d.ts new file mode 100644 index 0000000..20668a8 --- /dev/null +++ b/dist/main/coreum/extensions/nftbeta.d.ts @@ -0,0 +1,14 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryBalanceResponse, QueryClassResponse, QueryClassesResponse, QueryNFTResponse, QueryNFTsResponse, QueryOwnerResponse, QuerySupplyResponse } from "../nft/v1beta1/query"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupNFTBetaExtension(base: QueryClient): { + nftbeta: { + balance: (class_id: string, owner: string) => Promise; + owner: (class_id: string, nft_id: string) => Promise; + supply: (class_id: string) => Promise; + nfts: (class_id: string, owner: string, pagination?: PageRequest) => Promise; + nft: (nft_id: string, class_id: string) => Promise; + class: (class_id: string) => Promise; + classes: (pagination?: PageRequest) => Promise; + }; +}; diff --git a/dist/main/coreum/extensions/nftbeta.js b/dist/main/coreum/extensions/nftbeta.js new file mode 100644 index 0000000..3fb9c50 --- /dev/null +++ b/dist/main/coreum/extensions/nftbeta.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupNFTBetaExtension = void 0; +const query_1 = require("../nft/v1beta1/query"); +const stargate_1 = require("@cosmjs/stargate"); +function setupNFTBetaExtension(base) { + const rpc = (0, stargate_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + nftbeta: { + balance: async (class_id, owner) => { + return await queryService.Balance({ classId: class_id, owner }); + }, + owner: async (class_id, nft_id) => { + return await queryService.Owner({ + classId: class_id, + id: nft_id, + }); + }, + supply: async (class_id) => { + return await queryService.Supply({ classId: class_id }); + }, + nfts: async (class_id, owner, pagination) => { + return await queryService.NFTs({ + classId: class_id, + owner, + pagination, + }); + }, + nft: async (nft_id, class_id) => { + return await queryService.NFT({ classId: class_id, id: nft_id }); + }, + class: async (class_id) => { + return await queryService.Class({ classId: class_id }); + }, + classes: async (pagination) => { + return await queryService.Classes({ pagination }); + }, + }, + }; +} +exports.setupNFTBetaExtension = setupNFTBetaExtension; diff --git a/dist/main/coreum/feemodel/v1/genesis.d.ts b/dist/main/coreum/feemodel/v1/genesis.d.ts new file mode 100644 index 0000000..8ebe638 --- /dev/null +++ b/dist/main/coreum/feemodel/v1/genesis.d.ts @@ -0,0 +1,31 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DecCoin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.feemodel.v1"; +/** GenesisState defines the module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + /** min_gas_price is the current minimum gas price required by the chain. */ + minGasPrice: DecCoin | undefined; +} +export declare const GenesisState: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/feemodel/v1/genesis.js b/dist/main/coreum/feemodel/v1/genesis.js new file mode 100644 index 0000000..7568fbc --- /dev/null +++ b/dist/main/coreum/feemodel/v1/genesis.js @@ -0,0 +1,92 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/feemodel/genesis.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GenesisState = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.feemodel.v1"; +function createBaseGenesisState() { + return { params: undefined, minGasPrice: undefined }; +} +exports.GenesisState = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.minGasPrice !== undefined) { + coin_1.DecCoin.encode(message.minGasPrice, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.minGasPrice = coin_1.DecCoin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + minGasPrice: isSet(object.minGasPrice) + ? coin_1.DecCoin.fromJSON(object.minGasPrice) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = coin_1.DecCoin.toJSON(message.minGasPrice); + } + return obj; + }, + create(base) { + return exports.GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + message.minGasPrice = + object.minGasPrice !== undefined && object.minGasPrice !== null + ? coin_1.DecCoin.fromPartial(object.minGasPrice) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/feemodel/v1/params.d.ts b/dist/main/coreum/feemodel/v1/params.d.ts new file mode 100644 index 0000000..42fa5b2 --- /dev/null +++ b/dist/main/coreum/feemodel/v1/params.d.ts @@ -0,0 +1,61 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.feemodel.v1"; +/** + * ModelParams define fee model params. + * There are four regions on the fee model curve + * - between 0 and "long average block gas" where gas price goes down exponentially from InitialGasPrice to gas price with maximum discount (InitialGasPrice * (1 - MaxDiscount)) + * - between "long average block gas" and EscalationStartBlockGas (EscalationStartBlockGas = MaxBlockGas * EscalationStartFraction) where we offer gas price with maximum discount all the time + * - between EscalationStartBlockGas (EscalationStartBlockGas = MaxBlockGas * EscalationStartFraction) and MaxBlockGas where price goes up rapidly (being an output of a power function) from gas price with maximum discount to MaxGasPrice (MaxGasPrice = InitialGasPrice * MaxGasMultiplier) + * - above MaxBlockGas (if it happens for any reason) where price is equal to MaxGasPrice (MaxGasPrice = InitialGasPrice * MaxGasMultiplier) + * + * The input (x value) for that function is calculated by taking short block gas average. + * Price (y value) being an output of the fee model is used as the minimum gas price for next block. + */ +export interface ModelParams { + /** initial_gas_price is used when block gas short average is 0. It happens when there are no transactions being broadcasted. This value is also used to initialize gas price on brand-new chain. */ + initialGasPrice: string; + /** max_gas_price_multiplier is used to compute max_gas_price (max_gas_price = initial_gas_price * max_gas_price_multiplier). Max gas price is charged when block gas short average is greater than or equal to MaxBlockGas. This value is used to limit gas price escalation to avoid having possible infinity GasPrice value otherwise. */ + maxGasPriceMultiplier: string; + /** max_discount is th maximum discount we offer on top of initial gas price if short average block gas is between long average block gas and escalation start block gas. */ + maxDiscount: string; + /** escalation_start_fraction defines fraction of max block gas usage where gas price escalation starts if short average block gas is higher than this value. */ + escalationStartFraction: string; + /** max_block_gas sets the maximum capacity of block. This is enforced on tendermint level in genesis configuration. Once short average block gas goes above this value, gas price is a flat line equal to MaxGasPrice. */ + maxBlockGas: number; + /** + * short_ema_block_length defines inertia for short average long gas in EMA model. The equation is: NewAverage = ((ShortAverageBlockLength - 1)*PreviousAverage + GasUsedByCurrentBlock) / ShortAverageBlockLength + * The value might be interpreted as the number of blocks which are taken to calculate the average. It would be exactly like that in SMA model, in EMA this is an approximation. + */ + shortEmaBlockLength: number; + /** + * long_ema_block_length defines inertia for long average block gas in EMA model. The equation is: NewAverage = ((LongAverageBlockLength - 1)*PreviousAverage + GasUsedByCurrentBlock) / LongAverageBlockLength + * The value might be interpreted as the number of blocks which are taken to calculate the average. It would be exactly like that in SMA model, in EMA this is an approximation. + */ + longEmaBlockLength: number; +} +/** Params store gov manageable feemodel parameters. */ +export interface Params { + /** model is a fee model params. */ + model: ModelParams | undefined; +} +export declare const ModelParams: MessageFns; +export declare const Params: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/feemodel/v1/params.js b/dist/main/coreum/feemodel/v1/params.js new file mode 100644 index 0000000..a21442c --- /dev/null +++ b/dist/main/coreum/feemodel/v1/params.js @@ -0,0 +1,247 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/feemodel/params.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Params = exports.ModelParams = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +exports.protobufPackage = "coreum.feemodel.v1"; +function createBaseModelParams() { + return { + initialGasPrice: "", + maxGasPriceMultiplier: "", + maxDiscount: "", + escalationStartFraction: "", + maxBlockGas: 0, + shortEmaBlockLength: 0, + longEmaBlockLength: 0, + }; +} +exports.ModelParams = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.initialGasPrice !== "") { + writer.uint32(10).string(message.initialGasPrice); + } + if (message.maxGasPriceMultiplier !== "") { + writer.uint32(18).string(message.maxGasPriceMultiplier); + } + if (message.maxDiscount !== "") { + writer.uint32(26).string(message.maxDiscount); + } + if (message.escalationStartFraction !== "") { + writer.uint32(34).string(message.escalationStartFraction); + } + if (message.maxBlockGas !== 0) { + writer.uint32(40).int64(message.maxBlockGas); + } + if (message.shortEmaBlockLength !== 0) { + writer.uint32(48).uint32(message.shortEmaBlockLength); + } + if (message.longEmaBlockLength !== 0) { + writer.uint32(56).uint32(message.longEmaBlockLength); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModelParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.initialGasPrice = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.maxGasPriceMultiplier = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.maxDiscount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.escalationStartFraction = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.maxBlockGas = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.shortEmaBlockLength = reader.uint32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.longEmaBlockLength = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + initialGasPrice: isSet(object.initialGasPrice) + ? globalThis.String(object.initialGasPrice) + : "", + maxGasPriceMultiplier: isSet(object.maxGasPriceMultiplier) + ? globalThis.String(object.maxGasPriceMultiplier) + : "", + maxDiscount: isSet(object.maxDiscount) + ? globalThis.String(object.maxDiscount) + : "", + escalationStartFraction: isSet(object.escalationStartFraction) + ? globalThis.String(object.escalationStartFraction) + : "", + maxBlockGas: isSet(object.maxBlockGas) + ? globalThis.Number(object.maxBlockGas) + : 0, + shortEmaBlockLength: isSet(object.shortEmaBlockLength) + ? globalThis.Number(object.shortEmaBlockLength) + : 0, + longEmaBlockLength: isSet(object.longEmaBlockLength) + ? globalThis.Number(object.longEmaBlockLength) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.initialGasPrice !== "") { + obj.initialGasPrice = message.initialGasPrice; + } + if (message.maxGasPriceMultiplier !== "") { + obj.maxGasPriceMultiplier = message.maxGasPriceMultiplier; + } + if (message.maxDiscount !== "") { + obj.maxDiscount = message.maxDiscount; + } + if (message.escalationStartFraction !== "") { + obj.escalationStartFraction = message.escalationStartFraction; + } + if (message.maxBlockGas !== 0) { + obj.maxBlockGas = Math.round(message.maxBlockGas); + } + if (message.shortEmaBlockLength !== 0) { + obj.shortEmaBlockLength = Math.round(message.shortEmaBlockLength); + } + if (message.longEmaBlockLength !== 0) { + obj.longEmaBlockLength = Math.round(message.longEmaBlockLength); + } + return obj; + }, + create(base) { + return exports.ModelParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseModelParams(); + message.initialGasPrice = object.initialGasPrice ?? ""; + message.maxGasPriceMultiplier = object.maxGasPriceMultiplier ?? ""; + message.maxDiscount = object.maxDiscount ?? ""; + message.escalationStartFraction = object.escalationStartFraction ?? ""; + message.maxBlockGas = object.maxBlockGas ?? 0; + message.shortEmaBlockLength = object.shortEmaBlockLength ?? 0; + message.longEmaBlockLength = object.longEmaBlockLength ?? 0; + return message; + }, +}; +function createBaseParams() { + return { model: undefined }; +} +exports.Params = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.model !== undefined) { + exports.ModelParams.encode(message.model, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.model = exports.ModelParams.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + model: isSet(object.model) + ? exports.ModelParams.fromJSON(object.model) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.model !== undefined) { + obj.model = exports.ModelParams.toJSON(message.model); + } + return obj; + }, + create(base) { + return exports.Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.model = + object.model !== undefined && object.model !== null + ? exports.ModelParams.fromPartial(object.model) + : undefined; + return message; + }, +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/feemodel/v1/query.d.ts b/dist/main/coreum/feemodel/v1/query.d.ts new file mode 100644 index 0000000..a64a55a --- /dev/null +++ b/dist/main/coreum/feemodel/v1/query.d.ts @@ -0,0 +1,75 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DecCoin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.feemodel.v1"; +/** QueryMinGasPriceRequest is the request type for the Query/MinGasPrice RPC method. */ +export interface QueryMinGasPriceRequest { +} +/** QueryMinGasPriceResponse is the response type for the Query/MinGasPrice RPC method. */ +export interface QueryMinGasPriceResponse { + /** min_gas_price is the current minimum gas price required by the network. */ + minGasPrice: DecCoin | undefined; +} +export interface QueryRecommendedGasPriceRequest { + afterBlocks: number; +} +export interface QueryRecommendedGasPriceResponse { + low: DecCoin | undefined; + med: DecCoin | undefined; + high: DecCoin | undefined; +} +/** QueryParamsRequest defines the request type for querying x/feemodel parameters. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse defines the response type for querying x/feemodel parameters. */ +export interface QueryParamsResponse { + params: Params | undefined; +} +export declare const QueryMinGasPriceRequest: MessageFns; +export declare const QueryMinGasPriceResponse: MessageFns; +export declare const QueryRecommendedGasPriceRequest: MessageFns; +export declare const QueryRecommendedGasPriceResponse: MessageFns; +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** MinGasPrice queries the current minimum gas price required by the network. */ + MinGasPrice(request: QueryMinGasPriceRequest): Promise; + /** RecommendedGasPrice queries the recommended gas price for the next n blocks. */ + RecommendedGasPrice(request: QueryRecommendedGasPriceRequest): Promise; + /** Params queries the parameters of x/feemodel module. */ + Params(request: QueryParamsRequest): Promise; +} +export declare const QueryServiceName = "coreum.feemodel.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + MinGasPrice(request: QueryMinGasPriceRequest): Promise; + RecommendedGasPrice(request: QueryRecommendedGasPriceRequest): Promise; + Params(request: QueryParamsRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/feemodel/v1/query.js b/dist/main/coreum/feemodel/v1/query.js new file mode 100644 index 0000000..ec6d8f6 --- /dev/null +++ b/dist/main/coreum/feemodel/v1/query.js @@ -0,0 +1,377 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/feemodel/query.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QueryClientImpl = exports.QueryServiceName = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.QueryRecommendedGasPriceResponse = exports.QueryRecommendedGasPriceRequest = exports.QueryMinGasPriceResponse = exports.QueryMinGasPriceRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const params_1 = require("./params"); +exports.protobufPackage = "coreum.feemodel.v1"; +function createBaseQueryMinGasPriceRequest() { + return {}; +} +exports.QueryMinGasPriceRequest = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMinGasPriceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.QueryMinGasPriceRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryMinGasPriceRequest(); + return message; + }, +}; +function createBaseQueryMinGasPriceResponse() { + return { minGasPrice: undefined }; +} +exports.QueryMinGasPriceResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.minGasPrice !== undefined) { + coin_1.DecCoin.encode(message.minGasPrice, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMinGasPriceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.minGasPrice = coin_1.DecCoin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + minGasPrice: isSet(object.minGasPrice) + ? coin_1.DecCoin.fromJSON(object.minGasPrice) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.minGasPrice !== undefined) { + obj.minGasPrice = coin_1.DecCoin.toJSON(message.minGasPrice); + } + return obj; + }, + create(base) { + return exports.QueryMinGasPriceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryMinGasPriceResponse(); + message.minGasPrice = + object.minGasPrice !== undefined && object.minGasPrice !== null + ? coin_1.DecCoin.fromPartial(object.minGasPrice) + : undefined; + return message; + }, +}; +function createBaseQueryRecommendedGasPriceRequest() { + return { afterBlocks: 0 }; +} +exports.QueryRecommendedGasPriceRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.afterBlocks !== 0) { + writer.uint32(8).uint32(message.afterBlocks); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecommendedGasPriceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.afterBlocks = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + afterBlocks: isSet(object.afterBlocks) + ? globalThis.Number(object.afterBlocks) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.afterBlocks !== 0) { + obj.afterBlocks = Math.round(message.afterBlocks); + } + return obj; + }, + create(base) { + return exports.QueryRecommendedGasPriceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryRecommendedGasPriceRequest(); + message.afterBlocks = object.afterBlocks ?? 0; + return message; + }, +}; +function createBaseQueryRecommendedGasPriceResponse() { + return { low: undefined, med: undefined, high: undefined }; +} +exports.QueryRecommendedGasPriceResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.low !== undefined) { + coin_1.DecCoin.encode(message.low, writer.uint32(10).fork()).ldelim(); + } + if (message.med !== undefined) { + coin_1.DecCoin.encode(message.med, writer.uint32(18).fork()).ldelim(); + } + if (message.high !== undefined) { + coin_1.DecCoin.encode(message.high, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecommendedGasPriceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.low = coin_1.DecCoin.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.med = coin_1.DecCoin.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.high = coin_1.DecCoin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + low: isSet(object.low) ? coin_1.DecCoin.fromJSON(object.low) : undefined, + med: isSet(object.med) ? coin_1.DecCoin.fromJSON(object.med) : undefined, + high: isSet(object.high) ? coin_1.DecCoin.fromJSON(object.high) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.low !== undefined) { + obj.low = coin_1.DecCoin.toJSON(message.low); + } + if (message.med !== undefined) { + obj.med = coin_1.DecCoin.toJSON(message.med); + } + if (message.high !== undefined) { + obj.high = coin_1.DecCoin.toJSON(message.high); + } + return obj; + }, + create(base) { + return exports.QueryRecommendedGasPriceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryRecommendedGasPriceResponse(); + message.low = + object.low !== undefined && object.low !== null + ? coin_1.DecCoin.fromPartial(object.low) + : undefined; + message.med = + object.med !== undefined && object.med !== null + ? coin_1.DecCoin.fromPartial(object.med) + : undefined; + message.high = + object.high !== undefined && object.high !== null + ? coin_1.DecCoin.fromPartial(object.high) + : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +exports.QueryParamsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + params_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = params_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? params_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = params_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? params_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +exports.QueryServiceName = "coreum.feemodel.v1.Query"; +class QueryClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.QueryServiceName; + this.rpc = rpc; + this.MinGasPrice = this.MinGasPrice.bind(this); + this.RecommendedGasPrice = this.RecommendedGasPrice.bind(this); + this.Params = this.Params.bind(this); + } + MinGasPrice(request) { + const data = exports.QueryMinGasPriceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "MinGasPrice", data); + return promise.then((data) => exports.QueryMinGasPriceResponse.decode(new binary_1.BinaryReader(data))); + } + RecommendedGasPrice(request) { + const data = exports.QueryRecommendedGasPriceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "RecommendedGasPrice", data); + return promise.then((data) => exports.QueryRecommendedGasPriceResponse.decode(new binary_1.BinaryReader(data))); + } + Params(request) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/index.d.ts b/dist/main/coreum/index.d.ts new file mode 100644 index 0000000..1eeab15 --- /dev/null +++ b/dist/main/coreum/index.d.ts @@ -0,0 +1,263 @@ +import { GeneratedType } from "@cosmjs/proto-signing"; +import { MsgSend as NFTMsgSend } from "./nft/v1beta1/tx"; +import { MsgIssueClass as NFTMsgIssueClass, MsgMint as NFTMsgMint, MsgAddToWhitelist as NFTMsgAddToWhitelist, MsgBurn as NFTMsgBurn, MsgRemoveFromWhitelist as NFTMsgRemoveFromWhitelist, MsgFreeze as NFTMsgFreeze, MsgUnfreeze as NFTMsgUnfreeze } from "./asset/nft/v1/tx"; +import { MsgIssue as FTMsgIssue, MsgMint as FTMsgMint, MsgBurn as FTMsgBurn, MsgFreeze as FTMsgFreeze, MsgUnfreeze as FTMsgUnfreeze, MsgGloballyFreeze as FTMsgGloballyFreeze, MsgGloballyUnfreeze as FTMsgGloballyUnfreeze, MsgSetWhitelistedLimit as FTMsgSetWhitelistedLimit, MsgClawback as FTMsgClawback, MsgUpdateDEXUnifiedRefAmount, MsgUpdateDEXWhitelistedDenoms } from "./asset/ft/v1/tx"; +import { MsgUpdateParams as DEXMsgUpdateParams, MsgPlaceOrder as DEXMsgPlaceOrder, MsgCancelOrder as DEXMsgCancelOrder, MsgCancelOrdersByDenom as DEXMsgCancelOrdersByDenom } from "./dex/v1/tx"; +import { FTMsgs, NFTMsgs } from "../types/msgs"; +export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./amino"; +export { Feature } from "./asset/ft/v1/token"; +export { ClassFeature } from "./asset/nft/v1/nft"; +/** @internal */ +export interface CoreumMessage { + typeUrl: string; + value: any; +} +/** + * Registry of the Custom Messages of the Coreum blockchain + */ +export declare const coreumRegistry: ReadonlyArray<[string, GeneratedType]>; +/** + * Transaction Module for the Fungible Tokens module. (assetft) + */ +export declare namespace FT { + /** MsgMint message creator + * Mints new fungible tokens. + * + * @param object Represents the properties available for this MsgMint message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Mint: (object: FTMsgs.MsgMint) => { + typeUrl: string; + value: FTMsgMint; + }; + /** MsgIssue message creator + * Defines a method to issue a new fungible token. + * + * @param object Represents the properties available for this MsgIssue message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Issue: (object: FTMsgs.MsgIssue) => { + typeUrl: string; + value: FTMsgIssue; + }; + /** MsgBurn message creator + * Burns the specified fungible tokens from senders balance if the sender has enough balance. + * + * @param object Represents the properties available for this MsgBurn message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Burn: (object: FTMsgs.MsgBurn) => { + typeUrl: string; + value: FTMsgBurn; + }; + /** MsgFreeze message creator + * Freezes a part of the fungible tokens in an account, only if the freezable feature is enabled on that token. + * + * @param object Represents the properties available for this MsgIssue message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Freeze: (object: FTMsgs.MsgFreeze) => { + typeUrl: string; + value: FTMsgFreeze; + }; + /** MsgGloballyFreeze message creator + * Freezes fungible token so no operations are allowed with it before unfrozen. This operation is idempotent so global freeze of already frozen token does nothing. + * + * @param object Represents the properties available for this MsgGloballyFreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const GloballyFreeze: (object: FTMsgs.MsgGloballyFreeze) => { + typeUrl: string; + value: FTMsgGloballyFreeze; + }; + /** MsgGloballyUnfreeze message creator + * Unfreezes fungible token and unblocks basic operations on it. This operation is idempotent so global unfreezing of non-frozen token does nothing. + * + * @param object Represents the properties available for this MsgGloballyUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const GloballyUnfreeze: (object: FTMsgs.MsgGloballyUnfreeze) => { + typeUrl: string; + value: FTMsgGloballyUnfreeze; + }; + /** MsgUnfreeze message creator + * Unfreezes a part of the frozen fungible tokens in an account, only if there are such frozen tokens on that account. + * + * @param object Represents the properties available for this MsgUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Unfreeze: (object: FTMsgs.MsgUnfreeze) => { + typeUrl: string; + value: FTMsgUnfreeze; + }; + /** MsgSetWhitelistedLimit message creator + * Sets the limit of how many tokens a specific account may hold. + * + * @param object Represents the properties available for this MsgSetWhitelistedLimit message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SetWhitelistedLimit: (object: FTMsgs.MsgSetWhitelistedLimit) => { + typeUrl: string; + value: FTMsgSetWhitelistedLimit; + }; + /** MsgClawback message creator + * Clawbacks the assets from the specific address. + * + * @param object Represents the properties available for this MsgClawback message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Clawback: (object: FTMsgs.MsgClawback) => { + typeUrl: string; + value: FTMsgClawback; + }; + /** MsgUpdateDEXUnifiedRefAmount + * Updates DEX unified ref amount. + * + * @param object Represents the properties available for this MsgUpdateDEXUnifiedRefAmount message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateDEXUnifiedRefAmount: (object: MsgUpdateDEXUnifiedRefAmount) => { + typeUrl: string; + value: MsgUpdateDEXUnifiedRefAmount; + }; + /** MsgUpdateDEXWhitelistedDenoms + * Updates DEX unified ref amount. + * + * @param object Represents the properties available for this MsgUpdateDEXWhitelistedDenoms message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateDEXWhitelistedDenoms: (object: MsgUpdateDEXWhitelistedDenoms) => { + typeUrl: string; + value: MsgUpdateDEXWhitelistedDenoms; + }; +} +/** + * Transaction Module for the Non-Fungible Tokens modules (assetnft, nftbeta). + */ +export declare namespace NFT { + /** MsgMint message creator + * Mints new non-fungible token in the class. + * + * @param object Represents the properties available for this MsgMint message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Mint: (object: NFTMsgs.MsgMint) => { + typeUrl: string; + value: NFTMsgMint; + }; + /** MsgAddToWhitelist message creator + * Sets the account as whitelisted to hold the NFT + * + * @param object Represents the properties available for this MsgAddToWhitelist message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const AddToWhitelist: (object: NFTMsgs.MsgAddToWhitelist) => { + typeUrl: string; + value: NFTMsgAddToWhitelist; + }; + /** MsgRemoveFromWhitelist message creator + * Removes an account from whitelisted list of the NFT + * + * @param object Represents the properties available for this MsgRemoveFromWhitelist message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const RemoveFromWhitelist: (object: NFTMsgs.MsgRemoveFromWhitelist) => { + typeUrl: string; + value: NFTMsgRemoveFromWhitelist; + }; + /** MsgBurn message creator + * Burns the existing non-fungible token in the class. + * + * @param object Represents the properties available for this MsgBurn message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Burn: (object: NFTMsgs.MsgBurn) => { + typeUrl: string; + value: NFTMsgBurn; + }; + /** MsgFreeze message creator + * Freezes an NFT + * + * @param object Represents the properties available for this MsgFreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Freeze: (object: NFTMsgs.MsgFreeze) => { + typeUrl: string; + value: NFTMsgFreeze; + }; + /** MsgUnfreeze message creator + * Removes the freeze effect already put on an NFT + * + * @param object Represents the properties available for this MsgUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Unfreeze: (object: NFTMsgs.MsgUnfreeze) => { + typeUrl: string; + value: NFTMsgUnfreeze; + }; + /** MsgIssueClass message creator + * Creates new non-fungible token class. + * + * @param object Represents the properties available for this MsgIssueClass message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const IssueClass: (object: NFTMsgIssueClass) => { + typeUrl: string; + value: NFTMsgIssueClass; + }; + /** MsgSend message creator + * Represents a message to send a nft from one account to another account. + * + * @param object Represents the properties available for this MsgSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Send: (object: NFTMsgs.MsgSend) => { + typeUrl: string; + value: NFTMsgSend; + }; +} +/** + * Transaction Module for the DEX module + */ +export declare namespace DEX { + /** MsgPlaceOrder message creator + * Places a new order on the native DEX + * + * @param object Represents the properties available for this MsgPlaceOrder message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const PlaceOrder: (object: DEXMsgPlaceOrder) => { + typeUrl: string; + value: DEXMsgPlaceOrder; + }; + /** MsgCancelOrder message creator + * Cancels an order by ID + * + * @param object Represents the properties available for this MsgCancelOrder message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CancelOrder: (object: DEXMsgCancelOrder) => { + typeUrl: string; + value: DEXMsgCancelOrder; + }; + /** MsgUpdateParams message creator + * Updates module parameters + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: DEXMsgUpdateParams) => { + typeUrl: string; + value: DEXMsgUpdateParams; + }; + /** MsgCancelOrdersByDenom message creator + * Cancels all existing orders by denom + * + * @param object Represents the properties available for this MsgCancelOrdersByDenom message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CancelOrdersByDenom: (object: DEXMsgCancelOrdersByDenom) => { + typeUrl: string; + value: DEXMsgCancelOrdersByDenom; + }; +} diff --git a/dist/main/coreum/index.js b/dist/main/coreum/index.js new file mode 100644 index 0000000..0607cd4 --- /dev/null +++ b/dist/main/coreum/index.js @@ -0,0 +1,325 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DEX = exports.NFT = exports.FT = exports.coreumRegistry = exports.ClassFeature = exports.Feature = exports.nftBetaAminoConverters = exports.nftAminoConverters = exports.dexAminoConverters = exports.ftAminoConverters = exports.coreumAminoConverters = exports.createCoreumAminoTypes = void 0; +const asset_1 = require("./asset"); +const nft_1 = require("./nft"); +const dex_1 = require("./dex"); +const tx_1 = require("./nft/v1beta1/tx"); +const tx_2 = require("./asset/nft/v1/tx"); +const tx_3 = require("./asset/ft/v1/tx"); +const tx_4 = require("./dex/v1/tx"); +// Export AminoTypes +var amino_1 = require("./amino"); +Object.defineProperty(exports, "createCoreumAminoTypes", { enumerable: true, get: function () { return amino_1.createCoreumAminoTypes; } }); +Object.defineProperty(exports, "coreumAminoConverters", { enumerable: true, get: function () { return amino_1.coreumAminoConverters; } }); +Object.defineProperty(exports, "ftAminoConverters", { enumerable: true, get: function () { return amino_1.ftAminoConverters; } }); +Object.defineProperty(exports, "dexAminoConverters", { enumerable: true, get: function () { return amino_1.dexAminoConverters; } }); +Object.defineProperty(exports, "nftAminoConverters", { enumerable: true, get: function () { return amino_1.nftAminoConverters; } }); +Object.defineProperty(exports, "nftBetaAminoConverters", { enumerable: true, get: function () { return amino_1.nftBetaAminoConverters; } }); +var token_1 = require("./asset/ft/v1/token"); +Object.defineProperty(exports, "Feature", { enumerable: true, get: function () { return token_1.Feature; } }); +var nft_2 = require("./asset/nft/v1/nft"); +Object.defineProperty(exports, "ClassFeature", { enumerable: true, get: function () { return nft_2.ClassFeature; } }); +/** + * Registry of the Custom Messages of the Coreum blockchain + */ +exports.coreumRegistry = [ + ...asset_1.assetFtRegistry, + ...asset_1.assetNftRegistry, + ...nft_1.nftBetaRegistry, + ...dex_1.dexRegistry, +]; +/** + * Transaction Module for the Fungible Tokens module. (assetft) + */ +var FT; +(function (FT) { + /** MsgMint message creator + * Mints new fungible tokens. + * + * @param object Represents the properties available for this MsgMint message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Mint = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgMint", + value: tx_3.MsgMint.fromPartial(object), + }; + }; + /** MsgIssue message creator + * Defines a method to issue a new fungible token. + * + * @param object Represents the properties available for this MsgIssue message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Issue = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgIssue", + value: tx_3.MsgIssue.fromPartial(object), + }; + }; + /** MsgBurn message creator + * Burns the specified fungible tokens from senders balance if the sender has enough balance. + * + * @param object Represents the properties available for this MsgBurn message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Burn = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgBurn", + value: tx_3.MsgBurn.fromPartial(object), + }; + }; + /** MsgFreeze message creator + * Freezes a part of the fungible tokens in an account, only if the freezable feature is enabled on that token. + * + * @param object Represents the properties available for this MsgIssue message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Freeze = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgFreeze", + value: tx_3.MsgFreeze.fromPartial(object), + }; + }; + /** MsgGloballyFreeze message creator + * Freezes fungible token so no operations are allowed with it before unfrozen. This operation is idempotent so global freeze of already frozen token does nothing. + * + * @param object Represents the properties available for this MsgGloballyFreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.GloballyFreeze = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgGloballyFreeze", + value: tx_3.MsgGloballyFreeze.fromPartial(object), + }; + }; + /** MsgGloballyUnfreeze message creator + * Unfreezes fungible token and unblocks basic operations on it. This operation is idempotent so global unfreezing of non-frozen token does nothing. + * + * @param object Represents the properties available for this MsgGloballyUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.GloballyUnfreeze = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgGloballyUnfreeze", + value: tx_3.MsgGloballyUnfreeze.fromPartial(object), + }; + }; + /** MsgUnfreeze message creator + * Unfreezes a part of the frozen fungible tokens in an account, only if there are such frozen tokens on that account. + * + * @param object Represents the properties available for this MsgUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Unfreeze = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgUnfreeze", + value: tx_3.MsgUnfreeze.fromPartial(object), + }; + }; + /** MsgSetWhitelistedLimit message creator + * Sets the limit of how many tokens a specific account may hold. + * + * @param object Represents the properties available for this MsgSetWhitelistedLimit message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.SetWhitelistedLimit = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgSetWhitelistedLimit", + value: tx_3.MsgSetWhitelistedLimit.fromPartial(object), + }; + }; + /** MsgClawback message creator + * Clawbacks the assets from the specific address. + * + * @param object Represents the properties available for this MsgClawback message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Clawback = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgClawback", + value: tx_3.MsgClawback.fromPartial(object), + }; + }; + /** MsgUpdateDEXUnifiedRefAmount + * Updates DEX unified ref amount. + * + * @param object Represents the properties available for this MsgUpdateDEXUnifiedRefAmount message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.UpdateDEXUnifiedRefAmount = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgUpdateDEXUnifiedRefAmount", + value: tx_3.MsgUpdateDEXUnifiedRefAmount.fromPartial(object), + }; + }; + /** MsgUpdateDEXWhitelistedDenoms + * Updates DEX unified ref amount. + * + * @param object Represents the properties available for this MsgUpdateDEXWhitelistedDenoms message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.UpdateDEXWhitelistedDenoms = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgUpdateDEXWhitelistedDenoms", + value: tx_3.MsgUpdateDEXWhitelistedDenoms.fromPartial(object), + }; + }; +})(FT || (exports.FT = FT = {})); +/** + * Transaction Module for the Non-Fungible Tokens modules (assetnft, nftbeta). + */ +var NFT; +(function (NFT) { + /** MsgMint message creator + * Mints new non-fungible token in the class. + * + * @param object Represents the properties available for this MsgMint message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Mint = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgMint", + value: tx_2.MsgMint.fromPartial(object), + }; + }; + /** MsgAddToWhitelist message creator + * Sets the account as whitelisted to hold the NFT + * + * @param object Represents the properties available for this MsgAddToWhitelist message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.AddToWhitelist = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgAddToWhitelist", + value: tx_2.MsgAddToWhitelist.fromPartial(object), + }; + }; + /** MsgRemoveFromWhitelist message creator + * Removes an account from whitelisted list of the NFT + * + * @param object Represents the properties available for this MsgRemoveFromWhitelist message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.RemoveFromWhitelist = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgRemoveFromWhitelist", + value: tx_2.MsgRemoveFromWhitelist.fromPartial(object), + }; + }; + /** MsgBurn message creator + * Burns the existing non-fungible token in the class. + * + * @param object Represents the properties available for this MsgBurn message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Burn = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgBurn", + value: tx_2.MsgBurn.fromPartial(object), + }; + }; + /** MsgFreeze message creator + * Freezes an NFT + * + * @param object Represents the properties available for this MsgFreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Freeze = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgFreeze", + value: tx_2.MsgFreeze.fromPartial(object), + }; + }; + /** MsgUnfreeze message creator + * Removes the freeze effect already put on an NFT + * + * @param object Represents the properties available for this MsgUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Unfreeze = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgUnfreeze", + value: tx_2.MsgUnfreeze.fromPartial(object), + }; + }; + /** MsgIssueClass message creator + * Creates new non-fungible token class. + * + * @param object Represents the properties available for this MsgIssueClass message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.IssueClass = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgIssueClass", + value: tx_2.MsgIssueClass.fromPartial(object), + }; + }; + /** MsgSend message creator + * Represents a message to send a nft from one account to another account. + * + * @param object Represents the properties available for this MsgSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Send = function (object) { + return { + typeUrl: "/cosmos.nft.v1beta1.MsgSend", + value: tx_1.MsgSend.fromPartial(object), + }; + }; +})(NFT || (exports.NFT = NFT = {})); +/** + * Transaction Module for the DEX module + */ +var DEX; +(function (DEX) { + /** MsgPlaceOrder message creator + * Places a new order on the native DEX + * + * @param object Represents the properties available for this MsgPlaceOrder message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + DEX.PlaceOrder = function (object) { + return { + typeUrl: "/coreum.dex.v1.MsgPlaceOrder", + value: tx_4.MsgPlaceOrder.fromPartial(object), + }; + }; + /** MsgCancelOrder message creator + * Cancels an order by ID + * + * @param object Represents the properties available for this MsgCancelOrder message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + DEX.CancelOrder = function (object) { + return { + typeUrl: "/coreum.dex.v1.MsgCancelOrder", + value: tx_4.MsgCancelOrder.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * Updates module parameters + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + DEX.UpdateParams = function (object) { + return { + typeUrl: "/coreum.dex.v1.MsgUpdateParams", + value: tx_4.MsgUpdateParams.fromPartial(object), + }; + }; + /** MsgCancelOrdersByDenom message creator + * Cancels all existing orders by denom + * + * @param object Represents the properties available for this MsgCancelOrdersByDenom message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + DEX.CancelOrdersByDenom = function (object) { + return { + typeUrl: "/coreum.dex.v1.MsgCancelOrdersByDenom", + value: tx_4.MsgCancelOrdersByDenom.fromPartial(object), + }; + }; +})(DEX || (exports.DEX = DEX = {})); diff --git a/dist/main/coreum/nft/index.d.ts b/dist/main/coreum/nft/index.d.ts new file mode 100644 index 0000000..1a9585f --- /dev/null +++ b/dist/main/coreum/nft/index.d.ts @@ -0,0 +1 @@ +export declare const nftBetaRegistry: ReadonlyArray<[string, any]>; diff --git a/dist/main/coreum/nft/index.js b/dist/main/coreum/nft/index.js new file mode 100644 index 0000000..a58995e --- /dev/null +++ b/dist/main/coreum/nft/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.nftBetaRegistry = void 0; +const types_1 = require("../../types"); +const tx_1 = require("./v1beta1/tx"); +exports.nftBetaRegistry = [ + [types_1.CoreumTypeUrl.NFTBeta + "MsgSend", tx_1.MsgSend], +]; diff --git a/dist/main/coreum/nft/v1beta1/event.d.ts b/dist/main/coreum/nft/v1beta1/event.d.ts new file mode 100644 index 0000000..7391ae7 --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/event.d.ts @@ -0,0 +1,53 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** EventSend is emitted on Msg/Send */ +export interface EventSend { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} +/** EventMint is emitted on Mint */ +export interface EventMint { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} +/** EventBurn is emitted on Burn */ +export interface EventBurn { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} +export declare const EventSend: MessageFns; +export declare const EventMint: MessageFns; +export declare const EventBurn: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/nft/v1beta1/event.js b/dist/main/coreum/nft/v1beta1/event.js new file mode 100644 index 0000000..c0e015d --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/event.js @@ -0,0 +1,280 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/event.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EventBurn = exports.EventMint = exports.EventSend = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +exports.protobufPackage = "cosmos.nft.v1beta1"; +function createBaseEventSend() { + return { classId: "", id: "", sender: "", receiver: "" }; +} +exports.EventSend = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.sender = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.receiver = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) + ? globalThis.String(object.receiver) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + create(base) { + return exports.EventSend.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; +function createBaseEventMint() { + return { classId: "", id: "", owner: "" }; +} +exports.EventMint = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return exports.EventMint.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventMint(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseEventBurn() { + return { classId: "", id: "", owner: "" }; +} +exports.EventBurn = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return exports.EventBurn.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventBurn(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/nft/v1beta1/genesis.d.ts b/dist/main/coreum/nft/v1beta1/genesis.d.ts new file mode 100644 index 0000000..0ff0a81 --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/genesis.d.ts @@ -0,0 +1,38 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Class, NFT } from "./nft"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** GenesisState defines the nft module's genesis state. */ +export interface GenesisState { + /** class defines the class of the nft type. */ + classes: Class[]; + /** entry defines all nft owned by a person. */ + entries: Entry[]; +} +/** Entry Defines all nft owned by a person */ +export interface Entry { + /** owner is the owner address of the following nft */ + owner: string; + /** nfts is a group of nfts of the same owner */ + nfts: NFT[]; +} +export declare const GenesisState: MessageFns; +export declare const Entry: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/nft/v1beta1/genesis.js b/dist/main/coreum/nft/v1beta1/genesis.js new file mode 100644 index 0000000..3cfb2f8 --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/genesis.js @@ -0,0 +1,157 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/genesis.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Entry = exports.GenesisState = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const nft_1 = require("./nft"); +exports.protobufPackage = "cosmos.nft.v1beta1"; +function createBaseGenesisState() { + return { classes: [], entries: [] }; +} +exports.GenesisState = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.classes) { + nft_1.Class.encode(v, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.entries) { + exports.Entry.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classes.push(nft_1.Class.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.entries.push(exports.Entry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classes: globalThis.Array.isArray(object?.classes) + ? object.classes.map((e) => nft_1.Class.fromJSON(e)) + : [], + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e) => exports.Entry.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classes?.length) { + obj.classes = message.classes.map((e) => nft_1.Class.toJSON(e)); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => exports.Entry.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.classes = object.classes?.map((e) => nft_1.Class.fromPartial(e)) || []; + message.entries = object.entries?.map((e) => exports.Entry.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEntry() { + return { owner: "", nfts: [] }; +} +exports.Entry = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + for (const v of message.nfts) { + nft_1.NFT.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.owner = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nfts.push(nft_1.NFT.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + nfts: globalThis.Array.isArray(object?.nfts) + ? object.nfts.map((e) => nft_1.NFT.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => nft_1.NFT.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.Entry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEntry(); + message.owner = object.owner ?? ""; + message.nfts = object.nfts?.map((e) => nft_1.NFT.fromPartial(e)) || []; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/nft/v1beta1/nft.d.ts b/dist/main/coreum/nft/v1beta1/nft.d.ts new file mode 100644 index 0000000..d9f51d2 --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/nft.d.ts @@ -0,0 +1,54 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** Class defines the class of the nft type. */ +export interface Class { + /** id defines the unique identifier of the NFT classification, similar to the contract address of ERC721 */ + id: string; + /** name defines the human-readable name of the NFT classification. Optional */ + name: string; + /** symbol is an abbreviated name for nft classification. Optional */ + symbol: string; + /** description is a brief description of nft classification. Optional */ + description: string; + /** uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional */ + uri: string; + /** uri_hash is a hash of the document pointed by uri. Optional */ + uriHash: string; + /** data is the app specific metadata of the NFT class. Optional */ + data: Any | undefined; +} +/** NFT defines the NFT. */ +export interface NFT { + /** class_id associated with the NFT, similar to the contract address of ERC721 */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; + /** uri for the NFT metadata stored off chain */ + uri: string; + /** uri_hash is a hash of the document pointed by uri */ + uriHash: string; + /** data is an app specific data of the NFT. Optional */ + data: Any | undefined; +} +export declare const Class: MessageFns; +export declare const NFT: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/nft/v1beta1/nft.js b/dist/main/coreum/nft/v1beta1/nft.js new file mode 100644 index 0000000..aa12479 --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/nft.js @@ -0,0 +1,287 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/nft.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NFT = exports.Class = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const any_1 = require("cosmjs-types/google/protobuf/any"); +exports.protobufPackage = "cosmos.nft.v1beta1"; +function createBaseClass() { + return { + id: "", + name: "", + symbol: "", + description: "", + uri: "", + uriHash: "", + data: undefined, + }; +} +exports.Class = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + if (message.uri !== "") { + writer.uint32(42).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(50).string(message.uriHash); + } + if (message.data !== undefined) { + any_1.Any.encode(message.data, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.symbol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.description = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.uri = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.data = any_1.Any.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? any_1.Any.fromJSON(object.data) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = any_1.Any.toJSON(message.data); + } + return obj; + }, + create(base) { + return exports.Class.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClass(); + message.id = object.id ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? any_1.Any.fromPartial(object.data) + : undefined; + return message; + }, +}; +function createBaseNFT() { + return { classId: "", id: "", uri: "", uriHash: "", data: undefined }; +} +exports.NFT = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.uri !== "") { + writer.uint32(26).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(34).string(message.uriHash); + } + if (message.data !== undefined) { + any_1.Any.encode(message.data, writer.uint32(82).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNFT(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.uri = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.data = any_1.Any.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? any_1.Any.fromJSON(object.data) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = any_1.Any.toJSON(message.data); + } + return obj; + }, + create(base) { + return exports.NFT.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNFT(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? any_1.Any.fromPartial(object.data) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/nft/v1beta1/query.d.ts b/dist/main/coreum/nft/v1beta1/query.d.ts new file mode 100644 index 0000000..2b4f2d1 --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/query.d.ts @@ -0,0 +1,159 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Class, NFT } from "./nft"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** QueryBalanceRequest is the request type for the Query/Balance RPC method */ +export interface QueryBalanceRequest { + /** class_id associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; +} +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponse { + /** amount is the number of all NFTs of a given class owned by the owner */ + amount: number; +} +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponse { + /** owner is the owner address of the nft */ + owner: string; +} +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequest { + /** class_id associated with the nft */ + classId: string; +} +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponse { + /** amount is the number of all NFTs from the given class */ + amount: number; +} +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequest { + /** class_id associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponse { + /** NFT defines the NFT */ + nfts: NFT[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponse { + /** owner is the owner address of the nft */ + nft: NFT | undefined; +} +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequest { + /** class_id associated with the nft */ + classId: string; +} +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponse { + /** class defines the class of the nft type. */ + class: Class | undefined; +} +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponse { + /** class defines the class of the nft type. */ + classes: Class[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +export declare const QueryBalanceRequest: MessageFns; +export declare const QueryBalanceResponse: MessageFns; +export declare const QueryOwnerRequest: MessageFns; +export declare const QueryOwnerResponse: MessageFns; +export declare const QuerySupplyRequest: MessageFns; +export declare const QuerySupplyResponse: MessageFns; +export declare const QueryNFTsRequest: MessageFns; +export declare const QueryNFTsResponse: MessageFns; +export declare const QueryNFTRequest: MessageFns; +export declare const QueryNFTResponse: MessageFns; +export declare const QueryClassRequest: MessageFns; +export declare const QueryClassResponse: MessageFns; +export declare const QueryClassesRequest: MessageFns; +export declare const QueryClassesResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 */ + Balance(request: QueryBalanceRequest): Promise; + /** Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 */ + Owner(request: QueryOwnerRequest): Promise; + /** Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. */ + Supply(request: QuerySupplyRequest): Promise; + /** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + */ + NFTs(request: QueryNFTsRequest): Promise; + /** NFT queries an NFT based on its class and id. */ + NFT(request: QueryNFTRequest): Promise; + /** Class queries an NFT class based on its id */ + Class(request: QueryClassRequest): Promise; + /** Classes queries all NFT classes */ + Classes(request: QueryClassesRequest): Promise; +} +export declare const QueryServiceName = "cosmos.nft.v1beta1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Balance(request: QueryBalanceRequest): Promise; + Owner(request: QueryOwnerRequest): Promise; + Supply(request: QuerySupplyRequest): Promise; + NFTs(request: QueryNFTsRequest): Promise; + NFT(request: QueryNFTRequest): Promise; + Class(request: QueryClassRequest): Promise; + Classes(request: QueryClassesRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/nft/v1beta1/query.js b/dist/main/coreum/nft/v1beta1/query.js new file mode 100644 index 0000000..6b0b60f --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/query.js @@ -0,0 +1,951 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/query.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QueryClientImpl = exports.QueryServiceName = exports.QueryClassesResponse = exports.QueryClassesRequest = exports.QueryClassResponse = exports.QueryClassRequest = exports.QueryNFTResponse = exports.QueryNFTRequest = exports.QueryNFTsResponse = exports.QueryNFTsRequest = exports.QuerySupplyResponse = exports.QuerySupplyRequest = exports.QueryOwnerResponse = exports.QueryOwnerRequest = exports.QueryBalanceResponse = exports.QueryBalanceRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const pagination_1 = require("cosmjs-types/cosmos/base/query/v1beta1/pagination"); +const nft_1 = require("./nft"); +exports.protobufPackage = "cosmos.nft.v1beta1"; +function createBaseQueryBalanceRequest() { + return { classId: "", owner: "" }; +} +exports.QueryBalanceRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return exports.QueryBalanceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBalanceRequest(); + message.classId = object.classId ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseQueryBalanceResponse() { + return { amount: 0 }; +} +exports.QueryBalanceResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.amount = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + create(base) { + return exports.QueryBalanceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBalanceResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; +function createBaseQueryOwnerRequest() { + return { classId: "", id: "" }; +} +exports.QueryOwnerRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOwnerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.QueryOwnerRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOwnerRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseQueryOwnerResponse() { + return { owner: "" }; +} +exports.QueryOwnerResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOwnerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return exports.QueryOwnerResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOwnerResponse(); + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseQuerySupplyRequest() { + return { classId: "" }; +} +exports.QuerySupplyRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return exports.QuerySupplyRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQuerySupplyRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQuerySupplyResponse() { + return { amount: 0 }; +} +exports.QuerySupplyResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.amount = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + create(base) { + return exports.QuerySupplyResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQuerySupplyResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; +function createBaseQueryNFTsRequest() { + return { classId: "", owner: "", pagination: undefined }; +} +exports.QueryNFTsRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.owner = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryNFTsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryNFTsRequest(); + message.classId = object.classId ?? ""; + message.owner = object.owner ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryNFTsResponse() { + return { nfts: [], pagination: undefined }; +} +exports.QueryNFTsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.nfts) { + nft_1.NFT.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.nfts.push(nft_1.NFT.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nfts: globalThis.Array.isArray(object?.nfts) + ? object.nfts.map((e) => nft_1.NFT.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => nft_1.NFT.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryNFTsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryNFTsResponse(); + message.nfts = object.nfts?.map((e) => nft_1.NFT.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryNFTRequest() { + return { classId: "", id: "" }; +} +exports.QueryNFTRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return exports.QueryNFTRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryNFTRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseQueryNFTResponse() { + return { nft: undefined }; +} +exports.QueryNFTResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.nft !== undefined) { + nft_1.NFT.encode(message.nft, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.nft = nft_1.NFT.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { nft: isSet(object.nft) ? nft_1.NFT.fromJSON(object.nft) : undefined }; + }, + toJSON(message) { + const obj = {}; + if (message.nft !== undefined) { + obj.nft = nft_1.NFT.toJSON(message.nft); + } + return obj; + }, + create(base) { + return exports.QueryNFTResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryNFTResponse(); + message.nft = + object.nft !== undefined && object.nft !== null + ? nft_1.NFT.fromPartial(object.nft) + : undefined; + return message; + }, +}; +function createBaseQueryClassRequest() { + return { classId: "" }; +} +exports.QueryClassRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return exports.QueryClassRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryClassResponse() { + return { class: undefined }; +} +exports.QueryClassResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.class !== undefined) { + nft_1.Class.encode(message.class, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.class = nft_1.Class.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + class: isSet(object.class) ? nft_1.Class.fromJSON(object.class) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.class !== undefined) { + obj.class = nft_1.Class.toJSON(message.class); + } + return obj; + }, + create(base) { + return exports.QueryClassResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassResponse(); + message.class = + object.class !== undefined && object.class !== null + ? nft_1.Class.fromPartial(object.class) + : undefined; + return message; + }, +}; +function createBaseQueryClassesRequest() { + return { pagination: undefined }; +} +exports.QueryClassesRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryClassesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryClassesResponse() { + return { classes: [], pagination: undefined }; +} +exports.QueryClassesResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.classes) { + nft_1.Class.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classes.push(nft_1.Class.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classes: globalThis.Array.isArray(object?.classes) + ? object.classes.map((e) => nft_1.Class.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.classes?.length) { + obj.classes = message.classes.map((e) => nft_1.Class.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryClassesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassesResponse(); + message.classes = object.classes?.map((e) => nft_1.Class.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +exports.QueryServiceName = "cosmos.nft.v1beta1.Query"; +class QueryClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.QueryServiceName; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.Owner = this.Owner.bind(this); + this.Supply = this.Supply.bind(this); + this.NFTs = this.NFTs.bind(this); + this.NFT = this.NFT.bind(this); + this.Class = this.Class.bind(this); + this.Classes = this.Classes.bind(this); + } + Balance(request) { + const data = exports.QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => exports.QueryBalanceResponse.decode(new binary_1.BinaryReader(data))); + } + Owner(request) { + const data = exports.QueryOwnerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Owner", data); + return promise.then((data) => exports.QueryOwnerResponse.decode(new binary_1.BinaryReader(data))); + } + Supply(request) { + const data = exports.QuerySupplyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Supply", data); + return promise.then((data) => exports.QuerySupplyResponse.decode(new binary_1.BinaryReader(data))); + } + NFTs(request) { + const data = exports.QueryNFTsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "NFTs", data); + return promise.then((data) => exports.QueryNFTsResponse.decode(new binary_1.BinaryReader(data))); + } + NFT(request) { + const data = exports.QueryNFTRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "NFT", data); + return promise.then((data) => exports.QueryNFTResponse.decode(new binary_1.BinaryReader(data))); + } + Class(request) { + const data = exports.QueryClassRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Class", data); + return promise.then((data) => exports.QueryClassResponse.decode(new binary_1.BinaryReader(data))); + } + Classes(request) { + const data = exports.QueryClassesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Classes", data); + return promise.then((data) => exports.QueryClassesResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/coreum/nft/v1beta1/tx.d.ts b/dist/main/coreum/nft/v1beta1/tx.d.ts new file mode 100644 index 0000000..7610a63 --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/tx.d.ts @@ -0,0 +1,54 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** MsgSend represents a message to send a nft from one account to another account. */ +export interface MsgSend { + /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ + classId: string; + /** id defines the unique identification of nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponse { +} +export declare const MsgSend: MessageFns; +export declare const MsgSendResponse: MessageFns; +/** Msg defines the nft Msg service. */ +export interface Msg { + /** Send defines a method to send a nft from one account to another account. */ + Send(request: MsgSend): Promise; +} +export declare const MsgServiceName = "cosmos.nft.v1beta1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Send(request: MsgSend): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/coreum/nft/v1beta1/tx.js b/dist/main/coreum/nft/v1beta1/tx.js new file mode 100644 index 0000000..9a5481e --- /dev/null +++ b/dist/main/coreum/nft/v1beta1/tx.js @@ -0,0 +1,165 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/tx.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MsgClientImpl = exports.MsgServiceName = exports.MsgSendResponse = exports.MsgSend = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +exports.protobufPackage = "cosmos.nft.v1beta1"; +function createBaseMsgSend() { + return { classId: "", id: "", sender: "", receiver: "" }; +} +exports.MsgSend = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.sender = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.receiver = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) + ? globalThis.String(object.receiver) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + create(base) { + return exports.MsgSend.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; +function createBaseMsgSendResponse() { + return {}; +} +exports.MsgSendResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.MsgSendResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgSendResponse(); + return message; + }, +}; +exports.MsgServiceName = "cosmos.nft.v1beta1.Msg"; +class MsgClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.MsgServiceName; + this.rpc = rpc; + this.Send = this.Send.bind(this); + } + Send(request) { + const data = exports.MsgSend.encode(request).finish(); + const promise = this.rpc.request(this.service, "Send", data); + return promise.then((data) => exports.MsgSendResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/cosmos/extensions/bank.d.ts b/dist/main/cosmos/extensions/bank.d.ts new file mode 100644 index 0000000..4d8556b --- /dev/null +++ b/dist/main/cosmos/extensions/bank.d.ts @@ -0,0 +1,15 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupBankExtension(base: QueryClient): { + bank: { + balance: (address: string, denom: string) => Promise; + allBalances: (address: string) => Promise; + totalSupply: (pagination?: PageRequest) => Promise<{ + supply: import("cosmjs-types/cosmos/base/v1beta1/coin").Coin[]; + pagination: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + supplyOf: (denom: string) => Promise; + denomMetadata: (denom: string) => Promise; + denomsMetadata: (pagination?: PageRequest) => Promise; + }; +}; diff --git a/dist/main/cosmos/extensions/bank.js b/dist/main/cosmos/extensions/bank.js new file mode 100644 index 0000000..5db026d --- /dev/null +++ b/dist/main/cosmos/extensions/bank.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupBankExtension = void 0; +const query_1 = require("cosmjs-types/cosmos/bank/v1beta1/query"); +const query_2 = require("cosmjs-types/cosmos/bank/v1beta1/query"); +const stargate_1 = require("@cosmjs/stargate"); +function setupBankExtension(base) { + const rpc = (0, stargate_1.createProtobufRpcClient)(base); + const queryService = new query_2.QueryClientImpl(rpc); + return { + bank: { + balance: async (address, denom) => { + const { balance } = await queryService.Balance({ address, denom }); + return balance; + }, + allBalances: async (address) => { + const { balances } = await queryService.AllBalances(query_1.QueryAllBalancesRequest.fromPartial({ address })); + return balances; + }, + totalSupply: async (pagination) => { + const supplyResponse = await queryService.TotalSupply({ pagination }); + return { + supply: supplyResponse.supply, + pagination: supplyResponse.pagination, + }; + }, + supplyOf: async (denom) => { + const { amount } = await queryService.SupplyOf({ denom }); + return amount; + }, + denomMetadata: async (denom) => { + const { metadata } = await queryService.DenomMetadata({ denom }); + return metadata; + }, + denomsMetadata: async (pagination) => { + const { metadatas } = await queryService.DenomsMetadata({ pagination }); + return metadatas; + }, + }, + }; +} +exports.setupBankExtension = setupBankExtension; diff --git a/dist/main/cosmos/extensions/distribution.d.ts b/dist/main/cosmos/extensions/distribution.d.ts new file mode 100644 index 0000000..c8e1c14 --- /dev/null +++ b/dist/main/cosmos/extensions/distribution.d.ts @@ -0,0 +1,35 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupDistributionExtension(base: QueryClient): { + distribution: { + communityPool: () => Promise<{ + pool: import("cosmjs-types/cosmos/base/v1beta1/coin").DecCoin[]; + }>; + delegationRewards: (delegator: string, validator: string) => Promise<{ + rewards: import("cosmjs-types/cosmos/base/v1beta1/coin").DecCoin[]; + }>; + delegationTotalRewards: (delegator: string) => Promise<{ + rewards: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").DelegationDelegatorReward[]; + total: import("cosmjs-types/cosmos/base/v1beta1/coin").DecCoin[]; + }>; + delegatorValidators: (delegator: string) => Promise<{ + validators: string[]; + }>; + delegatorWithdrawAddress: (delegator: string) => Promise<{ + withdrawAddress: string; + }>; + params: () => Promise<{ + params: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").Params; + }>; + validatorCommission: (validator: string) => Promise<{ + commission: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").ValidatorAccumulatedCommission; + }>; + validatorOutstandingRewards: (validator: string) => Promise<{ + rewards: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").ValidatorOutstandingRewards; + }>; + validatorSlashes: (validator: string, starting_height: bigint, ending_height: bigint, pagination?: PageRequest) => Promise<{ + slashes: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").ValidatorSlashEvent[]; + pagination?: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + }; +}; diff --git a/dist/main/cosmos/extensions/distribution.js b/dist/main/cosmos/extensions/distribution.js new file mode 100644 index 0000000..9d152a7 --- /dev/null +++ b/dist/main/cosmos/extensions/distribution.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupDistributionExtension = void 0; +const query_1 = require("cosmjs-types/cosmos/distribution/v1beta1/query"); +const stargate_1 = require("@cosmjs/stargate"); +function setupDistributionExtension(base) { + const rpc = (0, stargate_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + distribution: { + communityPool: async () => { + const response = await queryService.CommunityPool({}); + return { ...response }; + }, + delegationRewards: async (delegator, validator) => { + const response = await queryService.DelegationRewards({ + delegatorAddress: delegator, + validatorAddress: validator, + }); + return { ...response }; + }, + delegationTotalRewards: async (delegator) => { + const response = await queryService.DelegationTotalRewards({ + delegatorAddress: delegator, + }); + return { ...response }; + }, + delegatorValidators: async (delegator) => { + const response = await queryService.DelegatorValidators({ + delegatorAddress: delegator, + }); + return { ...response }; + }, + delegatorWithdrawAddress: async (delegator) => { + const response = await queryService.DelegatorWithdrawAddress({ + delegatorAddress: delegator, + }); + return { ...response }; + }, + params: async () => { + const response = await queryService.Params({}); + return { ...response }; + }, + validatorCommission: async (validator) => { + const response = await queryService.ValidatorCommission({ + validatorAddress: validator, + }); + return { ...response }; + }, + validatorOutstandingRewards: async (validator) => { + const response = await queryService.ValidatorOutstandingRewards({ + validatorAddress: validator, + }); + return { ...response }; + }, + validatorSlashes: async (validator, starting_height, ending_height, pagination) => { + const response = await queryService.ValidatorSlashes({ + validatorAddress: validator, + startingHeight: starting_height, + endingHeight: ending_height, + pagination, + }); + return { ...response }; + }, + }, + }; +} +exports.setupDistributionExtension = setupDistributionExtension; diff --git a/dist/main/cosmos/extensions/gov.d.ts b/dist/main/cosmos/extensions/gov.d.ts new file mode 100644 index 0000000..2a726d2 --- /dev/null +++ b/dist/main/cosmos/extensions/gov.d.ts @@ -0,0 +1,36 @@ +import { ProposalStatus } from "cosmjs-types/cosmos/gov/v1beta1/gov"; +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupGovExtension(base: QueryClient): { + gov: { + params: (parametersType: "deposit" | "tallying" | "voting") => Promise<{ + votingParams: import("cosmjs-types/cosmos/gov/v1beta1/gov").VotingParams; + depositParams: import("cosmjs-types/cosmos/gov/v1beta1/gov").DepositParams; + tallyParams: import("cosmjs-types/cosmos/gov/v1beta1/gov").TallyParams; + }>; + proposals: (proposalStatus: ProposalStatus, depositor: string, voter: string, pagination?: PageRequest) => Promise<{ + proposals: import("cosmjs-types/cosmos/gov/v1beta1/gov").Proposal[]; + pagination?: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + proposal: (proposal_id: bigint) => Promise<{ + proposal: import("cosmjs-types/cosmos/gov/v1beta1/gov").Proposal; + }>; + deposits: (proposal_id: bigint, pagination?: PageRequest) => Promise<{ + deposits: import("cosmjs-types/cosmos/gov/v1beta1/gov").Deposit[]; + pagination?: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + deposit: (proposal_id: bigint, depositor: string) => Promise<{ + deposit: import("cosmjs-types/cosmos/gov/v1beta1/gov").Deposit; + }>; + tally: (proposal_id: bigint) => Promise<{ + tally: import("cosmjs-types/cosmos/gov/v1beta1/gov").TallyResult; + }>; + votes: (proposal_id: bigint, pagination?: PageRequest) => Promise<{ + votes: import("cosmjs-types/cosmos/gov/v1beta1/gov").Vote[]; + pagination?: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + vote: (proposal_id: bigint, voter: string) => Promise<{ + vote: import("cosmjs-types/cosmos/gov/v1beta1/gov").Vote; + }>; + }; +}; diff --git a/dist/main/cosmos/extensions/gov.js b/dist/main/cosmos/extensions/gov.js new file mode 100644 index 0000000..0c92e40 --- /dev/null +++ b/dist/main/cosmos/extensions/gov.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupGovExtension = void 0; +const query_1 = require("cosmjs-types/cosmos/gov/v1beta1/query"); +const stargate_1 = require("@cosmjs/stargate"); +function setupGovExtension(base) { + const rpc = (0, stargate_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + gov: { + params: async (parametersType) => { + const response = await queryService.Params({ + paramsType: parametersType, + }); + return { + ...response, + }; + }, + proposals: async (proposalStatus, depositor, voter, pagination) => { + const response = await queryService.Proposals({ + proposalStatus, + depositor, + voter, + pagination, + }); + return { + ...response, + }; + }, + proposal: async (proposal_id) => { + const response = await queryService.Proposal({ + proposalId: proposal_id, + }); + return { ...response }; + }, + deposits: async (proposal_id, pagination) => { + const response = await queryService.Deposits({ + proposalId: proposal_id, + pagination, + }); + return { + ...response, + }; + }, + deposit: async (proposal_id, depositor) => { + const response = await queryService.Deposit({ + proposalId: proposal_id, + depositor, + }); + return { ...response }; + }, + tally: async (proposal_id) => { + const response = await queryService.TallyResult({ + proposalId: proposal_id, + }); + return { ...response }; + }, + votes: async (proposal_id, pagination) => { + const response = await queryService.Votes({ + proposalId: proposal_id, + pagination, + }); + return { ...response }; + }, + vote: async (proposal_id, voter) => { + const response = await queryService.Vote({ + proposalId: proposal_id, + voter, + }); + return { ...response }; + }, + }, + }; +} +exports.setupGovExtension = setupGovExtension; diff --git a/dist/main/cosmos/extensions/index.d.ts b/dist/main/cosmos/extensions/index.d.ts new file mode 100644 index 0000000..a246917 --- /dev/null +++ b/dist/main/cosmos/extensions/index.d.ts @@ -0,0 +1,3 @@ +export * from "./bank"; +export * from "./gov"; +export * from "./distribution"; diff --git a/dist/main/cosmos/extensions/index.js b/dist/main/cosmos/extensions/index.js new file mode 100644 index 0000000..b62336d --- /dev/null +++ b/dist/main/cosmos/extensions/index.js @@ -0,0 +1,19 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./bank"), exports); +__exportStar(require("./gov"), exports); +__exportStar(require("./distribution"), exports); diff --git a/dist/main/cosmos/index.d.ts b/dist/main/cosmos/index.d.ts new file mode 100644 index 0000000..e979a2f --- /dev/null +++ b/dist/main/cosmos/index.d.ts @@ -0,0 +1,316 @@ +import { MsgDeposit, MsgSubmitProposal, MsgVote, MsgVoteWeighted } from "cosmjs-types/cosmos/gov/v1beta1/tx"; +import { MsgGrantAllowance, MsgRevokeAllowance } from "cosmjs-types/cosmos/feegrant/v1beta1/tx"; +import { MsgCommunityPoolSpend, MsgFundCommunityPool, MsgSetWithdrawAddress, MsgUpdateParams as DMsgUpdateParams, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission } from "cosmjs-types/cosmos/distribution/v1beta1/tx"; +import { MsgCreatePeriodicVestingAccount, MsgCreatePermanentLockedAccount, MsgCreateVestingAccount } from "cosmjs-types/cosmos/vesting/v1beta1/tx"; +import { MsgBeginRedelegate, MsgCancelUnbondingDelegation, MsgCreateValidator, MsgDelegate, MsgEditValidator, MsgUndelegate, MsgUpdateParams as SMsgUpdateParams } from "cosmjs-types/cosmos/staking/v1beta1/tx"; +import { MsgExec, MsgGrant, MsgRevoke } from "cosmjs-types/cosmos/authz/v1beta1/tx"; +import { MsgMultiSend, MsgSend, MsgSetSendEnabled, MsgUpdateParams } from "cosmjs-types/cosmos/bank/v1beta1/tx"; +import { StakingMsgs, DistributionMsgs, BankMsgs, FeegrantMsgs, GovMsgs } from "../types/msgs"; +export * from "cosmjs-types/cosmos/tx/v1beta1/tx"; +/** + * Module to generate the Messages related to the Authz module of the Blockchain + */ +export declare namespace Authz { + /** MsgGrant message creator + * Grants the provided authorization to the grantee on the granter's account with the provided expiration time. If there is already a grant for the given (granter, grantee, Authorization) triple, then the grant will be overwritten. + * + * @param object Represents the properties available for this MsgGrant message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Grant: (object: MsgGrant) => { + typeUrl: string; + value: MsgGrant; + }; + /** MsgExec message creator + * Attempts to execute the provided messages using authorizations granted to the grantee. Each message should have only one signer corresponding to the granter of the authorization. + * + * @param object Represents the properties available for this MsgExec message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Exec: (object: MsgExec) => { + typeUrl: string; + value: MsgExec; + }; + /** MsgRevoke message creator + * Revokes any authorization corresponding to the provided method name on the granter's account that has been granted to the grantee. + * + * @param object Represents the properties available for this MsgRevoke message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Revoke: (object: MsgRevoke) => { + typeUrl: string; + value: MsgRevoke; + }; +} +/** + * Module to generate the Messages related to the Staking module of the Blockchain + */ +export declare namespace Staking { + /** MsgBeginRedelegate message creator + * Defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator. + * + * @param object Represents the properties available for this MsgBeginRedelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const BeginRedelegate: (object: StakingMsgs.MsgBeginRedelegate) => { + typeUrl: string; + value: MsgBeginRedelegate; + }; + /** MsgCancelUnbondingDelegation message creator + * + * @param object Represents the properties available for this MsgCancelUnbondingDelegation message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CancelUnbondingDelegation: (object: MsgCancelUnbondingDelegation) => { + typeUrl: string; + value: MsgCancelUnbondingDelegation; + }; + /** MsgCreateValidator message creator + * Defines a method for creating a new validator. + * + * @param object Represents the properties available for this MsgCreateValidator message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CreateValidator: (object: StakingMsgs.MsgCreateValidator) => { + typeUrl: string; + value: MsgCreateValidator; + }; + /** MsgDelegate message creator + * Defines a method for performing a delegation of coins from a delegator to a validator. + * + * @param object Represents the properties available for this MsgDelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Delegate: (object: StakingMsgs.MsgDelegate) => { + typeUrl: string; + value: MsgDelegate; + }; + /** MsgEditValidator message creator + * Defines a method for editing an existing validator. + * + * @param object Represents the properties available for this MsgEditValidator message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const EditValidator: (object: StakingMsgs.MsgEditValidator) => { + typeUrl: string; + value: MsgEditValidator; + }; + /** MsgUndelegate message creator + * Defines a method for performing an undelegation from a delegate and a validator. + * + * @param object Represents the properties available for this MsgUndelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Undelegate: (object: StakingMsgs.MsgUndelegate) => { + typeUrl: string; + value: MsgUndelegate; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: StakingMsgs.MsgUpdateParams) => { + typeUrl: string; + value: SMsgUpdateParams; + }; +} +/** + * Module to generate the Messages related to the Governance module of the Blockchain + */ +export declare namespace Governance { + /** MsgDeposit message creator + * Defines a method to add deposit on a specific proposal. + * + * @param object Represents the properties available for this MsgDeposit message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Deposit: (object: MsgDeposit) => { + typeUrl: string; + value: MsgDeposit; + }; + /** MsgSubmitProposal message creator + * Defines a method to create new proposal given a content. + * + * @param object Represents the properties available for this MsgSubmitProposal message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SubmitProposal: (object: GovMsgs.MsgSubmitProposal) => { + typeUrl: string; + value: MsgSubmitProposal; + }; + /** MsgVote message creator + * Defines a method to add a vote on a specific proposal. + * + * @param object Represents the properties available for this MsgVote message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Vote: (object: MsgVote) => { + typeUrl: string; + value: MsgVote; + }; + /** MsgVoteWeighted message creator + * Defines a method to add a weighted vote on a specific proposal. + * + * @param object Represents the properties available for this MsgVoteWeighted message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const VoteWeighted: (object: MsgVoteWeighted) => { + typeUrl: string; + value: MsgVoteWeighted; + }; +} +/** + * Module to generate the Messages related to the Feegrant module of the Blockchain + */ +export declare namespace Feegrant { + /** MsgGrantAllowance message creator + * Grants fee allowance to the grantee on the granter's account with the provided expiration time. + * + * @param object Represents the properties available for this MsgGrantAllowance message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const GrantAllowance: (object: FeegrantMsgs.MsgGrantAllowance) => { + typeUrl: string; + value: MsgGrantAllowance; + }; + /** MsgRevokeAllowance message creator + * Revokes any fee allowance of granter's account that has been granted to the grantee. + * + * @param object Represents the properties available for this MsgRevokeAllowance message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const RevokeAllowance: (object: FeegrantMsgs.MsgRevokeAllowance) => { + typeUrl: string; + value: MsgRevokeAllowance; + }; +} +/** + * Module to generate the Messages related to the Bank module of the Blockchain + */ +export declare namespace Bank { + /** MsgMultiSend message creator + * Defines a method for sending coins from some accounts to other accounts. + * + * @param object Represents the properties available for this MsgMultiSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const MultiSend: (object: BankMsgs.MsgMultiSend) => { + typeUrl: string; + value: MsgMultiSend; + }; + /** MsgSend message creator + * Defines a method for sending coins from one account to another account. + * + * @param object Represents the properties available for this MsgSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Send: (object: BankMsgs.MsgSend) => { + typeUrl: string; + value: MsgSend; + }; + /** MsgSetSendEnabled message creator + * + * @param object Represents the properties available for this MsgSetSendEnabled message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SetSendEnabled: (object: BankMsgs.MsgSetSendEnabled) => { + typeUrl: string; + value: MsgSetSendEnabled; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: BankMsgs.MsgUpdateParams) => { + typeUrl: string; + value: MsgUpdateParams; + }; +} +/** + * Module to generate the Messages related to the Distribution module of the Blockchain + */ +export declare namespace Distribution { + /** MsgWithdrawDelegatorReward message creator + * Defines a method to withdraw rewards of delegator from a single validator. + * + * @param object Represents the properties available for this MsgWithdrawDelegatorReward message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const WithdrawDelegatorReward: (object: DistributionMsgs.MsgWithdrawDelegatorReward) => { + typeUrl: string; + value: MsgWithdrawDelegatorReward; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: DistributionMsgs.MsgUpdateParams) => { + typeUrl: string; + value: DMsgUpdateParams; + }; + /** MsgWithdrawValidatorCommission message creator + * Defines a method to withdraw the full commission to the validator address. + * + * @param object Represents the properties available for this MsgWithdrawValidatorCommission message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const WithdrawValidatorCommission: (object: DistributionMsgs.MsgWithdrawValidatorCommission) => { + typeUrl: string; + value: MsgWithdrawValidatorCommission; + }; + /** MsgCommunityPoolSpend message creator + * + * @param object Represents the properties available for this MsgCommunityPoolSpend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CommunityPoolSpend: (object: DistributionMsgs.MsgCommunityPoolSpend) => { + typeUrl: string; + value: MsgCommunityPoolSpend; + }; + /** MsgFundCommunityPool message creator + * Defines a method to allow an account to directly fund the community pool. + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const FundCommunityPool: (object: DistributionMsgs.MsgFundCommunityPool) => { + typeUrl: string; + value: MsgFundCommunityPool; + }; + /** MsgSetWithdrawAddress message creator + * Defines a method to change the withdraw address for a delegator (or validator self-delegation). + * + * @param object Represents the properties available for this MsgSetWithdrawAddress message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SetWithdrawAddress: (object: DistributionMsgs.MsgSetWithdrawAddress) => { + typeUrl: string; + value: MsgSetWithdrawAddress; + }; +} +/** + * Module to generate the Messages related to the Vesting module of the Blockchain + */ +export declare namespace Vesting { + /** MsgCreateVestingAccount message creator + * Defines a method that enables creating a vesting account. + * + * @param object Represents the properties available for this MsgCreateVestingAccount message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CreateVestingAccount: (object: MsgCreateVestingAccount) => { + typeUrl: string; + value: MsgCreateVestingAccount; + }; + const CreatePeriodicVestingAccount: (object: MsgCreatePeriodicVestingAccount) => { + typeUrl: string; + value: MsgCreatePeriodicVestingAccount; + }; + const CreatePermanentLockedAccount: (object: MsgCreatePermanentLockedAccount) => { + typeUrl: string; + value: MsgCreatePermanentLockedAccount; + }; +} diff --git a/dist/main/cosmos/index.js b/dist/main/cosmos/index.js new file mode 100644 index 0000000..9a890fd --- /dev/null +++ b/dist/main/cosmos/index.js @@ -0,0 +1,423 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Vesting = exports.Distribution = exports.Bank = exports.Feegrant = exports.Governance = exports.Staking = exports.Authz = void 0; +const tx_1 = require("cosmjs-types/cosmos/gov/v1beta1/tx"); +const tx_2 = require("cosmjs-types/cosmos/feegrant/v1beta1/tx"); +// import { +// MsgMultiSend, +// MsgSend, +// MsgSetSendEnabled, +// MsgUpdateParams, +// } from "./bank/v1beta1/tx"; +const tx_3 = require("cosmjs-types/cosmos/distribution/v1beta1/tx"); +const tx_4 = require("cosmjs-types/cosmos/vesting/v1beta1/tx"); +const tx_5 = require("cosmjs-types/cosmos/staking/v1beta1/tx"); +const tx_6 = require("cosmjs-types/cosmos/authz/v1beta1/tx"); +const tx_7 = require("cosmjs-types/cosmos/bank/v1beta1/tx"); +const authzBaseUrl = "/cosmos.authz.v1beta1."; +const stakeBaseUrl = "/cosmos.staking.v1beta1."; +const govBaseUrl = "/cosmos.gov.v1beta1."; +const fgBaseUrl = "/cosmos.feegrant.v1beta1."; +const bankBaseUrl = "/cosmos.bank.v1beta1."; +const distBaseUrl = "/cosmos.distribution.v1beta1."; +const vestBaseUrl = "/cosmos.vesting.v1beta1."; +__exportStar(require("cosmjs-types/cosmos/tx/v1beta1/tx"), exports); +/** + * Module to generate the Messages related to the Authz module of the Blockchain + */ +var Authz; +(function (Authz) { + /** MsgGrant message creator + * Grants the provided authorization to the grantee on the granter's account with the provided expiration time. If there is already a grant for the given (granter, grantee, Authorization) triple, then the grant will be overwritten. + * + * @param object Represents the properties available for this MsgGrant message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Authz.Grant = function (object) { + return { + typeUrl: authzBaseUrl + "MsgGrant", + value: tx_6.MsgGrant.fromPartial(object), + }; + }; + /** MsgExec message creator + * Attempts to execute the provided messages using authorizations granted to the grantee. Each message should have only one signer corresponding to the granter of the authorization. + * + * @param object Represents the properties available for this MsgExec message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Authz.Exec = function (object) { + return { + typeUrl: authzBaseUrl + "MsgExec", + value: tx_6.MsgExec.fromPartial(object), + }; + }; + /** MsgRevoke message creator + * Revokes any authorization corresponding to the provided method name on the granter's account that has been granted to the grantee. + * + * @param object Represents the properties available for this MsgRevoke message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Authz.Revoke = function (object) { + return { + typeUrl: authzBaseUrl + "MsgRevoke", + value: tx_6.MsgRevoke.fromPartial(object), + }; + }; +})(Authz || (exports.Authz = Authz = {})); +/** + * Module to generate the Messages related to the Staking module of the Blockchain + */ +var Staking; +(function (Staking) { + /** MsgBeginRedelegate message creator + * Defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator. + * + * @param object Represents the properties available for this MsgBeginRedelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.BeginRedelegate = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgBeginRedelegate", + value: tx_5.MsgBeginRedelegate.fromPartial(object), + }; + }; + /** MsgCancelUnbondingDelegation message creator + * + * @param object Represents the properties available for this MsgCancelUnbondingDelegation message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.CancelUnbondingDelegation = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgCancelUnbondingDelegation", + value: tx_5.MsgCancelUnbondingDelegation.fromPartial(object), + }; + }; + /** MsgCreateValidator message creator + * Defines a method for creating a new validator. + * + * @param object Represents the properties available for this MsgCreateValidator message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.CreateValidator = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgCreateValidator", + value: tx_5.MsgCreateValidator.fromPartial(object), + }; + }; + /** MsgDelegate message creator + * Defines a method for performing a delegation of coins from a delegator to a validator. + * + * @param object Represents the properties available for this MsgDelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.Delegate = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgDelegate", + value: tx_5.MsgDelegate.fromPartial(object), + }; + }; + /** MsgEditValidator message creator + * Defines a method for editing an existing validator. + * + * @param object Represents the properties available for this MsgEditValidator message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.EditValidator = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgEditValidator", + value: tx_5.MsgEditValidator.fromPartial(object), + }; + }; + /** MsgUndelegate message creator + * Defines a method for performing an undelegation from a delegate and a validator. + * + * @param object Represents the properties available for this MsgUndelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.Undelegate = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgUndelegate", + value: tx_5.MsgUndelegate.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.UpdateParams = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgUpdateParams", + value: tx_5.MsgUpdateParams.fromPartial(object), + }; + }; +})(Staking || (exports.Staking = Staking = {})); +/** + * Module to generate the Messages related to the Governance module of the Blockchain + */ +var Governance; +(function (Governance) { + /** MsgDeposit message creator + * Defines a method to add deposit on a specific proposal. + * + * @param object Represents the properties available for this MsgDeposit message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Governance.Deposit = function (object) { + return { + typeUrl: govBaseUrl + "MsgDeposit", + value: tx_1.MsgDeposit.fromPartial(object), + }; + }; + /** MsgSubmitProposal message creator + * Defines a method to create new proposal given a content. + * + * @param object Represents the properties available for this MsgSubmitProposal message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Governance.SubmitProposal = function (object) { + return { + typeUrl: govBaseUrl + "MsgSubmitProposal", + value: tx_1.MsgSubmitProposal.fromPartial(object), + }; + }; + /** MsgVote message creator + * Defines a method to add a vote on a specific proposal. + * + * @param object Represents the properties available for this MsgVote message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Governance.Vote = function (object) { + return { + typeUrl: govBaseUrl + "MsgVote", + value: tx_1.MsgVote.fromPartial(object), + }; + }; + /** MsgVoteWeighted message creator + * Defines a method to add a weighted vote on a specific proposal. + * + * @param object Represents the properties available for this MsgVoteWeighted message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Governance.VoteWeighted = function (object) { + return { + typeUrl: govBaseUrl + "MsgVoteWeighted", + value: tx_1.MsgVoteWeighted.fromPartial(object), + }; + }; +})(Governance || (exports.Governance = Governance = {})); +/** + * Module to generate the Messages related to the Feegrant module of the Blockchain + */ +var Feegrant; +(function (Feegrant) { + /** MsgGrantAllowance message creator + * Grants fee allowance to the grantee on the granter's account with the provided expiration time. + * + * @param object Represents the properties available for this MsgGrantAllowance message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Feegrant.GrantAllowance = function (object) { + return { + typeUrl: fgBaseUrl + "MsgGrantAllowance", + value: tx_2.MsgGrantAllowance.fromPartial(object), + }; + }; + /** MsgRevokeAllowance message creator + * Revokes any fee allowance of granter's account that has been granted to the grantee. + * + * @param object Represents the properties available for this MsgRevokeAllowance message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Feegrant.RevokeAllowance = function (object) { + return { + typeUrl: fgBaseUrl + "MsgRevokeAllowance", + value: tx_2.MsgRevokeAllowance.fromPartial(object), + }; + }; +})(Feegrant || (exports.Feegrant = Feegrant = {})); +/** + * Module to generate the Messages related to the Bank module of the Blockchain + */ +var Bank; +(function (Bank) { + /** MsgMultiSend message creator + * Defines a method for sending coins from some accounts to other accounts. + * + * @param object Represents the properties available for this MsgMultiSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Bank.MultiSend = function (object) { + return { + typeUrl: bankBaseUrl + "MsgMultiSend", + value: tx_7.MsgMultiSend.fromPartial(object), + }; + }; + /** MsgSend message creator + * Defines a method for sending coins from one account to another account. + * + * @param object Represents the properties available for this MsgSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Bank.Send = function (object) { + return { + typeUrl: bankBaseUrl + "MsgSend", + value: tx_7.MsgSend.fromPartial(object), + }; + }; + /** MsgSetSendEnabled message creator + * + * @param object Represents the properties available for this MsgSetSendEnabled message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Bank.SetSendEnabled = function (object) { + return { + typeUrl: bankBaseUrl + "MsgSetSendEnabled", + value: tx_7.MsgSetSendEnabled.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Bank.UpdateParams = function (object) { + return { + typeUrl: bankBaseUrl + "MsgUpdateParams", + value: tx_7.MsgUpdateParams.fromPartial(object), + }; + }; +})(Bank || (exports.Bank = Bank = {})); +/** + * Module to generate the Messages related to the Distribution module of the Blockchain + */ +var Distribution; +(function (Distribution) { + /** MsgWithdrawDelegatorReward message creator + * Defines a method to withdraw rewards of delegator from a single validator. + * + * @param object Represents the properties available for this MsgWithdrawDelegatorReward message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.WithdrawDelegatorReward = function (object) { + return { + typeUrl: distBaseUrl + "MsgWithdrawDelegatorReward", + value: tx_3.MsgWithdrawDelegatorReward.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.UpdateParams = function (object) { + return { + typeUrl: distBaseUrl + "MsgUpdateParams", + value: tx_3.MsgUpdateParams.fromPartial(object), + }; + }; + /** MsgWithdrawValidatorCommission message creator + * Defines a method to withdraw the full commission to the validator address. + * + * @param object Represents the properties available for this MsgWithdrawValidatorCommission message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.WithdrawValidatorCommission = function (object) { + return { + typeUrl: distBaseUrl + "MsgWithdrawValidatorCommission", + value: tx_3.MsgWithdrawValidatorCommission.fromPartial(object), + }; + }; + /** MsgCommunityPoolSpend message creator + * + * @param object Represents the properties available for this MsgCommunityPoolSpend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.CommunityPoolSpend = function (object) { + return { + typeUrl: distBaseUrl + "MsgCommunityPoolSpend", + value: tx_3.MsgCommunityPoolSpend.fromPartial(object), + }; + }; + // /** MsgDepositValidatorRewardsPool message creator + // * + // * @param object Represents the properties available for this MsgDepositValidatorRewardsPool message. + // * @returns A Msg object with the typeUrl and value object for the proper message + // */ + // export const DepositValidatorRewardsPool = function ( + // object: DistributionMsgs.MsgDepositValidatorRewardsPool + // ) { + // return { + // typeUrl: distBaseUrl + "MsgDepositValidatorRewardsPool", + // value: MsgDepositValidatorRewardsPool.fromPartial(object), + // }; + // }; + /** MsgFundCommunityPool message creator + * Defines a method to allow an account to directly fund the community pool. + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.FundCommunityPool = function (object) { + return { + typeUrl: distBaseUrl + "MsgFundCommunityPool", + value: tx_3.MsgFundCommunityPool.fromPartial(object), + }; + }; + /** MsgSetWithdrawAddress message creator + * Defines a method to change the withdraw address for a delegator (or validator self-delegation). + * + * @param object Represents the properties available for this MsgSetWithdrawAddress message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.SetWithdrawAddress = function (object) { + return { + typeUrl: distBaseUrl + "MsgSetWithdrawAddress", + value: tx_3.MsgSetWithdrawAddress.fromPartial(object), + }; + }; +})(Distribution || (exports.Distribution = Distribution = {})); +/** + * Module to generate the Messages related to the Vesting module of the Blockchain + */ +var Vesting; +(function (Vesting) { + /** MsgCreateVestingAccount message creator + * Defines a method that enables creating a vesting account. + * + * @param object Represents the properties available for this MsgCreateVestingAccount message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Vesting.CreateVestingAccount = function (object) { + return { + typeUrl: vestBaseUrl + "MsgCreateVestingAccount", + value: tx_4.MsgCreateVestingAccount.fromPartial(object), + }; + }; + Vesting.CreatePeriodicVestingAccount = function (object) { + return { + typeUrl: vestBaseUrl + "MsgCreatePeriodicVestingAccount", + value: tx_4.MsgCreatePeriodicVestingAccount.fromPartial(object), + }; + }; + Vesting.CreatePermanentLockedAccount = function (object) { + return { + typeUrl: vestBaseUrl + "MsgCreatePermanentLockedAccount", + value: tx_4.MsgCreatePermanentLockedAccount.fromPartial(object), + }; + }; +})(Vesting || (exports.Vesting = Vesting = {})); diff --git a/dist/main/errors.d.ts b/dist/main/errors.d.ts new file mode 100644 index 0000000..21e428c --- /dev/null +++ b/dist/main/errors.d.ts @@ -0,0 +1,7 @@ +export declare class TxJsError extends Error { + readonly thrower: string; + readonly code: number | null; + constructor(thrower: string, cause: unknown, code?: number | null); +} +export declare function toTxJsError(thrower: string, error: unknown, code?: number | null): TxJsError; +export declare function normalizeWalletError(thrower: string, error: unknown): TxJsError; diff --git a/dist/main/errors.js b/dist/main/errors.js new file mode 100644 index 0000000..13b3b51 --- /dev/null +++ b/dist/main/errors.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeWalletError = exports.toTxJsError = exports.TxJsError = void 0; +class TxJsError extends Error { + constructor(thrower, cause, code = null) { + const message = cause instanceof Error + ? cause.message + : typeof cause === "string" + ? cause + : "Unknown error"; + super(message); + this.name = "TxJsError"; + this.thrower = thrower; + this.code = code; + if (cause instanceof Error && cause.stack) { + this.stack = cause.stack; + } + } +} +exports.TxJsError = TxJsError; +function toTxJsError(thrower, error, code) { + if (error instanceof TxJsError) { + return error; + } + if (typeof error === "object" && + error !== null && + "error" in error) { + const legacy = error; + return new TxJsError(legacy.thrower ?? thrower, legacy.error, legacy.code ?? code ?? null); + } + return new TxJsError(thrower, error, code ?? null); +} +exports.toTxJsError = toTxJsError; +function normalizeWalletError(thrower, error) { + if (error instanceof TxJsError) { + return error; + } + const wrapped = toTxJsError(thrower, error); + if (wrapped.message === "Extension not installed.") { + return new TxJsError(thrower, wrapped.message, 4000); + } + if (["User rejected the request.", "Request rejected"].includes(wrapped.message)) { + return new TxJsError(thrower, "Request rejected", 4001); + } + return wrapped; +} +exports.normalizeWalletError = normalizeWalletError; diff --git a/dist/main/google/api/annotations.d.ts b/dist/main/google/api/annotations.d.ts new file mode 100644 index 0000000..a64daf0 --- /dev/null +++ b/dist/main/google/api/annotations.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "google.api"; diff --git a/dist/main/google/api/annotations.js b/dist/main/google/api/annotations.js new file mode 100644 index 0000000..302ac7d --- /dev/null +++ b/dist/main/google/api/annotations.js @@ -0,0 +1,5 @@ +"use strict"; +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.protobufPackage = void 0; +exports.protobufPackage = "google.api"; diff --git a/dist/main/google/api/http.d.ts b/dist/main/google/api/http.d.ts new file mode 100644 index 0000000..cb09360 --- /dev/null +++ b/dist/main/google/api/http.d.ts @@ -0,0 +1,2953 @@ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export declare 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. + */ + fullyDecodeReservedExpansion: 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. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} +export declare const Http: { + encode(message: Http, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Http; + fromJSON(object: any): Http; + toJSON(message: Http): unknown; + create]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & any & { [K_9 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & any & { [K_10 in Exclude]: never; })[] & { [K_11 in Exclude]: never; }) | undefined; + } & { [K_12 in Exclude]: never; })[] & { [K_13 in Exclude]: never; }) | undefined; + } & { [K_14 in Exclude]: never; })[] & { [K_15 in Exclude]: never; }) | undefined; + } & { [K_16 in Exclude]: never; })[] & { [K_17 in Exclude]: never; }) | undefined; + } & { [K_18 in Exclude]: never; })[] & { [K_19 in Exclude]: never; }) | undefined; + } & { [K_20 in Exclude]: never; })[] & { [K_21 in Exclude]: never; }) | undefined; + } & { [K_22 in Exclude]: never; })[] & { [K_23 in Exclude]: never; }) | undefined; + } & { [K_24 in Exclude]: never; })[] & { [K_25 in Exclude]: never; }) | undefined; + } & { [K_26 in Exclude]: never; })[] & { [K_27 in Exclude]: never; }) | undefined; + } & { [K_28 in Exclude]: never; })[] & { [K_29 in Exclude]: never; }) | undefined; + } & { [K_30 in Exclude]: never; })[] & { [K_31 in Exclude]: never; }) | undefined; + fullyDecodeReservedExpansion?: boolean | undefined; + } & { [K_32 in Exclude]: never; }>(base?: I | undefined): Http; + fromPartial]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_34 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_35 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_36 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_37 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_38 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_39 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_40 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_41 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & any & { [K_42 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & any & { [K_43 in Exclude]: never; })[] & { [K_44 in Exclude]: never; }) | undefined; + } & { [K_45 in Exclude]: never; })[] & { [K_46 in Exclude]: never; }) | undefined; + } & { [K_47 in Exclude]: never; })[] & { [K_48 in Exclude]: never; }) | undefined; + } & { [K_49 in Exclude]: never; })[] & { [K_50 in Exclude]: never; }) | undefined; + } & { [K_51 in Exclude]: never; })[] & { [K_52 in Exclude]: never; }) | undefined; + } & { [K_53 in Exclude]: never; })[] & { [K_54 in Exclude]: never; }) | undefined; + } & { [K_55 in Exclude]: never; })[] & { [K_56 in Exclude]: never; }) | undefined; + } & { [K_57 in Exclude]: never; })[] & { [K_58 in Exclude]: never; }) | undefined; + } & { [K_59 in Exclude]: never; })[] & { [K_60 in Exclude]: never; }) | undefined; + } & { [K_61 in Exclude]: never; })[] & { [K_62 in Exclude]: never; }) | undefined; + } & { [K_63 in Exclude]: never; })[] & { [K_64 in Exclude]: never; }) | undefined; + fullyDecodeReservedExpansion?: boolean | undefined; + } & { [K_65 in Exclude]: never; }>(object: I_1): Http; +}; +export declare const HttpRule: { + encode(message: HttpRule, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule; + fromJSON(object: any): HttpRule; + toJSON(message: HttpRule): unknown; + create]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & any & { [K_10 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & any & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + } & { [K_13 in Exclude]: never; })[] & { [K_14 in Exclude]: never; }) | undefined; + } & { [K_15 in Exclude]: never; })[] & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; })[] & { [K_18 in Exclude]: never; }) | undefined; + } & { [K_19 in Exclude]: never; })[] & { [K_20 in Exclude]: never; }) | undefined; + } & { [K_21 in Exclude]: never; })[] & { [K_22 in Exclude]: never; }) | undefined; + } & { [K_23 in Exclude]: never; })[] & { [K_24 in Exclude]: never; }) | undefined; + } & { [K_25 in Exclude]: never; })[] & { [K_26 in Exclude]: never; }) | undefined; + } & { [K_27 in Exclude]: never; })[] & { [K_28 in Exclude]: never; }) | undefined; + } & { [K_29 in Exclude]: never; })[] & { [K_30 in Exclude]: never; }) | undefined; + } & { [K_31 in Exclude]: never; })[] & { [K_32 in Exclude]: never; }) | undefined; + } & { [K_33 in Exclude]: never; }>(base?: I | undefined): HttpRule; + fromPartial]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_35 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_36 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_37 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_38 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_39 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_40 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_41 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_42 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_43 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & any & { [K_44 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & any & { [K_45 in Exclude]: never; })[] & { [K_46 in Exclude]: never; }) | undefined; + } & { [K_47 in Exclude]: never; })[] & { [K_48 in Exclude]: never; }) | undefined; + } & { [K_49 in Exclude]: never; })[] & { [K_50 in Exclude]: never; }) | undefined; + } & { [K_51 in Exclude]: never; })[] & { [K_52 in Exclude]: never; }) | undefined; + } & { [K_53 in Exclude]: never; })[] & { [K_54 in Exclude]: never; }) | undefined; + } & { [K_55 in Exclude]: never; })[] & { [K_56 in Exclude]: never; }) | undefined; + } & { [K_57 in Exclude]: never; })[] & { [K_58 in Exclude]: never; }) | undefined; + } & { [K_59 in Exclude]: never; })[] & { [K_60 in Exclude]: never; }) | undefined; + } & { [K_61 in Exclude]: never; })[] & { [K_62 in Exclude]: never; }) | undefined; + } & { [K_63 in Exclude]: never; })[] & { [K_64 in Exclude]: never; }) | undefined; + } & { [K_65 in Exclude]: never; })[] & { [K_66 in Exclude]: never; }) | undefined; + } & { [K_67 in Exclude]: never; }>(object: I_1): HttpRule; +}; +export declare const CustomHttpPattern: { + encode(message: CustomHttpPattern, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern; + fromJSON(object: any): CustomHttpPattern; + toJSON(message: CustomHttpPattern): unknown; + create]: never; }>(base?: I | undefined): CustomHttpPattern; + fromPartial]: never; }>(object: I_1): CustomHttpPattern; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/google/api/http.js b/dist/main/google/api/http.js new file mode 100644 index 0000000..f5cd359 --- /dev/null +++ b/dist/main/google/api/http.js @@ -0,0 +1,325 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CustomHttpPattern = exports.HttpRule = exports.Http = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +exports.protobufPackage = "google.api"; +function createBaseHttp() { + return { rules: [], fullyDecodeReservedExpansion: false }; +} +exports.Http = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.rules) { + exports.HttpRule.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.fullyDecodeReservedExpansion === true) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag != 10) { + break; + } + message.rules.push(exports.HttpRule.decode(reader, reader.uint32())); + continue; + case 2: + if (tag != 16) { + break; + } + message.fullyDecodeReservedExpansion = reader.bool(); + continue; + } + if ((tag & 7) == 4 || tag == 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e) => exports.HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.rules) { + obj.rules = message.rules.map((e) => e ? exports.HttpRule.toJSON(e) : undefined); + } + else { + obj.rules = []; + } + message.fullyDecodeReservedExpansion !== undefined && + (obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion); + return obj; + }, + create(base) { + return exports.Http.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => exports.HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; +function createBaseHttpRule() { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} +exports.HttpRule = { + encode(message, writer = minimal_1.default.Writer.create()) { + 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) { + exports.CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + exports.HttpRule.encode(v, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag != 10) { + break; + } + message.selector = reader.string(); + continue; + case 2: + if (tag != 18) { + break; + } + message.get = reader.string(); + continue; + case 3: + if (tag != 26) { + break; + } + message.put = reader.string(); + continue; + case 4: + if (tag != 34) { + break; + } + message.post = reader.string(); + continue; + case 5: + if (tag != 42) { + break; + } + message.delete = reader.string(); + continue; + case 6: + if (tag != 50) { + break; + } + message.patch = reader.string(); + continue; + case 8: + if (tag != 66) { + break; + } + message.custom = exports.CustomHttpPattern.decode(reader, reader.uint32()); + continue; + case 7: + if (tag != 58) { + break; + } + message.body = reader.string(); + continue; + case 12: + if (tag != 98) { + break; + } + message.responseBody = reader.string(); + continue; + case 11: + if (tag != 90) { + break; + } + message.additionalBindings.push(exports.HttpRule.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) == 4 || tag == 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + selector: isSet(object.selector) ? String(object.selector) : "", + get: isSet(object.get) ? String(object.get) : undefined, + put: isSet(object.put) ? String(object.put) : undefined, + post: isSet(object.post) ? String(object.post) : undefined, + delete: isSet(object.delete) ? String(object.delete) : undefined, + patch: isSet(object.patch) ? String(object.patch) : undefined, + custom: isSet(object.custom) ? exports.CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? String(object.body) : "", + responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", + additionalBindings: Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e) => exports.HttpRule.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + 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 ? exports.CustomHttpPattern.toJSON(message.custom) : undefined); + message.body !== undefined && (obj.body = message.body); + message.responseBody !== undefined && (obj.responseBody = message.responseBody); + if (message.additionalBindings) { + obj.additionalBindings = message.additionalBindings.map((e) => e ? exports.HttpRule.toJSON(e) : undefined); + } + else { + obj.additionalBindings = []; + } + return obj; + }, + create(base) { + return exports.HttpRule.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = (object.custom !== undefined && object.custom !== null) + ? exports.CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map((e) => exports.HttpRule.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCustomHttpPattern() { + return { kind: "", path: "" }; +} +exports.CustomHttpPattern = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag != 10) { + break; + } + message.kind = reader.string(); + continue; + case 2: + if (tag != 18) { + break; + } + message.path = reader.string(); + continue; + } + if ((tag & 7) == 4 || tag == 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { kind: isSet(object.kind) ? String(object.kind) : "", path: isSet(object.path) ? String(object.path) : "" }; + }, + toJSON(message) { + const obj = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.path !== undefined && (obj.path = message.path); + return obj; + }, + create(base) { + return exports.CustomHttpPattern.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/google/index.d.ts b/dist/main/google/index.d.ts new file mode 100644 index 0000000..498ae62 --- /dev/null +++ b/dist/main/google/index.d.ts @@ -0,0 +1 @@ +export * from "./protobuf/any"; diff --git a/dist/main/google/index.js b/dist/main/google/index.js new file mode 100644 index 0000000..64c3cd8 --- /dev/null +++ b/dist/main/google/index.js @@ -0,0 +1,17 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./protobuf/any"), exports); diff --git a/dist/main/google/protobuf/any.d.ts b/dist/main/google/protobuf/any.d.ts new file mode 100644 index 0000000..e1ca8ec --- /dev/null +++ b/dist/main/google/protobuf/any.d.ts @@ -0,0 +1,150 @@ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "google.protobuf"; +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} +export declare const Any: { + encode(message: Any, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Any; + fromJSON(object: any): Any; + toJSON(message: Any): unknown; + create]: never; }>(base?: I | undefined): Any; + fromPartial]: never; }>(object: I_1): Any; +}; +export declare function bytesFromBase64(b64: string): Uint8Array; +export declare function base64FromBytes(arr: Uint8Array): string; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/google/protobuf/any.js b/dist/main/google/protobuf/any.js new file mode 100644 index 0000000..5a9aeb3 --- /dev/null +++ b/dist/main/google/protobuf/any.js @@ -0,0 +1,124 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.base64FromBytes = exports.bytesFromBase64 = exports.Any = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +exports.protobufPackage = "google.protobuf"; +function createBaseAny() { + return { typeUrl: "", value: new Uint8Array() }; +} +exports.Any = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag != 10) { + break; + } + message.typeUrl = reader.string(); + continue; + case 2: + if (tag != 18) { + break; + } + message.value = reader.bytes(); + continue; + } + if ((tag & 7) == 4 || tag == 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + create(base) { + return exports.Any.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +exports.bytesFromBase64 = bytesFromBase64; +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +exports.base64FromBytes = base64FromBytes; +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/google/protobuf/duration.d.ts b/dist/main/google/protobuf/duration.d.ts new file mode 100644 index 0000000..f51af0b --- /dev/null +++ b/dist/main/google/protobuf/duration.d.ts @@ -0,0 +1,110 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "google.protobuf"; +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} +export declare const Duration: { + encode(message: Duration, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Duration; + fromJSON(object: any): Duration; + toJSON(message: Duration): unknown; + create]: never; }>(base?: I | undefined): Duration; + fromPartial]: never; }>(object: I_1): Duration; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/google/protobuf/duration.js b/dist/main/google/protobuf/duration.js new file mode 100644 index 0000000..c42562a --- /dev/null +++ b/dist/main/google/protobuf/duration.js @@ -0,0 +1,100 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Duration = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +exports.protobufPackage = "google.protobuf"; +function createBaseDuration() { + return { seconds: 0, nanos: 0 }; +} +exports.Duration = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + seconds: isSet(object.seconds) ? Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.seconds !== undefined && (obj.seconds = Math.round(message.seconds)); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + create(base) { + return exports.Duration.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDuration(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/google/protobuf/timestamp.d.ts b/dist/main/google/protobuf/timestamp.d.ts new file mode 100644 index 0000000..a8a0b79 --- /dev/null +++ b/dist/main/google/protobuf/timestamp.d.ts @@ -0,0 +1,139 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "google.protobuf"; +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} +export declare const Timestamp: { + encode(message: Timestamp, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp; + fromJSON(object: any): Timestamp; + toJSON(message: Timestamp): unknown; + create]: never; }>(base?: I | undefined): Timestamp; + fromPartial]: never; }>(object: I_1): Timestamp; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/google/protobuf/timestamp.js b/dist/main/google/protobuf/timestamp.js new file mode 100644 index 0000000..c8c04dd --- /dev/null +++ b/dist/main/google/protobuf/timestamp.js @@ -0,0 +1,100 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Timestamp = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +exports.protobufPackage = "google.protobuf"; +function createBaseTimestamp() { + return { seconds: 0, nanos: 0 }; +} +exports.Timestamp = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + seconds: isSet(object.seconds) ? Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.seconds !== undefined && (obj.seconds = Math.round(message.seconds)); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + create(base) { + return exports.Timestamp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/index.d.ts b/dist/main/index.d.ts new file mode 100644 index 0000000..e5f963d --- /dev/null +++ b/dist/main/index.d.ts @@ -0,0 +1,9 @@ +export { Client } from "./client/index"; +export * from "./types"; +export * from "./utils"; +export * from "./coreum"; +export * from "./cosmos"; +export * from "./wasm/v1"; +export * from "./services"; +export { TxJsError } from "./errors"; +export * as Stargate from "@cosmjs/stargate"; diff --git a/dist/main/index.js b/dist/main/index.js new file mode 100644 index 0000000..5e5e603 --- /dev/null +++ b/dist/main/index.js @@ -0,0 +1,40 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Stargate = exports.TxJsError = exports.Client = void 0; +var index_1 = require("./client/index"); +Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return index_1.Client; } }); +__exportStar(require("./types"), exports); +__exportStar(require("./utils"), exports); +__exportStar(require("./coreum"), exports); +__exportStar(require("./cosmos"), exports); +__exportStar(require("./wasm/v1"), exports); +__exportStar(require("./services"), exports); +var errors_1 = require("./errors"); +Object.defineProperty(exports, "TxJsError", { enumerable: true, get: function () { return errors_1.TxJsError; } }); +exports.Stargate = __importStar(require("@cosmjs/stargate")); diff --git a/dist/main/services/cosmostation.d.ts b/dist/main/services/cosmostation.d.ts new file mode 100644 index 0000000..b40a1df --- /dev/null +++ b/dist/main/services/cosmostation.d.ts @@ -0,0 +1,4 @@ +import { CoreumNetworkConfig } from "../types/coreum"; +import { OfflineSigner } from "@cosmjs/proto-signing"; +export declare const connectCosmostation: (config: CoreumNetworkConfig) => Promise; +export declare const getCosmosOfflineSigner: (chainId: string) => Promise; diff --git a/dist/main/services/cosmostation.js b/dist/main/services/cosmostation.js new file mode 100644 index 0000000..4a4b463 --- /dev/null +++ b/dist/main/services/cosmostation.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getCosmosOfflineSigner = exports.connectCosmostation = void 0; +const extension_client_1 = require("@cosmostation/extension-client"); +const cosmos_client_1 = require("@cosmostation/cosmos-client"); +const errors_1 = require("../errors"); +const connectCosmostation = async (config) => { + try { + const provider = await (0, extension_client_1.cosmos)(); + const gasPrice = (config.gas_price || "").replace(config.staking_denom || "", ""); + await provider.addChain({ + chainId: config.chain_id, + chainName: config.chain_name, + addressPrefix: config.chain_bech32_prefix, + baseDenom: config.staking_denom, + displayDenom: "core", + restURL: config.chain_rest_endpoint, + coinType: String(config.coin_type), + decimals: 6, + gasRate: { + average: gasPrice, + low: gasPrice, + tiny: gasPrice, + }, + }); + } + catch (error) { + if (error instanceof Error && error.name === "InstallError") { + throw new errors_1.TxJsError("connectCosmostation", "Extension not installed.", 4000); + } + throw new errors_1.TxJsError("connectCosmostation", error); + } +}; +exports.connectCosmostation = connectCosmostation; +const getCosmosOfflineSigner = async (chainId) => { + try { + return (await (0, cosmos_client_1.getOfflineSigner)(chainId)); + } + catch (error) { + throw new errors_1.TxJsError("getCosmosOfflineSigner", error); + } +}; +exports.getCosmosOfflineSigner = getCosmosOfflineSigner; diff --git a/dist/main/services/index.d.ts b/dist/main/services/index.d.ts new file mode 100644 index 0000000..ce44237 --- /dev/null +++ b/dist/main/services/index.d.ts @@ -0,0 +1,3 @@ +export * from "./keplr"; +export * from "./cosmostation"; +export * from "./leap"; diff --git a/dist/main/services/index.js b/dist/main/services/index.js new file mode 100644 index 0000000..765a75a --- /dev/null +++ b/dist/main/services/index.js @@ -0,0 +1,19 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./keplr"), exports); +__exportStar(require("./cosmostation"), exports); +__exportStar(require("./leap"), exports); diff --git a/dist/main/services/keplr.d.ts b/dist/main/services/keplr.d.ts new file mode 100644 index 0000000..85b0fc1 --- /dev/null +++ b/dist/main/services/keplr.d.ts @@ -0,0 +1,3 @@ +import { CoreumNetworkConfig } from "../types/coreum"; +export declare const connectKeplr: (config: CoreumNetworkConfig) => Promise; +export declare const getKeplrOfflineSigner: (chainId: string) => Promise; diff --git a/dist/main/services/keplr.js b/dist/main/services/keplr.js new file mode 100644 index 0000000..6cdd2ab --- /dev/null +++ b/dist/main/services/keplr.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getKeplrOfflineSigner = exports.connectKeplr = void 0; +const chainConfig_1 = require("../utils/chainConfig"); +const errors_1 = require("../errors"); +function getKeplrWindow() { + if (typeof window === "undefined") { + throw new errors_1.TxJsError("connectKeplr", "Wallet extensions are only available in browser environments"); + } + return window; +} +const connectKeplr = async (config) => { + try { + const browserWindow = getKeplrWindow(); + if (!browserWindow.getOfflineSignerAuto || !browserWindow.keplr) { + throw new errors_1.TxJsError("connectKeplr", "Extension not installed.", 4000); + } + if (!browserWindow.keplr.experimentalSuggestChain) { + throw new errors_1.TxJsError("connectKeplr", "Please use the recent version of Keplr extension"); + } + try { + await browserWindow.keplr.experimentalSuggestChain((0, chainConfig_1.buildKeplrChainSuggestion)(config)); + } + catch { + throw new errors_1.TxJsError("connectKeplr", "Failed to suggest the chain"); + } + } + catch (error) { + throw (0, errors_1.toTxJsError)("connectKeplr", error); + } +}; +exports.connectKeplr = connectKeplr; +const getKeplrOfflineSigner = async (chainId) => { + const browserWindow = getKeplrWindow(); + if (!browserWindow.getOfflineSignerAuto) { + throw new errors_1.TxJsError("getKeplrOfflineSigner", "Extension not installed.", 4000); + } + await browserWindow.keplr?.enable(chainId); + return browserWindow.getOfflineSignerAuto(chainId); +}; +exports.getKeplrOfflineSigner = getKeplrOfflineSigner; diff --git a/dist/main/services/leap.d.ts b/dist/main/services/leap.d.ts new file mode 100644 index 0000000..99d6b8a --- /dev/null +++ b/dist/main/services/leap.d.ts @@ -0,0 +1,4 @@ +import { CoreumNetworkConfig } from "../types/coreum"; +import { OfflineSigner } from "@cosmjs/proto-signing"; +export declare const connectLeap: (config: CoreumNetworkConfig) => Promise; +export declare const getLeapOfflineSigner: (chainId: string) => Promise; diff --git a/dist/main/services/leap.js b/dist/main/services/leap.js new file mode 100644 index 0000000..88f3511 --- /dev/null +++ b/dist/main/services/leap.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getLeapOfflineSigner = exports.connectLeap = void 0; +const chainConfig_1 = require("../utils/chainConfig"); +const errors_1 = require("../errors"); +function getLeapWindow() { + if (typeof window === "undefined") { + throw new errors_1.TxJsError("connectLeap", "Wallet extensions are only available in browser environments"); + } + return window; +} +const connectLeap = async (config) => { + try { + const browserWindow = getLeapWindow(); + if (!browserWindow.leap) { + throw new errors_1.TxJsError("connectLeap", "Extension not installed.", 4000); + } + if (browserWindow.leap.experimentalSuggestChain) { + try { + await browserWindow.leap.experimentalSuggestChain((0, chainConfig_1.buildKeplrChainSuggestion)(config)); + } + catch { + throw new errors_1.TxJsError("connectLeap", "Failed to suggest the chain"); + } + } + await browserWindow.leap.enable(config.chain_id); + } + catch (error) { + if (error instanceof errors_1.TxJsError) { + throw error; + } + throw new errors_1.TxJsError("connectLeap", error); + } +}; +exports.connectLeap = connectLeap; +const getLeapOfflineSigner = async (chainId) => { + const browserWindow = getLeapWindow(); + if (!browserWindow.leap) { + throw new errors_1.TxJsError("getLeapOfflineSigner", "Extension not installed.", 4000); + } + await browserWindow.leap.enable(chainId); + return browserWindow.leap.getOfflineSignerAuto(chainId); +}; +exports.getLeapOfflineSigner = getLeapOfflineSigner; diff --git a/dist/main/tendermint/abci/types.d.ts b/dist/main/tendermint/abci/types.d.ts new file mode 100644 index 0000000..a6f80bb --- /dev/null +++ b/dist/main/tendermint/abci/types.d.ts @@ -0,0 +1,7075 @@ +import _m0 from "protobufjs/minimal"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { ConsensusParams } from "../types/params"; +import { Header } from "../types/types"; +export declare const protobufPackage = "tendermint.abci"; +export declare enum CheckTxType { + NEW = 0, + RECHECK = 1, + UNRECOGNIZED = -1 +} +export declare function checkTxTypeFromJSON(object: any): CheckTxType; +export declare function checkTxTypeToJSON(object: CheckTxType): string; +export declare enum MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1 +} +export declare function misbehaviorTypeFromJSON(object: any): MisbehaviorType; +export declare function misbehaviorTypeToJSON(object: MisbehaviorType): string; +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + initChain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + beginBlock?: RequestBeginBlock | undefined; + checkTx?: RequestCheckTx | undefined; + deliverTx?: RequestDeliverTx | undefined; + endBlock?: RequestEndBlock | undefined; + commit?: RequestCommit | undefined; + listSnapshots?: RequestListSnapshots | undefined; + offerSnapshot?: RequestOfferSnapshot | undefined; + loadSnapshotChunk?: RequestLoadSnapshotChunk | undefined; + applySnapshotChunk?: RequestApplySnapshotChunk | undefined; + prepareProposal?: RequestPrepareProposal | undefined; + processProposal?: RequestProcessProposal | undefined; +} +export interface RequestEcho { + message: string; +} +export interface RequestFlush { +} +export interface RequestInfo { + version: string; + blockVersion: number; + p2pVersion: number; + abciVersion: string; +} +export interface RequestInitChain { + time: Date | undefined; + chainId: string; + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: number; +} +export interface RequestQuery { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} +export interface RequestBeginBlock { + hash: Uint8Array; + header: Header | undefined; + lastCommitInfo: CommitInfo | undefined; + byzantineValidators: Misbehavior[]; +} +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} +export interface RequestDeliverTx { + tx: Uint8Array; +} +export interface RequestEndBlock { + height: number; +} +export interface RequestCommit { +} +/** lists available snapshots */ +export interface RequestListSnapshots { +} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot: Snapshot | undefined; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: number; + format: number; + chunk: number; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: number; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo | undefined; + misbehavior: Misbehavior[]; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + initChain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + beginBlock?: ResponseBeginBlock | undefined; + checkTx?: ResponseCheckTx | undefined; + deliverTx?: ResponseDeliverTx | undefined; + endBlock?: ResponseEndBlock | undefined; + commit?: ResponseCommit | undefined; + listSnapshots?: ResponseListSnapshots | undefined; + offerSnapshot?: ResponseOfferSnapshot | undefined; + loadSnapshotChunk?: ResponseLoadSnapshotChunk | undefined; + applySnapshotChunk?: ResponseApplySnapshotChunk | undefined; + prepareProposal?: ResponsePrepareProposal | undefined; + processProposal?: ResponseProcessProposal | undefined; +} +/** nondeterministic */ +export interface ResponseException { + error: string; +} +export interface ResponseEcho { + message: string; +} +export interface ResponseFlush { +} +export interface ResponseInfo { + data: string; + version: string; + appVersion: number; + lastBlockHeight: number; + lastBlockAppHash: Uint8Array; +} +export interface ResponseInitChain { + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} +export interface ResponseBeginBlock { + events: Event[]; +} +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + events: Event[]; + codespace: string; + sender: string; + priority: number; + /** + * mempool_error is set by CometBFT. + * ABCI applictions creating a ResponseCheckTX should not set mempool_error. + */ + mempoolError: string; +} +export interface ResponseDeliverTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} +export interface ResponseEndBlock { + validatorUpdates: ValidatorUpdate[]; + consensusParamUpdates: ConsensusParams | undefined; + events: Event[]; +} +export interface ResponseCommit { + /** reserve 1 */ + data: Uint8Array; + retainHeight: number; +} +export interface ResponseListSnapshots { + snapshots: Snapshot[]; +} +export interface ResponseOfferSnapshot { + result: ResponseOfferSnapshot_Result; +} +export declare enum ResponseOfferSnapshot_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Snapshot accepted, apply chunks */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** REJECT - Reject this specific snapshot, try others */ + REJECT = 3, + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + REJECT_FORMAT = 4, + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + REJECT_SENDER = 5, + UNRECOGNIZED = -1 +} +export declare function responseOfferSnapshot_ResultFromJSON(object: any): ResponseOfferSnapshot_Result; +export declare function responseOfferSnapshot_ResultToJSON(object: ResponseOfferSnapshot_Result): string; +export interface ResponseLoadSnapshotChunk { + chunk: Uint8Array; +} +export interface ResponseApplySnapshotChunk { + result: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: string[]; +} +export declare enum ResponseApplySnapshotChunk_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Chunk successfully accepted */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** RETRY - Retry chunk (combine with refetch and reject) */ + RETRY = 3, + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + RETRY_SNAPSHOT = 4, + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + REJECT_SNAPSHOT = 5, + UNRECOGNIZED = -1 +} +export declare function responseApplySnapshotChunk_ResultFromJSON(object: any): ResponseApplySnapshotChunk_Result; +export declare function responseApplySnapshotChunk_ResultToJSON(object: ResponseApplySnapshotChunk_Result): string; +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} +export declare enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1 +} +export declare function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus; +export declare function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string; +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: number; + index: number; + tx: Uint8Array; + result: ResponseDeliverTx | undefined; +} +/** Validator */ +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: number; +} +/** ValidatorUpdate */ +export interface ValidatorUpdate { + pubKey: PublicKey | undefined; + power: number; +} +/** VoteInfo */ +export interface VoteInfo { + validator: Validator | undefined; + signedLastBlock: boolean; +} +export interface ExtendedVoteInfo { + validator: Validator | undefined; + signedLastBlock: boolean; + /** Reserved for future use */ + voteExtension: Uint8Array; +} +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: Validator | undefined; + /** The height when the offense occurred */ + height: number; + /** The corresponding time where the offense occurred */ + time: Date | undefined; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: number; +} +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: number; + /** The application-specific snapshot format */ + format: number; + /** Number of chunks in the snapshot */ + chunks: number; + /** Arbitrary snapshot hash, equal only if identical */ + hash: Uint8Array; + /** Arbitrary application metadata */ + metadata: Uint8Array; +} +export declare const Request: { + encode(message: Request, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Request; + fromJSON(object: any): Request; + toJSON(message: Request): unknown; + create]: never; }) | undefined; + flush?: ({} & {} & { [K_1 in Exclude]: never; }) | undefined; + info?: ({ + version?: string | undefined; + blockVersion?: number | undefined; + p2pVersion?: number | undefined; + abciVersion?: string | undefined; + } & { + version?: string | undefined; + blockVersion?: number | undefined; + p2pVersion?: number | undefined; + abciVersion?: string | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + initChain?: ({ + time?: Date | undefined; + chainId?: string | undefined; + consensusParams?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + validators?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { + time?: Date | undefined; + chainId?: string | undefined; + consensusParams?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + query?: ({ + data?: Uint8Array | undefined; + path?: string | undefined; + height?: number | undefined; + prove?: boolean | undefined; + } & { + data?: Uint8Array | undefined; + path?: string | undefined; + height?: number | undefined; + prove?: boolean | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + beginBlock?: ({ + hash?: Uint8Array | undefined; + header?: { + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } | undefined; + lastCommitInfo?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } | undefined; + byzantineValidators?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + } & { + hash?: Uint8Array | undefined; + header?: ({ + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + version?: ({ + block?: number | undefined; + app?: number | undefined; + } & { + block?: number | undefined; + app?: number | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + lastCommitInfo?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_19 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_20 in Exclude]: never; })[] & { [K_21 in Exclude]: never; }) | undefined; + } & { [K_22 in Exclude]: never; }) | undefined; + byzantineValidators?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_23 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_24 in Exclude]: never; })[] & { [K_25 in Exclude]: never; }) | undefined; + } & { [K_26 in Exclude]: never; }) | undefined; + checkTx?: ({ + tx?: Uint8Array | undefined; + type?: CheckTxType | undefined; + } & { + tx?: Uint8Array | undefined; + type?: CheckTxType | undefined; + } & { [K_27 in Exclude]: never; }) | undefined; + deliverTx?: ({ + tx?: Uint8Array | undefined; + } & { + tx?: Uint8Array | undefined; + } & { [K_28 in Exclude]: never; }) | undefined; + endBlock?: ({ + height?: number | undefined; + } & { + height?: number | undefined; + } & { [K_29 in Exclude]: never; }) | undefined; + commit?: ({} & {} & { [K_30 in Exclude]: never; }) | undefined; + listSnapshots?: ({} & {} & { [K_31 in Exclude]: never; }) | undefined; + offerSnapshot?: ({ + snapshot?: { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } | undefined; + appHash?: Uint8Array | undefined; + } & { + snapshot?: ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { [K_32 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_33 in Exclude]: never; }) | undefined; + loadSnapshotChunk?: ({ + height?: number | undefined; + format?: number | undefined; + chunk?: number | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunk?: number | undefined; + } & { [K_34 in Exclude]: never; }) | undefined; + applySnapshotChunk?: ({ + index?: number | undefined; + chunk?: Uint8Array | undefined; + sender?: string | undefined; + } & { + index?: number | undefined; + chunk?: Uint8Array | undefined; + sender?: string | undefined; + } & { [K_35 in Exclude]: never; }) | undefined; + prepareProposal?: ({ + maxTxBytes?: number | undefined; + txs?: Uint8Array[] | undefined; + localLastCommit?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } | undefined; + misbehavior?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + maxTxBytes?: number | undefined; + txs?: (Uint8Array[] & Uint8Array[] & { [K_36 in Exclude]: never; }) | undefined; + localLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_37 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_38 in Exclude]: never; })[] & { [K_39 in Exclude]: never; }) | undefined; + } & { [K_40 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_41 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_42 in Exclude]: never; })[] & { [K_43 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_44 in Exclude]: never; }) | undefined; + processProposal?: ({ + txs?: Uint8Array[] | undefined; + proposedLastCommit?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } | undefined; + misbehavior?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + txs?: (Uint8Array[] & Uint8Array[] & { [K_45 in Exclude]: never; }) | undefined; + proposedLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_46 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_47 in Exclude]: never; })[] & { [K_48 in Exclude]: never; }) | undefined; + } & { [K_49 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_50 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_51 in Exclude]: never; })[] & { [K_52 in Exclude]: never; }) | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_53 in Exclude]: never; }) | undefined; + } & { [K_54 in Exclude]: never; }>(base?: I | undefined): Request; + fromPartial]: never; }) | undefined; + flush?: ({} & {} & { [K_56 in Exclude]: never; }) | undefined; + info?: ({ + version?: string | undefined; + blockVersion?: number | undefined; + p2pVersion?: number | undefined; + abciVersion?: string | undefined; + } & { + version?: string | undefined; + blockVersion?: number | undefined; + p2pVersion?: number | undefined; + abciVersion?: string | undefined; + } & { [K_57 in Exclude]: never; }) | undefined; + initChain?: ({ + time?: Date | undefined; + chainId?: string | undefined; + consensusParams?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + validators?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { + time?: Date | undefined; + chainId?: string | undefined; + consensusParams?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_58 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_59 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_60 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_61 in Exclude]: never; }) | undefined; + } & { [K_62 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_63 in Exclude]: never; }) | undefined; + } & { [K_64 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_65 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_66 in Exclude]: never; })[] & { [K_67 in Exclude]: never; }) | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { [K_68 in Exclude]: never; }) | undefined; + query?: ({ + data?: Uint8Array | undefined; + path?: string | undefined; + height?: number | undefined; + prove?: boolean | undefined; + } & { + data?: Uint8Array | undefined; + path?: string | undefined; + height?: number | undefined; + prove?: boolean | undefined; + } & { [K_69 in Exclude]: never; }) | undefined; + beginBlock?: ({ + hash?: Uint8Array | undefined; + header?: { + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } | undefined; + lastCommitInfo?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } | undefined; + byzantineValidators?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + } & { + hash?: Uint8Array | undefined; + header?: ({ + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + version?: ({ + block?: number | undefined; + app?: number | undefined; + } & { + block?: number | undefined; + app?: number | undefined; + } & { [K_70 in Exclude]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_71 in Exclude]: never; }) | undefined; + } & { [K_72 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_73 in Exclude]: never; }) | undefined; + lastCommitInfo?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_74 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_75 in Exclude]: never; })[] & { [K_76 in Exclude]: never; }) | undefined; + } & { [K_77 in Exclude]: never; }) | undefined; + byzantineValidators?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_78 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_79 in Exclude]: never; })[] & { [K_80 in Exclude]: never; }) | undefined; + } & { [K_81 in Exclude]: never; }) | undefined; + checkTx?: ({ + tx?: Uint8Array | undefined; + type?: CheckTxType | undefined; + } & { + tx?: Uint8Array | undefined; + type?: CheckTxType | undefined; + } & { [K_82 in Exclude]: never; }) | undefined; + deliverTx?: ({ + tx?: Uint8Array | undefined; + } & { + tx?: Uint8Array | undefined; + } & { [K_83 in Exclude]: never; }) | undefined; + endBlock?: ({ + height?: number | undefined; + } & { + height?: number | undefined; + } & { [K_84 in Exclude]: never; }) | undefined; + commit?: ({} & {} & { [K_85 in Exclude]: never; }) | undefined; + listSnapshots?: ({} & {} & { [K_86 in Exclude]: never; }) | undefined; + offerSnapshot?: ({ + snapshot?: { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } | undefined; + appHash?: Uint8Array | undefined; + } & { + snapshot?: ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { [K_87 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_88 in Exclude]: never; }) | undefined; + loadSnapshotChunk?: ({ + height?: number | undefined; + format?: number | undefined; + chunk?: number | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunk?: number | undefined; + } & { [K_89 in Exclude]: never; }) | undefined; + applySnapshotChunk?: ({ + index?: number | undefined; + chunk?: Uint8Array | undefined; + sender?: string | undefined; + } & { + index?: number | undefined; + chunk?: Uint8Array | undefined; + sender?: string | undefined; + } & { [K_90 in Exclude]: never; }) | undefined; + prepareProposal?: ({ + maxTxBytes?: number | undefined; + txs?: Uint8Array[] | undefined; + localLastCommit?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } | undefined; + misbehavior?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + maxTxBytes?: number | undefined; + txs?: (Uint8Array[] & Uint8Array[] & { [K_91 in Exclude]: never; }) | undefined; + localLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_92 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_93 in Exclude]: never; })[] & { [K_94 in Exclude]: never; }) | undefined; + } & { [K_95 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_96 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_97 in Exclude]: never; })[] & { [K_98 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_99 in Exclude]: never; }) | undefined; + processProposal?: ({ + txs?: Uint8Array[] | undefined; + proposedLastCommit?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } | undefined; + misbehavior?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + txs?: (Uint8Array[] & Uint8Array[] & { [K_100 in Exclude]: never; }) | undefined; + proposedLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_101 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_102 in Exclude]: never; })[] & { [K_103 in Exclude]: never; }) | undefined; + } & { [K_104 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_105 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_106 in Exclude]: never; })[] & { [K_107 in Exclude]: never; }) | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_108 in Exclude]: never; }) | undefined; + } & { [K_109 in Exclude]: never; }>(object: I_1): Request; +}; +export declare const RequestEcho: { + encode(message: RequestEcho, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestEcho; + fromJSON(object: any): RequestEcho; + toJSON(message: RequestEcho): unknown; + create]: never; }>(base?: I | undefined): RequestEcho; + fromPartial]: never; }>(object: I_1): RequestEcho; +}; +export declare const RequestFlush: { + encode(_: RequestFlush, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestFlush; + fromJSON(_: any): RequestFlush; + toJSON(_: RequestFlush): unknown; + create]: never; }>(base?: I | undefined): RequestFlush; + fromPartial]: never; }>(_: I_1): RequestFlush; +}; +export declare const RequestInfo: { + encode(message: RequestInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestInfo; + fromJSON(object: any): RequestInfo; + toJSON(message: RequestInfo): unknown; + create]: never; }>(base?: I | undefined): RequestInfo; + fromPartial]: never; }>(object: I_1): RequestInfo; +}; +export declare const RequestInitChain: { + encode(message: RequestInitChain, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestInitChain; + fromJSON(object: any): RequestInitChain; + toJSON(message: RequestInitChain): unknown; + create]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_8 in Exclude]: never; })[] & { [K_9 in Exclude]: never; }) | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { [K_10 in Exclude]: never; }>(base?: I | undefined): RequestInitChain; + fromPartial]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_14 in Exclude]: never; }) | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_19 in Exclude]: never; })[] & { [K_20 in Exclude]: never; }) | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { [K_21 in Exclude]: never; }>(object: I_1): RequestInitChain; +}; +export declare const RequestQuery: { + encode(message: RequestQuery, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestQuery; + fromJSON(object: any): RequestQuery; + toJSON(message: RequestQuery): unknown; + create]: never; }>(base?: I | undefined): RequestQuery; + fromPartial]: never; }>(object: I_1): RequestQuery; +}; +export declare const RequestBeginBlock: { + encode(message: RequestBeginBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestBeginBlock; + fromJSON(object: any): RequestBeginBlock; + toJSON(message: RequestBeginBlock): unknown; + create]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + lastCommitInfo?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_5 in Exclude]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + byzantineValidators?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_9 in Exclude]: never; })[] & { [K_10 in Exclude]: never; }) | undefined; + } & { [K_11 in Exclude]: never; }>(base?: I | undefined): RequestBeginBlock; + fromPartial]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + lastCommitInfo?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_16 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_17 in Exclude]: never; })[] & { [K_18 in Exclude]: never; }) | undefined; + } & { [K_19 in Exclude]: never; }) | undefined; + byzantineValidators?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_20 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_21 in Exclude]: never; })[] & { [K_22 in Exclude]: never; }) | undefined; + } & { [K_23 in Exclude]: never; }>(object: I_1): RequestBeginBlock; +}; +export declare const RequestCheckTx: { + encode(message: RequestCheckTx, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestCheckTx; + fromJSON(object: any): RequestCheckTx; + toJSON(message: RequestCheckTx): unknown; + create]: never; }>(base?: I | undefined): RequestCheckTx; + fromPartial]: never; }>(object: I_1): RequestCheckTx; +}; +export declare const RequestDeliverTx: { + encode(message: RequestDeliverTx, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestDeliverTx; + fromJSON(object: any): RequestDeliverTx; + toJSON(message: RequestDeliverTx): unknown; + create]: never; }>(base?: I | undefined): RequestDeliverTx; + fromPartial]: never; }>(object: I_1): RequestDeliverTx; +}; +export declare const RequestEndBlock: { + encode(message: RequestEndBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestEndBlock; + fromJSON(object: any): RequestEndBlock; + toJSON(message: RequestEndBlock): unknown; + create]: never; }>(base?: I | undefined): RequestEndBlock; + fromPartial]: never; }>(object: I_1): RequestEndBlock; +}; +export declare const RequestCommit: { + encode(_: RequestCommit, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestCommit; + fromJSON(_: any): RequestCommit; + toJSON(_: RequestCommit): unknown; + create]: never; }>(base?: I | undefined): RequestCommit; + fromPartial]: never; }>(_: I_1): RequestCommit; +}; +export declare const RequestListSnapshots: { + encode(_: RequestListSnapshots, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestListSnapshots; + fromJSON(_: any): RequestListSnapshots; + toJSON(_: RequestListSnapshots): unknown; + create]: never; }>(base?: I | undefined): RequestListSnapshots; + fromPartial]: never; }>(_: I_1): RequestListSnapshots; +}; +export declare const RequestOfferSnapshot: { + encode(message: RequestOfferSnapshot, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestOfferSnapshot; + fromJSON(object: any): RequestOfferSnapshot; + toJSON(message: RequestOfferSnapshot): unknown; + create]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): RequestOfferSnapshot; + fromPartial]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): RequestOfferSnapshot; +}; +export declare const RequestLoadSnapshotChunk: { + encode(message: RequestLoadSnapshotChunk, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestLoadSnapshotChunk; + fromJSON(object: any): RequestLoadSnapshotChunk; + toJSON(message: RequestLoadSnapshotChunk): unknown; + create]: never; }>(base?: I | undefined): RequestLoadSnapshotChunk; + fromPartial]: never; }>(object: I_1): RequestLoadSnapshotChunk; +}; +export declare const RequestApplySnapshotChunk: { + encode(message: RequestApplySnapshotChunk, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestApplySnapshotChunk; + fromJSON(object: any): RequestApplySnapshotChunk; + toJSON(message: RequestApplySnapshotChunk): unknown; + create]: never; }>(base?: I | undefined): RequestApplySnapshotChunk; + fromPartial]: never; }>(object: I_1): RequestApplySnapshotChunk; +}; +export declare const RequestPrepareProposal: { + encode(message: RequestPrepareProposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestPrepareProposal; + fromJSON(object: any): RequestPrepareProposal; + toJSON(message: RequestPrepareProposal): unknown; + create]: never; }) | undefined; + localLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_6 in Exclude]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_8 in Exclude]: never; }>(base?: I | undefined): RequestPrepareProposal; + fromPartial]: never; }) | undefined; + localLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_15 in Exclude]: never; })[] & { [K_16 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_17 in Exclude]: never; }>(object: I_1): RequestPrepareProposal; +}; +export declare const RequestProcessProposal: { + encode(message: RequestProcessProposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestProcessProposal; + fromJSON(object: any): RequestProcessProposal; + toJSON(message: RequestProcessProposal): unknown; + create]: never; }) | undefined; + proposedLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_6 in Exclude]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_8 in Exclude]: never; }>(base?: I | undefined): RequestProcessProposal; + fromPartial]: never; }) | undefined; + proposedLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_15 in Exclude]: never; })[] & { [K_16 in Exclude]: never; }) | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_17 in Exclude]: never; }>(object: I_1): RequestProcessProposal; +}; +export declare const Response: { + encode(message: Response, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Response; + fromJSON(object: any): Response; + toJSON(message: Response): unknown; + create]: never; }) | undefined; + echo?: ({ + message?: string | undefined; + } & { + message?: string | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + flush?: ({} & {} & { [K_2 in Exclude]: never; }) | undefined; + info?: ({ + data?: string | undefined; + version?: string | undefined; + appVersion?: number | undefined; + lastBlockHeight?: number | undefined; + lastBlockAppHash?: Uint8Array | undefined; + } & { + data?: string | undefined; + version?: string | undefined; + appVersion?: number | undefined; + lastBlockHeight?: number | undefined; + lastBlockAppHash?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + initChain?: ({ + consensusParams?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + validators?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + appHash?: Uint8Array | undefined; + } & { + consensusParams?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_7 in Exclude]: never; }) | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_11 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_12 in Exclude]: never; })[] & { [K_13 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + query?: ({ + code?: number | undefined; + log?: string | undefined; + info?: string | undefined; + index?: number | undefined; + key?: Uint8Array | undefined; + value?: Uint8Array | undefined; + proofOps?: { + ops?: { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] | undefined; + } | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { + code?: number | undefined; + log?: string | undefined; + info?: string | undefined; + index?: number | undefined; + key?: Uint8Array | undefined; + value?: Uint8Array | undefined; + proofOps?: ({ + ops?: { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] | undefined; + } & { + ops?: ({ + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] & ({ + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + } & { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + } & { [K_15 in Exclude]: never; })[] & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; }) | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + beginBlock?: ({ + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + } & { + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_19 in Exclude]: never; })[] & { [K_20 in Exclude]: never; }) | undefined; + } & { [K_21 in Exclude]: never; })[] & { [K_22 in Exclude]: never; }) | undefined; + } & { [K_23 in Exclude]: never; }) | undefined; + checkTx?: ({ + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_24 in Exclude]: never; })[] & { [K_25 in Exclude]: never; }) | undefined; + } & { [K_26 in Exclude]: never; })[] & { [K_27 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { [K_28 in Exclude]: never; }) | undefined; + deliverTx?: ({ + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + codespace?: string | undefined; + } & { + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_29 in Exclude]: never; })[] & { [K_30 in Exclude]: never; }) | undefined; + } & { [K_31 in Exclude]: never; })[] & { [K_32 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_33 in Exclude]: never; }) | undefined; + endBlock?: ({ + validatorUpdates?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + consensusParamUpdates?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + } & { + validatorUpdates?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_34 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_35 in Exclude]: never; })[] & { [K_36 in Exclude]: never; }) | undefined; + consensusParamUpdates?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_37 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_38 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_39 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_40 in Exclude]: never; }) | undefined; + } & { [K_41 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_42 in Exclude]: never; }) | undefined; + } & { [K_43 in Exclude]: never; }) | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_44 in Exclude]: never; })[] & { [K_45 in Exclude]: never; }) | undefined; + } & { [K_46 in Exclude]: never; })[] & { [K_47 in Exclude]: never; }) | undefined; + } & { [K_48 in Exclude]: never; }) | undefined; + commit?: ({ + data?: Uint8Array | undefined; + retainHeight?: number | undefined; + } & { + data?: Uint8Array | undefined; + retainHeight?: number | undefined; + } & { [K_49 in Exclude]: never; }) | undefined; + listSnapshots?: ({ + snapshots?: { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + }[] | undefined; + } & { + snapshots?: ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + }[] & ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { [K_50 in Exclude]: never; })[] & { [K_51 in Exclude]: never; }) | undefined; + } & { [K_52 in Exclude]: never; }) | undefined; + offerSnapshot?: ({ + result?: ResponseOfferSnapshot_Result | undefined; + } & { + result?: ResponseOfferSnapshot_Result | undefined; + } & { [K_53 in Exclude]: never; }) | undefined; + loadSnapshotChunk?: ({ + chunk?: Uint8Array | undefined; + } & { + chunk?: Uint8Array | undefined; + } & { [K_54 in Exclude]: never; }) | undefined; + applySnapshotChunk?: ({ + result?: ResponseApplySnapshotChunk_Result | undefined; + refetchChunks?: number[] | undefined; + rejectSenders?: string[] | undefined; + } & { + result?: ResponseApplySnapshotChunk_Result | undefined; + refetchChunks?: (number[] & number[] & { [K_55 in Exclude]: never; }) | undefined; + rejectSenders?: (string[] & string[] & { [K_56 in Exclude]: never; }) | undefined; + } & { [K_57 in Exclude]: never; }) | undefined; + prepareProposal?: ({ + txs?: Uint8Array[] | undefined; + } & { + txs?: (Uint8Array[] & Uint8Array[] & { [K_58 in Exclude]: never; }) | undefined; + } & { [K_59 in Exclude]: never; }) | undefined; + processProposal?: ({ + status?: ResponseProcessProposal_ProposalStatus | undefined; + } & { + status?: ResponseProcessProposal_ProposalStatus | undefined; + } & { [K_60 in Exclude]: never; }) | undefined; + } & { [K_61 in Exclude]: never; }>(base?: I | undefined): Response; + fromPartial]: never; }) | undefined; + echo?: ({ + message?: string | undefined; + } & { + message?: string | undefined; + } & { [K_63 in Exclude]: never; }) | undefined; + flush?: ({} & {} & { [K_64 in Exclude]: never; }) | undefined; + info?: ({ + data?: string | undefined; + version?: string | undefined; + appVersion?: number | undefined; + lastBlockHeight?: number | undefined; + lastBlockAppHash?: Uint8Array | undefined; + } & { + data?: string | undefined; + version?: string | undefined; + appVersion?: number | undefined; + lastBlockHeight?: number | undefined; + lastBlockAppHash?: Uint8Array | undefined; + } & { [K_65 in Exclude]: never; }) | undefined; + initChain?: ({ + consensusParams?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + validators?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + appHash?: Uint8Array | undefined; + } & { + consensusParams?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_66 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_67 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_68 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_69 in Exclude]: never; }) | undefined; + } & { [K_70 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_71 in Exclude]: never; }) | undefined; + } & { [K_72 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_73 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_74 in Exclude]: never; })[] & { [K_75 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_76 in Exclude]: never; }) | undefined; + query?: ({ + code?: number | undefined; + log?: string | undefined; + info?: string | undefined; + index?: number | undefined; + key?: Uint8Array | undefined; + value?: Uint8Array | undefined; + proofOps?: { + ops?: { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] | undefined; + } | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { + code?: number | undefined; + log?: string | undefined; + info?: string | undefined; + index?: number | undefined; + key?: Uint8Array | undefined; + value?: Uint8Array | undefined; + proofOps?: ({ + ops?: { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] | undefined; + } & { + ops?: ({ + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] & ({ + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + } & { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + } & { [K_77 in Exclude]: never; })[] & { [K_78 in Exclude]: never; }) | undefined; + } & { [K_79 in Exclude]: never; }) | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { [K_80 in Exclude]: never; }) | undefined; + beginBlock?: ({ + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + } & { + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_81 in Exclude]: never; })[] & { [K_82 in Exclude]: never; }) | undefined; + } & { [K_83 in Exclude]: never; })[] & { [K_84 in Exclude]: never; }) | undefined; + } & { [K_85 in Exclude]: never; }) | undefined; + checkTx?: ({ + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_86 in Exclude]: never; })[] & { [K_87 in Exclude]: never; }) | undefined; + } & { [K_88 in Exclude]: never; })[] & { [K_89 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { [K_90 in Exclude]: never; }) | undefined; + deliverTx?: ({ + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + codespace?: string | undefined; + } & { + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_91 in Exclude]: never; })[] & { [K_92 in Exclude]: never; }) | undefined; + } & { [K_93 in Exclude]: never; })[] & { [K_94 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_95 in Exclude]: never; }) | undefined; + endBlock?: ({ + validatorUpdates?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + consensusParamUpdates?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + } & { + validatorUpdates?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_96 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_97 in Exclude]: never; })[] & { [K_98 in Exclude]: never; }) | undefined; + consensusParamUpdates?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_99 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_100 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_101 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_102 in Exclude]: never; }) | undefined; + } & { [K_103 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_104 in Exclude]: never; }) | undefined; + } & { [K_105 in Exclude]: never; }) | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_106 in Exclude]: never; })[] & { [K_107 in Exclude]: never; }) | undefined; + } & { [K_108 in Exclude]: never; })[] & { [K_109 in Exclude]: never; }) | undefined; + } & { [K_110 in Exclude]: never; }) | undefined; + commit?: ({ + data?: Uint8Array | undefined; + retainHeight?: number | undefined; + } & { + data?: Uint8Array | undefined; + retainHeight?: number | undefined; + } & { [K_111 in Exclude]: never; }) | undefined; + listSnapshots?: ({ + snapshots?: { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + }[] | undefined; + } & { + snapshots?: ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + }[] & ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { [K_112 in Exclude]: never; })[] & { [K_113 in Exclude]: never; }) | undefined; + } & { [K_114 in Exclude]: never; }) | undefined; + offerSnapshot?: ({ + result?: ResponseOfferSnapshot_Result | undefined; + } & { + result?: ResponseOfferSnapshot_Result | undefined; + } & { [K_115 in Exclude]: never; }) | undefined; + loadSnapshotChunk?: ({ + chunk?: Uint8Array | undefined; + } & { + chunk?: Uint8Array | undefined; + } & { [K_116 in Exclude]: never; }) | undefined; + applySnapshotChunk?: ({ + result?: ResponseApplySnapshotChunk_Result | undefined; + refetchChunks?: number[] | undefined; + rejectSenders?: string[] | undefined; + } & { + result?: ResponseApplySnapshotChunk_Result | undefined; + refetchChunks?: (number[] & number[] & { [K_117 in Exclude]: never; }) | undefined; + rejectSenders?: (string[] & string[] & { [K_118 in Exclude]: never; }) | undefined; + } & { [K_119 in Exclude]: never; }) | undefined; + prepareProposal?: ({ + txs?: Uint8Array[] | undefined; + } & { + txs?: (Uint8Array[] & Uint8Array[] & { [K_120 in Exclude]: never; }) | undefined; + } & { [K_121 in Exclude]: never; }) | undefined; + processProposal?: ({ + status?: ResponseProcessProposal_ProposalStatus | undefined; + } & { + status?: ResponseProcessProposal_ProposalStatus | undefined; + } & { [K_122 in Exclude]: never; }) | undefined; + } & { [K_123 in Exclude]: never; }>(object: I_1): Response; +}; +export declare const ResponseException: { + encode(message: ResponseException, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseException; + fromJSON(object: any): ResponseException; + toJSON(message: ResponseException): unknown; + create]: never; }>(base?: I | undefined): ResponseException; + fromPartial]: never; }>(object: I_1): ResponseException; +}; +export declare const ResponseEcho: { + encode(message: ResponseEcho, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEcho; + fromJSON(object: any): ResponseEcho; + toJSON(message: ResponseEcho): unknown; + create]: never; }>(base?: I | undefined): ResponseEcho; + fromPartial]: never; }>(object: I_1): ResponseEcho; +}; +export declare const ResponseFlush: { + encode(_: ResponseFlush, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseFlush; + fromJSON(_: any): ResponseFlush; + toJSON(_: ResponseFlush): unknown; + create]: never; }>(base?: I | undefined): ResponseFlush; + fromPartial]: never; }>(_: I_1): ResponseFlush; +}; +export declare const ResponseInfo: { + encode(message: ResponseInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInfo; + fromJSON(object: any): ResponseInfo; + toJSON(message: ResponseInfo): unknown; + create]: never; }>(base?: I | undefined): ResponseInfo; + fromPartial]: never; }>(object: I_1): ResponseInfo; +}; +export declare const ResponseInitChain: { + encode(message: ResponseInitChain, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInitChain; + fromJSON(object: any): ResponseInitChain; + toJSON(message: ResponseInitChain): unknown; + create]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_8 in Exclude]: never; })[] & { [K_9 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_10 in Exclude]: never; }>(base?: I | undefined): ResponseInitChain; + fromPartial]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_14 in Exclude]: never; }) | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_19 in Exclude]: never; })[] & { [K_20 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_21 in Exclude]: never; }>(object: I_1): ResponseInitChain; +}; +export declare const ResponseQuery: { + encode(message: ResponseQuery, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseQuery; + fromJSON(object: any): ResponseQuery; + toJSON(message: ResponseQuery): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { [K_3 in Exclude]: never; }>(base?: I | undefined): ResponseQuery; + fromPartial]: never; })[] & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { [K_7 in Exclude]: never; }>(object: I_1): ResponseQuery; +}; +export declare const ResponseBeginBlock: { + encode(message: ResponseBeginBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseBeginBlock; + fromJSON(object: any): ResponseBeginBlock; + toJSON(message: ResponseBeginBlock): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }>(base?: I | undefined): ResponseBeginBlock; + fromPartial]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }>(object: I_1): ResponseBeginBlock; +}; +export declare const ResponseCheckTx: { + encode(message: ResponseCheckTx, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCheckTx; + fromJSON(object: any): ResponseCheckTx; + toJSON(message: ResponseCheckTx): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { [K_4 in Exclude]: never; }>(base?: I | undefined): ResponseCheckTx; + fromPartial]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { [K_9 in Exclude]: never; }>(object: I_1): ResponseCheckTx; +}; +export declare const ResponseDeliverTx: { + encode(message: ResponseDeliverTx, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseDeliverTx; + fromJSON(object: any): ResponseDeliverTx; + toJSON(message: ResponseDeliverTx): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_4 in Exclude]: never; }>(base?: I | undefined): ResponseDeliverTx; + fromPartial]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_9 in Exclude]: never; }>(object: I_1): ResponseDeliverTx; +}; +export declare const ResponseEndBlock: { + encode(message: ResponseEndBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEndBlock; + fromJSON(object: any): ResponseEndBlock; + toJSON(message: ResponseEndBlock): unknown; + create]: never; }) | undefined; + power?: number | undefined; + } & { [K_1 in Exclude]: never; })[] & { [K_2 in Exclude]: never; }) | undefined; + consensusParamUpdates?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_10 in Exclude]: never; })[] & { [K_11 in Exclude]: never; }) | undefined; + } & { [K_12 in Exclude]: never; })[] & { [K_13 in Exclude]: never; }) | undefined; + } & { [K_14 in Exclude]: never; }>(base?: I | undefined): ResponseEndBlock; + fromPartial]: never; }) | undefined; + power?: number | undefined; + } & { [K_16 in Exclude]: never; })[] & { [K_17 in Exclude]: never; }) | undefined; + consensusParamUpdates?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_19 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_20 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_21 in Exclude]: never; }) | undefined; + } & { [K_22 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_23 in Exclude]: never; }) | undefined; + } & { [K_24 in Exclude]: never; }) | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_25 in Exclude]: never; })[] & { [K_26 in Exclude]: never; }) | undefined; + } & { [K_27 in Exclude]: never; })[] & { [K_28 in Exclude]: never; }) | undefined; + } & { [K_29 in Exclude]: never; }>(object: I_1): ResponseEndBlock; +}; +export declare const ResponseCommit: { + encode(message: ResponseCommit, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCommit; + fromJSON(object: any): ResponseCommit; + toJSON(message: ResponseCommit): unknown; + create]: never; }>(base?: I | undefined): ResponseCommit; + fromPartial]: never; }>(object: I_1): ResponseCommit; +}; +export declare const ResponseListSnapshots: { + encode(message: ResponseListSnapshots, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseListSnapshots; + fromJSON(object: any): ResponseListSnapshots; + toJSON(message: ResponseListSnapshots): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): ResponseListSnapshots; + fromPartial]: never; })[] & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): ResponseListSnapshots; +}; +export declare const ResponseOfferSnapshot: { + encode(message: ResponseOfferSnapshot, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseOfferSnapshot; + fromJSON(object: any): ResponseOfferSnapshot; + toJSON(message: ResponseOfferSnapshot): unknown; + create]: never; }>(base?: I | undefined): ResponseOfferSnapshot; + fromPartial]: never; }>(object: I_1): ResponseOfferSnapshot; +}; +export declare const ResponseLoadSnapshotChunk: { + encode(message: ResponseLoadSnapshotChunk, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseLoadSnapshotChunk; + fromJSON(object: any): ResponseLoadSnapshotChunk; + toJSON(message: ResponseLoadSnapshotChunk): unknown; + create]: never; }>(base?: I | undefined): ResponseLoadSnapshotChunk; + fromPartial]: never; }>(object: I_1): ResponseLoadSnapshotChunk; +}; +export declare const ResponseApplySnapshotChunk: { + encode(message: ResponseApplySnapshotChunk, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseApplySnapshotChunk; + fromJSON(object: any): ResponseApplySnapshotChunk; + toJSON(message: ResponseApplySnapshotChunk): unknown; + create]: never; }) | undefined; + rejectSenders?: (string[] & string[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): ResponseApplySnapshotChunk; + fromPartial]: never; }) | undefined; + rejectSenders?: (string[] & string[] & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): ResponseApplySnapshotChunk; +}; +export declare const ResponsePrepareProposal: { + encode(message: ResponsePrepareProposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponsePrepareProposal; + fromJSON(object: any): ResponsePrepareProposal; + toJSON(message: ResponsePrepareProposal): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): ResponsePrepareProposal; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): ResponsePrepareProposal; +}; +export declare const ResponseProcessProposal: { + encode(message: ResponseProcessProposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseProcessProposal; + fromJSON(object: any): ResponseProcessProposal; + toJSON(message: ResponseProcessProposal): unknown; + create]: never; }>(base?: I | undefined): ResponseProcessProposal; + fromPartial]: never; }>(object: I_1): ResponseProcessProposal; +}; +export declare const CommitInfo: { + encode(message: CommitInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): CommitInfo; + fromJSON(object: any): CommitInfo; + toJSON(message: CommitInfo): unknown; + create]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_1 in Exclude]: never; })[] & { [K_2 in Exclude]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(base?: I | undefined): CommitInfo; + fromPartial]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_5 in Exclude]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }>(object: I_1): CommitInfo; +}; +export declare const ExtendedCommitInfo: { + encode(message: ExtendedCommitInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ExtendedCommitInfo; + fromJSON(object: any): ExtendedCommitInfo; + toJSON(message: ExtendedCommitInfo): unknown; + create]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; })[] & { [K_2 in Exclude]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(base?: I | undefined): ExtendedCommitInfo; + fromPartial]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }>(object: I_1): ExtendedCommitInfo; +}; +export declare const Event: { + encode(message: Event, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Event; + fromJSON(object: any): Event; + toJSON(message: Event): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): Event; + fromPartial]: never; })[] & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): Event; +}; +export declare const EventAttribute: { + encode(message: EventAttribute, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): EventAttribute; + fromJSON(object: any): EventAttribute; + toJSON(message: EventAttribute): unknown; + create]: never; }>(base?: I | undefined): EventAttribute; + fromPartial]: never; }>(object: I_1): EventAttribute; +}; +export declare const TxResult: { + encode(message: TxResult, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): TxResult; + fromJSON(object: any): TxResult; + toJSON(message: TxResult): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(base?: I | undefined): TxResult; + fromPartial]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + } & { [K_8 in Exclude]: never; })[] & { [K_9 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + } & { [K_11 in Exclude]: never; }>(object: I_1): TxResult; +}; +export declare const Validator: { + encode(message: Validator, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Validator; + fromJSON(object: any): Validator; + toJSON(message: Validator): unknown; + create]: never; }>(base?: I | undefined): Validator; + fromPartial]: never; }>(object: I_1): Validator; +}; +export declare const ValidatorUpdate: { + encode(message: ValidatorUpdate, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorUpdate; + fromJSON(object: any): ValidatorUpdate; + toJSON(message: ValidatorUpdate): unknown; + create]: never; }) | undefined; + power?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): ValidatorUpdate; + fromPartial]: never; }) | undefined; + power?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): ValidatorUpdate; +}; +export declare const VoteInfo: { + encode(message: VoteInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): VoteInfo; + fromJSON(object: any): VoteInfo; + toJSON(message: VoteInfo): unknown; + create]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): VoteInfo; + fromPartial]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): VoteInfo; +}; +export declare const ExtendedVoteInfo: { + encode(message: ExtendedVoteInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ExtendedVoteInfo; + fromJSON(object: any): ExtendedVoteInfo; + toJSON(message: ExtendedVoteInfo): unknown; + create]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): ExtendedVoteInfo; + fromPartial]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): ExtendedVoteInfo; +}; +export declare const Misbehavior: { + encode(message: Misbehavior, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Misbehavior; + fromJSON(object: any): Misbehavior; + toJSON(message: Misbehavior): unknown; + create]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): Misbehavior; + fromPartial]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): Misbehavior; +}; +export declare const Snapshot: { + encode(message: Snapshot, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot; + fromJSON(object: any): Snapshot; + toJSON(message: Snapshot): unknown; + create]: never; }>(base?: I | undefined): Snapshot; + fromPartial]: never; }>(object: I_1): Snapshot; +}; +export interface ABCIApplication { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + DeliverTx(request: RequestDeliverTx): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + BeginBlock(request: RequestBeginBlock): Promise; + EndBlock(request: RequestEndBlock): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; +} +export declare class ABCIApplicationClientImpl implements ABCIApplication { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + DeliverTx(request: RequestDeliverTx): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + BeginBlock(request: RequestBeginBlock): Promise; + EndBlock(request: RequestEndBlock): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/tendermint/abci/types.js b/dist/main/tendermint/abci/types.js new file mode 100644 index 0000000..c87de5f --- /dev/null +++ b/dist/main/tendermint/abci/types.js @@ -0,0 +1,4893 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ResponsePrepareProposal = exports.ResponseApplySnapshotChunk = exports.ResponseLoadSnapshotChunk = exports.ResponseOfferSnapshot = exports.ResponseListSnapshots = exports.ResponseCommit = exports.ResponseEndBlock = exports.ResponseDeliverTx = exports.ResponseCheckTx = exports.ResponseBeginBlock = exports.ResponseQuery = exports.ResponseInitChain = exports.ResponseInfo = exports.ResponseFlush = exports.ResponseEcho = exports.ResponseException = exports.Response = exports.RequestProcessProposal = exports.RequestPrepareProposal = exports.RequestApplySnapshotChunk = exports.RequestLoadSnapshotChunk = exports.RequestOfferSnapshot = exports.RequestListSnapshots = exports.RequestCommit = exports.RequestEndBlock = exports.RequestDeliverTx = exports.RequestCheckTx = exports.RequestBeginBlock = exports.RequestQuery = exports.RequestInitChain = exports.RequestInfo = exports.RequestFlush = exports.RequestEcho = exports.Request = exports.responseProcessProposal_ProposalStatusToJSON = exports.responseProcessProposal_ProposalStatusFromJSON = exports.ResponseProcessProposal_ProposalStatus = exports.responseApplySnapshotChunk_ResultToJSON = exports.responseApplySnapshotChunk_ResultFromJSON = exports.ResponseApplySnapshotChunk_Result = exports.responseOfferSnapshot_ResultToJSON = exports.responseOfferSnapshot_ResultFromJSON = exports.ResponseOfferSnapshot_Result = exports.misbehaviorTypeToJSON = exports.misbehaviorTypeFromJSON = exports.MisbehaviorType = exports.checkTxTypeToJSON = exports.checkTxTypeFromJSON = exports.CheckTxType = exports.protobufPackage = void 0; +exports.ABCIApplicationClientImpl = exports.Snapshot = exports.Misbehavior = exports.ExtendedVoteInfo = exports.VoteInfo = exports.ValidatorUpdate = exports.Validator = exports.TxResult = exports.EventAttribute = exports.Event = exports.ExtendedCommitInfo = exports.CommitInfo = exports.ResponseProcessProposal = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +const timestamp_1 = require("../../google/protobuf/timestamp"); +const keys_1 = require("../crypto/keys"); +const proof_1 = require("../crypto/proof"); +const params_1 = require("../types/params"); +const types_1 = require("../types/types"); +exports.protobufPackage = "tendermint.abci"; +var CheckTxType; +(function (CheckTxType) { + CheckTxType[CheckTxType["NEW"] = 0] = "NEW"; + CheckTxType[CheckTxType["RECHECK"] = 1] = "RECHECK"; + CheckTxType[CheckTxType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(CheckTxType || (exports.CheckTxType = CheckTxType = {})); +function checkTxTypeFromJSON(object) { + switch (object) { + case 0: + case "NEW": + return CheckTxType.NEW; + case 1: + case "RECHECK": + return CheckTxType.RECHECK; + case -1: + case "UNRECOGNIZED": + default: + return CheckTxType.UNRECOGNIZED; + } +} +exports.checkTxTypeFromJSON = checkTxTypeFromJSON; +function checkTxTypeToJSON(object) { + switch (object) { + case CheckTxType.NEW: + return "NEW"; + case CheckTxType.RECHECK: + return "RECHECK"; + case CheckTxType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.checkTxTypeToJSON = checkTxTypeToJSON; +var MisbehaviorType; +(function (MisbehaviorType) { + MisbehaviorType[MisbehaviorType["UNKNOWN"] = 0] = "UNKNOWN"; + MisbehaviorType[MisbehaviorType["DUPLICATE_VOTE"] = 1] = "DUPLICATE_VOTE"; + MisbehaviorType[MisbehaviorType["LIGHT_CLIENT_ATTACK"] = 2] = "LIGHT_CLIENT_ATTACK"; + MisbehaviorType[MisbehaviorType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(MisbehaviorType || (exports.MisbehaviorType = MisbehaviorType = {})); +function misbehaviorTypeFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} +exports.misbehaviorTypeFromJSON = misbehaviorTypeFromJSON; +function misbehaviorTypeToJSON(object) { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.misbehaviorTypeToJSON = misbehaviorTypeToJSON; +var ResponseOfferSnapshot_Result; +(function (ResponseOfferSnapshot_Result) { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["UNKNOWN"] = 0] = "UNKNOWN"; + /** ACCEPT - Snapshot accepted, apply chunks */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["ACCEPT"] = 1] = "ACCEPT"; + /** ABORT - Abort all snapshot restoration */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["ABORT"] = 2] = "ABORT"; + /** REJECT - Reject this specific snapshot, try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT"] = 3] = "REJECT"; + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT_FORMAT"] = 4] = "REJECT_FORMAT"; + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT_SENDER"] = 5] = "REJECT_SENDER"; + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseOfferSnapshot_Result || (exports.ResponseOfferSnapshot_Result = ResponseOfferSnapshot_Result = {})); +function responseOfferSnapshot_ResultFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseOfferSnapshot_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseOfferSnapshot_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseOfferSnapshot_Result.ABORT; + case 3: + case "REJECT": + return ResponseOfferSnapshot_Result.REJECT; + case 4: + case "REJECT_FORMAT": + return ResponseOfferSnapshot_Result.REJECT_FORMAT; + case 5: + case "REJECT_SENDER": + return ResponseOfferSnapshot_Result.REJECT_SENDER; + case -1: + case "UNRECOGNIZED": + default: + return ResponseOfferSnapshot_Result.UNRECOGNIZED; + } +} +exports.responseOfferSnapshot_ResultFromJSON = responseOfferSnapshot_ResultFromJSON; +function responseOfferSnapshot_ResultToJSON(object) { + switch (object) { + case ResponseOfferSnapshot_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseOfferSnapshot_Result.ACCEPT: + return "ACCEPT"; + case ResponseOfferSnapshot_Result.ABORT: + return "ABORT"; + case ResponseOfferSnapshot_Result.REJECT: + return "REJECT"; + case ResponseOfferSnapshot_Result.REJECT_FORMAT: + return "REJECT_FORMAT"; + case ResponseOfferSnapshot_Result.REJECT_SENDER: + return "REJECT_SENDER"; + case ResponseOfferSnapshot_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.responseOfferSnapshot_ResultToJSON = responseOfferSnapshot_ResultToJSON; +var ResponseApplySnapshotChunk_Result; +(function (ResponseApplySnapshotChunk_Result) { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["UNKNOWN"] = 0] = "UNKNOWN"; + /** ACCEPT - Chunk successfully accepted */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["ACCEPT"] = 1] = "ACCEPT"; + /** ABORT - Abort all snapshot restoration */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["ABORT"] = 2] = "ABORT"; + /** RETRY - Retry chunk (combine with refetch and reject) */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["RETRY"] = 3] = "RETRY"; + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["RETRY_SNAPSHOT"] = 4] = "RETRY_SNAPSHOT"; + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["REJECT_SNAPSHOT"] = 5] = "REJECT_SNAPSHOT"; + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseApplySnapshotChunk_Result || (exports.ResponseApplySnapshotChunk_Result = ResponseApplySnapshotChunk_Result = {})); +function responseApplySnapshotChunk_ResultFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseApplySnapshotChunk_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseApplySnapshotChunk_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseApplySnapshotChunk_Result.ABORT; + case 3: + case "RETRY": + return ResponseApplySnapshotChunk_Result.RETRY; + case 4: + case "RETRY_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT; + case 5: + case "REJECT_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseApplySnapshotChunk_Result.UNRECOGNIZED; + } +} +exports.responseApplySnapshotChunk_ResultFromJSON = responseApplySnapshotChunk_ResultFromJSON; +function responseApplySnapshotChunk_ResultToJSON(object) { + switch (object) { + case ResponseApplySnapshotChunk_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseApplySnapshotChunk_Result.ACCEPT: + return "ACCEPT"; + case ResponseApplySnapshotChunk_Result.ABORT: + return "ABORT"; + case ResponseApplySnapshotChunk_Result.RETRY: + return "RETRY"; + case ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT: + return "RETRY_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT: + return "REJECT_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.responseApplySnapshotChunk_ResultToJSON = responseApplySnapshotChunk_ResultToJSON; +var ResponseProcessProposal_ProposalStatus; +(function (ResponseProcessProposal_ProposalStatus) { + ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["UNKNOWN"] = 0] = "UNKNOWN"; + ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["ACCEPT"] = 1] = "ACCEPT"; + ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["REJECT"] = 2] = "REJECT"; + ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseProcessProposal_ProposalStatus || (exports.ResponseProcessProposal_ProposalStatus = ResponseProcessProposal_ProposalStatus = {})); +function responseProcessProposal_ProposalStatusFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} +exports.responseProcessProposal_ProposalStatusFromJSON = responseProcessProposal_ProposalStatusFromJSON; +function responseProcessProposal_ProposalStatusToJSON(object) { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.responseProcessProposal_ProposalStatusToJSON = responseProcessProposal_ProposalStatusToJSON; +function createBaseRequest() { + return { + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + beginBlock: undefined, + checkTx: undefined, + deliverTx: undefined, + endBlock: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + }; +} +exports.Request = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.echo !== undefined) { + exports.RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); + } + if (message.flush !== undefined) { + exports.RequestFlush.encode(message.flush, writer.uint32(18).fork()).ldelim(); + } + if (message.info !== undefined) { + exports.RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim(); + } + if (message.initChain !== undefined) { + exports.RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).ldelim(); + } + if (message.query !== undefined) { + exports.RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + exports.RequestBeginBlock.encode(message.beginBlock, writer.uint32(58).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + exports.RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + exports.RequestDeliverTx.encode(message.deliverTx, writer.uint32(74).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + exports.RequestEndBlock.encode(message.endBlock, writer.uint32(82).fork()).ldelim(); + } + if (message.commit !== undefined) { + exports.RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + exports.RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + exports.RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + exports.RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + exports.RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.prepareProposal !== undefined) { + exports.RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).ldelim(); + } + if (message.processProposal !== undefined) { + exports.RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.echo = exports.RequestEcho.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.flush = exports.RequestFlush.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.info = exports.RequestInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + message.initChain = exports.RequestInitChain.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.query = exports.RequestQuery.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + message.beginBlock = exports.RequestBeginBlock.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + message.checkTx = exports.RequestCheckTx.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + message.deliverTx = exports.RequestDeliverTx.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + message.endBlock = exports.RequestEndBlock.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + message.commit = exports.RequestCommit.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + message.listSnapshots = exports.RequestListSnapshots.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + message.offerSnapshot = exports.RequestOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + message.loadSnapshotChunk = exports.RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + message.applySnapshotChunk = exports.RequestApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + message.prepareProposal = exports.RequestPrepareProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + message.processProposal = exports.RequestProcessProposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + echo: isSet(object.echo) ? exports.RequestEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) + ? exports.RequestFlush.fromJSON(object.flush) + : undefined, + info: isSet(object.info) ? exports.RequestInfo.fromJSON(object.info) : undefined, + initChain: isSet(object.initChain) + ? exports.RequestInitChain.fromJSON(object.initChain) + : undefined, + query: isSet(object.query) + ? exports.RequestQuery.fromJSON(object.query) + : undefined, + beginBlock: isSet(object.beginBlock) + ? exports.RequestBeginBlock.fromJSON(object.beginBlock) + : undefined, + checkTx: isSet(object.checkTx) + ? exports.RequestCheckTx.fromJSON(object.checkTx) + : undefined, + deliverTx: isSet(object.deliverTx) + ? exports.RequestDeliverTx.fromJSON(object.deliverTx) + : undefined, + endBlock: isSet(object.endBlock) + ? exports.RequestEndBlock.fromJSON(object.endBlock) + : undefined, + commit: isSet(object.commit) + ? exports.RequestCommit.fromJSON(object.commit) + : undefined, + listSnapshots: isSet(object.listSnapshots) + ? exports.RequestListSnapshots.fromJSON(object.listSnapshots) + : undefined, + offerSnapshot: isSet(object.offerSnapshot) + ? exports.RequestOfferSnapshot.fromJSON(object.offerSnapshot) + : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? exports.RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? exports.RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? exports.RequestPrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? exports.RequestProcessProposal.fromJSON(object.processProposal) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.echo !== undefined && + (obj.echo = message.echo ? exports.RequestEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && + (obj.flush = message.flush + ? exports.RequestFlush.toJSON(message.flush) + : undefined); + message.info !== undefined && + (obj.info = message.info ? exports.RequestInfo.toJSON(message.info) : undefined); + message.initChain !== undefined && + (obj.initChain = message.initChain + ? exports.RequestInitChain.toJSON(message.initChain) + : undefined); + message.query !== undefined && + (obj.query = message.query + ? exports.RequestQuery.toJSON(message.query) + : undefined); + message.beginBlock !== undefined && + (obj.beginBlock = message.beginBlock + ? exports.RequestBeginBlock.toJSON(message.beginBlock) + : undefined); + message.checkTx !== undefined && + (obj.checkTx = message.checkTx + ? exports.RequestCheckTx.toJSON(message.checkTx) + : undefined); + message.deliverTx !== undefined && + (obj.deliverTx = message.deliverTx + ? exports.RequestDeliverTx.toJSON(message.deliverTx) + : undefined); + message.endBlock !== undefined && + (obj.endBlock = message.endBlock + ? exports.RequestEndBlock.toJSON(message.endBlock) + : undefined); + message.commit !== undefined && + (obj.commit = message.commit + ? exports.RequestCommit.toJSON(message.commit) + : undefined); + message.listSnapshots !== undefined && + (obj.listSnapshots = message.listSnapshots + ? exports.RequestListSnapshots.toJSON(message.listSnapshots) + : undefined); + message.offerSnapshot !== undefined && + (obj.offerSnapshot = message.offerSnapshot + ? exports.RequestOfferSnapshot.toJSON(message.offerSnapshot) + : undefined); + message.loadSnapshotChunk !== undefined && + (obj.loadSnapshotChunk = message.loadSnapshotChunk + ? exports.RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) + : undefined); + message.applySnapshotChunk !== undefined && + (obj.applySnapshotChunk = message.applySnapshotChunk + ? exports.RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk) + : undefined); + message.prepareProposal !== undefined && + (obj.prepareProposal = message.prepareProposal + ? exports.RequestPrepareProposal.toJSON(message.prepareProposal) + : undefined); + message.processProposal !== undefined && + (obj.processProposal = message.processProposal + ? exports.RequestProcessProposal.toJSON(message.processProposal) + : undefined); + return obj; + }, + create(base) { + return exports.Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequest(); + message.echo = + object.echo !== undefined && object.echo !== null + ? exports.RequestEcho.fromPartial(object.echo) + : undefined; + message.flush = + object.flush !== undefined && object.flush !== null + ? exports.RequestFlush.fromPartial(object.flush) + : undefined; + message.info = + object.info !== undefined && object.info !== null + ? exports.RequestInfo.fromPartial(object.info) + : undefined; + message.initChain = + object.initChain !== undefined && object.initChain !== null + ? exports.RequestInitChain.fromPartial(object.initChain) + : undefined; + message.query = + object.query !== undefined && object.query !== null + ? exports.RequestQuery.fromPartial(object.query) + : undefined; + message.beginBlock = + object.beginBlock !== undefined && object.beginBlock !== null + ? exports.RequestBeginBlock.fromPartial(object.beginBlock) + : undefined; + message.checkTx = + object.checkTx !== undefined && object.checkTx !== null + ? exports.RequestCheckTx.fromPartial(object.checkTx) + : undefined; + message.deliverTx = + object.deliverTx !== undefined && object.deliverTx !== null + ? exports.RequestDeliverTx.fromPartial(object.deliverTx) + : undefined; + message.endBlock = + object.endBlock !== undefined && object.endBlock !== null + ? exports.RequestEndBlock.fromPartial(object.endBlock) + : undefined; + message.commit = + object.commit !== undefined && object.commit !== null + ? exports.RequestCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = + object.listSnapshots !== undefined && object.listSnapshots !== null + ? exports.RequestListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = + object.offerSnapshot !== undefined && object.offerSnapshot !== null + ? exports.RequestOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = + object.loadSnapshotChunk !== undefined && + object.loadSnapshotChunk !== null + ? exports.RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = + object.applySnapshotChunk !== undefined && + object.applySnapshotChunk !== null + ? exports.RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = + object.prepareProposal !== undefined && object.prepareProposal !== null + ? exports.RequestPrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = + object.processProposal !== undefined && object.processProposal !== null + ? exports.RequestProcessProposal.fromPartial(object.processProposal) + : undefined; + return message; + }, +}; +function createBaseRequestEcho() { + return { message: "" }; +} +exports.RequestEcho = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { message: isSet(object.message) ? String(object.message) : "" }; + }, + toJSON(message) { + const obj = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + create(base) { + return exports.RequestEcho.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; +function createBaseRequestFlush() { + return {}; +} +exports.RequestFlush = { + encode(_, writer = minimal_1.default.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.RequestFlush.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseRequestFlush(); + return message; + }, +}; +function createBaseRequestInfo() { + return { version: "", blockVersion: 0, p2pVersion: 0, abciVersion: "" }; +} +exports.RequestInfo = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== 0) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== 0) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.version = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.blockVersion = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.p2pVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.abciVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + version: isSet(object.version) ? String(object.version) : "", + blockVersion: isSet(object.blockVersion) + ? Number(object.blockVersion) + : 0, + p2pVersion: isSet(object.p2pVersion) ? Number(object.p2pVersion) : 0, + abciVersion: isSet(object.abciVersion) ? String(object.abciVersion) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.version !== undefined && (obj.version = message.version); + message.blockVersion !== undefined && + (obj.blockVersion = Math.round(message.blockVersion)); + message.p2pVersion !== undefined && + (obj.p2pVersion = Math.round(message.p2pVersion)); + message.abciVersion !== undefined && + (obj.abciVersion = message.abciVersion); + return obj; + }, + create(base) { + return exports.RequestInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion ?? 0; + message.p2pVersion = object.p2pVersion ?? 0; + message.abciVersion = object.abciVersion ?? ""; + return message; + }, +}; +function createBaseRequestInitChain() { + return { + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(), + initialHeight: 0, + }; +} +exports.RequestInitChain = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + params_1.ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + exports.ValidatorUpdate.encode(v, writer.uint32(34).fork()).ldelim(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.time = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.consensusParams = params_1.ConsensusParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.validators.push(exports.ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + message.appStateBytes = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + message.initialHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chainId: isSet(object.chainId) ? String(object.chainId) : "", + consensusParams: isSet(object.consensusParams) + ? params_1.ConsensusParams.fromJSON(object.consensusParams) + : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => exports.ValidatorUpdate.fromJSON(e)) + : [], + appStateBytes: isSet(object.appStateBytes) + ? bytesFromBase64(object.appStateBytes) + : new Uint8Array(), + initialHeight: isSet(object.initialHeight) + ? Number(object.initialHeight) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.time !== undefined && (obj.time = message.time.toISOString()); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.consensusParams !== undefined && + (obj.consensusParams = message.consensusParams + ? params_1.ConsensusParams.toJSON(message.consensusParams) + : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? exports.ValidatorUpdate.toJSON(e) : undefined); + } + else { + obj.validators = []; + } + message.appStateBytes !== undefined && + (obj.appStateBytes = base64FromBytes(message.appStateBytes !== undefined + ? message.appStateBytes + : new Uint8Array())); + message.initialHeight !== undefined && + (obj.initialHeight = Math.round(message.initialHeight)); + return obj; + }, + create(base) { + return exports.RequestInitChain.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = + object.consensusParams !== undefined && object.consensusParams !== null + ? params_1.ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = + object.validators?.map((e) => exports.ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(); + message.initialHeight = object.initialHeight ?? 0; + return message; + }, +}; +function createBaseRequestQuery() { + return { data: new Uint8Array(), path: "", height: 0, prove: false }; +} +exports.RequestQuery = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.prove === true) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + path: isSet(object.path) ? String(object.path) : "", + height: isSet(object.height) ? Number(object.height) : 0, + prove: isSet(object.prove) ? Boolean(object.prove) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.path !== undefined && (obj.path = message.path); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.prove !== undefined && (obj.prove = message.prove); + return obj; + }, + create(base) { + return exports.RequestQuery.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; +function createBaseRequestBeginBlock() { + return { + hash: new Uint8Array(), + header: undefined, + lastCommitInfo: undefined, + byzantineValidators: [], + }; +} +exports.RequestBeginBlock = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.header !== undefined) { + types_1.Header.encode(message.header, writer.uint32(18).fork()).ldelim(); + } + if (message.lastCommitInfo !== undefined) { + exports.CommitInfo.encode(message.lastCommitInfo, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.byzantineValidators) { + exports.Misbehavior.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.header = types_1.Header.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.lastCommitInfo = exports.CommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.byzantineValidators.push(exports.Misbehavior.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + header: isSet(object.header) ? types_1.Header.fromJSON(object.header) : undefined, + lastCommitInfo: isSet(object.lastCommitInfo) + ? exports.CommitInfo.fromJSON(object.lastCommitInfo) + : undefined, + byzantineValidators: Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e) => exports.Misbehavior.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.header !== undefined && + (obj.header = message.header ? types_1.Header.toJSON(message.header) : undefined); + message.lastCommitInfo !== undefined && + (obj.lastCommitInfo = message.lastCommitInfo + ? exports.CommitInfo.toJSON(message.lastCommitInfo) + : undefined); + if (message.byzantineValidators) { + obj.byzantineValidators = message.byzantineValidators.map((e) => e ? exports.Misbehavior.toJSON(e) : undefined); + } + else { + obj.byzantineValidators = []; + } + return obj; + }, + create(base) { + return exports.RequestBeginBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestBeginBlock(); + message.hash = object.hash ?? new Uint8Array(); + message.header = + object.header !== undefined && object.header !== null + ? types_1.Header.fromPartial(object.header) + : undefined; + message.lastCommitInfo = + object.lastCommitInfo !== undefined && object.lastCommitInfo !== null + ? exports.CommitInfo.fromPartial(object.lastCommitInfo) + : undefined; + message.byzantineValidators = + object.byzantineValidators?.map((e) => exports.Misbehavior.fromPartial(e)) || []; + return message; + }, +}; +function createBaseRequestCheckTx() { + return { tx: new Uint8Array(), type: 0 }; +} +exports.RequestCheckTx = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.tx = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.type !== undefined && (obj.type = checkTxTypeToJSON(message.type)); + return obj; + }, + create(base) { + return exports.RequestCheckTx.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(); + message.type = object.type ?? 0; + return message; + }, +}; +function createBaseRequestDeliverTx() { + return { tx: new Uint8Array() }; +} +exports.RequestDeliverTx = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.tx = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + return obj; + }, + create(base) { + return exports.RequestDeliverTx.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestDeliverTx(); + message.tx = object.tx ?? new Uint8Array(); + return message; + }, +}; +function createBaseRequestEndBlock() { + return { height: 0 }; +} +exports.RequestEndBlock = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { height: isSet(object.height) ? Number(object.height) : 0 }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + return obj; + }, + create(base) { + return exports.RequestEndBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestEndBlock(); + message.height = object.height ?? 0; + return message; + }, +}; +function createBaseRequestCommit() { + return {}; +} +exports.RequestCommit = { + encode(_, writer = minimal_1.default.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.RequestCommit.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseRequestCommit(); + return message; + }, +}; +function createBaseRequestListSnapshots() { + return {}; +} +exports.RequestListSnapshots = { + encode(_, writer = minimal_1.default.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.RequestListSnapshots.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; +function createBaseRequestOfferSnapshot() { + return { snapshot: undefined, appHash: new Uint8Array() }; +} +exports.RequestOfferSnapshot = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.snapshot !== undefined) { + exports.Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.snapshot = exports.Snapshot.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + snapshot: isSet(object.snapshot) + ? exports.Snapshot.fromJSON(object.snapshot) + : undefined, + appHash: isSet(object.appHash) + ? bytesFromBase64(object.appHash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.snapshot !== undefined && + (obj.snapshot = message.snapshot + ? exports.Snapshot.toJSON(message.snapshot) + : undefined); + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + return obj; + }, + create(base) { + return exports.RequestOfferSnapshot.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = + object.snapshot !== undefined && object.snapshot !== null + ? exports.Snapshot.fromPartial(object.snapshot) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseRequestLoadSnapshotChunk() { + return { height: 0, format: 0, chunk: 0 }; +} +exports.RequestLoadSnapshotChunk = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunk !== 0) { + writer.uint32(24).uint32(message.chunk); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.chunk = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + height: isSet(object.height) ? Number(object.height) : 0, + format: isSet(object.format) ? Number(object.format) : 0, + chunk: isSet(object.chunk) ? Number(object.chunk) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunk !== undefined && (obj.chunk = Math.round(message.chunk)); + return obj; + }, + create(base) { + return exports.RequestLoadSnapshotChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestLoadSnapshotChunk(); + message.height = object.height ?? 0; + message.format = object.format ?? 0; + message.chunk = object.chunk ?? 0; + return message; + }, +}; +function createBaseRequestApplySnapshotChunk() { + return { index: 0, chunk: new Uint8Array(), sender: "" }; +} +exports.RequestApplySnapshotChunk = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.chunk = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + index: isSet(object.index) ? Number(object.index) : 0, + chunk: isSet(object.chunk) + ? bytesFromBase64(object.chunk) + : new Uint8Array(), + sender: isSet(object.sender) ? String(object.sender) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + create(base) { + return exports.RequestApplySnapshotChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(); + message.sender = object.sender ?? ""; + return message; + }, +}; +function createBaseRequestPrepareProposal() { + return { + maxTxBytes: 0, + txs: [], + localLastCommit: undefined, + misbehavior: [], + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +exports.RequestPrepareProposal = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.maxTxBytes !== 0) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v); + } + if (message.localLastCommit !== undefined) { + exports.ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.misbehavior) { + exports.Misbehavior.encode(v, writer.uint32(34).fork()).ldelim(); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.maxTxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.txs.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.localLastCommit = exports.ExtendedCommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.misbehavior.push(exports.Misbehavior.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.time = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + maxTxBytes: isSet(object.maxTxBytes) ? Number(object.maxTxBytes) : 0, + txs: Array.isArray(object?.txs) + ? object.txs.map((e) => bytesFromBase64(e)) + : [], + localLastCommit: isSet(object.localLastCommit) + ? exports.ExtendedCommitInfo.fromJSON(object.localLastCommit) + : undefined, + misbehavior: Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e) => exports.Misbehavior.fromJSON(e)) + : [], + height: isSet(object.height) ? Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) + ? bytesFromBase64(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.maxTxBytes !== undefined && + (obj.maxTxBytes = Math.round(message.maxTxBytes)); + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + message.localLastCommit !== undefined && + (obj.localLastCommit = message.localLastCommit + ? exports.ExtendedCommitInfo.toJSON(message.localLastCommit) + : undefined); + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map((e) => e ? exports.Misbehavior.toJSON(e) : undefined); + } + else { + obj.misbehavior = []; + } + message.height !== undefined && (obj.height = Math.round(message.height)); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array())); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes(message.proposerAddress !== undefined + ? message.proposerAddress + : new Uint8Array())); + return obj; + }, + create(base) { + return exports.RequestPrepareProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes ?? 0; + message.txs = object.txs?.map((e) => e) || []; + message.localLastCommit = + object.localLastCommit !== undefined && object.localLastCommit !== null + ? exports.ExtendedCommitInfo.fromPartial(object.localLastCommit) + : undefined; + message.misbehavior = + object.misbehavior?.map((e) => exports.Misbehavior.fromPartial(e)) || []; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, +}; +function createBaseRequestProcessProposal() { + return { + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +exports.RequestProcessProposal = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.txs) { + writer.uint32(10).bytes(v); + } + if (message.proposedLastCommit !== undefined) { + exports.CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.misbehavior) { + exports.Misbehavior.encode(v, writer.uint32(26).fork()).ldelim(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.proposedLastCommit = exports.CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.misbehavior.push(exports.Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.time = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) + ? object.txs.map((e) => bytesFromBase64(e)) + : [], + proposedLastCommit: isSet(object.proposedLastCommit) + ? exports.CommitInfo.fromJSON(object.proposedLastCommit) + : undefined, + misbehavior: Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e) => exports.Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + height: isSet(object.height) ? Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) + ? bytesFromBase64(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + message.proposedLastCommit !== undefined && + (obj.proposedLastCommit = message.proposedLastCommit + ? exports.CommitInfo.toJSON(message.proposedLastCommit) + : undefined); + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map((e) => e ? exports.Misbehavior.toJSON(e) : undefined); + } + else { + obj.misbehavior = []; + } + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array())); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes(message.proposerAddress !== undefined + ? message.proposerAddress + : new Uint8Array())); + return obj; + }, + create(base) { + return exports.RequestProcessProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = + object.proposedLastCommit !== undefined && + object.proposedLastCommit !== null + ? exports.CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = + object.misbehavior?.map((e) => exports.Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponse() { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + beginBlock: undefined, + checkTx: undefined, + deliverTx: undefined, + endBlock: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + }; +} +exports.Response = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.exception !== undefined) { + exports.ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); + } + if (message.echo !== undefined) { + exports.ResponseEcho.encode(message.echo, writer.uint32(18).fork()).ldelim(); + } + if (message.flush !== undefined) { + exports.ResponseFlush.encode(message.flush, writer.uint32(26).fork()).ldelim(); + } + if (message.info !== undefined) { + exports.ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); + } + if (message.initChain !== undefined) { + exports.ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).ldelim(); + } + if (message.query !== undefined) { + exports.ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + exports.ResponseBeginBlock.encode(message.beginBlock, writer.uint32(66).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + exports.ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + exports.ResponseDeliverTx.encode(message.deliverTx, writer.uint32(82).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + exports.ResponseEndBlock.encode(message.endBlock, writer.uint32(90).fork()).ldelim(); + } + if (message.commit !== undefined) { + exports.ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + exports.ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + exports.ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + exports.ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + exports.ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).ldelim(); + } + if (message.prepareProposal !== undefined) { + exports.ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).ldelim(); + } + if (message.processProposal !== undefined) { + exports.ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.exception = exports.ResponseException.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.echo = exports.ResponseEcho.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.flush = exports.ResponseFlush.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.info = exports.ResponseInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.initChain = exports.ResponseInitChain.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + message.query = exports.ResponseQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + message.beginBlock = exports.ResponseBeginBlock.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + message.checkTx = exports.ResponseCheckTx.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + message.deliverTx = exports.ResponseDeliverTx.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + message.endBlock = exports.ResponseEndBlock.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + message.commit = exports.ResponseCommit.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + message.listSnapshots = exports.ResponseListSnapshots.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + message.offerSnapshot = exports.ResponseOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + message.loadSnapshotChunk = exports.ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + message.applySnapshotChunk = exports.ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + message.prepareProposal = exports.ResponsePrepareProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + message.processProposal = exports.ResponseProcessProposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + exception: isSet(object.exception) + ? exports.ResponseException.fromJSON(object.exception) + : undefined, + echo: isSet(object.echo) ? exports.ResponseEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) + ? exports.ResponseFlush.fromJSON(object.flush) + : undefined, + info: isSet(object.info) ? exports.ResponseInfo.fromJSON(object.info) : undefined, + initChain: isSet(object.initChain) + ? exports.ResponseInitChain.fromJSON(object.initChain) + : undefined, + query: isSet(object.query) + ? exports.ResponseQuery.fromJSON(object.query) + : undefined, + beginBlock: isSet(object.beginBlock) + ? exports.ResponseBeginBlock.fromJSON(object.beginBlock) + : undefined, + checkTx: isSet(object.checkTx) + ? exports.ResponseCheckTx.fromJSON(object.checkTx) + : undefined, + deliverTx: isSet(object.deliverTx) + ? exports.ResponseDeliverTx.fromJSON(object.deliverTx) + : undefined, + endBlock: isSet(object.endBlock) + ? exports.ResponseEndBlock.fromJSON(object.endBlock) + : undefined, + commit: isSet(object.commit) + ? exports.ResponseCommit.fromJSON(object.commit) + : undefined, + listSnapshots: isSet(object.listSnapshots) + ? exports.ResponseListSnapshots.fromJSON(object.listSnapshots) + : undefined, + offerSnapshot: isSet(object.offerSnapshot) + ? exports.ResponseOfferSnapshot.fromJSON(object.offerSnapshot) + : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? exports.ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? exports.ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? exports.ResponsePrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? exports.ResponseProcessProposal.fromJSON(object.processProposal) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.exception !== undefined && + (obj.exception = message.exception + ? exports.ResponseException.toJSON(message.exception) + : undefined); + message.echo !== undefined && + (obj.echo = message.echo ? exports.ResponseEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && + (obj.flush = message.flush + ? exports.ResponseFlush.toJSON(message.flush) + : undefined); + message.info !== undefined && + (obj.info = message.info ? exports.ResponseInfo.toJSON(message.info) : undefined); + message.initChain !== undefined && + (obj.initChain = message.initChain + ? exports.ResponseInitChain.toJSON(message.initChain) + : undefined); + message.query !== undefined && + (obj.query = message.query + ? exports.ResponseQuery.toJSON(message.query) + : undefined); + message.beginBlock !== undefined && + (obj.beginBlock = message.beginBlock + ? exports.ResponseBeginBlock.toJSON(message.beginBlock) + : undefined); + message.checkTx !== undefined && + (obj.checkTx = message.checkTx + ? exports.ResponseCheckTx.toJSON(message.checkTx) + : undefined); + message.deliverTx !== undefined && + (obj.deliverTx = message.deliverTx + ? exports.ResponseDeliverTx.toJSON(message.deliverTx) + : undefined); + message.endBlock !== undefined && + (obj.endBlock = message.endBlock + ? exports.ResponseEndBlock.toJSON(message.endBlock) + : undefined); + message.commit !== undefined && + (obj.commit = message.commit + ? exports.ResponseCommit.toJSON(message.commit) + : undefined); + message.listSnapshots !== undefined && + (obj.listSnapshots = message.listSnapshots + ? exports.ResponseListSnapshots.toJSON(message.listSnapshots) + : undefined); + message.offerSnapshot !== undefined && + (obj.offerSnapshot = message.offerSnapshot + ? exports.ResponseOfferSnapshot.toJSON(message.offerSnapshot) + : undefined); + message.loadSnapshotChunk !== undefined && + (obj.loadSnapshotChunk = message.loadSnapshotChunk + ? exports.ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) + : undefined); + message.applySnapshotChunk !== undefined && + (obj.applySnapshotChunk = message.applySnapshotChunk + ? exports.ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk) + : undefined); + message.prepareProposal !== undefined && + (obj.prepareProposal = message.prepareProposal + ? exports.ResponsePrepareProposal.toJSON(message.prepareProposal) + : undefined); + message.processProposal !== undefined && + (obj.processProposal = message.processProposal + ? exports.ResponseProcessProposal.toJSON(message.processProposal) + : undefined); + return obj; + }, + create(base) { + return exports.Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponse(); + message.exception = + object.exception !== undefined && object.exception !== null + ? exports.ResponseException.fromPartial(object.exception) + : undefined; + message.echo = + object.echo !== undefined && object.echo !== null + ? exports.ResponseEcho.fromPartial(object.echo) + : undefined; + message.flush = + object.flush !== undefined && object.flush !== null + ? exports.ResponseFlush.fromPartial(object.flush) + : undefined; + message.info = + object.info !== undefined && object.info !== null + ? exports.ResponseInfo.fromPartial(object.info) + : undefined; + message.initChain = + object.initChain !== undefined && object.initChain !== null + ? exports.ResponseInitChain.fromPartial(object.initChain) + : undefined; + message.query = + object.query !== undefined && object.query !== null + ? exports.ResponseQuery.fromPartial(object.query) + : undefined; + message.beginBlock = + object.beginBlock !== undefined && object.beginBlock !== null + ? exports.ResponseBeginBlock.fromPartial(object.beginBlock) + : undefined; + message.checkTx = + object.checkTx !== undefined && object.checkTx !== null + ? exports.ResponseCheckTx.fromPartial(object.checkTx) + : undefined; + message.deliverTx = + object.deliverTx !== undefined && object.deliverTx !== null + ? exports.ResponseDeliverTx.fromPartial(object.deliverTx) + : undefined; + message.endBlock = + object.endBlock !== undefined && object.endBlock !== null + ? exports.ResponseEndBlock.fromPartial(object.endBlock) + : undefined; + message.commit = + object.commit !== undefined && object.commit !== null + ? exports.ResponseCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = + object.listSnapshots !== undefined && object.listSnapshots !== null + ? exports.ResponseListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = + object.offerSnapshot !== undefined && object.offerSnapshot !== null + ? exports.ResponseOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = + object.loadSnapshotChunk !== undefined && + object.loadSnapshotChunk !== null + ? exports.ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = + object.applySnapshotChunk !== undefined && + object.applySnapshotChunk !== null + ? exports.ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = + object.prepareProposal !== undefined && object.prepareProposal !== null + ? exports.ResponsePrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = + object.processProposal !== undefined && object.processProposal !== null + ? exports.ResponseProcessProposal.fromPartial(object.processProposal) + : undefined; + return message; + }, +}; +function createBaseResponseException() { + return { error: "" }; +} +exports.ResponseException = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { error: isSet(object.error) ? String(object.error) : "" }; + }, + toJSON(message) { + const obj = {}; + message.error !== undefined && (obj.error = message.error); + return obj; + }, + create(base) { + return exports.ResponseException.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; +function createBaseResponseEcho() { + return { message: "" }; +} +exports.ResponseEcho = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { message: isSet(object.message) ? String(object.message) : "" }; + }, + toJSON(message) { + const obj = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + create(base) { + return exports.ResponseEcho.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; +function createBaseResponseFlush() { + return {}; +} +exports.ResponseFlush = { + encode(_, writer = minimal_1.default.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.ResponseFlush.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseResponseFlush(); + return message; + }, +}; +function createBaseResponseInfo() { + return { + data: "", + version: "", + appVersion: 0, + lastBlockHeight: 0, + lastBlockAppHash: new Uint8Array(), + }; +} +exports.ResponseInfo = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== 0) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.version = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.appVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.lastBlockHeight = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + message.lastBlockAppHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) ? String(object.data) : "", + version: isSet(object.version) ? String(object.version) : "", + appVersion: isSet(object.appVersion) ? Number(object.appVersion) : 0, + lastBlockHeight: isSet(object.lastBlockHeight) + ? Number(object.lastBlockHeight) + : 0, + lastBlockAppHash: isSet(object.lastBlockAppHash) + ? bytesFromBase64(object.lastBlockAppHash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && (obj.data = message.data); + message.version !== undefined && (obj.version = message.version); + message.appVersion !== undefined && + (obj.appVersion = Math.round(message.appVersion)); + message.lastBlockHeight !== undefined && + (obj.lastBlockHeight = Math.round(message.lastBlockHeight)); + message.lastBlockAppHash !== undefined && + (obj.lastBlockAppHash = base64FromBytes(message.lastBlockAppHash !== undefined + ? message.lastBlockAppHash + : new Uint8Array())); + return obj; + }, + create(base) { + return exports.ResponseInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion ?? 0; + message.lastBlockHeight = object.lastBlockHeight ?? 0; + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseInitChain() { + return { + consensusParams: undefined, + validators: [], + appHash: new Uint8Array(), + }; +} +exports.ResponseInitChain = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.consensusParams !== undefined) { + params_1.ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.validators) { + exports.ValidatorUpdate.encode(v, writer.uint32(18).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.consensusParams = params_1.ConsensusParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.validators.push(exports.ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + consensusParams: isSet(object.consensusParams) + ? params_1.ConsensusParams.fromJSON(object.consensusParams) + : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => exports.ValidatorUpdate.fromJSON(e)) + : [], + appHash: isSet(object.appHash) + ? bytesFromBase64(object.appHash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.consensusParams !== undefined && + (obj.consensusParams = message.consensusParams + ? params_1.ConsensusParams.toJSON(message.consensusParams) + : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? exports.ValidatorUpdate.toJSON(e) : undefined); + } + else { + obj.validators = []; + } + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + return obj; + }, + create(base) { + return exports.ResponseInitChain.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseInitChain(); + message.consensusParams = + object.consensusParams !== undefined && object.consensusParams !== null + ? params_1.ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = + object.validators?.map((e) => exports.ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseQuery() { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(), + value: new Uint8Array(), + proofOps: undefined, + height: 0, + codespace: "", + }; +} +exports.ResponseQuery = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + proof_1.ProofOps.encode(message.proofOps, writer.uint32(66).fork()).ldelim(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.proofOps = proof_1.ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + code: isSet(object.code) ? Number(object.code) : 0, + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + index: isSet(object.index) ? Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(), + proofOps: isSet(object.proofOps) + ? proof_1.ProofOps.fromJSON(object.proofOps) + : undefined, + height: isSet(object.height) ? Number(object.height) : 0, + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.proofOps !== undefined && + (obj.proofOps = message.proofOps + ? proof_1.ProofOps.toJSON(message.proofOps) + : undefined); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + create(base) { + return exports.ResponseQuery.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseQuery(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? 0; + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.proofOps = + object.proofOps !== undefined && object.proofOps !== null + ? proof_1.ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; +function createBaseResponseBeginBlock() { + return { events: [] }; +} +exports.ResponseBeginBlock = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.events) { + exports.Event.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.events.push(exports.Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + events: Array.isArray(object?.events) + ? object.events.map((e) => exports.Event.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + create(base) { + return exports.ResponseBeginBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseBeginBlock(); + message.events = object.events?.map((e) => exports.Event.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseCheckTx() { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: 0, + gasUsed: 0, + events: [], + codespace: "", + sender: "", + priority: 0, + mempoolError: "", + }; +} +exports.ResponseCheckTx = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + exports.Event.encode(v, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + if (message.sender !== "") { + writer.uint32(74).string(message.sender); + } + if (message.priority !== 0) { + writer.uint32(80).int64(message.priority); + } + if (message.mempoolError !== "") { + writer.uint32(90).string(message.mempoolError); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + message.events.push(exports.Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + message.codespace = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + message.sender = reader.string(); + continue; + case 10: + if (tag !== 80) { + break; + } + message.priority = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + message.mempoolError = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? Number(object.gas_used) : 0, + events: Array.isArray(object?.events) + ? object.events.map((e) => exports.Event.fromJSON(e)) + : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + priority: isSet(object.priority) ? Number(object.priority) : 0, + mempoolError: isSet(object.mempoolError) + ? String(object.mempoolError) + : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && + (obj.gas_wanted = Math.round(message.gasWanted)); + message.gasUsed !== undefined && + (obj.gas_used = Math.round(message.gasUsed)); + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + message.sender !== undefined && (obj.sender = message.sender); + message.priority !== undefined && + (obj.priority = Math.round(message.priority)); + message.mempoolError !== undefined && + (obj.mempoolError = message.mempoolError); + return obj; + }, + create(base) { + return exports.ResponseCheckTx.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => exports.Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + message.sender = object.sender ?? ""; + message.priority = object.priority ?? 0; + message.mempoolError = object.mempoolError ?? ""; + return message; + }, +}; +function createBaseResponseDeliverTx() { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: 0, + gasUsed: 0, + events: [], + codespace: "", + }; +} +exports.ResponseDeliverTx = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + exports.Event.encode(v, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + message.events.push(exports.Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? Number(object.gas_used) : 0, + events: Array.isArray(object?.events) + ? object.events.map((e) => exports.Event.fromJSON(e)) + : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && + (obj.gas_wanted = Math.round(message.gasWanted)); + message.gasUsed !== undefined && + (obj.gas_used = Math.round(message.gasUsed)); + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + create(base) { + return exports.ResponseDeliverTx.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseDeliverTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => exports.Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; +function createBaseResponseEndBlock() { + return { validatorUpdates: [], consensusParamUpdates: undefined, events: [] }; +} +exports.ResponseEndBlock = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.validatorUpdates) { + exports.ValidatorUpdate.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusParamUpdates !== undefined) { + params_1.ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.events) { + exports.Event.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.validatorUpdates.push(exports.ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + message.consensusParamUpdates = params_1.ConsensusParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.events.push(exports.Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + validatorUpdates: Array.isArray(object?.validatorUpdates) + ? object.validatorUpdates.map((e) => exports.ValidatorUpdate.fromJSON(e)) + : [], + consensusParamUpdates: isSet(object.consensusParamUpdates) + ? params_1.ConsensusParams.fromJSON(object.consensusParamUpdates) + : undefined, + events: Array.isArray(object?.events) + ? object.events.map((e) => exports.Event.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.validatorUpdates) { + obj.validatorUpdates = message.validatorUpdates.map((e) => e ? exports.ValidatorUpdate.toJSON(e) : undefined); + } + else { + obj.validatorUpdates = []; + } + message.consensusParamUpdates !== undefined && + (obj.consensusParamUpdates = message.consensusParamUpdates + ? params_1.ConsensusParams.toJSON(message.consensusParamUpdates) + : undefined); + if (message.events) { + obj.events = message.events.map((e) => (e ? exports.Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + create(base) { + return exports.ResponseEndBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseEndBlock(); + message.validatorUpdates = + object.validatorUpdates?.map((e) => exports.ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = + object.consensusParamUpdates !== undefined && + object.consensusParamUpdates !== null + ? params_1.ConsensusParams.fromPartial(object.consensusParamUpdates) + : undefined; + message.events = object.events?.map((e) => exports.Event.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseCommit() { + return { data: new Uint8Array(), retainHeight: 0 }; +} +exports.ResponseCommit = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.retainHeight !== 0) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.retainHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + retainHeight: isSet(object.retainHeight) + ? Number(object.retainHeight) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.retainHeight !== undefined && + (obj.retainHeight = Math.round(message.retainHeight)); + return obj; + }, + create(base) { + return exports.ResponseCommit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseCommit(); + message.data = object.data ?? new Uint8Array(); + message.retainHeight = object.retainHeight ?? 0; + return message; + }, +}; +function createBaseResponseListSnapshots() { + return { snapshots: [] }; +} +exports.ResponseListSnapshots = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.snapshots) { + exports.Snapshot.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.snapshots.push(exports.Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + snapshots: Array.isArray(object?.snapshots) + ? object.snapshots.map((e) => exports.Snapshot.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map((e) => e ? exports.Snapshot.toJSON(e) : undefined); + } + else { + obj.snapshots = []; + } + return obj; + }, + create(base) { + return exports.ResponseListSnapshots.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseListSnapshots(); + message.snapshots = + object.snapshots?.map((e) => exports.Snapshot.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseOfferSnapshot() { + return { result: 0 }; +} +exports.ResponseOfferSnapshot = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.result = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet(object.result) + ? responseOfferSnapshot_ResultFromJSON(object.result) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && + (obj.result = responseOfferSnapshot_ResultToJSON(message.result)); + return obj; + }, + create(base) { + return exports.ResponseOfferSnapshot.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; +function createBaseResponseLoadSnapshotChunk() { + return { chunk: new Uint8Array() }; +} +exports.ResponseLoadSnapshotChunk = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.chunk = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + chunk: isSet(object.chunk) + ? bytesFromBase64(object.chunk) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + return obj; + }, + create(base) { + return exports.ResponseLoadSnapshotChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseApplySnapshotChunk() { + return { result: 0, refetchChunks: [], rejectSenders: [] }; +} +exports.ResponseApplySnapshotChunk = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.ldelim(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.result = reader.int32(); + continue; + case 2: + if (tag === 16) { + message.refetchChunks.push(reader.uint32()); + continue; + } + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + continue; + } + break; + case 3: + if (tag !== 26) { + break; + } + message.rejectSenders.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet(object.result) + ? responseApplySnapshotChunk_ResultFromJSON(object.result) + : 0, + refetchChunks: Array.isArray(object?.refetchChunks) + ? object.refetchChunks.map((e) => Number(e)) + : [], + rejectSenders: Array.isArray(object?.rejectSenders) + ? object.rejectSenders.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && + (obj.result = responseApplySnapshotChunk_ResultToJSON(message.result)); + if (message.refetchChunks) { + obj.refetchChunks = message.refetchChunks.map((e) => Math.round(e)); + } + else { + obj.refetchChunks = []; + } + if (message.rejectSenders) { + obj.rejectSenders = message.rejectSenders.map((e) => e); + } + else { + obj.rejectSenders = []; + } + return obj; + }, + create(base) { + return exports.ResponseApplySnapshotChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map((e) => e) || []; + message.rejectSenders = object.rejectSenders?.map((e) => e) || []; + return message; + }, +}; +function createBaseResponsePrepareProposal() { + return { txs: [] }; +} +exports.ResponsePrepareProposal = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.txs) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) + ? object.txs.map((e) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + return obj; + }, + create(base) { + return exports.ResponsePrepareProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; +function createBaseResponseProcessProposal() { + return { status: 0 }; +} +exports.ResponseProcessProposal = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.status = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + status: isSet(object.status) + ? responseProcessProposal_ProposalStatusFromJSON(object.status) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.status !== undefined && + (obj.status = responseProcessProposal_ProposalStatusToJSON(message.status)); + return obj; + }, + create(base) { + return exports.ResponseProcessProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, +}; +function createBaseCommitInfo() { + return { round: 0, votes: [] }; +} +exports.CommitInfo = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + exports.VoteInfo.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.votes.push(exports.VoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) + ? object.votes.map((e) => exports.VoteInfo.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => e ? exports.VoteInfo.toJSON(e) : undefined); + } + else { + obj.votes = []; + } + return obj; + }, + create(base) { + return exports.CommitInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => exports.VoteInfo.fromPartial(e)) || []; + return message; + }, +}; +function createBaseExtendedCommitInfo() { + return { round: 0, votes: [] }; +} +exports.ExtendedCommitInfo = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + exports.ExtendedVoteInfo.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.votes.push(exports.ExtendedVoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) + ? object.votes.map((e) => exports.ExtendedVoteInfo.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => e ? exports.ExtendedVoteInfo.toJSON(e) : undefined); + } + else { + obj.votes = []; + } + return obj; + }, + create(base) { + return exports.ExtendedCommitInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = + object.votes?.map((e) => exports.ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEvent() { + return { type: "", attributes: [] }; +} +exports.Event = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + exports.EventAttribute.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.attributes.push(exports.EventAttribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) + ? object.attributes.map((e) => exports.EventAttribute.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => e ? exports.EventAttribute.toJSON(e) : undefined); + } + else { + obj.attributes = []; + } + return obj; + }, + create(base) { + return exports.Event.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEvent(); + message.type = object.type ?? ""; + message.attributes = + object.attributes?.map((e) => exports.EventAttribute.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEventAttribute() { + return { key: "", value: "", index: false }; +} +exports.EventAttribute = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index === true) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.index = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "", + index: isSet(object.index) ? Boolean(object.index) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + message.index !== undefined && (obj.index = message.index); + return obj; + }, + create(base) { + return exports.EventAttribute.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, +}; +function createBaseTxResult() { + return { height: 0, index: 0, tx: new Uint8Array(), result: undefined }; +} +exports.TxResult = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.index !== 0) { + writer.uint32(16).uint32(message.index); + } + if (message.tx.length !== 0) { + writer.uint32(26).bytes(message.tx); + } + if (message.result !== undefined) { + exports.ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.index = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.tx = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.result = exports.ResponseDeliverTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + height: isSet(object.height) ? Number(object.height) : 0, + index: isSet(object.index) ? Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + result: isSet(object.result) + ? exports.ResponseDeliverTx.fromJSON(object.result) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.result !== undefined && + (obj.result = message.result + ? exports.ResponseDeliverTx.toJSON(message.result) + : undefined); + return obj; + }, + create(base) { + return exports.TxResult.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTxResult(); + message.height = object.height ?? 0; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(); + message.result = + object.result !== undefined && object.result !== null + ? exports.ResponseDeliverTx.fromPartial(object.result) + : undefined; + return message; + }, +}; +function createBaseValidator() { + return { address: new Uint8Array(), power: 0 }; +} +exports.Validator = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.power !== 0) { + writer.uint32(24).int64(message.power); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) + ? bytesFromBase64(object.address) + : new Uint8Array(), + power: isSet(object.power) ? Number(object.power) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.power !== undefined && (obj.power = Math.round(message.power)); + return obj; + }, + create(base) { + return exports.Validator.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.power = object.power ?? 0; + return message; + }, +}; +function createBaseValidatorUpdate() { + return { pubKey: undefined, power: 0 }; +} +exports.ValidatorUpdate = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.pubKey !== undefined) { + keys_1.PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.pubKey = keys_1.PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pubKey: isSet(object.pubKey) + ? keys_1.PublicKey.fromJSON(object.pubKey) + : undefined, + power: isSet(object.power) ? Number(object.power) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.pubKey !== undefined && + (obj.pubKey = message.pubKey + ? keys_1.PublicKey.toJSON(message.pubKey) + : undefined); + message.power !== undefined && (obj.power = Math.round(message.power)); + return obj; + }, + create(base) { + return exports.ValidatorUpdate.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidatorUpdate(); + message.pubKey = + object.pubKey !== undefined && object.pubKey !== null + ? keys_1.PublicKey.fromPartial(object.pubKey) + : undefined; + message.power = object.power ?? 0; + return message; + }, +}; +function createBaseVoteInfo() { + return { validator: undefined, signedLastBlock: false }; +} +exports.VoteInfo = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.validator !== undefined) { + exports.Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.validator = exports.Validator.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.signedLastBlock = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + validator: isSet(object.validator) + ? exports.Validator.fromJSON(object.validator) + : undefined, + signedLastBlock: isSet(object.signedLastBlock) + ? Boolean(object.signedLastBlock) + : false, + }; + }, + toJSON(message) { + const obj = {}; + message.validator !== undefined && + (obj.validator = message.validator + ? exports.Validator.toJSON(message.validator) + : undefined); + message.signedLastBlock !== undefined && + (obj.signedLastBlock = message.signedLastBlock); + return obj; + }, + create(base) { + return exports.VoteInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVoteInfo(); + message.validator = + object.validator !== undefined && object.validator !== null + ? exports.Validator.fromPartial(object.validator) + : undefined; + message.signedLastBlock = object.signedLastBlock ?? false; + return message; + }, +}; +function createBaseExtendedVoteInfo() { + return { + validator: undefined, + signedLastBlock: false, + voteExtension: new Uint8Array(), + }; +} +exports.ExtendedVoteInfo = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.validator !== undefined) { + exports.Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.validator = exports.Validator.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.signedLastBlock = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + validator: isSet(object.validator) + ? exports.Validator.fromJSON(object.validator) + : undefined, + signedLastBlock: isSet(object.signedLastBlock) + ? Boolean(object.signedLastBlock) + : false, + voteExtension: isSet(object.voteExtension) + ? bytesFromBase64(object.voteExtension) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.validator !== undefined && + (obj.validator = message.validator + ? exports.Validator.toJSON(message.validator) + : undefined); + message.signedLastBlock !== undefined && + (obj.signedLastBlock = message.signedLastBlock); + message.voteExtension !== undefined && + (obj.voteExtension = base64FromBytes(message.voteExtension !== undefined + ? message.voteExtension + : new Uint8Array())); + return obj; + }, + create(base) { + return exports.ExtendedVoteInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtendedVoteInfo(); + message.validator = + object.validator !== undefined && object.validator !== null + ? exports.Validator.fromPartial(object.validator) + : undefined; + message.signedLastBlock = object.signedLastBlock ?? false; + message.voteExtension = object.voteExtension ?? new Uint8Array(); + return message; + }, +}; +function createBaseMisbehavior() { + return { + type: 0, + validator: undefined, + height: 0, + time: undefined, + totalVotingPower: 0, + }; +} +exports.Misbehavior = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + exports.Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.validator = exports.Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.time = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) + ? exports.Validator.fromJSON(object.validator) + : undefined, + height: isSet(object.height) ? Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + totalVotingPower: isSet(object.totalVotingPower) + ? Number(object.totalVotingPower) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && + (obj.type = misbehaviorTypeToJSON(message.type)); + message.validator !== undefined && + (obj.validator = message.validator + ? exports.Validator.toJSON(message.validator) + : undefined); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.totalVotingPower !== undefined && + (obj.totalVotingPower = Math.round(message.totalVotingPower)); + return obj; + }, + create(base) { + return exports.Misbehavior.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = + object.validator !== undefined && object.validator !== null + ? exports.Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; +function createBaseSnapshot() { + return { + height: 0, + format: 0, + chunks: 0, + hash: new Uint8Array(), + metadata: new Uint8Array(), + }; +} +exports.Snapshot = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata.length !== 0) { + writer.uint32(42).bytes(message.metadata); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + message.metadata = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + height: isSet(object.height) ? Number(object.height) : 0, + format: isSet(object.format) ? Number(object.format) : 0, + chunks: isSet(object.chunks) ? Number(object.chunks) : 0, + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + metadata: isSet(object.metadata) + ? bytesFromBase64(object.metadata) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunks !== undefined && (obj.chunks = Math.round(message.chunks)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.metadata !== undefined && + (obj.metadata = base64FromBytes(message.metadata !== undefined ? message.metadata : new Uint8Array())); + return obj; + }, + create(base) { + return exports.Snapshot.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSnapshot(); + message.height = object.height ?? 0; + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = object.metadata ?? new Uint8Array(); + return message; + }, +}; +class ABCIApplicationClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || "tendermint.abci.ABCIApplication"; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.bind(this); + this.DeliverTx = this.DeliverTx.bind(this); + this.CheckTx = this.CheckTx.bind(this); + this.Query = this.Query.bind(this); + this.Commit = this.Commit.bind(this); + this.InitChain = this.InitChain.bind(this); + this.BeginBlock = this.BeginBlock.bind(this); + this.EndBlock = this.EndBlock.bind(this); + this.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + this.PrepareProposal = this.PrepareProposal.bind(this); + this.ProcessProposal = this.ProcessProposal.bind(this); + } + Echo(request) { + const data = exports.RequestEcho.encode(request).finish(); + const promise = this.rpc.request(this.service, "Echo", data); + return promise.then((data) => exports.ResponseEcho.decode(minimal_1.default.Reader.create(data))); + } + Flush(request) { + const data = exports.RequestFlush.encode(request).finish(); + const promise = this.rpc.request(this.service, "Flush", data); + return promise.then((data) => exports.ResponseFlush.decode(minimal_1.default.Reader.create(data))); + } + Info(request) { + const data = exports.RequestInfo.encode(request).finish(); + const promise = this.rpc.request(this.service, "Info", data); + return promise.then((data) => exports.ResponseInfo.decode(minimal_1.default.Reader.create(data))); + } + DeliverTx(request) { + const data = exports.RequestDeliverTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeliverTx", data); + return promise.then((data) => exports.ResponseDeliverTx.decode(minimal_1.default.Reader.create(data))); + } + CheckTx(request) { + const data = exports.RequestCheckTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "CheckTx", data); + return promise.then((data) => exports.ResponseCheckTx.decode(minimal_1.default.Reader.create(data))); + } + Query(request) { + const data = exports.RequestQuery.encode(request).finish(); + const promise = this.rpc.request(this.service, "Query", data); + return promise.then((data) => exports.ResponseQuery.decode(minimal_1.default.Reader.create(data))); + } + Commit(request) { + const data = exports.RequestCommit.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commit", data); + return promise.then((data) => exports.ResponseCommit.decode(minimal_1.default.Reader.create(data))); + } + InitChain(request) { + const data = exports.RequestInitChain.encode(request).finish(); + const promise = this.rpc.request(this.service, "InitChain", data); + return promise.then((data) => exports.ResponseInitChain.decode(minimal_1.default.Reader.create(data))); + } + BeginBlock(request) { + const data = exports.RequestBeginBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "BeginBlock", data); + return promise.then((data) => exports.ResponseBeginBlock.decode(minimal_1.default.Reader.create(data))); + } + EndBlock(request) { + const data = exports.RequestEndBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "EndBlock", data); + return promise.then((data) => exports.ResponseEndBlock.decode(minimal_1.default.Reader.create(data))); + } + ListSnapshots(request) { + const data = exports.RequestListSnapshots.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListSnapshots", data); + return promise.then((data) => exports.ResponseListSnapshots.decode(minimal_1.default.Reader.create(data))); + } + OfferSnapshot(request) { + const data = exports.RequestOfferSnapshot.encode(request).finish(); + const promise = this.rpc.request(this.service, "OfferSnapshot", data); + return promise.then((data) => exports.ResponseOfferSnapshot.decode(minimal_1.default.Reader.create(data))); + } + LoadSnapshotChunk(request) { + const data = exports.RequestLoadSnapshotChunk.encode(request).finish(); + const promise = this.rpc.request(this.service, "LoadSnapshotChunk", data); + return promise.then((data) => exports.ResponseLoadSnapshotChunk.decode(minimal_1.default.Reader.create(data))); + } + ApplySnapshotChunk(request) { + const data = exports.RequestApplySnapshotChunk.encode(request).finish(); + const promise = this.rpc.request(this.service, "ApplySnapshotChunk", data); + return promise.then((data) => exports.ResponseApplySnapshotChunk.decode(minimal_1.default.Reader.create(data))); + } + PrepareProposal(request) { + const data = exports.RequestPrepareProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrepareProposal", data); + return promise.then((data) => exports.ResponsePrepareProposal.decode(minimal_1.default.Reader.create(data))); + } + ProcessProposal(request) { + const data = exports.RequestProcessProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProcessProposal", data); + return promise.then((data) => exports.ResponseProcessProposal.decode(minimal_1.default.Reader.create(data))); + } +} +exports.ABCIApplicationClientImpl = ABCIApplicationClientImpl; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function toTimestamp(date) { + const seconds = date.getTime() / 1000; + const nanos = (date.getTime() % 1000) * 1000000; + return { seconds, nanos }; +} +function fromTimestamp(t) { + let millis = (t.seconds || 0) * 1000; + millis += (t.nanos || 0) / 1000000; + return new Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof Date) { + return o; + } + else if (typeof o === "string") { + return new Date(o); + } + else { + return fromTimestamp(timestamp_1.Timestamp.fromJSON(o)); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/tendermint/crypto/keys.d.ts b/dist/main/tendermint/crypto/keys.d.ts new file mode 100644 index 0000000..53a5977 --- /dev/null +++ b/dist/main/tendermint/crypto/keys.d.ts @@ -0,0 +1,38 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "tendermint.crypto"; +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} +export declare const PublicKey: { + encode(message: PublicKey, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PublicKey; + fromJSON(object: any): PublicKey; + toJSON(message: PublicKey): unknown; + create]: never; }>(base?: I | undefined): PublicKey; + fromPartial]: never; }>(object: I_1): PublicKey; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/tendermint/crypto/keys.js b/dist/main/tendermint/crypto/keys.js new file mode 100644 index 0000000..3cc40cc --- /dev/null +++ b/dist/main/tendermint/crypto/keys.js @@ -0,0 +1,116 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PublicKey = exports.protobufPackage = void 0; +/* eslint-disable */ +const minimal_1 = __importDefault(require("protobufjs/minimal")); +exports.protobufPackage = "tendermint.crypto"; +function createBasePublicKey() { + return { ed25519: undefined, secp256k1: undefined }; +} +exports.PublicKey = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.ed25519 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.secp256k1 = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + ed25519: isSet(object.ed25519) ? bytesFromBase64(object.ed25519) : undefined, + secp256k1: isSet(object.secp256k1) ? bytesFromBase64(object.secp256k1) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.ed25519 !== undefined && + (obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined); + message.secp256k1 !== undefined && + (obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined); + return obj; + }, + create(base) { + return exports.PublicKey.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/tendermint/crypto/proof.d.ts b/dist/main/tendermint/crypto/proof.d.ts new file mode 100644 index 0000000..4b04766 --- /dev/null +++ b/dist/main/tendermint/crypto/proof.d.ts @@ -0,0 +1,226 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "tendermint.crypto"; +export interface Proof { + total: number; + index: number; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof: Proof | undefined; +} +export interface DominoOp { + key: string; + input: string; + output: string; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOps { + ops: ProofOp[]; +} +export declare const Proof: { + encode(message: Proof, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Proof; + fromJSON(object: any): Proof; + toJSON(message: Proof): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): Proof; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): Proof; +}; +export declare const ValueOp: { + encode(message: ValueOp, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ValueOp; + fromJSON(object: any): ValueOp; + toJSON(message: ValueOp): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): ValueOp; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): ValueOp; +}; +export declare const DominoOp: { + encode(message: DominoOp, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): DominoOp; + fromJSON(object: any): DominoOp; + toJSON(message: DominoOp): unknown; + create]: never; }>(base?: I | undefined): DominoOp; + fromPartial]: never; }>(object: I_1): DominoOp; +}; +export declare const ProofOp: { + encode(message: ProofOp, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ProofOp; + fromJSON(object: any): ProofOp; + toJSON(message: ProofOp): unknown; + create]: never; }>(base?: I | undefined): ProofOp; + fromPartial]: never; }>(object: I_1): ProofOp; +}; +export declare const ProofOps: { + encode(message: ProofOps, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ProofOps; + fromJSON(object: any): ProofOps; + toJSON(message: ProofOps): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): ProofOps; + fromPartial]: never; })[] & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): ProofOps; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/tendermint/crypto/proof.js b/dist/main/tendermint/crypto/proof.js new file mode 100644 index 0000000..76cdc66 --- /dev/null +++ b/dist/main/tendermint/crypto/proof.js @@ -0,0 +1,421 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ProofOps = exports.ProofOp = exports.DominoOp = exports.ValueOp = exports.Proof = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +exports.protobufPackage = "tendermint.crypto"; +function createBaseProof() { + return { total: 0, index: 0, leafHash: new Uint8Array(), aunts: [] }; +} +exports.Proof = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.total !== 0) { + writer.uint32(8).int64(message.total); + } + if (message.index !== 0) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.total = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.index = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.leafHash = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.aunts.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + total: isSet(object.total) ? Number(object.total) : 0, + index: isSet(object.index) ? Number(object.index) : 0, + leafHash: isSet(object.leafHash) ? bytesFromBase64(object.leafHash) : new Uint8Array(), + aunts: Array.isArray(object?.aunts) ? object.aunts.map((e) => bytesFromBase64(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.total !== undefined && (obj.total = Math.round(message.total)); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.leafHash !== undefined && + (obj.leafHash = base64FromBytes(message.leafHash !== undefined ? message.leafHash : new Uint8Array())); + if (message.aunts) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.aunts = []; + } + return obj; + }, + create(base) { + return exports.Proof.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProof(); + message.total = object.total ?? 0; + message.index = object.index ?? 0; + message.leafHash = object.leafHash ?? new Uint8Array(); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; +function createBaseValueOp() { + return { key: new Uint8Array(), proof: undefined }; +} +exports.ValueOp = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + exports.Proof.encode(message.proof, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.proof = exports.Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + proof: isSet(object.proof) ? exports.Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? exports.Proof.toJSON(message.proof) : undefined); + return obj; + }, + create(base) { + return exports.ValueOp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(); + message.proof = (object.proof !== undefined && object.proof !== null) ? exports.Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; +function createBaseDominoOp() { + return { key: "", input: "", output: "" }; +} +exports.DominoOp = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.input = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.output = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? String(object.key) : "", + input: isSet(object.input) ? String(object.input) : "", + output: isSet(object.output) ? String(object.output) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && (obj.key = message.key); + message.input !== undefined && (obj.input = message.input); + message.output !== undefined && (obj.output = message.output); + return obj; + }, + create(base) { + return exports.DominoOp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDominoOp(); + message.key = object.key ?? ""; + message.input = object.input ?? ""; + message.output = object.output ?? ""; + return message; + }, +}; +function createBaseProofOp() { + return { type: "", key: new Uint8Array(), data: new Uint8Array() }; +} +exports.ProofOp = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = message.type); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + create(base) { + return exports.ProofOp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBaseProofOps() { + return { ops: [] }; +} +exports.ProofOps = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.ops) { + exports.ProofOp.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.ops.push(exports.ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { ops: Array.isArray(object?.ops) ? object.ops.map((e) => exports.ProofOp.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.ops) { + obj.ops = message.ops.map((e) => e ? exports.ProofOp.toJSON(e) : undefined); + } + else { + obj.ops = []; + } + return obj; + }, + create(base) { + return exports.ProofOps.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => exports.ProofOp.fromPartial(e)) || []; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/tendermint/types/params.d.ts b/dist/main/tendermint/types/params.d.ts new file mode 100644 index 0000000..100aff3 --- /dev/null +++ b/dist/main/tendermint/types/params.d.ts @@ -0,0 +1,313 @@ +import _m0 from "protobufjs/minimal"; +import { Duration } from "../../google/protobuf/duration"; +export declare const protobufPackage = "tendermint.types"; +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParams { + block: BlockParams | undefined; + evidence: EvidenceParams | undefined; + validator: ValidatorParams | undefined; + version: VersionParams | undefined; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: number; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: number; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: number; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: Duration | undefined; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: number; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: number; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: number; + blockMaxGas: number; +} +export declare const ConsensusParams: { + encode(message: ConsensusParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams; + fromJSON(object: any): ConsensusParams; + toJSON(message: ConsensusParams): unknown; + create]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }>(base?: I | undefined): ConsensusParams; + fromPartial]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_10 in Exclude]: never; }) | undefined; + } & { [K_11 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + } & { [K_13 in Exclude]: never; }>(object: I_1): ConsensusParams; +}; +export declare const BlockParams: { + encode(message: BlockParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams; + fromJSON(object: any): BlockParams; + toJSON(message: BlockParams): unknown; + create]: never; }>(base?: I | undefined): BlockParams; + fromPartial]: never; }>(object: I_1): BlockParams; +}; +export declare const EvidenceParams: { + encode(message: EvidenceParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceParams; + fromJSON(object: any): EvidenceParams; + toJSON(message: EvidenceParams): unknown; + create]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): EvidenceParams; + fromPartial]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): EvidenceParams; +}; +export declare const ValidatorParams: { + encode(message: ValidatorParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorParams; + fromJSON(object: any): ValidatorParams; + toJSON(message: ValidatorParams): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): ValidatorParams; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): ValidatorParams; +}; +export declare const VersionParams: { + encode(message: VersionParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): VersionParams; + fromJSON(object: any): VersionParams; + toJSON(message: VersionParams): unknown; + create]: never; }>(base?: I | undefined): VersionParams; + fromPartial]: never; }>(object: I_1): VersionParams; +}; +export declare const HashedParams: { + encode(message: HashedParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): HashedParams; + fromJSON(object: any): HashedParams; + toJSON(message: HashedParams): unknown; + create]: never; }>(base?: I | undefined): HashedParams; + fromPartial]: never; }>(object: I_1): HashedParams; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/tendermint/types/params.js b/dist/main/tendermint/types/params.js new file mode 100644 index 0000000..a64c794 --- /dev/null +++ b/dist/main/tendermint/types/params.js @@ -0,0 +1,482 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HashedParams = exports.VersionParams = exports.ValidatorParams = exports.EvidenceParams = exports.BlockParams = exports.ConsensusParams = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +const duration_1 = require("../../google/protobuf/duration"); +exports.protobufPackage = "tendermint.types"; +function createBaseConsensusParams() { + return { + block: undefined, + evidence: undefined, + validator: undefined, + version: undefined, + }; +} +exports.ConsensusParams = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.block !== undefined) { + exports.BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); + } + if (message.evidence !== undefined) { + exports.EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + } + if (message.validator !== undefined) { + exports.ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim(); + } + if (message.version !== undefined) { + exports.VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.block = exports.BlockParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.evidence = exports.EvidenceParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.validator = exports.ValidatorParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.version = exports.VersionParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + block: isSet(object.block) + ? exports.BlockParams.fromJSON(object.block) + : undefined, + evidence: isSet(object.evidence) + ? exports.EvidenceParams.fromJSON(object.evidence) + : undefined, + validator: isSet(object.validator) + ? exports.ValidatorParams.fromJSON(object.validator) + : undefined, + version: isSet(object.version) + ? exports.VersionParams.fromJSON(object.version) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.block !== undefined && + (obj.block = message.block + ? exports.BlockParams.toJSON(message.block) + : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence + ? exports.EvidenceParams.toJSON(message.evidence) + : undefined); + message.validator !== undefined && + (obj.validator = message.validator + ? exports.ValidatorParams.toJSON(message.validator) + : undefined); + message.version !== undefined && + (obj.version = message.version + ? exports.VersionParams.toJSON(message.version) + : undefined); + return obj; + }, + create(base) { + return exports.ConsensusParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseConsensusParams(); + message.block = + object.block !== undefined && object.block !== null + ? exports.BlockParams.fromPartial(object.block) + : undefined; + message.evidence = + object.evidence !== undefined && object.evidence !== null + ? exports.EvidenceParams.fromPartial(object.evidence) + : undefined; + message.validator = + object.validator !== undefined && object.validator !== null + ? exports.ValidatorParams.fromPartial(object.validator) + : undefined; + message.version = + object.version !== undefined && object.version !== null + ? exports.VersionParams.fromPartial(object.version) + : undefined; + return message; + }, +}; +function createBaseBlockParams() { + return { maxBytes: 0, maxGas: 0 }; +} +exports.BlockParams = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.maxBytes !== 0) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== 0) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.maxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.maxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + maxBytes: isSet(object.maxBytes) ? Number(object.maxBytes) : 0, + maxGas: isSet(object.maxGas) ? Number(object.maxGas) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.maxBytes !== undefined && + (obj.maxBytes = Math.round(message.maxBytes)); + message.maxGas !== undefined && (obj.maxGas = Math.round(message.maxGas)); + return obj; + }, + create(base) { + return exports.BlockParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes ?? 0; + message.maxGas = object.maxGas ?? 0; + return message; + }, +}; +function createBaseEvidenceParams() { + return { maxAgeNumBlocks: 0, maxAgeDuration: undefined, maxBytes: 0 }; +} +exports.EvidenceParams = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.maxAgeNumBlocks !== 0) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + duration_1.Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim(); + } + if (message.maxBytes !== 0) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.maxAgeNumBlocks = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.maxAgeDuration = duration_1.Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.maxBytes = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) + ? Number(object.maxAgeNumBlocks) + : 0, + maxAgeDuration: isSet(object.maxAgeDuration) + ? duration_1.Duration.fromJSON(object.maxAgeDuration) + : undefined, + maxBytes: isSet(object.maxBytes) ? Number(object.maxBytes) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.maxAgeNumBlocks !== undefined && + (obj.maxAgeNumBlocks = Math.round(message.maxAgeNumBlocks)); + message.maxAgeDuration !== undefined && + (obj.maxAgeDuration = message.maxAgeDuration + ? duration_1.Duration.toJSON(message.maxAgeDuration) + : undefined); + message.maxBytes !== undefined && + (obj.maxBytes = Math.round(message.maxBytes)); + return obj; + }, + create(base) { + return exports.EvidenceParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks ?? 0; + message.maxAgeDuration = + object.maxAgeDuration !== undefined && object.maxAgeDuration !== null + ? duration_1.Duration.fromPartial(object.maxAgeDuration) + : undefined; + message.maxBytes = object.maxBytes ?? 0; + return message; + }, +}; +function createBaseValidatorParams() { + return { pubKeyTypes: [] }; +} +exports.ValidatorParams = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.pubKeyTypes.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pubKeyTypes: Array.isArray(object?.pubKeyTypes) + ? object.pubKeyTypes.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pubKeyTypes) { + obj.pubKeyTypes = message.pubKeyTypes.map((e) => e); + } + else { + obj.pubKeyTypes = []; + } + return obj; + }, + create(base) { + return exports.ValidatorParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; + return message; + }, +}; +function createBaseVersionParams() { + return { app: 0 }; +} +exports.VersionParams = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.app !== 0) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { app: isSet(object.app) ? Number(object.app) : 0 }; + }, + toJSON(message) { + const obj = {}; + message.app !== undefined && (obj.app = Math.round(message.app)); + return obj; + }, + create(base) { + return exports.VersionParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVersionParams(); + message.app = object.app ?? 0; + return message; + }, +}; +function createBaseHashedParams() { + return { blockMaxBytes: 0, blockMaxGas: 0 }; +} +exports.HashedParams = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.blockMaxBytes !== 0) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.blockMaxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.blockMaxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blockMaxBytes: isSet(object.blockMaxBytes) + ? Number(object.blockMaxBytes) + : 0, + blockMaxGas: isSet(object.blockMaxGas) ? Number(object.blockMaxGas) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.blockMaxBytes !== undefined && + (obj.blockMaxBytes = Math.round(message.blockMaxBytes)); + message.blockMaxGas !== undefined && + (obj.blockMaxGas = Math.round(message.blockMaxGas)); + return obj; + }, + create(base) { + return exports.HashedParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes ?? 0; + message.blockMaxGas = object.blockMaxGas ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/tendermint/types/types.d.ts b/dist/main/tendermint/types/types.d.ts new file mode 100644 index 0000000..59dfd2f --- /dev/null +++ b/dist/main/tendermint/types/types.d.ts @@ -0,0 +1,1970 @@ +import _m0 from "protobufjs/minimal"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { ValidatorSet } from "./validator"; +export declare const protobufPackage = "tendermint.types"; +/** BlockIdFlag indicates which BlcokID the signature is for */ +export declare enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = 0, + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + BLOCK_ID_FLAG_NIL = 3, + UNRECOGNIZED = -1 +} +export declare function blockIDFlagFromJSON(object: any): BlockIDFlag; +export declare function blockIDFlagToJSON(object: BlockIDFlag): string; +/** SignedMsgType is a type of signed message in the consensus. */ +export declare enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = 0, + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SIGNED_MSG_TYPE_PREVOTE = 1, + SIGNED_MSG_TYPE_PRECOMMIT = 2, + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SIGNED_MSG_TYPE_PROPOSAL = 32, + UNRECOGNIZED = -1 +} +export declare function signedMsgTypeFromJSON(object: any): SignedMsgType; +export declare function signedMsgTypeToJSON(object: SignedMsgType): string; +/** PartsetHeader */ +export interface PartSetHeader { + total: number; + hash: Uint8Array; +} +export interface Part { + index: number; + bytes: Uint8Array; + proof: Proof | undefined; +} +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader | undefined; +} +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: Date | undefined; + /** prev block info */ + lastBlockId: BlockID | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} +/** Data contains the set of transactions included in the block */ +export interface Data { + /** + * Txs that will be applied by state @ block.Height+1. + * NOTE: not all txs here are valid. We're just agreeing on the order first. + * This means that block.AppHash does not include these txs. + */ + txs: Uint8Array[]; +} +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: number; + round: number; + /** zero if vote is nil. */ + blockId: BlockID | undefined; + timestamp: Date | undefined; + validatorAddress: Uint8Array; + validatorIndex: number; + signature: Uint8Array; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: number; + round: number; + blockId: BlockID | undefined; + signatures: CommitSig[]; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; +} +export interface Proposal { + type: SignedMsgType; + height: number; + round: number; + polRound: number; + blockId: BlockID | undefined; + timestamp: Date | undefined; + signature: Uint8Array; +} +export interface SignedHeader { + header: Header | undefined; + commit: Commit | undefined; +} +export interface LightBlock { + signedHeader: SignedHeader | undefined; + validatorSet: ValidatorSet | undefined; +} +export interface BlockMeta { + blockId: BlockID | undefined; + blockSize: number; + header: Header | undefined; + numTxs: number; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof: Proof | undefined; +} +export declare const PartSetHeader: { + encode(message: PartSetHeader, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PartSetHeader; + fromJSON(object: any): PartSetHeader; + toJSON(message: PartSetHeader): unknown; + create]: never; }>(base?: I | undefined): PartSetHeader; + fromPartial]: never; }>(object: I_1): PartSetHeader; +}; +export declare const Part: { + encode(message: Part, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Part; + fromJSON(object: any): Part; + toJSON(message: Part): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): Part; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): Part; +}; +export declare const BlockID: { + encode(message: BlockID, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): BlockID; + fromJSON(object: any): BlockID; + toJSON(message: BlockID): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): BlockID; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): BlockID; +}; +export declare const Header: { + encode(message: Header, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Header; + fromJSON(object: any): Header; + toJSON(message: Header): unknown; + create]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }>(base?: I | undefined): Header; + fromPartial]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_7 in Exclude]: never; }>(object: I_1): Header; +}; +export declare const Data: { + encode(message: Data, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Data; + fromJSON(object: any): Data; + toJSON(message: Data): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): Data; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): Data; +}; +export declare const Vote: { + encode(message: Vote, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Vote; + fromJSON(object: any): Vote; + toJSON(message: Vote): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + timestamp?: Date | undefined; + validatorAddress?: Uint8Array | undefined; + validatorIndex?: number | undefined; + signature?: Uint8Array | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): Vote; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + timestamp?: Date | undefined; + validatorAddress?: Uint8Array | undefined; + validatorIndex?: number | undefined; + signature?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): Vote; +}; +export declare const Commit: { + encode(message: Commit, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Commit; + fromJSON(object: any): Commit; + toJSON(message: Commit): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }>(base?: I | undefined): Commit; + fromPartial]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }>(object: I_1): Commit; +}; +export declare const CommitSig: { + encode(message: CommitSig, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): CommitSig; + fromJSON(object: any): CommitSig; + toJSON(message: CommitSig): unknown; + create]: never; }>(base?: I | undefined): CommitSig; + fromPartial]: never; }>(object: I_1): CommitSig; +}; +export declare const Proposal: { + encode(message: Proposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal; + fromJSON(object: any): Proposal; + toJSON(message: Proposal): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): Proposal; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): Proposal; +}; +export declare const SignedHeader: { + encode(message: SignedHeader, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): SignedHeader; + fromJSON(object: any): SignedHeader; + toJSON(message: SignedHeader): unknown; + create]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + commit?: ({ + height?: number | undefined; + round?: number | undefined; + blockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + signatures?: { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] | undefined; + } & { + height?: number | undefined; + round?: number | undefined; + blockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_6 in Exclude]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }>(base?: I | undefined): SignedHeader; + fromPartial]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_11 in Exclude]: never; }) | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + commit?: ({ + height?: number | undefined; + round?: number | undefined; + blockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + signatures?: { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] | undefined; + } & { + height?: number | undefined; + round?: number | undefined; + blockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_16 in Exclude]: never; })[] & { [K_17 in Exclude]: never; }) | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + } & { [K_19 in Exclude]: never; }>(object: I_1): SignedHeader; +}; +export declare const LightBlock: { + encode(message: LightBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): LightBlock; + fromJSON(object: any): LightBlock; + toJSON(message: LightBlock): unknown; + create]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + commit?: ({ + height?: number | undefined; + round?: number | undefined; + blockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + signatures?: { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] | undefined; + } & { + height?: number | undefined; + round?: number | undefined; + blockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_6 in Exclude]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + validatorSet?: ({ + validators?: { + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + }[] | undefined; + proposer?: { + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } | undefined; + totalVotingPower?: number | undefined; + } & { + validators?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + }[] & ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + proposer?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + totalVotingPower?: number | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + } & { [K_16 in Exclude]: never; }>(base?: I | undefined): LightBlock; + fromPartial]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + } & { [K_19 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_20 in Exclude]: never; }) | undefined; + commit?: ({ + height?: number | undefined; + round?: number | undefined; + blockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + signatures?: { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] | undefined; + } & { + height?: number | undefined; + round?: number | undefined; + blockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_21 in Exclude]: never; }) | undefined; + } & { [K_22 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_23 in Exclude]: never; })[] & { [K_24 in Exclude]: never; }) | undefined; + } & { [K_25 in Exclude]: never; }) | undefined; + } & { [K_26 in Exclude]: never; }) | undefined; + validatorSet?: ({ + validators?: { + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + }[] | undefined; + proposer?: { + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } | undefined; + totalVotingPower?: number | undefined; + } & { + validators?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + }[] & ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_27 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_28 in Exclude]: never; })[] & { [K_29 in Exclude]: never; }) | undefined; + proposer?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_30 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_31 in Exclude]: never; }) | undefined; + totalVotingPower?: number | undefined; + } & { [K_32 in Exclude]: never; }) | undefined; + } & { [K_33 in Exclude]: never; }>(object: I_1): LightBlock; +}; +export declare const BlockMeta: { + encode(message: BlockMeta, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): BlockMeta; + fromJSON(object: any): BlockMeta; + toJSON(message: BlockMeta): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + blockSize?: number | undefined; + header?: ({ + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + version?: ({ + block?: number | undefined; + app?: number | undefined; + } & { + block?: number | undefined; + app?: number | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + numTxs?: number | undefined; + } & { [K_6 in Exclude]: never; }>(base?: I | undefined): BlockMeta; + fromPartial]: never; }) | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + blockSize?: number | undefined; + header?: ({ + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + version?: ({ + block?: number | undefined; + app?: number | undefined; + } & { + block?: number | undefined; + app?: number | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + } & { [K_11 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + numTxs?: number | undefined; + } & { [K_13 in Exclude]: never; }>(object: I_1): BlockMeta; +}; +export declare const TxProof: { + encode(message: TxProof, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): TxProof; + fromJSON(object: any): TxProof; + toJSON(message: TxProof): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): TxProof; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): TxProof; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/tendermint/types/types.js b/dist/main/tendermint/types/types.js new file mode 100644 index 0000000..e490e70 --- /dev/null +++ b/dist/main/tendermint/types/types.js @@ -0,0 +1,1590 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TxProof = exports.BlockMeta = exports.LightBlock = exports.SignedHeader = exports.Proposal = exports.CommitSig = exports.Commit = exports.Vote = exports.Data = exports.Header = exports.BlockID = exports.Part = exports.PartSetHeader = exports.signedMsgTypeToJSON = exports.signedMsgTypeFromJSON = exports.SignedMsgType = exports.blockIDFlagToJSON = exports.blockIDFlagFromJSON = exports.BlockIDFlag = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +const timestamp_1 = require("../../google/protobuf/timestamp"); +const proof_1 = require("../crypto/proof"); +const types_1 = require("../version/types"); +const validator_1 = require("./validator"); +exports.protobufPackage = "tendermint.types"; +/** BlockIdFlag indicates which BlcokID the signature is for */ +var BlockIDFlag; +(function (BlockIDFlag) { + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_UNKNOWN"] = 0] = "BLOCK_ID_FLAG_UNKNOWN"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_ABSENT"] = 1] = "BLOCK_ID_FLAG_ABSENT"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_COMMIT"] = 2] = "BLOCK_ID_FLAG_COMMIT"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_NIL"] = 3] = "BLOCK_ID_FLAG_NIL"; + BlockIDFlag[BlockIDFlag["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(BlockIDFlag || (exports.BlockIDFlag = BlockIDFlag = {})); +function blockIDFlagFromJSON(object) { + switch (object) { + case 0: + case "BLOCK_ID_FLAG_UNKNOWN": + return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; + case 1: + case "BLOCK_ID_FLAG_ABSENT": + return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; + case 2: + case "BLOCK_ID_FLAG_COMMIT": + return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; + case 3: + case "BLOCK_ID_FLAG_NIL": + return BlockIDFlag.BLOCK_ID_FLAG_NIL; + case -1: + case "UNRECOGNIZED": + default: + return BlockIDFlag.UNRECOGNIZED; + } +} +exports.blockIDFlagFromJSON = blockIDFlagFromJSON; +function blockIDFlagToJSON(object) { + switch (object) { + case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: + return "BLOCK_ID_FLAG_UNKNOWN"; + case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: + return "BLOCK_ID_FLAG_ABSENT"; + case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: + return "BLOCK_ID_FLAG_COMMIT"; + case BlockIDFlag.BLOCK_ID_FLAG_NIL: + return "BLOCK_ID_FLAG_NIL"; + case BlockIDFlag.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.blockIDFlagToJSON = blockIDFlagToJSON; +/** SignedMsgType is a type of signed message in the consensus. */ +var SignedMsgType; +(function (SignedMsgType) { + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_UNKNOWN"] = 0] = "SIGNED_MSG_TYPE_UNKNOWN"; + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PREVOTE"] = 1] = "SIGNED_MSG_TYPE_PREVOTE"; + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PRECOMMIT"] = 2] = "SIGNED_MSG_TYPE_PRECOMMIT"; + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PROPOSAL"] = 32] = "SIGNED_MSG_TYPE_PROPOSAL"; + SignedMsgType[SignedMsgType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(SignedMsgType || (exports.SignedMsgType = SignedMsgType = {})); +function signedMsgTypeFromJSON(object) { + switch (object) { + case 0: + case "SIGNED_MSG_TYPE_UNKNOWN": + return SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; + case 1: + case "SIGNED_MSG_TYPE_PREVOTE": + return SignedMsgType.SIGNED_MSG_TYPE_PREVOTE; + case 2: + case "SIGNED_MSG_TYPE_PRECOMMIT": + return SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT; + case 32: + case "SIGNED_MSG_TYPE_PROPOSAL": + return SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL; + case -1: + case "UNRECOGNIZED": + default: + return SignedMsgType.UNRECOGNIZED; + } +} +exports.signedMsgTypeFromJSON = signedMsgTypeFromJSON; +function signedMsgTypeToJSON(object) { + switch (object) { + case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN: + return "SIGNED_MSG_TYPE_UNKNOWN"; + case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE: + return "SIGNED_MSG_TYPE_PREVOTE"; + case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT: + return "SIGNED_MSG_TYPE_PRECOMMIT"; + case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL: + return "SIGNED_MSG_TYPE_PROPOSAL"; + case SignedMsgType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.signedMsgTypeToJSON = signedMsgTypeToJSON; +function createBasePartSetHeader() { + return { total: 0, hash: new Uint8Array() }; +} +exports.PartSetHeader = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.total = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + total: isSet(object.total) ? Number(object.total) : 0, + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.total !== undefined && (obj.total = Math.round(message.total)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + create(base) { + return exports.PartSetHeader.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; +function createBasePart() { + return { index: 0, bytes: new Uint8Array(), proof: undefined }; +} +exports.Part = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + proof_1.Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.proof = proof_1.Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + index: isSet(object.index) ? Number(object.index) : 0, + bytes: isSet(object.bytes) + ? bytesFromBase64(object.bytes) + : new Uint8Array(), + proof: isSet(object.proof) ? proof_1.Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.bytes !== undefined && + (obj.bytes = base64FromBytes(message.bytes !== undefined ? message.bytes : new Uint8Array())); + message.proof !== undefined && + (obj.proof = message.proof ? proof_1.Proof.toJSON(message.proof) : undefined); + return obj; + }, + create(base) { + return exports.Part.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(); + message.proof = + object.proof !== undefined && object.proof !== null + ? proof_1.Proof.fromPartial(object.proof) + : undefined; + return message; + }, +}; +function createBaseBlockID() { + return { hash: new Uint8Array(), partSetHeader: undefined }; +} +exports.BlockID = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + exports.PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.partSetHeader = exports.PartSetHeader.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + partSetHeader: isSet(object.partSetHeader) + ? exports.PartSetHeader.fromJSON(object.partSetHeader) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.partSetHeader !== undefined && + (obj.partSetHeader = message.partSetHeader + ? exports.PartSetHeader.toJSON(message.partSetHeader) + : undefined); + return obj; + }, + create(base) { + return exports.BlockID.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(); + message.partSetHeader = + object.partSetHeader !== undefined && object.partSetHeader !== null + ? exports.PartSetHeader.fromPartial(object.partSetHeader) + : undefined; + return message; + }, +}; +function createBaseHeader() { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(), + dataHash: new Uint8Array(), + validatorsHash: new Uint8Array(), + nextValidatorsHash: new Uint8Array(), + consensusHash: new Uint8Array(), + appHash: new Uint8Array(), + lastResultsHash: new Uint8Array(), + evidenceHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +exports.Header = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.version !== undefined) { + types_1.Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.lastBlockId !== undefined) { + exports.BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.version = types_1.Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.time = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + message.lastBlockId = exports.BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + version: isSet(object.version) + ? types_1.Consensus.fromJSON(object.version) + : undefined, + chainId: isSet(object.chainId) ? String(object.chainId) : "", + height: isSet(object.height) ? Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) + ? exports.BlockID.fromJSON(object.lastBlockId) + : undefined, + lastCommitHash: isSet(object.lastCommitHash) + ? bytesFromBase64(object.lastCommitHash) + : new Uint8Array(), + dataHash: isSet(object.dataHash) + ? bytesFromBase64(object.dataHash) + : new Uint8Array(), + validatorsHash: isSet(object.validatorsHash) + ? bytesFromBase64(object.validatorsHash) + : new Uint8Array(), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + consensusHash: isSet(object.consensusHash) + ? bytesFromBase64(object.consensusHash) + : new Uint8Array(), + appHash: isSet(object.appHash) + ? bytesFromBase64(object.appHash) + : new Uint8Array(), + lastResultsHash: isSet(object.lastResultsHash) + ? bytesFromBase64(object.lastResultsHash) + : new Uint8Array(), + evidenceHash: isSet(object.evidenceHash) + ? bytesFromBase64(object.evidenceHash) + : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) + ? bytesFromBase64(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.version !== undefined && + (obj.version = message.version + ? types_1.Consensus.toJSON(message.version) + : undefined); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.lastBlockId !== undefined && + (obj.lastBlockId = message.lastBlockId + ? exports.BlockID.toJSON(message.lastBlockId) + : undefined); + message.lastCommitHash !== undefined && + (obj.lastCommitHash = base64FromBytes(message.lastCommitHash !== undefined + ? message.lastCommitHash + : new Uint8Array())); + message.dataHash !== undefined && + (obj.dataHash = base64FromBytes(message.dataHash !== undefined ? message.dataHash : new Uint8Array())); + message.validatorsHash !== undefined && + (obj.validatorsHash = base64FromBytes(message.validatorsHash !== undefined + ? message.validatorsHash + : new Uint8Array())); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array())); + message.consensusHash !== undefined && + (obj.consensusHash = base64FromBytes(message.consensusHash !== undefined + ? message.consensusHash + : new Uint8Array())); + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + message.lastResultsHash !== undefined && + (obj.lastResultsHash = base64FromBytes(message.lastResultsHash !== undefined + ? message.lastResultsHash + : new Uint8Array())); + message.evidenceHash !== undefined && + (obj.evidenceHash = base64FromBytes(message.evidenceHash !== undefined + ? message.evidenceHash + : new Uint8Array())); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes(message.proposerAddress !== undefined + ? message.proposerAddress + : new Uint8Array())); + return obj; + }, + create(base) { + return exports.Header.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHeader(); + message.version = + object.version !== undefined && object.version !== null + ? types_1.Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = + object.lastBlockId !== undefined && object.lastBlockId !== null + ? exports.BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(); + message.dataHash = object.dataHash ?? new Uint8Array(); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.consensusHash = object.consensusHash ?? new Uint8Array(); + message.appHash = object.appHash ?? new Uint8Array(); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, +}; +function createBaseData() { + return { txs: [] }; +} +exports.Data = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.txs) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) + ? object.txs.map((e) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + return obj; + }, + create(base) { + return exports.Data.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseData(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; +function createBaseVote() { + return { + type: 0, + height: 0, + round: 0, + blockId: undefined, + timestamp: undefined, + validatorAddress: new Uint8Array(), + validatorIndex: 0, + signature: new Uint8Array(), + }; +} +exports.Vote = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.blockId !== undefined) { + exports.BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.round = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.blockId = exports.BlockID.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + message.validatorAddress = reader.bytes(); + continue; + case 7: + if (tag !== 56) { + break; + } + message.validatorIndex = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? Number(object.height) : 0, + round: isSet(object.round) ? Number(object.round) : 0, + blockId: isSet(object.blockId) + ? exports.BlockID.fromJSON(object.blockId) + : undefined, + timestamp: isSet(object.timestamp) + ? fromJsonTimestamp(object.timestamp) + : undefined, + validatorAddress: isSet(object.validatorAddress) + ? bytesFromBase64(object.validatorAddress) + : new Uint8Array(), + validatorIndex: isSet(object.validatorIndex) + ? Number(object.validatorIndex) + : 0, + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && + (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.blockId !== undefined && + (obj.blockId = message.blockId + ? exports.BlockID.toJSON(message.blockId) + : undefined); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp.toISOString()); + message.validatorAddress !== undefined && + (obj.validatorAddress = base64FromBytes(message.validatorAddress !== undefined + ? message.validatorAddress + : new Uint8Array())); + message.validatorIndex !== undefined && + (obj.validatorIndex = Math.round(message.validatorIndex)); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + create(base) { + return exports.Vote.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? exports.BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseCommit() { + return { height: 0, round: 0, blockId: undefined, signatures: [] }; +} +exports.Commit = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + exports.BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.signatures) { + exports.CommitSig.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.blockId = exports.BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.signatures.push(exports.CommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + height: isSet(object.height) ? Number(object.height) : 0, + round: isSet(object.round) ? Number(object.round) : 0, + blockId: isSet(object.blockId) + ? exports.BlockID.fromJSON(object.blockId) + : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e) => exports.CommitSig.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.blockId !== undefined && + (obj.blockId = message.blockId + ? exports.BlockID.toJSON(message.blockId) + : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? exports.CommitSig.toJSON(e) : undefined); + } + else { + obj.signatures = []; + } + return obj; + }, + create(base) { + return exports.Commit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? exports.BlockID.fromPartial(object.blockId) + : undefined; + message.signatures = + object.signatures?.map((e) => exports.CommitSig.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCommitSig() { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(), + timestamp: undefined, + signature: new Uint8Array(), + }; +} +exports.CommitSig = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.blockIdFlag = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blockIdFlag: isSet(object.blockIdFlag) + ? blockIDFlagFromJSON(object.blockIdFlag) + : 0, + validatorAddress: isSet(object.validatorAddress) + ? bytesFromBase64(object.validatorAddress) + : new Uint8Array(), + timestamp: isSet(object.timestamp) + ? fromJsonTimestamp(object.timestamp) + : undefined, + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.blockIdFlag !== undefined && + (obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag)); + message.validatorAddress !== undefined && + (obj.validatorAddress = base64FromBytes(message.validatorAddress !== undefined + ? message.validatorAddress + : new Uint8Array())); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp.toISOString()); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + create(base) { + return exports.CommitSig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseProposal() { + return { + type: 0, + height: 0, + round: 0, + polRound: 0, + blockId: undefined, + timestamp: undefined, + signature: new Uint8Array(), + }; +} +exports.Proposal = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + exports.BlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.round = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + message.polRound = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + message.blockId = exports.BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? Number(object.height) : 0, + round: isSet(object.round) ? Number(object.round) : 0, + polRound: isSet(object.polRound) ? Number(object.polRound) : 0, + blockId: isSet(object.blockId) + ? exports.BlockID.fromJSON(object.blockId) + : undefined, + timestamp: isSet(object.timestamp) + ? fromJsonTimestamp(object.timestamp) + : undefined, + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && + (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.polRound !== undefined && + (obj.polRound = Math.round(message.polRound)); + message.blockId !== undefined && + (obj.blockId = message.blockId + ? exports.BlockID.toJSON(message.blockId) + : undefined); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp.toISOString()); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + create(base) { + return exports.Proposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? exports.BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseSignedHeader() { + return { header: undefined, commit: undefined }; +} +exports.SignedHeader = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.header !== undefined) { + exports.Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + if (message.commit !== undefined) { + exports.Commit.encode(message.commit, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.header = exports.Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.commit = exports.Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + header: isSet(object.header) ? exports.Header.fromJSON(object.header) : undefined, + commit: isSet(object.commit) ? exports.Commit.fromJSON(object.commit) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.header !== undefined && + (obj.header = message.header ? exports.Header.toJSON(message.header) : undefined); + message.commit !== undefined && + (obj.commit = message.commit ? exports.Commit.toJSON(message.commit) : undefined); + return obj; + }, + create(base) { + return exports.SignedHeader.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSignedHeader(); + message.header = + object.header !== undefined && object.header !== null + ? exports.Header.fromPartial(object.header) + : undefined; + message.commit = + object.commit !== undefined && object.commit !== null + ? exports.Commit.fromPartial(object.commit) + : undefined; + return message; + }, +}; +function createBaseLightBlock() { + return { signedHeader: undefined, validatorSet: undefined }; +} +exports.LightBlock = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.signedHeader !== undefined) { + exports.SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorSet !== undefined) { + validator_1.ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.signedHeader = exports.SignedHeader.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.validatorSet = validator_1.ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + signedHeader: isSet(object.signedHeader) + ? exports.SignedHeader.fromJSON(object.signedHeader) + : undefined, + validatorSet: isSet(object.validatorSet) + ? validator_1.ValidatorSet.fromJSON(object.validatorSet) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.signedHeader !== undefined && + (obj.signedHeader = message.signedHeader + ? exports.SignedHeader.toJSON(message.signedHeader) + : undefined); + message.validatorSet !== undefined && + (obj.validatorSet = message.validatorSet + ? validator_1.ValidatorSet.toJSON(message.validatorSet) + : undefined); + return obj; + }, + create(base) { + return exports.LightBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseLightBlock(); + message.signedHeader = + object.signedHeader !== undefined && object.signedHeader !== null + ? exports.SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = + object.validatorSet !== undefined && object.validatorSet !== null + ? validator_1.ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; +function createBaseBlockMeta() { + return { blockId: undefined, blockSize: 0, header: undefined, numTxs: 0 }; +} +exports.BlockMeta = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.blockId !== undefined) { + exports.BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); + } + if (message.blockSize !== 0) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + exports.Header.encode(message.header, writer.uint32(26).fork()).ldelim(); + } + if (message.numTxs !== 0) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.blockId = exports.BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.blockSize = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.header = exports.Header.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.numTxs = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blockId: isSet(object.blockId) + ? exports.BlockID.fromJSON(object.blockId) + : undefined, + blockSize: isSet(object.blockSize) ? Number(object.blockSize) : 0, + header: isSet(object.header) ? exports.Header.fromJSON(object.header) : undefined, + numTxs: isSet(object.numTxs) ? Number(object.numTxs) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.blockId !== undefined && + (obj.blockId = message.blockId + ? exports.BlockID.toJSON(message.blockId) + : undefined); + message.blockSize !== undefined && + (obj.blockSize = Math.round(message.blockSize)); + message.header !== undefined && + (obj.header = message.header ? exports.Header.toJSON(message.header) : undefined); + message.numTxs !== undefined && (obj.numTxs = Math.round(message.numTxs)); + return obj; + }, + create(base) { + return exports.BlockMeta.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlockMeta(); + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? exports.BlockID.fromPartial(object.blockId) + : undefined; + message.blockSize = object.blockSize ?? 0; + message.header = + object.header !== undefined && object.header !== null + ? exports.Header.fromPartial(object.header) + : undefined; + message.numTxs = object.numTxs ?? 0; + return message; + }, +}; +function createBaseTxProof() { + return { + rootHash: new Uint8Array(), + data: new Uint8Array(), + proof: undefined, + }; +} +exports.TxProof = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + proof_1.Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.rootHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.proof = proof_1.Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rootHash: isSet(object.rootHash) + ? bytesFromBase64(object.rootHash) + : new Uint8Array(), + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + proof: isSet(object.proof) ? proof_1.Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.rootHash !== undefined && + (obj.rootHash = base64FromBytes(message.rootHash !== undefined ? message.rootHash : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.proof !== undefined && + (obj.proof = message.proof ? proof_1.Proof.toJSON(message.proof) : undefined); + return obj; + }, + create(base) { + return exports.TxProof.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + message.proof = + object.proof !== undefined && object.proof !== null + ? proof_1.Proof.fromPartial(object.proof) + : undefined; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function toTimestamp(date) { + const seconds = date.getTime() / 1000; + const nanos = (date.getTime() % 1000) * 1000000; + return { seconds, nanos }; +} +function fromTimestamp(t) { + let millis = (t.seconds || 0) * 1000; + millis += (t.nanos || 0) / 1000000; + return new Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof Date) { + return o; + } + else if (typeof o === "string") { + return new Date(o); + } + else { + return fromTimestamp(timestamp_1.Timestamp.fromJSON(o)); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/tendermint/types/validator.d.ts b/dist/main/tendermint/types/validator.d.ts new file mode 100644 index 0000000..c634f85 --- /dev/null +++ b/dist/main/tendermint/types/validator.d.ts @@ -0,0 +1,277 @@ +import _m0 from "protobufjs/minimal"; +import { PublicKey } from "../crypto/keys"; +export declare const protobufPackage = "tendermint.types"; +export interface ValidatorSet { + validators: Validator[]; + proposer: Validator | undefined; + totalVotingPower: number; +} +export interface Validator { + address: Uint8Array; + pubKey: PublicKey | undefined; + votingPower: number; + proposerPriority: number; +} +export interface SimpleValidator { + pubKey: PublicKey | undefined; + votingPower: number; +} +export declare const ValidatorSet: { + encode(message: ValidatorSet, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSet; + fromJSON(object: any): ValidatorSet; + toJSON(message: ValidatorSet): unknown; + create]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_1 in Exclude]: never; })[] & { [K_2 in Exclude]: never; }) | undefined; + proposer?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + totalVotingPower?: number | undefined; + } & { [K_5 in Exclude]: never; }>(base?: I | undefined): ValidatorSet; + fromPartial]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + proposer?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + totalVotingPower?: number | undefined; + } & { [K_11 in Exclude]: never; }>(object: I_1): ValidatorSet; +}; +export declare const Validator: { + encode(message: Validator, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Validator; + fromJSON(object: any): Validator; + toJSON(message: Validator): unknown; + create]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): Validator; + fromPartial]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): Validator; +}; +export declare const SimpleValidator: { + encode(message: SimpleValidator, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): SimpleValidator; + fromJSON(object: any): SimpleValidator; + toJSON(message: SimpleValidator): unknown; + create]: never; }) | undefined; + votingPower?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): SimpleValidator; + fromPartial]: never; }) | undefined; + votingPower?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): SimpleValidator; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/tendermint/types/validator.js b/dist/main/tendermint/types/validator.js new file mode 100644 index 0000000..d0daba1 --- /dev/null +++ b/dist/main/tendermint/types/validator.js @@ -0,0 +1,299 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SimpleValidator = exports.Validator = exports.ValidatorSet = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +const keys_1 = require("../crypto/keys"); +exports.protobufPackage = "tendermint.types"; +function createBaseValidatorSet() { + return { validators: [], proposer: undefined, totalVotingPower: 0 }; +} +exports.ValidatorSet = { + encode(message, writer = minimal_1.default.Writer.create()) { + for (const v of message.validators) { + exports.Validator.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.proposer !== undefined) { + exports.Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.validators.push(exports.Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + message.proposer = exports.Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e) => exports.Validator.fromJSON(e)) : [], + proposer: isSet(object.proposer) ? exports.Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? Number(object.totalVotingPower) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e ? exports.Validator.toJSON(e) : undefined); + } + else { + obj.validators = []; + } + message.proposer !== undefined && + (obj.proposer = message.proposer ? exports.Validator.toJSON(message.proposer) : undefined); + message.totalVotingPower !== undefined && (obj.totalVotingPower = Math.round(message.totalVotingPower)); + return obj; + }, + create(base) { + return exports.ValidatorSet.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map((e) => exports.Validator.fromPartial(e)) || []; + message.proposer = (object.proposer !== undefined && object.proposer !== null) + ? exports.Validator.fromPartial(object.proposer) + : undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; +function createBaseValidator() { + return { address: new Uint8Array(), pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} +exports.Validator = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + keys_1.PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.address = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.pubKey = keys_1.PublicKey.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(), + pubKey: isSet(object.pubKey) ? keys_1.PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? Number(object.proposerPriority) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.pubKey !== undefined && (obj.pubKey = message.pubKey ? keys_1.PublicKey.toJSON(message.pubKey) : undefined); + message.votingPower !== undefined && (obj.votingPower = Math.round(message.votingPower)); + message.proposerPriority !== undefined && (obj.proposerPriority = Math.round(message.proposerPriority)); + return obj; + }, + create(base) { + return exports.Validator.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? keys_1.PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; +function createBaseSimpleValidator() { + return { pubKey: undefined, votingPower: 0 }; +} +exports.SimpleValidator = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.pubKey !== undefined) { + keys_1.PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.votingPower !== 0) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.pubKey = keys_1.PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.votingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pubKey: isSet(object.pubKey) ? keys_1.PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? Number(object.votingPower) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.pubKey !== undefined && (obj.pubKey = message.pubKey ? keys_1.PublicKey.toJSON(message.pubKey) : undefined); + message.votingPower !== undefined && (obj.votingPower = Math.round(message.votingPower)); + return obj; + }, + create(base) { + return exports.SimpleValidator.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSimpleValidator(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? keys_1.PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/tendermint/version/types.d.ts b/dist/main/tendermint/version/types.d.ts new file mode 100644 index 0000000..c4d5087 --- /dev/null +++ b/dist/main/tendermint/version/types.d.ts @@ -0,0 +1,71 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "tendermint.version"; +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface App { + protocol: number; + software: string; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface Consensus { + block: number; + app: number; +} +export declare const App: { + encode(message: App, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): App; + fromJSON(object: any): App; + toJSON(message: App): unknown; + create]: never; }>(base?: I | undefined): App; + fromPartial]: never; }>(object: I_1): App; +}; +export declare const Consensus: { + encode(message: Consensus, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Consensus; + fromJSON(object: any): Consensus; + toJSON(message: Consensus): unknown; + create]: never; }>(base?: I | undefined): Consensus; + fromPartial]: never; }>(object: I_1): Consensus; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/tendermint/version/types.js b/dist/main/tendermint/version/types.js new file mode 100644 index 0000000..867de66 --- /dev/null +++ b/dist/main/tendermint/version/types.js @@ -0,0 +1,159 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Consensus = exports.App = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +exports.protobufPackage = "tendermint.version"; +function createBaseApp() { + return { protocol: 0, software: "" }; +} +exports.App = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.protocol !== 0) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.protocol = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.software = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + protocol: isSet(object.protocol) ? Number(object.protocol) : 0, + software: isSet(object.software) ? String(object.software) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.protocol !== undefined && (obj.protocol = Math.round(message.protocol)); + message.software !== undefined && (obj.software = message.software); + return obj; + }, + create(base) { + return exports.App.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseApp(); + message.protocol = object.protocol ?? 0; + message.software = object.software ?? ""; + return message; + }, +}; +function createBaseConsensus() { + return { block: 0, app: 0 }; +} +exports.Consensus = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.block !== 0) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.block = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { block: isSet(object.block) ? Number(object.block) : 0, app: isSet(object.app) ? Number(object.app) : 0 }; + }, + toJSON(message) { + const obj = {}; + message.block !== undefined && (obj.block = Math.round(message.block)); + message.app !== undefined && (obj.app = Math.round(message.app)); + return obj; + }, + create(base) { + return exports.Consensus.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseConsensus(); + message.block = object.block ?? 0; + message.app = object.app ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/types/core.d.ts b/dist/main/types/core.d.ts new file mode 100644 index 0000000..7174656 --- /dev/null +++ b/dist/main/types/core.d.ts @@ -0,0 +1,31 @@ +import { AuthExtension, MintExtension, QueryClient, StakingExtension, TxExtension } from "@cosmjs/stargate"; +import { setupFTExtension } from "../coreum/extensions/ft"; +import { setupNFTExtension } from "../coreum/extensions/nft"; +import { setupNFTBetaExtension } from "../coreum/extensions/nftbeta"; +import { FeegrantExtension, IbcExtension } from "@cosmjs/stargate/build/modules"; +import { WasmExtension } from "@cosmjs/cosmwasm-stargate"; +import { setupBankExtension, setupGovExtension, setupDistributionExtension } from "../cosmos/extensions"; +import { setupDexExtension } from "../coreum/extensions/dex"; +/** @internal */ +export declare enum CoreumTypeUrl { + NFT = "/coreum.asset.nft.v1.", + FT = "/coreum.asset.ft.v1.", + NFTBeta = "/cosmos.nft.v1beta1.", + DEX = "/coreum.dex.v1." +} +export interface ClientQueryClient extends QueryClient { + ft: ReturnType["ft"]; + nft: ReturnType["nft"]; + nftbeta: ReturnType["nftbeta"]; + bank: ReturnType["bank"]; + gov: ReturnType["gov"]; + distribution: ReturnType["distribution"]; + dex: ReturnType["dex"]; + staking: StakingExtension["staking"]; + auth: AuthExtension["auth"]; + mint: MintExtension["mint"]; + feegrant: FeegrantExtension["feegrant"]; + ibc: IbcExtension["ibc"]; + wasm: WasmExtension["wasm"]; + tx: TxExtension["tx"]; +} diff --git a/dist/main/types/core.js b/dist/main/types/core.js new file mode 100644 index 0000000..acfc684 --- /dev/null +++ b/dist/main/types/core.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CoreumTypeUrl = void 0; +const tx_1 = require("../coreum/asset/nft/v1/tx"); +const tx_2 = require("../coreum/asset/ft/v1/tx"); +const tx_3 = require("../coreum/nft/v1beta1/tx"); +const tx_4 = require("../coreum/dex/v1/tx"); +/** @internal */ +var CoreumTypeUrl; +(function (CoreumTypeUrl) { + CoreumTypeUrl["NFT"] = "/coreum.asset.nft.v1."; + CoreumTypeUrl["FT"] = "/coreum.asset.ft.v1."; + CoreumTypeUrl["NFTBeta"] = "/cosmos.nft.v1beta1."; + CoreumTypeUrl["DEX"] = "/coreum.dex.v1."; +})(CoreumTypeUrl || (exports.CoreumTypeUrl = CoreumTypeUrl = {})); +// setupMintExtension, +// setupFeegrantExtension, +// setupGovExtension, +// setupIbcExtension, +// setupDistributionExtension, diff --git a/dist/main/types/coreum.d.ts b/dist/main/types/coreum.d.ts new file mode 100644 index 0000000..501e038 --- /dev/null +++ b/dist/main/types/coreum.d.ts @@ -0,0 +1,75 @@ +export declare enum CoreumNetwork { + MAINNET = "mainnet", + TESTNET = "testnet", + DEVNET = "devnet" +} +export declare enum CoreumChainID { + MAINNET = "coreum-mainnet-1", + TESTNET = "coreum-testnet-1", + DEVNET = "coreum-devnet-1" +} +export declare enum CoreumPrefixes { + MAINNET = "core", + TESTNET = "testcore", + DEVNET = "devcore" +} +export declare enum CoreumDenom { + MAINNET = "ucore", + TESTNET = "utestcore", + DEVNET = "udevcore" +} +export type CoreumNetworkKey = keyof typeof COREUM_CONFIG; +export interface CoreumNetworkConfig { + chain_name: string; + chain_id: CoreumChainID; + chain_bech32_prefix: CoreumPrefixes; + chain_rpc_endpoint: string; + chain_rest_endpoint: string; + chain_ws_endpoint: string; + chain_explorer: string; + staking_denom: CoreumDenom; + coin_type: string | number; + site_title: string; + gas_price: string; +} +export declare const COREUM_CONFIG: { + mainnet: { + chain_name: string; + chain_id: CoreumChainID; + chain_bech32_prefix: CoreumPrefixes; + chain_rpc_endpoint: string; + chain_rest_endpoint: string; + chain_ws_endpoint: string; + chain_explorer: string; + staking_denom: CoreumDenom; + coin_type: string; + site_title: string; + gas_price: string; + }; + testnet: { + chain_name: string; + chain_id: CoreumChainID; + chain_bech32_prefix: CoreumPrefixes; + chain_rpc_endpoint: string; + chain_rest_endpoint: string; + chain_ws_endpoint: string; + chain_explorer: string; + staking_denom: CoreumDenom; + coin_type: string; + site_title: string; + gas_price: string; + }; + devnet: { + chain_name: string; + chain_id: CoreumChainID; + chain_bech32_prefix: CoreumPrefixes; + chain_rpc_endpoint: string; + chain_rest_endpoint: string; + chain_ws_endpoint: string; + chain_explorer: string; + staking_denom: CoreumDenom; + coin_type: string; + site_title: string; + gas_price: string; + }; +}; diff --git a/dist/main/types/coreum.js b/dist/main/types/coreum.js new file mode 100644 index 0000000..40ab551 --- /dev/null +++ b/dist/main/types/coreum.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.COREUM_CONFIG = exports.CoreumDenom = exports.CoreumPrefixes = exports.CoreumChainID = exports.CoreumNetwork = void 0; +var CoreumNetwork; +(function (CoreumNetwork) { + CoreumNetwork["MAINNET"] = "mainnet"; + CoreumNetwork["TESTNET"] = "testnet"; + CoreumNetwork["DEVNET"] = "devnet"; +})(CoreumNetwork || (exports.CoreumNetwork = CoreumNetwork = {})); +var CoreumChainID; +(function (CoreumChainID) { + CoreumChainID["MAINNET"] = "coreum-mainnet-1"; + CoreumChainID["TESTNET"] = "coreum-testnet-1"; + CoreumChainID["DEVNET"] = "coreum-devnet-1"; +})(CoreumChainID || (exports.CoreumChainID = CoreumChainID = {})); +var CoreumPrefixes; +(function (CoreumPrefixes) { + CoreumPrefixes["MAINNET"] = "core"; + CoreumPrefixes["TESTNET"] = "testcore"; + CoreumPrefixes["DEVNET"] = "devcore"; +})(CoreumPrefixes || (exports.CoreumPrefixes = CoreumPrefixes = {})); +var CoreumDenom; +(function (CoreumDenom) { + CoreumDenom["MAINNET"] = "ucore"; + CoreumDenom["TESTNET"] = "utestcore"; + CoreumDenom["DEVNET"] = "udevcore"; +})(CoreumDenom || (exports.CoreumDenom = CoreumDenom = {})); +exports.COREUM_CONFIG = { + mainnet: { + chain_name: "Coreum", + chain_id: CoreumChainID.MAINNET, + chain_bech32_prefix: CoreumPrefixes.MAINNET, + chain_rpc_endpoint: "https://full-node.mainnet-1.coreum.dev:26657", + chain_rest_endpoint: "https://full-node.mainnet-1.coreum.dev:1317", + chain_ws_endpoint: "wss://full-node.mainnet-1.coreum.dev:26657", + chain_explorer: "https://explorer.mainnet-1.coreum.dev", + staking_denom: CoreumDenom.MAINNET, + coin_type: "990", + site_title: "Coreum Services", + gas_price: `0.0625${CoreumDenom.MAINNET}`, + }, + testnet: { + chain_name: "Coreum Testnet", + chain_id: CoreumChainID.TESTNET, + chain_bech32_prefix: CoreumPrefixes.TESTNET, + chain_rpc_endpoint: "https://full-node.testnet-1.coreum.dev:26657", + chain_rest_endpoint: "https://full-node.testnet-1.coreum.dev:1317", + chain_ws_endpoint: "wss://full-node.testnet-1.coreum.dev:26657", + chain_explorer: "https://explorer.testnet-1.coreum.dev", + staking_denom: CoreumDenom.TESTNET, + coin_type: "990", + site_title: "Coreum Services", + gas_price: `0.0625${CoreumDenom.TESTNET}`, + }, + devnet: { + chain_name: "Coreum Devnet", + chain_id: CoreumChainID.DEVNET, + chain_bech32_prefix: CoreumPrefixes.DEVNET, + chain_rpc_endpoint: "https://full-node.devnet-1.coreum.dev:26657", + chain_rest_endpoint: "https://full-node.devnet-1.coreum.dev:1317", + chain_ws_endpoint: "wss://full-node.devnet-1.coreum.dev:26657", + chain_explorer: "https://explorer.devnet-1.coreum.dev", + staking_denom: CoreumDenom.DEVNET, + coin_type: "990", + site_title: "Coreum Services", + gas_price: `0.0625${CoreumDenom.DEVNET}`, + }, +}; diff --git a/dist/main/types/index.d.ts b/dist/main/types/index.d.ts new file mode 100644 index 0000000..a82d6c7 --- /dev/null +++ b/dist/main/types/index.d.ts @@ -0,0 +1,3 @@ +export * from "./core"; +export * from "./signing"; +export * from "./coreum"; diff --git a/dist/main/types/index.js b/dist/main/types/index.js new file mode 100644 index 0000000..a9117c2 --- /dev/null +++ b/dist/main/types/index.js @@ -0,0 +1,19 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./core"), exports); +__exportStar(require("./signing"), exports); +__exportStar(require("./coreum"), exports); diff --git a/dist/main/types/msgs.d.ts b/dist/main/types/msgs.d.ts new file mode 100644 index 0000000..3cc273c --- /dev/null +++ b/dist/main/types/msgs.d.ts @@ -0,0 +1,680 @@ +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Feature } from "../coreum/asset/ft/v1/token"; +import { ClassFeature } from "../coreum/asset/nft/v1/nft"; +import { Any } from "../google/protobuf/any"; +import { AccessConfig, Params as WasmParams } from "cosmjs-types/cosmwasm/wasm/v1/types"; +import { VoteOption, WeightedVoteOption } from "cosmjs-types/cosmos/gov/v1beta1/gov"; +import { Input, Output, SendEnabled, Params as BankParams } from "cosmjs-types/cosmos/bank/v1beta1/bank"; +import { Params as DistParams } from "cosmjs-types/cosmos/distribution/v1beta1/distribution"; +import { Period } from "cosmjs-types/cosmos/vesting/v1beta1/vesting"; +import { Grant } from "cosmjs-types/cosmos/authz/v1beta1/authz"; +import { CommissionRates, Description, Params as StakingParams } from "cosmjs-types/cosmos/staking/v1beta1/staking"; +export declare namespace FTMsgs { + interface MsgIssue { + issuer: string; + symbol: string; + subunit: string; + precision: number; + initialAmount: string; + description?: string; + features?: Feature[]; + /** + * burn_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * burn_amount. This value will be burnt on top of the send amount. + */ + burnRate?: string; + /** + * send_commission_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * amount sent to the token issuer account. + */ + sendCommissionRate?: string; + uri?: string; + uriHash?: string; + } + interface MsgMint { + sender: string; + coin: Coin; + } + interface MsgBurn { + sender: string; + coin: Coin; + } + interface MsgFreeze { + sender: string; + account: string; + coin: Coin; + } + interface MsgUnfreeze { + sender: string; + account: string; + coin: Coin; + } + interface MsgGloballyFreeze { + sender: string; + denom: string; + } + interface MsgGloballyUnfreeze { + sender: string; + denom: string; + } + interface MsgSetWhitelistedLimit { + sender: string; + account: string; + coin: Coin; + } + interface MsgClawback { + sender: string; + account: string; + coin: Coin; + } +} +export declare namespace NFTMsgs { + /** MsgSend represents a message to send a nft from one account to another account. */ + interface MsgSend { + /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ + classId: string; + /** id defines the unique identification of nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; + } + /** MsgIssueClass defines message for the IssueClass method. */ + interface MsgIssueClass { + issuer: string; + symbol: string; + name: string; + description?: string; + uri: string; + uriHash?: string; + data?: Any; + features?: ClassFeature[]; + royaltyRate?: string; + } + /** MsgMint defines message for the Mint method. */ + interface MsgMint { + sender: string; + classId: string; + id: string; + uri: string; + uriHash: string; + data?: Any; + recipient: string; + } + /** MsgBurn defines message for the Burn method. */ + interface MsgBurn { + sender: string; + classId: string; + id: string; + } + interface MsgFreeze { + sender: string; + classId: string; + id: string; + } + interface MsgUnfreeze { + sender: string; + classId: string; + id: string; + } + interface MsgAddToWhitelist { + sender: string; + classId: string; + id: string; + account: string; + } + interface MsgRemoveFromWhitelist { + sender: string; + classId: string; + id: string; + account: string; + } +} +export declare namespace CWMsgs { + /** MsgStoreCode submit Wasm code to the system */ + interface MsgStoreCode { + /** Sender is the actor that signed the messages */ + sender: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** + * InstantiatePermission access control to apply on contract creation, + * optional + */ + instantiatePermission: AccessConfig | undefined; + } + /** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ + interface MsgInstantiateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + } + /** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ + interface MsgStoreAndInstantiateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig | undefined; + /** + * UnpinCode code on upload, optional. As default the uploaded contract is + * pinned to cache. + */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** + * Funds coins that are transferred from the authority account to the contract + * on instantiation + */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; + } + /** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ + interface MsgUnpinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the WASM codes */ + codeIds: number[]; + } + /** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ + interface MsgPinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the new WASM codes */ + codeIds: number[]; + } + /** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ + interface MsgSudoContract { + /** Authority is the address of the governance account. */ + authority: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; + } + /** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ + interface MsgUpdateParams { + /** Authority is the address of the governance account. */ + authority: string; + /** + * params defines the x/wasm parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: WasmParams | undefined; + } + /** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ + interface MsgUpdateInstantiateConfig { + /** Sender is the that actor that signed the messages */ + sender: string; + /** CodeID references the stored WASM code */ + codeId: number; + /** NewInstantiatePermission is the new access control */ + newInstantiatePermission: AccessConfig | undefined; + } + /** MsgClearAdmin removes any admin stored for a smart contract */ + interface MsgClearAdmin { + /** Sender is the actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + } + /** MsgUpdateAdmin sets a new admin for a smart contract */ + interface MsgUpdateAdmin { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; + } + /** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ + interface MsgMigrateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: number; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; + } + /** MsgExecuteContract submits the given message data to a smart contract */ + interface MsgExecuteContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on execution */ + funds: Coin[]; + } + /** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ + interface MsgInstantiateContract2 { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; + } +} +export declare namespace AuthzMsgs { + /** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ + interface MsgGrant { + granter: string; + grantee: string; + grant?: Grant; + } + /** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ + interface MsgExec { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; + } + /** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ + interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; + } +} +export declare namespace StakingMsgs { + /** MsgCreateValidator defines a SDK message for creating a new validator. */ + interface MsgCreateValidator { + description: Description | undefined; + commission: CommissionRates | undefined; + minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + * + * @deprecated + */ + delegatorAddress: string; + validatorAddress: string; + pubkey: Any | undefined; + value: Coin | undefined; + } + /** MsgEditValidator defines a SDK message for editing an existing validator. */ + interface MsgEditValidator { + description: Description | undefined; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; + } + /** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ + interface MsgDelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; + } + /** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ + interface MsgBeginRedelegate { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin | undefined; + } + /** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ + interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; + } + /** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ + interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: Coin | undefined; + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; + } + /** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: StakingParams | undefined; + } +} +export declare namespace GovMsgs { + /** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ + interface MsgSubmitProposal { + /** content is the proposal's content. */ + content: Any | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + } + /** MsgVote defines a message to cast a vote. */ + interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + } + /** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ + interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + } + /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ + interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; + } +} +export declare namespace FeegrantMsgs { + /** + * MsgGrantAllowance adds permission for Grantee to spend up to Allowance + * of fees from the account of Granter. + */ + interface MsgGrantAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + /** allowance can be any of basic, periodic, allowed fee allowance. */ + allowance: Any | undefined; + } + /** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ + interface MsgRevokeAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + } +} +export declare namespace BankMsgs { + /** MsgSend represents a message to send coins from one account to another. */ + interface MsgSend { + fromAddress: string; + toAddress: string; + amount: Coin[]; + } + /** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ + interface MsgMultiSend { + /** + * Inputs, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; + } + /** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: BankParams | undefined; + } + /** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgSetSendEnabled { + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; + } +} +export declare namespace DistributionMsgs { + /** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ + interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: string; + } + /** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ + interface MsgWithdrawDelegatorReward { + delegatorAddress: string; + validatorAddress: string; + } + /** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ + interface MsgWithdrawValidatorCommission { + validatorAddress: string; + } + /** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ + interface MsgFundCommunityPool { + amount: Coin[]; + depositor: string; + } + /** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: DistParams | undefined; + } + /** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; + } + /** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.48 + */ + interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; + } +} +export declare namespace VestingMsgs { + /** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ + interface MsgCreateVestingAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: number; + delayed: boolean; + } + /** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ + interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; + } + /** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ + interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: number; + vestingPeriods: Period[]; + } +} diff --git a/dist/main/types/msgs.js b/dist/main/types/msgs.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/dist/main/types/msgs.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/main/types/signing.d.ts b/dist/main/types/signing.d.ts new file mode 100644 index 0000000..44af9be --- /dev/null +++ b/dist/main/types/signing.d.ts @@ -0,0 +1,25 @@ +import { MultisigThresholdPubkey, StdFee } from "@cosmjs/amino"; +export interface MultisigAccount { + pubkey: MultisigThresholdPubkey; + address: string; + threshold: number; +} +export declare enum WalletMethods { + OFFLINE = "offline", + COSMOSTATION = "cosmostation", + MNEMONIC = "mnemonic", + LEAP = "leap" +} +export interface FeeCalculation { + fee: StdFee; + gas_wanted: number; +} +export interface FeeOptions { + address?: string; + gasLimit?: number; +} +export declare enum ExtensionWallets { + KEPLR = "keplr", + COSMOSTATION = "cosmostation", + LEAP = "leap" +} diff --git a/dist/main/types/signing.js b/dist/main/types/signing.js new file mode 100644 index 0000000..d5b6afd --- /dev/null +++ b/dist/main/types/signing.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtensionWallets = exports.WalletMethods = void 0; +var WalletMethods; +(function (WalletMethods) { + WalletMethods["OFFLINE"] = "offline"; + WalletMethods["COSMOSTATION"] = "cosmostation"; + WalletMethods["MNEMONIC"] = "mnemonic"; + WalletMethods["LEAP"] = "leap"; +})(WalletMethods || (exports.WalletMethods = WalletMethods = {})); +var ExtensionWallets; +(function (ExtensionWallets) { + ExtensionWallets["KEPLR"] = "keplr"; + ExtensionWallets["COSMOSTATION"] = "cosmostation"; + ExtensionWallets["LEAP"] = "leap"; +})(ExtensionWallets || (exports.ExtensionWallets = ExtensionWallets = {})); diff --git a/dist/main/utils/calculations.d.ts b/dist/main/utils/calculations.d.ts new file mode 100644 index 0000000..aedbf6d --- /dev/null +++ b/dist/main/utils/calculations.d.ts @@ -0,0 +1,29 @@ +/** + * @param ucore ucore to convert to CORE + * @returns A string representing CORE value of ucore + */ +export declare const ucoreToCORE: (ucore: string) => string; +/** + * @param core CORE to convert to ucore + * @returns A string representing ucore value of CORE + */ +export declare const coreToUCORE: (core: string) => string; +/** + * @param royalty Float to convert to royalty rate format + * @returns a string representing the float passed in royalty rate format + */ +export declare const parseFloatToRoyaltyRate: (royalty: number | string) => string; +/** + * + * @param subunit Amount of the subunit of the token to parse into full unit + * @param precision The precision of the token; number of decimals + * @returns The converted subunit to Unit with the passed precision + */ +export declare const subunitToUnit: (subunit: string, precision: number) => string; +/** + * + * @param unit Amount of the unit of the token to parse into its subunit + * @param precision The precision of the token; number of decimals + * @returns The converted unit to subunit with the passed precision + */ +export declare const unitToSubunit: (unit: string, precision: number) => string; diff --git a/dist/main/utils/calculations.js b/dist/main/utils/calculations.js new file mode 100644 index 0000000..97464c5 --- /dev/null +++ b/dist/main/utils/calculations.js @@ -0,0 +1,78 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unitToSubunit = exports.subunitToUnit = exports.parseFloatToRoyaltyRate = exports.coreToUCORE = exports.ucoreToCORE = void 0; +const bignumber_js_1 = __importDefault(require("bignumber.js")); +function assertValidAmount(value, fieldName) { + const amount = new bignumber_js_1.default(value); + if (!amount.isFinite() || amount.isNaN()) { + throw new Error(`Invalid ${fieldName}: ${value}`); + } + if (amount.isNegative()) { + throw new Error(`${fieldName} must be non-negative`); + } + return amount; +} +function assertValidPrecision(precision, fieldName) { + if (!Number.isInteger(precision) || precision < 0 || precision > 18) { + throw new Error(`${fieldName} must be an integer between 0 and 18`); + } +} +/** + * @param ucore ucore to convert to CORE + * @returns A string representing CORE value of ucore + */ +const ucoreToCORE = (ucore) => { + return assertValidAmount(ucore, "ucore").dividedBy(1000000).valueOf(); +}; +exports.ucoreToCORE = ucoreToCORE; +/** + * @param core CORE to convert to ucore + * @returns A string representing ucore value of CORE + */ +const coreToUCORE = (core) => { + return assertValidAmount(core, "core").multipliedBy(1000000).valueOf(); +}; +exports.coreToUCORE = coreToUCORE; +/** + * @param royalty Float to convert to royalty rate format + * @returns a string representing the float passed in royalty rate format + */ +const parseFloatToRoyaltyRate = (royalty) => { + const float = new bignumber_js_1.default(royalty); + if (!float.isFinite() || float.isNaN() || float.isNegative()) { + throw new Error(`Invalid royalty value: ${royalty}`); + } + return float.dividedBy(100).multipliedBy("1000000000000000000").toString(); +}; +exports.parseFloatToRoyaltyRate = parseFloatToRoyaltyRate; +/** + * + * @param subunit Amount of the subunit of the token to parse into full unit + * @param precision The precision of the token; number of decimals + * @returns The converted subunit to Unit with the passed precision + */ +const subunitToUnit = (subunit, precision) => { + assertValidPrecision(precision, "precision"); + const precisionFactor = new bignumber_js_1.default(10).exponentiatedBy(precision); + return assertValidAmount(subunit, "subunit") + .dividedBy(precisionFactor) + .toString(); +}; +exports.subunitToUnit = subunitToUnit; +/** + * + * @param unit Amount of the unit of the token to parse into its subunit + * @param precision The precision of the token; number of decimals + * @returns The converted unit to subunit with the passed precision + */ +const unitToSubunit = (unit, precision) => { + assertValidPrecision(precision, "precision"); + const precisionFactor = new bignumber_js_1.default(10).exponentiatedBy(precision); + return assertValidAmount(unit, "unit") + .multipliedBy(precisionFactor) + .toString(); +}; +exports.unitToSubunit = unitToSubunit; diff --git a/dist/main/utils/chainConfig.d.ts b/dist/main/utils/chainConfig.d.ts new file mode 100644 index 0000000..e1d983e --- /dev/null +++ b/dist/main/utils/chainConfig.d.ts @@ -0,0 +1,39 @@ +import { CoreumNetworkConfig } from "../types/coreum"; +export declare function buildKeplrChainSuggestion(config: CoreumNetworkConfig): { + chainId: import("../types/coreum").CoreumChainID; + chainName: string; + rpc: string; + rest: string; + stakeCurrency: { + coinDenom: string; + coinMinimalDenom: import("../types/coreum").CoreumDenom; + coinDecimals: number; + }; + bip44: { + coinType: number; + }; + bech32Config: { + bech32PrefixAccAddr: import("../types/coreum").CoreumPrefixes; + bech32PrefixAccPub: string; + bech32PrefixValAddr: string; + bech32PrefixValPub: string; + bech32PrefixConsAddr: string; + bech32PrefixConsPub: string; + }; + currencies: { + coinDenom: string; + coinMinimalDenom: import("../types/coreum").CoreumDenom; + coinDecimals: number; + }[]; + feeCurrencies: { + coinDenom: string; + coinMinimalDenom: import("../types/coreum").CoreumDenom; + coinDecimals: number; + }[]; + coinType: number; + gasPriceStep: { + low: number; + average: number; + high: number; + }; +}; diff --git a/dist/main/utils/chainConfig.js b/dist/main/utils/chainConfig.js new file mode 100644 index 0000000..65158d3 --- /dev/null +++ b/dist/main/utils/chainConfig.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.buildKeplrChainSuggestion = void 0; +function buildKeplrChainSuggestion(config) { + const stakingDenom = "core"; + const gasPrice = Number((config.gas_price || "").replace(config.staking_denom || "", "")); + return { + chainId: config.chain_id, + chainName: config.chain_name, + rpc: config.chain_rpc_endpoint, + rest: config.chain_rest_endpoint, + stakeCurrency: { + coinDenom: stakingDenom, + coinMinimalDenom: config.staking_denom, + coinDecimals: 6, + }, + bip44: { + coinType: Number(config.coin_type), + }, + bech32Config: { + bech32PrefixAccAddr: config.chain_bech32_prefix, + bech32PrefixAccPub: `${config.chain_bech32_prefix}pub`, + bech32PrefixValAddr: `${config.chain_bech32_prefix}valoper`, + bech32PrefixValPub: `${config.chain_bech32_prefix}valoperpub`, + bech32PrefixConsAddr: `${config.chain_bech32_prefix}valcons`, + bech32PrefixConsPub: `${config.chain_bech32_prefix}valconspub`, + }, + currencies: [ + { + coinDenom: stakingDenom, + coinMinimalDenom: config.staking_denom, + coinDecimals: 6, + }, + ], + feeCurrencies: [ + { + coinDenom: stakingDenom, + coinMinimalDenom: config.staking_denom, + coinDecimals: 6, + }, + ], + coinType: Number(config.coin_type), + gasPriceStep: { + low: gasPrice, + average: gasPrice, + high: gasPrice, + }, + }; +} +exports.buildKeplrChainSuggestion = buildKeplrChainSuggestion; diff --git a/dist/main/utils/convertStringToAny.d.ts b/dist/main/utils/convertStringToAny.d.ts new file mode 100644 index 0000000..3903ef6 --- /dev/null +++ b/dist/main/utils/convertStringToAny.d.ts @@ -0,0 +1,2 @@ +import { Any } from "google-protobuf/google/protobuf/any_pb"; +export declare const convertStringToAny: (message: string) => Any; diff --git a/dist/main/utils/convertStringToAny.js b/dist/main/utils/convertStringToAny.js new file mode 100644 index 0000000..9c887cc --- /dev/null +++ b/dist/main/utils/convertStringToAny.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.convertStringToAny = void 0; +const any_pb_1 = require("google-protobuf/google/protobuf/any_pb"); +const types_1 = require("../coreum/asset/nft/v1/types"); +const convertStringToAny = (message) => { + const formattedValueOfData = btoa(message); + const dataBytesMessage = types_1.DataBytes.fromJSON({ Data: formattedValueOfData }); + const dataBytesBinary = types_1.DataBytes.encode(dataBytesMessage).finish(); + const formattedAnyDataValue = new any_pb_1.Any(); + formattedAnyDataValue.setTypeUrl("/coreum.asset.nft.v1.DataBytes"); + formattedAnyDataValue.setValue(dataBytesBinary); + return formattedAnyDataValue; +}; +exports.convertStringToAny = convertStringToAny; diff --git a/dist/main/utils/endpoints.d.ts b/dist/main/utils/endpoints.d.ts new file mode 100644 index 0000000..e16042a --- /dev/null +++ b/dist/main/utils/endpoints.d.ts @@ -0,0 +1,8 @@ +export interface EndpointValidationOptions { + /** Allow http:// and ws:// (intended for local development only). */ + allowInsecure?: boolean; + /** Block localhost and private IP ranges (enabled automatically in Node.js). */ + blockPrivateHosts?: boolean; +} +export declare function validateRpcEndpoint(url: string, options?: EndpointValidationOptions): string; +export declare function validateWsEndpoint(url: string, options?: EndpointValidationOptions): string; diff --git a/dist/main/utils/endpoints.js b/dist/main/utils/endpoints.js new file mode 100644 index 0000000..c4e84a1 --- /dev/null +++ b/dist/main/utils/endpoints.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateWsEndpoint = exports.validateRpcEndpoint = void 0; +const PRIVATE_IPV4_RANGES = [ + /^127\./, + /^10\./, + /^192\.168\./, + /^169\.254\./, + /^172\.(1[6-9]|2\d|3[01])\./, + /^0\./, +]; +function isNodeRuntime() { + return (typeof process !== "undefined" && + typeof process.versions?.node === "string"); +} +function isPrivateOrLocalHost(hostname) { + const normalized = hostname.toLowerCase(); + if (normalized === "localhost" || + normalized.endsWith(".localhost") || + normalized === "::1" || + normalized === "[::1]") { + return true; + } + if (normalized.includes(":")) { + return normalized.startsWith("fc") || normalized.startsWith("fd"); + } + return PRIVATE_IPV4_RANGES.some((pattern) => pattern.test(normalized)); +} +function assertAllowedHost(hostname, options) { + const shouldBlockPrivate = options?.blockPrivateHosts ?? isNodeRuntime(); + if (shouldBlockPrivate && isPrivateOrLocalHost(hostname)) { + throw new Error(`Endpoint host "${hostname}" is not allowed in this environment`); + } +} +function validateRpcEndpoint(url, options) { + let parsed; + try { + parsed = new URL(url); + } + catch { + throw new Error(`Invalid RPC endpoint URL: ${url}`); + } + const allowedSchemes = options?.allowInsecure + ? ["http:", "https:"] + : ["https:"]; + if (!allowedSchemes.includes(parsed.protocol)) { + throw new Error(`RPC endpoint must use ${allowedSchemes.join(" or ")} (got ${parsed.protocol})`); + } + assertAllowedHost(parsed.hostname, options); + return url; +} +exports.validateRpcEndpoint = validateRpcEndpoint; +function validateWsEndpoint(url, options) { + let parsed; + try { + parsed = new URL(url); + } + catch { + throw new Error(`Invalid WebSocket endpoint URL: ${url}`); + } + const allowedSchemes = options?.allowInsecure + ? ["ws:", "wss:"] + : ["wss:"]; + if (!allowedSchemes.includes(parsed.protocol)) { + throw new Error(`WebSocket endpoint must use ${allowedSchemes.join(" or ")} (got ${parsed.protocol})`); + } + assertAllowedHost(parsed.hostname, options); + return url; +} +exports.validateWsEndpoint = validateWsEndpoint; diff --git a/dist/main/utils/event.d.ts b/dist/main/utils/event.d.ts new file mode 100644 index 0000000..e57b889 --- /dev/null +++ b/dist/main/utils/event.d.ts @@ -0,0 +1,9 @@ +interface SubscriptionEvents { + [key: string]: string[]; +} +/** + * @param events Subscription events + * @returns A well-defined object showcasing all the events of a subscription + */ +export declare const parseSubscriptionEvents: (events: SubscriptionEvents) => any; +export {}; diff --git a/dist/main/utils/event.js b/dist/main/utils/event.js new file mode 100644 index 0000000..04c4ea6 --- /dev/null +++ b/dist/main/utils/event.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseSubscriptionEvents = void 0; +/** + * @param events Subscription events + * @returns A well-defined object showcasing all the events of a subscription + */ +const parseSubscriptionEvents = (events) => { + let parsedEvents = {}; + Object.entries(events).map((entry) => { + const [key, value] = entry; + const splitKey = key.split("."); + const last = splitKey.pop(); + const property = splitKey.join("."); + parsedEvents[property] = parsedEvents[property] || {}; + try { + parsedEvents[property][last] = JSON.parse(value[0]); + } + catch (e) { + parsedEvents[property][last] = value[0]; + } + }); + return parsedEvents; +}; +exports.parseSubscriptionEvents = parseSubscriptionEvents; diff --git a/dist/main/utils/ft.d.ts b/dist/main/utils/ft.d.ts new file mode 100644 index 0000000..c785fb9 --- /dev/null +++ b/dist/main/utils/ft.d.ts @@ -0,0 +1,11 @@ +import { Feature } from "../coreum/asset/ft/v1/token"; +/** + * @param features An array of Feature. + * @returns An object defining which features are enabled/disabled with boolean + */ +export declare const parseTokenFeatures: (features: Feature[]) => { + minting: boolean; + freezing: boolean; + burning: boolean; + whitelisting: boolean; +}; diff --git a/dist/main/utils/ft.js b/dist/main/utils/ft.js new file mode 100644 index 0000000..5852cee --- /dev/null +++ b/dist/main/utils/ft.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseTokenFeatures = void 0; +const token_1 = require("../coreum/asset/ft/v1/token"); +/** + * @param features An array of Feature. + * @returns An object defining which features are enabled/disabled with boolean + */ +const parseTokenFeatures = (features) => { + return { + minting: features.includes(token_1.Feature["minting"]), + freezing: features.includes(token_1.Feature["freezing"]), + burning: features.includes(token_1.Feature["burning"]), + whitelisting: features.includes(token_1.Feature["whitelisting"]), + }; +}; +exports.parseTokenFeatures = parseTokenFeatures; diff --git a/dist/main/utils/index.d.ts b/dist/main/utils/index.d.ts new file mode 100644 index 0000000..3383c8a --- /dev/null +++ b/dist/main/utils/index.d.ts @@ -0,0 +1,7 @@ +export * from "./wallet"; +export * from "./calculations"; +export * from "./nft"; +export * from "./ft"; +export * from "./convertStringToAny"; +export * from "./event"; +export * from "./endpoints"; diff --git a/dist/main/utils/index.js b/dist/main/utils/index.js new file mode 100644 index 0000000..2f62b70 --- /dev/null +++ b/dist/main/utils/index.js @@ -0,0 +1,23 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./wallet"), exports); +__exportStar(require("./calculations"), exports); +__exportStar(require("./nft"), exports); +__exportStar(require("./ft"), exports); +__exportStar(require("./convertStringToAny"), exports); +__exportStar(require("./event"), exports); +__exportStar(require("./endpoints"), exports); diff --git a/dist/main/utils/nft.d.ts b/dist/main/utils/nft.d.ts new file mode 100644 index 0000000..3469b11 --- /dev/null +++ b/dist/main/utils/nft.d.ts @@ -0,0 +1,13 @@ +import { ClassFeature } from "../coreum/asset/nft/v1/nft"; +/** + * + * @param features An array of NFT Class features + * @returns An object defining which features are enabled/disabled with a boolean + */ +export declare function parseClassFeatures(features: ClassFeature[]): { + burning: boolean; + freezing: boolean; + whitelisting: boolean; + disable_sending: boolean; + soulbound: boolean; +}; diff --git a/dist/main/utils/nft.js b/dist/main/utils/nft.js new file mode 100644 index 0000000..705cf88 --- /dev/null +++ b/dist/main/utils/nft.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseClassFeatures = void 0; +const nft_1 = require("../coreum/asset/nft/v1/nft"); +/** + * + * @param features An array of NFT Class features + * @returns An object defining which features are enabled/disabled with a boolean + */ +function parseClassFeatures(features) { + return { + burning: features.includes(nft_1.ClassFeature["burning"]), + freezing: features.includes(nft_1.ClassFeature["freezing"]), + whitelisting: features.includes(nft_1.ClassFeature["whitelisting"]), + disable_sending: features.includes(nft_1.ClassFeature["disable_sending"]), + soulbound: features.includes(nft_1.ClassFeature["soulbound"]), + }; +} +exports.parseClassFeatures = parseClassFeatures; diff --git a/dist/main/utils/wallet.d.ts b/dist/main/utils/wallet.d.ts new file mode 100644 index 0000000..e6c6dfb --- /dev/null +++ b/dist/main/utils/wallet.d.ts @@ -0,0 +1,20 @@ +import { OfflineDirectSigner } from "@cosmjs/proto-signing"; +import { CoreumPrefixes } from "../types/coreum"; +import { MultisigAccount } from "../types"; +/** + * + * @param address String representing an address on the Coreum blockchain + * @param expectedPrefix Optional bech32 prefix that must match the active network + * @returns A boolean defining if the passed address is a valid address on the Coreum Blockchain + */ +export declare const isValidCoreumAddress: (address: string, expectedPrefix?: CoreumPrefixes | string) => boolean; +export declare const assertValidCoreumAddress: (address: string, expectedPrefix?: CoreumPrefixes | string) => void; +export declare const validateMnemonic: (mnemonic: string) => void; +/** + * + * @param mnemonic Mnemonic words of a Cosmos SDK wallet + * @param prefix The prefix to use - "core" | "testcore" | "devcore" + * @returns A wallet with the default hdPath for the Coreum Blockchain, and with the selected prefix. + */ +export declare const generateWalletFromMnemonic: (mnemonic: string, prefix: CoreumPrefixes) => Promise; +export declare const generateMultisigFromPubkeys: (pubkeys: string[], threshold: number, prefix: string) => MultisigAccount; diff --git a/dist/main/utils/wallet.js b/dist/main/utils/wallet.js new file mode 100644 index 0000000..4bda202 --- /dev/null +++ b/dist/main/utils/wallet.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateMultisigFromPubkeys = exports.generateWalletFromMnemonic = exports.validateMnemonic = exports.assertValidCoreumAddress = exports.isValidCoreumAddress = void 0; +const proto_signing_1 = require("@cosmjs/proto-signing"); +const crypto_1 = require("@cosmjs/crypto"); +const bech32_1 = require("bech32"); +const coreum_1 = require("../types/coreum"); +const amino_1 = require("@cosmjs/amino"); +const errors_1 = require("../errors"); +/** + * + * @param address String representing an address on the Coreum blockchain + * @param expectedPrefix Optional bech32 prefix that must match the active network + * @returns A boolean defining if the passed address is a valid address on the Coreum Blockchain + */ +const isValidCoreumAddress = (address, expectedPrefix) => { + try { + const { prefix = null } = bech32_1.bech32.decode(address); + if (prefix !== coreum_1.CoreumPrefixes.MAINNET && + prefix !== coreum_1.CoreumPrefixes.DEVNET && + prefix !== coreum_1.CoreumPrefixes.TESTNET) { + return false; + } + if (expectedPrefix && prefix !== expectedPrefix) { + return false; + } + return true; + } + catch { + return false; + } +}; +exports.isValidCoreumAddress = isValidCoreumAddress; +const assertValidCoreumAddress = (address, expectedPrefix) => { + if (!(0, exports.isValidCoreumAddress)(address, expectedPrefix)) { + throw new Error(`Invalid Coreum address: ${address}`); + } +}; +exports.assertValidCoreumAddress = assertValidCoreumAddress; +const validateMnemonic = (mnemonic) => { + const words = mnemonic.trim().split(/\s+/); + if (words.length !== 12 && words.length !== 24) { + throw new Error("Mnemonic must contain 12 or 24 words"); + } + if (words.some((word) => word.length === 0)) { + throw new Error("Mnemonic contains empty words"); + } +}; +exports.validateMnemonic = validateMnemonic; +/** + * + * @param mnemonic Mnemonic words of a Cosmos SDK wallet + * @param prefix The prefix to use - "core" | "testcore" | "devcore" + * @returns A wallet with the default hdPath for the Coreum Blockchain, and with the selected prefix. + */ +const generateWalletFromMnemonic = async (mnemonic, prefix) => { + (0, exports.validateMnemonic)(mnemonic); + const hdPath = "m/44'/990'/0'/0/0"; + try { + const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { + prefix, + hdPaths: [(0, crypto_1.stringToPath)(hdPath)], + }); + return wallet; + } + catch (error) { + throw new errors_1.TxJsError("generateWalletFromMnemonic", error); + } +}; +exports.generateWalletFromMnemonic = generateWalletFromMnemonic; +const generateMultisigFromPubkeys = (pubkeys, threshold, prefix) => { + const secpPubkeys = pubkeys.map((p) => { + return { + type: "tendermint/PubKeySecp256k1", + value: p, + }; + }); + const multisigPubkey = (0, amino_1.createMultisigThresholdPubkey)(secpPubkeys, threshold); + return { + pubkey: multisigPubkey, + address: (0, amino_1.pubkeyToAddress)(multisigPubkey, prefix), + threshold, + }; +}; +exports.generateMultisigFromPubkeys = generateMultisigFromPubkeys; diff --git a/dist/main/wasm/v1/authz.d.ts b/dist/main/wasm/v1/authz.d.ts new file mode 100644 index 0000000..15a866c --- /dev/null +++ b/dist/main/wasm/v1/authz.d.ts @@ -0,0 +1,119 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** + * ContractExecutionAuthorization defines authorization for wasm execute. + * Since: wasmd 0.30 + */ +export interface ContractExecutionAuthorization { + /** Grants for contract executions */ + grants: ContractGrant[]; +} +/** + * ContractMigrationAuthorization defines authorization for wasm contract + * migration. Since: wasmd 0.30 + */ +export interface ContractMigrationAuthorization { + /** Grants for contract migrations */ + grants: ContractGrant[]; +} +/** + * ContractGrant a granted permission for a single contract + * Since: wasmd 0.30 + */ +export interface ContractGrant { + /** Contract is the bech32 address of the smart contract */ + contract: string; + /** + * Limit defines execution limits that are enforced and updated when the grant + * is applied. When the limit lapsed the grant is removed. + */ + limit: Any | undefined; + /** + * Filter define more fine-grained control on the message payload passed + * to the contract in the operation. When no filter applies on execution, the + * operation is prohibited. + */ + filter: Any | undefined; +} +/** + * MaxCallsLimit limited number of calls to the contract. No funds transferable. + * Since: wasmd 0.30 + */ +export interface MaxCallsLimit { + /** Remaining number that is decremented on each execution */ + remaining: number; +} +/** + * MaxFundsLimit defines the maximal amounts that can be sent to the contract. + * Since: wasmd 0.30 + */ +export interface MaxFundsLimit { + /** Amounts is the maximal amount of tokens transferable to the contract. */ + amounts: Coin[]; +} +/** + * CombinedLimit defines the maximal amounts that can be sent to a contract and + * the maximal number of calls executable. Both need to remain >0 to be valid. + * Since: wasmd 0.30 + */ +export interface CombinedLimit { + /** Remaining number that is decremented on each execution */ + callsRemaining: number; + /** Amounts is the maximal amount of tokens transferable to the contract. */ + amounts: Coin[]; +} +/** + * AllowAllMessagesFilter is a wildcard to allow any type of contract payload + * message. + * Since: wasmd 0.30 + */ +export interface AllowAllMessagesFilter { +} +/** + * AcceptedMessageKeysFilter accept only the specific contract message keys in + * the json object to be executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessageKeysFilter { + /** Messages is the list of unique keys */ + keys: string[]; +} +/** + * AcceptedMessagesFilter accept only the specific raw contract messages to be + * executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessagesFilter { + /** Messages is the list of raw contract messages */ + messages: Uint8Array[]; +} +export declare const ContractExecutionAuthorization: MessageFns; +export declare const ContractMigrationAuthorization: MessageFns; +export declare const ContractGrant: MessageFns; +export declare const MaxCallsLimit: MessageFns; +export declare const MaxFundsLimit: MessageFns; +export declare const CombinedLimit: MessageFns; +export declare const AllowAllMessagesFilter: MessageFns; +export declare const AcceptedMessageKeysFilter: MessageFns; +export declare const AcceptedMessagesFilter: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/wasm/v1/authz.js b/dist/main/wasm/v1/authz.js new file mode 100644 index 0000000..07a8c9e --- /dev/null +++ b/dist/main/wasm/v1/authz.js @@ -0,0 +1,583 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/authz.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AcceptedMessagesFilter = exports.AcceptedMessageKeysFilter = exports.AllowAllMessagesFilter = exports.CombinedLimit = exports.MaxFundsLimit = exports.MaxCallsLimit = exports.ContractGrant = exports.ContractMigrationAuthorization = exports.ContractExecutionAuthorization = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const any_1 = require("cosmjs-types/google/protobuf/any"); +exports.protobufPackage = "cosmwasm.wasm.v1"; +function createBaseContractExecutionAuthorization() { + return { grants: [] }; +} +exports.ContractExecutionAuthorization = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.grants) { + exports.ContractGrant.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractExecutionAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.grants.push(exports.ContractGrant.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + grants: globalThis.Array.isArray(object?.grants) + ? object.grants.map((e) => exports.ContractGrant.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.grants?.length) { + obj.grants = message.grants.map((e) => exports.ContractGrant.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.ContractExecutionAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractExecutionAuthorization(); + message.grants = + object.grants?.map((e) => exports.ContractGrant.fromPartial(e)) || []; + return message; + }, +}; +function createBaseContractMigrationAuthorization() { + return { grants: [] }; +} +exports.ContractMigrationAuthorization = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.grants) { + exports.ContractGrant.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractMigrationAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.grants.push(exports.ContractGrant.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + grants: globalThis.Array.isArray(object?.grants) + ? object.grants.map((e) => exports.ContractGrant.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.grants?.length) { + obj.grants = message.grants.map((e) => exports.ContractGrant.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.ContractMigrationAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractMigrationAuthorization(); + message.grants = + object.grants?.map((e) => exports.ContractGrant.fromPartial(e)) || []; + return message; + }, +}; +function createBaseContractGrant() { + return { contract: "", limit: undefined, filter: undefined }; +} +exports.ContractGrant = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.contract !== "") { + writer.uint32(10).string(message.contract); + } + if (message.limit !== undefined) { + any_1.Any.encode(message.limit, writer.uint32(18).fork()).ldelim(); + } + if (message.filter !== undefined) { + any_1.Any.encode(message.filter, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contract = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.limit = any_1.Any.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.filter = any_1.Any.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + limit: isSet(object.limit) ? any_1.Any.fromJSON(object.limit) : undefined, + filter: isSet(object.filter) ? any_1.Any.fromJSON(object.filter) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.limit !== undefined) { + obj.limit = any_1.Any.toJSON(message.limit); + } + if (message.filter !== undefined) { + obj.filter = any_1.Any.toJSON(message.filter); + } + return obj; + }, + create(base) { + return exports.ContractGrant.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractGrant(); + message.contract = object.contract ?? ""; + message.limit = + object.limit !== undefined && object.limit !== null + ? any_1.Any.fromPartial(object.limit) + : undefined; + message.filter = + object.filter !== undefined && object.filter !== null + ? any_1.Any.fromPartial(object.filter) + : undefined; + return message; + }, +}; +function createBaseMaxCallsLimit() { + return { remaining: 0 }; +} +exports.MaxCallsLimit = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.remaining !== 0) { + writer.uint32(8).uint64(message.remaining); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMaxCallsLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.remaining = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + remaining: isSet(object.remaining) + ? globalThis.Number(object.remaining) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.remaining !== 0) { + obj.remaining = Math.round(message.remaining); + } + return obj; + }, + create(base) { + return exports.MaxCallsLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMaxCallsLimit(); + message.remaining = object.remaining ?? 0; + return message; + }, +}; +function createBaseMaxFundsLimit() { + return { amounts: [] }; +} +exports.MaxFundsLimit = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.amounts) { + coin_1.Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMaxFundsLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.amounts.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + amounts: globalThis.Array.isArray(object?.amounts) + ? object.amounts.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.amounts?.length) { + obj.amounts = message.amounts.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.MaxFundsLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMaxFundsLimit(); + message.amounts = object.amounts?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCombinedLimit() { + return { callsRemaining: 0, amounts: [] }; +} +exports.CombinedLimit = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.callsRemaining !== 0) { + writer.uint32(8).uint64(message.callsRemaining); + } + for (const v of message.amounts) { + coin_1.Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCombinedLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.callsRemaining = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.amounts.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + callsRemaining: isSet(object.callsRemaining) + ? globalThis.Number(object.callsRemaining) + : 0, + amounts: globalThis.Array.isArray(object?.amounts) + ? object.amounts.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.callsRemaining !== 0) { + obj.callsRemaining = Math.round(message.callsRemaining); + } + if (message.amounts?.length) { + obj.amounts = message.amounts.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.CombinedLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCombinedLimit(); + message.callsRemaining = object.callsRemaining ?? 0; + message.amounts = object.amounts?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseAllowAllMessagesFilter() { + return {}; +} +exports.AllowAllMessagesFilter = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowAllMessagesFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.AllowAllMessagesFilter.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseAllowAllMessagesFilter(); + return message; + }, +}; +function createBaseAcceptedMessageKeysFilter() { + return { keys: [] }; +} +exports.AcceptedMessageKeysFilter = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.keys) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcceptedMessageKeysFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.keys.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + keys: globalThis.Array.isArray(object?.keys) + ? object.keys.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.keys?.length) { + obj.keys = message.keys; + } + return obj; + }, + create(base) { + return exports.AcceptedMessageKeysFilter.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAcceptedMessageKeysFilter(); + message.keys = object.keys?.map((e) => e) || []; + return message; + }, +}; +function createBaseAcceptedMessagesFilter() { + return { messages: [] }; +} +exports.AcceptedMessagesFilter = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.messages) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcceptedMessagesFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.messages.push(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + messages: globalThis.Array.isArray(object?.messages) + ? object.messages.map((e) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => base64FromBytes(e)); + } + return obj; + }, + create(base) { + return exports.AcceptedMessagesFilter.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAcceptedMessagesFilter(); + message.messages = object.messages?.map((e) => e) || []; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/wasm/v1/extensions/wasm.d.ts b/dist/main/wasm/v1/extensions/wasm.d.ts new file mode 100644 index 0000000..8b79416 --- /dev/null +++ b/dist/main/wasm/v1/extensions/wasm.d.ts @@ -0,0 +1,17 @@ +import { QueryClient } from "@cosmjs/stargate"; +import { QueryAllContractStateRequest, QueryAllContractStateResponse, QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractInfoRequest, QueryContractInfoResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, QueryContractsByCreatorRequest, QueryContractsByCreatorResponse, QueryParamsRequest, QueryParamsResponse, QueryPinnedCodesRequest, QueryPinnedCodesResponse, QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest, QuerySmartContractStateResponse } from "../query"; +export declare function setupWasmExtension(base: QueryClient): { + wasm: { + smartContractState: (request: QuerySmartContractStateRequest) => Promise; + rawContractState: (request: QueryRawContractStateRequest) => Promise; + pinnedCodes: (request: QueryPinnedCodesRequest) => Promise; + contractsByCreator: (request: QueryContractsByCreatorRequest) => Promise; + contractsByCode: (request: QueryContractsByCodeRequest) => Promise; + contractInfo: (request: QueryContractInfoRequest) => Promise; + contractHistory: (request: QueryContractHistoryRequest) => Promise; + allContractState: (request: QueryAllContractStateRequest) => Promise; + params: (request: QueryParamsRequest) => Promise; + code: (request: QueryCodeRequest) => Promise; + codes: (request: QueryCodesRequest) => Promise; + }; +}; diff --git a/dist/main/wasm/v1/extensions/wasm.js b/dist/main/wasm/v1/extensions/wasm.js new file mode 100644 index 0000000..02b8fa6 --- /dev/null +++ b/dist/main/wasm/v1/extensions/wasm.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupWasmExtension = void 0; +const stargate_1 = require("@cosmjs/stargate"); +const query_1 = require("../query"); +function setupWasmExtension(base) { + const rpc = (0, stargate_1.createProtobufRpcClient)(base); + const queryService = new query_1.QueryClientImpl(rpc); + return { + wasm: { + smartContractState: async (request) => { + return await queryService.SmartContractState(request); + }, + rawContractState: async (request) => { + return await queryService.RawContractState(request); + }, + pinnedCodes: async (request) => { + return await queryService.PinnedCodes(request); + }, + contractsByCreator: async (request) => { + return await queryService.ContractsByCreator(request); + }, + contractsByCode: async (request) => { + return await queryService.ContractsByCode(request); + }, + contractInfo: async (request) => { + return await queryService.ContractInfo(request); + }, + contractHistory: async (request) => { + return await queryService.ContractHistory(request); + }, + allContractState: async (request) => { + return await queryService.AllContractState(request); + }, + params: async (request) => { + return await queryService.Params(request); + }, + code: async (request) => { + return await queryService.Code(request); + }, + codes: async (request) => { + return await queryService.Codes(request); + }, + }, + }; +} +exports.setupWasmExtension = setupWasmExtension; diff --git a/dist/main/wasm/v1/genesis.d.ts b/dist/main/wasm/v1/genesis.d.ts new file mode 100644 index 0000000..0ea4646 --- /dev/null +++ b/dist/main/wasm/v1/genesis.d.ts @@ -0,0 +1,53 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { CodeInfo, ContractCodeHistoryEntry, ContractInfo, Model, Params } from "./types"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** GenesisState - genesis state of x/wasm */ +export interface GenesisState { + params: Params | undefined; + codes: Code[]; + contracts: Contract[]; + sequences: Sequence[]; +} +/** Code struct encompasses CodeInfo and CodeBytes */ +export interface Code { + codeId: number; + codeInfo: CodeInfo | undefined; + codeBytes: Uint8Array; + /** Pinned to wasmvm cache */ + pinned: boolean; +} +/** Contract struct encompasses ContractAddress, ContractInfo, and ContractState */ +export interface Contract { + contractAddress: string; + contractInfo: ContractInfo | undefined; + contractState: Model[]; + contractCodeHistory: ContractCodeHistoryEntry[]; +} +/** Sequence key and value of an id generation counter */ +export interface Sequence { + idKey: Uint8Array; + value: number; +} +export declare const GenesisState: MessageFns; +export declare const Code: MessageFns; +export declare const Contract: MessageFns; +export declare const Sequence: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/wasm/v1/genesis.js b/dist/main/wasm/v1/genesis.js new file mode 100644 index 0000000..7f1a742 --- /dev/null +++ b/dist/main/wasm/v1/genesis.js @@ -0,0 +1,455 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/genesis.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Sequence = exports.Contract = exports.Code = exports.GenesisState = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const types_1 = require("./types"); +exports.protobufPackage = "cosmwasm.wasm.v1"; +function createBaseGenesisState() { + return { params: undefined, codes: [], contracts: [], sequences: [] }; +} +exports.GenesisState = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + types_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.codes) { + exports.Code.encode(v, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.contracts) { + exports.Contract.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.sequences) { + exports.Sequence.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = types_1.Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.codes.push(exports.Code.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contracts.push(exports.Contract.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.sequences.push(exports.Sequence.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? types_1.Params.fromJSON(object.params) : undefined, + codes: globalThis.Array.isArray(object?.codes) + ? object.codes.map((e) => exports.Code.fromJSON(e)) + : [], + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e) => exports.Contract.fromJSON(e)) + : [], + sequences: globalThis.Array.isArray(object?.sequences) + ? object.sequences.map((e) => exports.Sequence.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = types_1.Params.toJSON(message.params); + } + if (message.codes?.length) { + obj.codes = message.codes.map((e) => exports.Code.toJSON(e)); + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => exports.Contract.toJSON(e)); + } + if (message.sequences?.length) { + obj.sequences = message.sequences.map((e) => exports.Sequence.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? types_1.Params.fromPartial(object.params) + : undefined; + message.codes = object.codes?.map((e) => exports.Code.fromPartial(e)) || []; + message.contracts = + object.contracts?.map((e) => exports.Contract.fromPartial(e)) || []; + message.sequences = + object.sequences?.map((e) => exports.Sequence.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCode() { + return { + codeId: 0, + codeInfo: undefined, + codeBytes: new Uint8Array(0), + pinned: false, + }; +} +exports.Code = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.codeInfo !== undefined) { + types_1.CodeInfo.encode(message.codeInfo, writer.uint32(18).fork()).ldelim(); + } + if (message.codeBytes.length !== 0) { + writer.uint32(26).bytes(message.codeBytes); + } + if (message.pinned !== false) { + writer.uint32(32).bool(message.pinned); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.codeInfo = types_1.CodeInfo.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.codeBytes = reader.bytes(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.pinned = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + codeInfo: isSet(object.codeInfo) + ? types_1.CodeInfo.fromJSON(object.codeInfo) + : undefined, + codeBytes: isSet(object.codeBytes) + ? bytesFromBase64(object.codeBytes) + : new Uint8Array(0), + pinned: isSet(object.pinned) ? globalThis.Boolean(object.pinned) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.codeInfo !== undefined) { + obj.codeInfo = types_1.CodeInfo.toJSON(message.codeInfo); + } + if (message.codeBytes.length !== 0) { + obj.codeBytes = base64FromBytes(message.codeBytes); + } + if (message.pinned !== false) { + obj.pinned = message.pinned; + } + return obj; + }, + create(base) { + return exports.Code.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCode(); + message.codeId = object.codeId ?? 0; + message.codeInfo = + object.codeInfo !== undefined && object.codeInfo !== null + ? types_1.CodeInfo.fromPartial(object.codeInfo) + : undefined; + message.codeBytes = object.codeBytes ?? new Uint8Array(0); + message.pinned = object.pinned ?? false; + return message; + }, +}; +function createBaseContract() { + return { + contractAddress: "", + contractInfo: undefined, + contractState: [], + contractCodeHistory: [], + }; +} +exports.Contract = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.contractInfo !== undefined) { + types_1.ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.contractState) { + types_1.Model.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.contractCodeHistory) { + types_1.ContractCodeHistoryEntry.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contractAddress = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contractInfo = types_1.ContractInfo.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contractState.push(types_1.Model.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.contractCodeHistory.push(types_1.ContractCodeHistoryEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contractAddress: isSet(object.contractAddress) + ? globalThis.String(object.contractAddress) + : "", + contractInfo: isSet(object.contractInfo) + ? types_1.ContractInfo.fromJSON(object.contractInfo) + : undefined, + contractState: globalThis.Array.isArray(object?.contractState) + ? object.contractState.map((e) => types_1.Model.fromJSON(e)) + : [], + contractCodeHistory: globalThis.Array.isArray(object?.contractCodeHistory) + ? object.contractCodeHistory.map((e) => types_1.ContractCodeHistoryEntry.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.contractInfo !== undefined) { + obj.contractInfo = types_1.ContractInfo.toJSON(message.contractInfo); + } + if (message.contractState?.length) { + obj.contractState = message.contractState.map((e) => types_1.Model.toJSON(e)); + } + if (message.contractCodeHistory?.length) { + obj.contractCodeHistory = message.contractCodeHistory.map((e) => types_1.ContractCodeHistoryEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.Contract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContract(); + message.contractAddress = object.contractAddress ?? ""; + message.contractInfo = + object.contractInfo !== undefined && object.contractInfo !== null + ? types_1.ContractInfo.fromPartial(object.contractInfo) + : undefined; + message.contractState = + object.contractState?.map((e) => types_1.Model.fromPartial(e)) || []; + message.contractCodeHistory = + object.contractCodeHistory?.map((e) => types_1.ContractCodeHistoryEntry.fromPartial(e)) || []; + return message; + }, +}; +function createBaseSequence() { + return { idKey: new Uint8Array(0), value: 0 }; +} +exports.Sequence = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.idKey.length !== 0) { + writer.uint32(10).bytes(message.idKey); + } + if (message.value !== 0) { + writer.uint32(16).uint64(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSequence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.idKey = reader.bytes(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.value = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + idKey: isSet(object.idKey) + ? bytesFromBase64(object.idKey) + : new Uint8Array(0), + value: isSet(object.value) ? globalThis.Number(object.value) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.idKey.length !== 0) { + obj.idKey = base64FromBytes(message.idKey); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } + return obj; + }, + create(base) { + return exports.Sequence.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSequence(); + message.idKey = object.idKey ?? new Uint8Array(0); + message.value = object.value ?? 0; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/wasm/v1/ibc.d.ts b/dist/main/wasm/v1/ibc.d.ts new file mode 100644 index 0000000..bc4532b --- /dev/null +++ b/dist/main/wasm/v1/ibc.d.ts @@ -0,0 +1,53 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** MsgIBCSend */ +export interface MsgIBCSend { + /** the channel by which the packet will be sent */ + channel: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeoutHeight: number; + /** + * Timeout timestamp (in nanoseconds) relative to the current block timestamp. + * The timeout is disabled when set to 0. + */ + timeoutTimestamp: number; + /** + * Data is the payload to transfer. We must not make assumption what format or + * content is in here. + */ + data: Uint8Array; +} +/** MsgIBCSendResponse */ +export interface MsgIBCSendResponse { + /** Sequence number of the IBC packet sent */ + sequence: number; +} +/** MsgIBCCloseChannel port and channel need to be owned by the contract */ +export interface MsgIBCCloseChannel { + channel: string; +} +export declare const MsgIBCSend: MessageFns; +export declare const MsgIBCSendResponse: MessageFns; +export declare const MsgIBCCloseChannel: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/wasm/v1/ibc.js b/dist/main/wasm/v1/ibc.js new file mode 100644 index 0000000..00e3905 --- /dev/null +++ b/dist/main/wasm/v1/ibc.js @@ -0,0 +1,264 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/ibc.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MsgIBCCloseChannel = exports.MsgIBCSendResponse = exports.MsgIBCSend = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +exports.protobufPackage = "cosmwasm.wasm.v1"; +function createBaseMsgIBCSend() { + return { + channel: "", + timeoutHeight: 0, + timeoutTimestamp: 0, + data: new Uint8Array(0), + }; +} +exports.MsgIBCSend = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.channel !== "") { + writer.uint32(18).string(message.channel); + } + if (message.timeoutHeight !== 0) { + writer.uint32(32).uint64(message.timeoutHeight); + } + if (message.timeoutTimestamp !== 0) { + writer.uint32(40).uint64(message.timeoutTimestamp); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.channel = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.timeoutHeight = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.timeoutTimestamp = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + channel: isSet(object.channel) ? globalThis.String(object.channel) : "", + timeoutHeight: isSet(object.timeoutHeight) + ? globalThis.Number(object.timeoutHeight) + : 0, + timeoutTimestamp: isSet(object.timeoutTimestamp) + ? globalThis.Number(object.timeoutTimestamp) + : 0, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.channel !== "") { + obj.channel = message.channel; + } + if (message.timeoutHeight !== 0) { + obj.timeoutHeight = Math.round(message.timeoutHeight); + } + if (message.timeoutTimestamp !== 0) { + obj.timeoutTimestamp = Math.round(message.timeoutTimestamp); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.MsgIBCSend.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIBCSend(); + message.channel = object.channel ?? ""; + message.timeoutHeight = object.timeoutHeight ?? 0; + message.timeoutTimestamp = object.timeoutTimestamp ?? 0; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgIBCSendResponse() { + return { sequence: 0 }; +} +exports.MsgIBCSendResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sequence !== 0) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + create(base) { + return exports.MsgIBCSendResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIBCSendResponse(); + message.sequence = object.sequence ?? 0; + return message; + }, +}; +function createBaseMsgIBCCloseChannel() { + return { channel: "" }; +} +exports.MsgIBCCloseChannel = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.channel !== "") { + writer.uint32(18).string(message.channel); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCCloseChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.channel = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + channel: isSet(object.channel) ? globalThis.String(object.channel) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.channel !== "") { + obj.channel = message.channel; + } + return obj; + }, + create(base) { + return exports.MsgIBCCloseChannel.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIBCCloseChannel(); + message.channel = object.channel ?? ""; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/wasm/v1/index.d.ts b/dist/main/wasm/v1/index.d.ts new file mode 100644 index 0000000..9e508d2 --- /dev/null +++ b/dist/main/wasm/v1/index.d.ts @@ -0,0 +1,157 @@ +import { MsgStoreCode, MsgInstantiateContract, MsgInstantiateContract2, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin, MsgUpdateInstantiateConfig, MsgUpdateParams, MsgSudoContract, MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract } from "./tx"; +import { MsgIBCSend, MsgIBCCloseChannel } from "./ibc"; +export declare const cosmwasmRegistry: ReadonlyArray<[string, any]>; +/** + * Transaction Module for the IBC Module (wasm) + */ +export declare namespace IBC { + /** MsgIBCSend message creator + * + * @param object Represents the properties available for this MsgIBCSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const IBCSend: (object: MsgIBCSend) => { + typeUrl: string; + value: MsgIBCSend; + }; + /** MsgIBCCloseChannel message creator + * + * @param object Represents the properties available for this MsgIBCCloseChannel message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const IBCCloseChannel: (object: MsgIBCCloseChannel) => { + typeUrl: string; + value: MsgIBCCloseChannel; + }; +} +/** + * Transaction Module for the Smart Contracts Module (wasm) + */ +export declare namespace CosmWasm { + /** MsgStoreAndInstantiateContract message creator + * + * @param object Represents the properties available for this MsgStoreAndInstantiateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const StoreAndInstantiateContract: (object: MsgStoreAndInstantiateContract) => { + typeUrl: string; + value: MsgStoreAndInstantiateContract; + }; + /** MsgUnpinCodes message creator + * + * @param object Represents the properties available for this MsgUnpinCodes message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UnpinCodes: (object: MsgUnpinCodes) => { + typeUrl: string; + value: MsgUnpinCodes; + }; + /** MsgPinCodes message creator + * + * @param object Represents the properties available for this MsgPinCodes message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const PinCodes: (object: MsgPinCodes) => { + typeUrl: string; + value: MsgPinCodes; + }; + /** MsgSudoContract message creator + * + * @param object Represents the properties available for this MsgSudoContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SudoContract: (object: MsgSudoContract) => { + typeUrl: string; + value: MsgSudoContract; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: MsgUpdateParams) => { + typeUrl: string; + value: MsgUpdateParams; + }; + /** MsgUpdateInstantiateConfig message creator + * + * @param object Represents the properties available for this MsgUpdateInstantiateConfig message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateInstantiateConfig: (object: MsgUpdateInstantiateConfig) => { + typeUrl: string; + value: MsgUpdateInstantiateConfig; + }; + /** + * MsgStoreCode message creator + * Submit Wasm code to the system + * + * @param object Represents the properties available for this MsgStoreCode message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const StoreCode: (object: MsgStoreCode) => { + typeUrl: string; + value: MsgStoreCode; + }; + /** + * MsgInstantiateContract message creator + * Creates a new smart contract instance for the given code id. + * + * @param object Represents the properties available for this MsgInstantiateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const InstantiateContract: (object: MsgInstantiateContract) => { + typeUrl: string; + value: MsgInstantiateContract; + }; + /** MsgInstantiateContract2 message creator + * Creates a new smart contract instance for the given code id with a predictable address + * + * @param object Represents the properties available for this MsgInstantiateContract2 message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const InstantiateContract2: (object: MsgInstantiateContract2) => { + typeUrl: string; + value: MsgInstantiateContract2; + }; + /** MsgClearAdmin message creator + * Removes any admin stored for a smart contract + * + * @param object Represents the properties available for this MsgClearAdmin message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const ClearAdmin: (object: MsgClearAdmin) => { + typeUrl: string; + value: MsgClearAdmin; + }; + /** MsgUpdateAdmin message creator + * Sets a new admin for a smart contract + * + * @param object Represents the properties available for this MsgUpdateAdmin message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateAdmin: (object: MsgUpdateAdmin) => { + typeUrl: string; + value: MsgUpdateAdmin; + }; + /** MsgExecuteContract message creator + * Submits the given message data to a smart contract + * + * @param object Represents the properties available for this MsgExecuteContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const ExecuteContract: (object: MsgExecuteContract) => { + typeUrl: string; + value: MsgExecuteContract; + }; + /** MsgMigrateContract message creator + * Runs a code upgrade/ downgrade for a smart contract + * + * @param object Represents the properties available for this MsgMigrateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const MigrateContract: (object: MsgMigrateContract) => { + typeUrl: string; + value: MsgMigrateContract; + }; +} diff --git a/dist/main/wasm/v1/index.js b/dist/main/wasm/v1/index.js new file mode 100644 index 0000000..c25c4c6 --- /dev/null +++ b/dist/main/wasm/v1/index.js @@ -0,0 +1,209 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CosmWasm = exports.IBC = exports.cosmwasmRegistry = void 0; +const tx_1 = require("./tx"); +const ibc_1 = require("./ibc"); +const baseUrl = "/cosmwasm.wasm.v1."; +exports.cosmwasmRegistry = [ + [baseUrl + "MsgStoreAndInstantiateContract", tx_1.MsgStoreAndInstantiateContract], + [baseUrl + "MsgUpdateParams", tx_1.MsgUpdateParams], + [baseUrl + "MsgSudoContract", tx_1.MsgSudoContract], + [baseUrl + "MsgUnpinCodes", tx_1.MsgUnpinCodes], + [baseUrl + "MsgPinCodes", tx_1.MsgPinCodes], + [baseUrl + "MsgStoreCode", tx_1.MsgStoreCode], + [baseUrl + "MsgInstantiateContract", tx_1.MsgInstantiateContract], + [baseUrl + "MsgInstantiateContract2", tx_1.MsgInstantiateContract2], + [baseUrl + "MsgExecuteContract", tx_1.MsgExecuteContract], + [baseUrl + "MsgMigrateContract", tx_1.MsgMigrateContract], + [baseUrl + "MsgUpdateAdmin", tx_1.MsgUpdateAdmin], + [baseUrl + "MsgClearAdmin", tx_1.MsgClearAdmin], + [baseUrl + "MsgUpdateInstantiateConfig", tx_1.MsgUpdateInstantiateConfig], + [baseUrl + "MsgIBCSend", ibc_1.MsgIBCSend], + [baseUrl + "MsgIBCCloseChannel", ibc_1.MsgIBCCloseChannel], +]; +/** + * Transaction Module for the IBC Module (wasm) + */ +var IBC; +(function (IBC) { + /** MsgIBCSend message creator + * + * @param object Represents the properties available for this MsgIBCSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + IBC.IBCSend = function (object) { + return { + typeUrl: baseUrl + "MsgIBCSend", + value: ibc_1.MsgIBCSend.fromPartial(object), + }; + }; + /** MsgIBCCloseChannel message creator + * + * @param object Represents the properties available for this MsgIBCCloseChannel message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + IBC.IBCCloseChannel = function (object) { + return { + typeUrl: baseUrl + "MsgIBCCloseChannel", + value: ibc_1.MsgIBCCloseChannel.fromPartial(object), + }; + }; +})(IBC || (exports.IBC = IBC = {})); +/** + * Transaction Module for the Smart Contracts Module (wasm) + */ +var CosmWasm; +(function (CosmWasm) { + /** MsgStoreAndInstantiateContract message creator + * + * @param object Represents the properties available for this MsgStoreAndInstantiateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.StoreAndInstantiateContract = function (object) { + return { + typeUrl: baseUrl + "MsgStoreAndInstantiateContract", + value: tx_1.MsgStoreAndInstantiateContract.fromPartial(object), + }; + }; + /** MsgUnpinCodes message creator + * + * @param object Represents the properties available for this MsgUnpinCodes message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.UnpinCodes = function (object) { + return { + typeUrl: baseUrl + "MsgUnpinCodes", + value: tx_1.MsgUnpinCodes.fromPartial(object), + }; + }; + /** MsgPinCodes message creator + * + * @param object Represents the properties available for this MsgPinCodes message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.PinCodes = function (object) { + return { + typeUrl: baseUrl + "MsgPinCodes", + value: tx_1.MsgPinCodes.fromPartial(object), + }; + }; + /** MsgSudoContract message creator + * + * @param object Represents the properties available for this MsgSudoContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.SudoContract = function (object) { + return { + typeUrl: baseUrl + "MsgSudoContract", + value: tx_1.MsgSudoContract.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.UpdateParams = function (object) { + return { + typeUrl: baseUrl + "MsgUpdateParams", + value: tx_1.MsgUpdateParams.fromPartial(object), + }; + }; + /** MsgUpdateInstantiateConfig message creator + * + * @param object Represents the properties available for this MsgUpdateInstantiateConfig message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.UpdateInstantiateConfig = function (object) { + return { + typeUrl: baseUrl + "MsgUpdateInstantiateConfig", + value: tx_1.MsgUpdateInstantiateConfig.fromPartial(object), + }; + }; + /** + * MsgStoreCode message creator + * Submit Wasm code to the system + * + * @param object Represents the properties available for this MsgStoreCode message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.StoreCode = function (object) { + return { + typeUrl: baseUrl + "MsgStoreCode", + value: tx_1.MsgStoreCode.fromPartial(object), + }; + }; + /** + * MsgInstantiateContract message creator + * Creates a new smart contract instance for the given code id. + * + * @param object Represents the properties available for this MsgInstantiateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.InstantiateContract = function (object) { + return { + typeUrl: baseUrl + "MsgInstantiateContract", + value: tx_1.MsgInstantiateContract.fromPartial(object), + }; + }; + /** MsgInstantiateContract2 message creator + * Creates a new smart contract instance for the given code id with a predictable address + * + * @param object Represents the properties available for this MsgInstantiateContract2 message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.InstantiateContract2 = function (object) { + return { + typeUrl: baseUrl + "MsgInstantiateContract2", + value: tx_1.MsgInstantiateContract2.fromPartial(object), + }; + }; + /** MsgClearAdmin message creator + * Removes any admin stored for a smart contract + * + * @param object Represents the properties available for this MsgClearAdmin message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.ClearAdmin = function (object) { + return { + typeUrl: baseUrl + "MsgClearAdmin", + value: tx_1.MsgClearAdmin.fromPartial(object), + }; + }; + /** MsgUpdateAdmin message creator + * Sets a new admin for a smart contract + * + * @param object Represents the properties available for this MsgUpdateAdmin message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.UpdateAdmin = function (object) { + return { + typeUrl: baseUrl + "MsgUpdateAdmin", + value: tx_1.MsgUpdateAdmin.fromPartial(object), + }; + }; + /** MsgExecuteContract message creator + * Submits the given message data to a smart contract + * + * @param object Represents the properties available for this MsgExecuteContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.ExecuteContract = function (object) { + return { + typeUrl: baseUrl + "MsgExecuteContract", + value: tx_1.MsgExecuteContract.fromPartial(object), + }; + }; + /** MsgMigrateContract message creator + * Runs a code upgrade/ downgrade for a smart contract + * + * @param object Represents the properties available for this MsgMigrateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.MigrateContract = function (object) { + return { + typeUrl: baseUrl + "MsgMigrateContract", + value: tx_1.MsgMigrateContract.fromPartial(object), + }; + }; +})(CosmWasm || (exports.CosmWasm = CosmWasm = {})); diff --git a/dist/main/wasm/v1/pagination.d.ts b/dist/main/wasm/v1/pagination.d.ts new file mode 100644 index 0000000..90b423a --- /dev/null +++ b/dist/main/wasm/v1/pagination.d.ts @@ -0,0 +1,128 @@ +import _m0 from "protobufjs/minimal"; +export declare 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. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} +export declare const PageRequest: { + encode(message: PageRequest, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest; + fromJSON(object: any): PageRequest; + toJSON(message: PageRequest): unknown; + create]: never; }>(base?: I | undefined): PageRequest; + fromPartial]: never; }>(object: I_1): PageRequest; +}; +export declare const PageResponse: { + encode(message: PageResponse, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse; + fromJSON(object: any): PageResponse; + toJSON(message: PageResponse): unknown; + create]: never; }>(base?: I | undefined): PageResponse; + fromPartial]: never; }>(object: I_1): PageResponse; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/main/wasm/v1/pagination.js b/dist/main/wasm/v1/pagination.js new file mode 100644 index 0000000..0c33056 --- /dev/null +++ b/dist/main/wasm/v1/pagination.js @@ -0,0 +1,225 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageResponse = exports.PageRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const long_1 = __importDefault(require("long")); +const minimal_1 = __importDefault(require("protobufjs/minimal")); +exports.protobufPackage = "cosmos.base.query.v1beta1"; +function createBasePageRequest() { + return { key: new Uint8Array(), offset: 0, limit: 0, countTotal: false, reverse: false }; +} +exports.PageRequest = { + encode(message, writer = minimal_1.default.Writer.create()) { + 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.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + offset: isSet(object.offset) ? Number(object.offset) : 0, + limit: isSet(object.limit) ? Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.offset !== undefined && (obj.offset = Math.round(message.offset)); + message.limit !== undefined && (obj.limit = Math.round(message.limit)); + message.countTotal !== undefined && (obj.countTotal = message.countTotal); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + create(base) { + return exports.PageRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; +function createBasePageResponse() { + return { nextKey: new Uint8Array(), total: 0 }; +} +exports.PageResponse = { + encode(message, writer = minimal_1.default.Writer.create()) { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(), + total: isSet(object.total) ? Number(object.total) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.nextKey !== undefined && + (obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array())); + message.total !== undefined && (obj.total = Math.round(message.total)); + return obj; + }, + create(base) { + return exports.PageResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(); + message.total = object.total ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (minimal_1.default.util.Long !== long_1.default) { + minimal_1.default.util.Long = long_1.default; + minimal_1.default.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/wasm/v1/proposal.d.ts b/dist/main/wasm/v1/proposal.d.ts new file mode 100644 index 0000000..da4d9d4 --- /dev/null +++ b/dist/main/wasm/v1/proposal.d.ts @@ -0,0 +1,326 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { AccessConfig } from "./types"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreCodeProposal. To submit WASM code to the system, + * a simple MsgStoreCode can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface StoreCodeProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig | undefined; + /** UnpinCode code on upload, optional */ + unpinCode: boolean; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContractProposal. To instantiate a contract, + * a simple MsgInstantiateContract can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface InstantiateContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContract2Proposal. To instantiate contract 2, + * a simple MsgInstantiateContract2 can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface InstantiateContract2Proposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's enviroment as sender */ + runAs: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encode message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit MigrateContractProposal. To migrate a contract, + * a simple MsgMigrateContract can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface MigrateContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: number; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit SudoContractProposal. To call sudo on a contract, + * a simple MsgSudoContract can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface SudoContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ExecuteContractProposal. To call execute on a contract, + * a simple MsgExecuteContract can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface ExecuteContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as execute */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateAdminProposal. To set an admin for a contract, + * a simple MsgUpdateAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface UpdateAdminProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ClearAdminProposal. To clear the admin of a contract, + * a simple MsgClearAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface ClearAdminProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit PinCodesProposal. To pin a set of code ids in the wasmvm + * cache, a simple MsgPinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface PinCodesProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** CodeIDs references the new WASM codes */ + codeIds: number[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm + * cache, a simple MsgUnpinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface UnpinCodesProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** CodeIDs references the WASM codes */ + codeIds: number[]; +} +/** + * AccessConfigUpdate contains the code id and the access config to be + * applied. + */ +export interface AccessConfigUpdate { + /** CodeID is the reference to the stored WASM code to be updated */ + codeId: number; + /** InstantiatePermission to apply to the set of code ids */ + instantiatePermission: AccessConfig | undefined; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateInstantiateConfigProposal. To update instantiate config + * to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from + * the x/gov module via a v1 governance proposal. + * + * @deprecated + */ +export interface UpdateInstantiateConfigProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** + * AccessConfigUpdate contains the list of code ids and the access config + * to be applied. + */ + accessConfigUpdates: AccessConfigUpdate[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreAndInstantiateContractProposal. To store and instantiate + * the contract, a simple MsgStoreAndInstantiateContract can be invoked from + * the x/gov module via a v1 governance proposal. + * + * @deprecated + */ +export interface StoreAndInstantiateContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig | undefined; + /** UnpinCode code on upload, optional */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +export declare const StoreCodeProposal: MessageFns; +export declare const InstantiateContractProposal: MessageFns; +export declare const InstantiateContract2Proposal: MessageFns; +export declare const MigrateContractProposal: MessageFns; +export declare const SudoContractProposal: MessageFns; +export declare const ExecuteContractProposal: MessageFns; +export declare const UpdateAdminProposal: MessageFns; +export declare const ClearAdminProposal: MessageFns; +export declare const PinCodesProposal: MessageFns; +export declare const UnpinCodesProposal: MessageFns; +export declare const AccessConfigUpdate: MessageFns; +export declare const UpdateInstantiateConfigProposal: MessageFns; +export declare const StoreAndInstantiateContractProposal: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/wasm/v1/proposal.js b/dist/main/wasm/v1/proposal.js new file mode 100644 index 0000000..6d91acd --- /dev/null +++ b/dist/main/wasm/v1/proposal.js @@ -0,0 +1,1806 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/proposal.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StoreAndInstantiateContractProposal = exports.UpdateInstantiateConfigProposal = exports.AccessConfigUpdate = exports.UnpinCodesProposal = exports.PinCodesProposal = exports.ClearAdminProposal = exports.UpdateAdminProposal = exports.ExecuteContractProposal = exports.SudoContractProposal = exports.MigrateContractProposal = exports.InstantiateContract2Proposal = exports.InstantiateContractProposal = exports.StoreCodeProposal = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const types_1 = require("./types"); +exports.protobufPackage = "cosmwasm.wasm.v1"; +function createBaseStoreCodeProposal() { + return { + title: "", + description: "", + runAs: "", + wasmByteCode: new Uint8Array(0), + instantiatePermission: undefined, + unpinCode: false, + source: "", + builder: "", + codeHash: new Uint8Array(0), + }; +} +exports.StoreCodeProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(34).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + types_1.AccessConfig.encode(message.instantiatePermission, writer.uint32(58).fork()).ldelim(); + } + if (message.unpinCode !== false) { + writer.uint32(64).bool(message.unpinCode); + } + if (message.source !== "") { + writer.uint32(74).string(message.source); + } + if (message.builder !== "") { + writer.uint32(82).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(90).bytes(message.codeHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreCodeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.wasmByteCode = reader.bytes(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.instantiatePermission = types_1.AccessConfig.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.unpinCode = reader.bool(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.source = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.builder = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.codeHash = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + wasmByteCode: isSet(object.wasmByteCode) + ? bytesFromBase64(object.wasmByteCode) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? types_1.AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + unpinCode: isSet(object.unpinCode) + ? globalThis.Boolean(object.unpinCode) + : false, + source: isSet(object.source) ? globalThis.String(object.source) : "", + builder: isSet(object.builder) ? globalThis.String(object.builder) : "", + codeHash: isSet(object.codeHash) + ? bytesFromBase64(object.codeHash) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.wasmByteCode.length !== 0) { + obj.wasmByteCode = base64FromBytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = types_1.AccessConfig.toJSON(message.instantiatePermission); + } + if (message.unpinCode !== false) { + obj.unpinCode = message.unpinCode; + } + if (message.source !== "") { + obj.source = message.source; + } + if (message.builder !== "") { + obj.builder = message.builder; + } + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + return obj; + }, + create(base) { + return exports.StoreCodeProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStoreCodeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? types_1.AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + message.unpinCode = object.unpinCode ?? false; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(0); + return message; + }, +}; +function createBaseInstantiateContractProposal() { + return { + title: "", + description: "", + runAs: "", + admin: "", + codeId: 0, + label: "", + msg: new Uint8Array(0), + funds: [], + }; +} +exports.InstantiateContractProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.admin !== "") { + writer.uint32(34).string(message.admin); + } + if (message.codeId !== 0) { + writer.uint32(40).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(50).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(58).bytes(message.msg); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInstantiateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.admin = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.label = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) + ? bytesFromBase64(object.msg) + : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.InstantiateContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInstantiateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseInstantiateContract2Proposal() { + return { + title: "", + description: "", + runAs: "", + admin: "", + codeId: 0, + label: "", + msg: new Uint8Array(0), + funds: [], + salt: new Uint8Array(0), + fixMsg: false, + }; +} +exports.InstantiateContract2Proposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.admin !== "") { + writer.uint32(34).string(message.admin); + } + if (message.codeId !== 0) { + writer.uint32(40).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(50).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(58).bytes(message.msg); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(66).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(74).bytes(message.salt); + } + if (message.fixMsg !== false) { + writer.uint32(80).bool(message.fixMsg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInstantiateContract2Proposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.admin = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.label = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.salt = reader.bytes(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.fixMsg = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) + ? bytesFromBase64(object.msg) + : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + salt: isSet(object.salt) + ? bytesFromBase64(object.salt) + : new Uint8Array(0), + fixMsg: isSet(object.fixMsg) + ? globalThis.Boolean(object.fixMsg) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + if (message.salt.length !== 0) { + obj.salt = base64FromBytes(message.salt); + } + if (message.fixMsg !== false) { + obj.fixMsg = message.fixMsg; + } + return obj; + }, + create(base) { + return exports.InstantiateContract2Proposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInstantiateContract2Proposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.salt = object.salt ?? new Uint8Array(0); + message.fixMsg = object.fixMsg ?? false; + return message; + }, +}; +function createBaseMigrateContractProposal() { + return { + title: "", + description: "", + contract: "", + codeId: 0, + msg: new Uint8Array(0), + }; +} +exports.MigrateContractProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.codeId !== 0) { + writer.uint32(40).uint64(message.codeId); + } + if (message.msg.length !== 0) { + writer.uint32(50).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.contract = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return exports.MigrateContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMigrateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + message.codeId = object.codeId ?? 0; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseSudoContractProposal() { + return { title: "", description: "", contract: "", msg: new Uint8Array(0) }; +} +exports.SudoContractProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSudoContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contract = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return exports.SudoContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSudoContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseExecuteContractProposal() { + return { + title: "", + description: "", + runAs: "", + contract: "", + msg: new Uint8Array(0), + funds: [], + }; +} +exports.ExecuteContractProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.contract = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.ExecuteContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExecuteContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseUpdateAdminProposal() { + return { title: "", description: "", newAdmin: "", contract: "" }; +} +exports.UpdateAdminProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateAdminProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.newAdmin = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.contract = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + newAdmin: isSet(object.newAdmin) + ? globalThis.String(object.newAdmin) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + return obj; + }, + create(base) { + return exports.UpdateAdminProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUpdateAdminProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.newAdmin = object.newAdmin ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBaseClearAdminProposal() { + return { title: "", description: "", contract: "" }; +} +exports.ClearAdminProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClearAdminProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contract = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + return obj; + }, + create(base) { + return exports.ClearAdminProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClearAdminProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBasePinCodesProposal() { + return { title: "", description: "", codeIds: [] }; +} +exports.PinCodesProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePinCodesProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + return obj; + }, + create(base) { + return exports.PinCodesProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePinCodesProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.codeIds = object.codeIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseUnpinCodesProposal() { + return { title: "", description: "", codeIds: [] }; +} +exports.UnpinCodesProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnpinCodesProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + return obj; + }, + create(base) { + return exports.UnpinCodesProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUnpinCodesProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.codeIds = object.codeIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseAccessConfigUpdate() { + return { codeId: 0, instantiatePermission: undefined }; +} +exports.AccessConfigUpdate = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.instantiatePermission !== undefined) { + types_1.AccessConfig.encode(message.instantiatePermission, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessConfigUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.instantiatePermission = types_1.AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + instantiatePermission: isSet(object.instantiatePermission) + ? types_1.AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = types_1.AccessConfig.toJSON(message.instantiatePermission); + } + return obj; + }, + create(base) { + return exports.AccessConfigUpdate.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAccessConfigUpdate(); + message.codeId = object.codeId ?? 0; + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? types_1.AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + return message; + }, +}; +function createBaseUpdateInstantiateConfigProposal() { + return { title: "", description: "", accessConfigUpdates: [] }; +} +exports.UpdateInstantiateConfigProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.accessConfigUpdates) { + exports.AccessConfigUpdate.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateInstantiateConfigProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.accessConfigUpdates.push(exports.AccessConfigUpdate.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + accessConfigUpdates: globalThis.Array.isArray(object?.accessConfigUpdates) + ? object.accessConfigUpdates.map((e) => exports.AccessConfigUpdate.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.accessConfigUpdates?.length) { + obj.accessConfigUpdates = message.accessConfigUpdates.map((e) => exports.AccessConfigUpdate.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.UpdateInstantiateConfigProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUpdateInstantiateConfigProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.accessConfigUpdates = + object.accessConfigUpdates?.map((e) => exports.AccessConfigUpdate.fromPartial(e)) || []; + return message; + }, +}; +function createBaseStoreAndInstantiateContractProposal() { + return { + title: "", + description: "", + runAs: "", + wasmByteCode: new Uint8Array(0), + instantiatePermission: undefined, + unpinCode: false, + admin: "", + label: "", + msg: new Uint8Array(0), + funds: [], + source: "", + builder: "", + codeHash: new Uint8Array(0), + }; +} +exports.StoreAndInstantiateContractProposal = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(34).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + types_1.AccessConfig.encode(message.instantiatePermission, writer.uint32(42).fork()).ldelim(); + } + if (message.unpinCode !== false) { + writer.uint32(48).bool(message.unpinCode); + } + if (message.admin !== "") { + writer.uint32(58).string(message.admin); + } + if (message.label !== "") { + writer.uint32(66).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(74).bytes(message.msg); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(82).fork()).ldelim(); + } + if (message.source !== "") { + writer.uint32(90).string(message.source); + } + if (message.builder !== "") { + writer.uint32(98).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(106).bytes(message.codeHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreAndInstantiateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.wasmByteCode = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.instantiatePermission = types_1.AccessConfig.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.unpinCode = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.admin = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.label = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.source = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.builder = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.codeHash = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + wasmByteCode: isSet(object.wasmByteCode) + ? bytesFromBase64(object.wasmByteCode) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? types_1.AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + unpinCode: isSet(object.unpinCode) + ? globalThis.Boolean(object.unpinCode) + : false, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) + ? bytesFromBase64(object.msg) + : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + source: isSet(object.source) ? globalThis.String(object.source) : "", + builder: isSet(object.builder) ? globalThis.String(object.builder) : "", + codeHash: isSet(object.codeHash) + ? bytesFromBase64(object.codeHash) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.wasmByteCode.length !== 0) { + obj.wasmByteCode = base64FromBytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = types_1.AccessConfig.toJSON(message.instantiatePermission); + } + if (message.unpinCode !== false) { + obj.unpinCode = message.unpinCode; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + if (message.source !== "") { + obj.source = message.source; + } + if (message.builder !== "") { + obj.builder = message.builder; + } + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + return obj; + }, + create(base) { + return exports.StoreAndInstantiateContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStoreAndInstantiateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? types_1.AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + message.unpinCode = object.unpinCode ?? false; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(0); + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/wasm/v1/query.d.ts b/dist/main/wasm/v1/query.d.ts new file mode 100644 index 0000000..7420ac6 --- /dev/null +++ b/dist/main/wasm/v1/query.d.ts @@ -0,0 +1,277 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { AccessConfig, ContractCodeHistoryEntry, ContractInfo, Model, Params } from "./types"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** + * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoRequest { + /** address is the address of the contract to query */ + address: string; +} +/** + * QueryContractInfoResponse is the response type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoResponse { + /** address is the address of the contract */ + address: string; + contractInfo: ContractInfo | undefined; +} +/** + * QueryContractHistoryRequest is the request type for the Query/ContractHistory + * RPC method + */ +export interface QueryContractHistoryRequest { + /** address is the address of the contract to query */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryContractHistoryResponse is the response type for the + * Query/ContractHistory RPC method + */ +export interface QueryContractHistoryResponse { + entries: ContractCodeHistoryEntry[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** + * QueryContractsByCodeRequest is the request type for the Query/ContractsByCode + * RPC method + */ +export interface QueryContractsByCodeRequest { + /** grpc-gateway_out does not support Go style CodID */ + codeId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryContractsByCodeResponse is the response type for the + * Query/ContractsByCode RPC method + */ +export interface QueryContractsByCodeResponse { + /** contracts are a set of contract addresses */ + contracts: string[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** + * QueryAllContractStateRequest is the request type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateRequest { + /** address is the address of the contract */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryAllContractStateResponse is the response type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateResponse { + models: Model[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** + * QueryRawContractStateRequest is the request type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateRequest { + /** address is the address of the contract */ + address: string; + queryData: Uint8Array; +} +/** + * QueryRawContractStateResponse is the response type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateResponse { + /** Data contains the raw store data */ + data: Uint8Array; +} +/** + * QuerySmartContractStateRequest is the request type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateRequest { + /** address is the address of the contract */ + address: string; + /** QueryData contains the query data passed to the contract */ + queryData: Uint8Array; +} +/** + * QuerySmartContractStateResponse is the response type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateResponse { + /** Data contains the json data returned from the smart contract */ + data: Uint8Array; +} +/** QueryCodeRequest is the request type for the Query/Code RPC method */ +export interface QueryCodeRequest { + /** grpc-gateway_out does not support Go style CodID */ + codeId: number; +} +/** CodeInfoResponse contains code meta data from CodeInfo */ +export interface CodeInfoResponse { + /** id for legacy support */ + codeId: number; + creator: string; + dataHash: Uint8Array; + instantiatePermission: AccessConfig | undefined; +} +/** QueryCodeResponse is the response type for the Query/Code RPC method */ +export interface QueryCodeResponse { + codeInfo: CodeInfoResponse | undefined; + data: Uint8Array; +} +/** QueryCodesRequest is the request type for the Query/Codes RPC method */ +export interface QueryCodesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryCodesResponse is the response type for the Query/Codes RPC method */ +export interface QueryCodesResponse { + codeInfos: CodeInfoResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** + * QueryPinnedCodesRequest is the request type for the Query/PinnedCodes + * RPC method + */ +export interface QueryPinnedCodesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryPinnedCodesResponse is the response type for the + * Query/PinnedCodes RPC method + */ +export interface QueryPinnedCodesResponse { + codeIds: number[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params | undefined; +} +/** + * QueryContractsByCreatorRequest is the request type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorRequest { + /** CreatorAddress is the address of contract creator */ + creatorAddress: string; + /** Pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryContractsByCreatorResponse is the response type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorResponse { + /** ContractAddresses result set */ + contractAddresses: string[]; + /** Pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +export declare const QueryContractInfoRequest: MessageFns; +export declare const QueryContractInfoResponse: MessageFns; +export declare const QueryContractHistoryRequest: MessageFns; +export declare const QueryContractHistoryResponse: MessageFns; +export declare const QueryContractsByCodeRequest: MessageFns; +export declare const QueryContractsByCodeResponse: MessageFns; +export declare const QueryAllContractStateRequest: MessageFns; +export declare const QueryAllContractStateResponse: MessageFns; +export declare const QueryRawContractStateRequest: MessageFns; +export declare const QueryRawContractStateResponse: MessageFns; +export declare const QuerySmartContractStateRequest: MessageFns; +export declare const QuerySmartContractStateResponse: MessageFns; +export declare const QueryCodeRequest: MessageFns; +export declare const CodeInfoResponse: MessageFns; +export declare const QueryCodeResponse: MessageFns; +export declare const QueryCodesRequest: MessageFns; +export declare const QueryCodesResponse: MessageFns; +export declare const QueryPinnedCodesRequest: MessageFns; +export declare const QueryPinnedCodesResponse: MessageFns; +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +export declare const QueryContractsByCreatorRequest: MessageFns; +export declare const QueryContractsByCreatorResponse: MessageFns; +/** Query provides defines the gRPC querier service */ +export interface Query { + /** ContractInfo gets the contract meta data */ + ContractInfo(request: QueryContractInfoRequest): Promise; + /** ContractHistory gets the contract code history */ + ContractHistory(request: QueryContractHistoryRequest): Promise; + /** ContractsByCode lists all smart contracts for a code id */ + ContractsByCode(request: QueryContractsByCodeRequest): Promise; + /** AllContractState gets all raw store data for a single contract */ + AllContractState(request: QueryAllContractStateRequest): Promise; + /** RawContractState gets single key from the raw store data of a contract */ + RawContractState(request: QueryRawContractStateRequest): Promise; + /** SmartContractState get smart query result from the contract */ + SmartContractState(request: QuerySmartContractStateRequest): Promise; + /** Code gets the binary code and metadata for a singe wasm code */ + Code(request: QueryCodeRequest): Promise; + /** Codes gets the metadata for all stored wasm codes */ + Codes(request: QueryCodesRequest): Promise; + /** PinnedCodes gets the pinned code ids */ + PinnedCodes(request: QueryPinnedCodesRequest): Promise; + /** Params gets the module params */ + Params(request: QueryParamsRequest): Promise; + /** ContractsByCreator gets the contracts by creator */ + ContractsByCreator(request: QueryContractsByCreatorRequest): Promise; +} +export declare const QueryServiceName = "cosmwasm.wasm.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + ContractInfo(request: QueryContractInfoRequest): Promise; + ContractHistory(request: QueryContractHistoryRequest): Promise; + ContractsByCode(request: QueryContractsByCodeRequest): Promise; + AllContractState(request: QueryAllContractStateRequest): Promise; + RawContractState(request: QueryRawContractStateRequest): Promise; + SmartContractState(request: QuerySmartContractStateRequest): Promise; + Code(request: QueryCodeRequest): Promise; + Codes(request: QueryCodesRequest): Promise; + PinnedCodes(request: QueryPinnedCodesRequest): Promise; + Params(request: QueryParamsRequest): Promise; + ContractsByCreator(request: QueryContractsByCreatorRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/wasm/v1/query.js b/dist/main/wasm/v1/query.js new file mode 100644 index 0000000..169c740 --- /dev/null +++ b/dist/main/wasm/v1/query.js @@ -0,0 +1,1705 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/query.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QueryClientImpl = exports.QueryServiceName = exports.QueryContractsByCreatorResponse = exports.QueryContractsByCreatorRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.QueryPinnedCodesResponse = exports.QueryPinnedCodesRequest = exports.QueryCodesResponse = exports.QueryCodesRequest = exports.QueryCodeResponse = exports.CodeInfoResponse = exports.QueryCodeRequest = exports.QuerySmartContractStateResponse = exports.QuerySmartContractStateRequest = exports.QueryRawContractStateResponse = exports.QueryRawContractStateRequest = exports.QueryAllContractStateResponse = exports.QueryAllContractStateRequest = exports.QueryContractsByCodeResponse = exports.QueryContractsByCodeRequest = exports.QueryContractHistoryResponse = exports.QueryContractHistoryRequest = exports.QueryContractInfoResponse = exports.QueryContractInfoRequest = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const pagination_1 = require("cosmjs-types/cosmos/base/query/v1beta1/pagination"); +const types_1 = require("./types"); +exports.protobufPackage = "cosmwasm.wasm.v1"; +function createBaseQueryContractInfoRequest() { + return { address: "" }; +} +exports.QueryContractInfoRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + create(base) { + return exports.QueryContractInfoRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; +function createBaseQueryContractInfoResponse() { + return { address: "", contractInfo: undefined }; +} +exports.QueryContractInfoResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.contractInfo !== undefined) { + types_1.ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contractInfo = types_1.ContractInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + contractInfo: isSet(object.contractInfo) + ? types_1.ContractInfo.fromJSON(object.contractInfo) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.contractInfo !== undefined) { + obj.contractInfo = types_1.ContractInfo.toJSON(message.contractInfo); + } + return obj; + }, + create(base) { + return exports.QueryContractInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractInfoResponse(); + message.address = object.address ?? ""; + message.contractInfo = + object.contractInfo !== undefined && object.contractInfo !== null + ? types_1.ContractInfo.fromPartial(object.contractInfo) + : undefined; + return message; + }, +}; +function createBaseQueryContractHistoryRequest() { + return { address: "", pagination: undefined }; +} +exports.QueryContractHistoryRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractHistoryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryContractHistoryRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractHistoryRequest(); + message.address = object.address ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryContractHistoryResponse() { + return { entries: [], pagination: undefined }; +} +exports.QueryContractHistoryResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.entries) { + types_1.ContractCodeHistoryEntry.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entries.push(types_1.ContractCodeHistoryEntry.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e) => types_1.ContractCodeHistoryEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => types_1.ContractCodeHistoryEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryContractHistoryResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractHistoryResponse(); + message.entries = + object.entries?.map((e) => types_1.ContractCodeHistoryEntry.fromPartial(e)) || + []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryContractsByCodeRequest() { + return { codeId: 0, pagination: undefined }; +} +exports.QueryContractsByCodeRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryContractsByCodeRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractsByCodeRequest(); + message.codeId = object.codeId ?? 0; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryContractsByCodeResponse() { + return { contracts: [], pagination: undefined }; +} +exports.QueryContractsByCodeResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.contracts) { + writer.uint32(10).string(v); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contracts.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e) => globalThis.String(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.contracts?.length) { + obj.contracts = message.contracts; + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryContractsByCodeResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractsByCodeResponse(); + message.contracts = object.contracts?.map((e) => e) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAllContractStateRequest() { + return { address: "", pagination: undefined }; +} +exports.QueryAllContractStateRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryAllContractStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryAllContractStateRequest(); + message.address = object.address ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAllContractStateResponse() { + return { models: [], pagination: undefined }; +} +exports.QueryAllContractStateResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.models) { + types_1.Model.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.models.push(types_1.Model.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + models: globalThis.Array.isArray(object?.models) + ? object.models.map((e) => types_1.Model.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.models?.length) { + obj.models = message.models.map((e) => types_1.Model.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryAllContractStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryAllContractStateResponse(); + message.models = object.models?.map((e) => types_1.Model.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryRawContractStateRequest() { + return { address: "", queryData: new Uint8Array(0) }; +} +exports.QueryRawContractStateRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRawContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.queryData = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + queryData: isSet(object.queryData) + ? bytesFromBase64(object.queryData) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.queryData.length !== 0) { + obj.queryData = base64FromBytes(message.queryData); + } + return obj; + }, + create(base) { + return exports.QueryRawContractStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryRawContractStateRequest(); + message.address = object.address ?? ""; + message.queryData = object.queryData ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQueryRawContractStateResponse() { + return { data: new Uint8Array(0) }; +} +exports.QueryRawContractStateResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRawContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.QueryRawContractStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryRawContractStateResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQuerySmartContractStateRequest() { + return { address: "", queryData: new Uint8Array(0) }; +} +exports.QuerySmartContractStateRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySmartContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.queryData = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + queryData: isSet(object.queryData) + ? bytesFromBase64(object.queryData) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.queryData.length !== 0) { + obj.queryData = base64FromBytes(message.queryData); + } + return obj; + }, + create(base) { + return exports.QuerySmartContractStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQuerySmartContractStateRequest(); + message.address = object.address ?? ""; + message.queryData = object.queryData ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQuerySmartContractStateResponse() { + return { data: new Uint8Array(0) }; +} +exports.QuerySmartContractStateResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySmartContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.QuerySmartContractStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQuerySmartContractStateResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQueryCodeRequest() { + return { codeId: 0 }; +} +exports.QueryCodeRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + return obj; + }, + create(base) { + return exports.QueryCodeRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryCodeRequest(); + message.codeId = object.codeId ?? 0; + return message; + }, +}; +function createBaseCodeInfoResponse() { + return { + codeId: 0, + creator: "", + dataHash: new Uint8Array(0), + instantiatePermission: undefined, + }; +} +exports.CodeInfoResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.dataHash.length !== 0) { + writer.uint32(26).bytes(message.dataHash); + } + if (message.instantiatePermission !== undefined) { + types_1.AccessConfig.encode(message.instantiatePermission, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dataHash = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.instantiatePermission = types_1.AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + dataHash: isSet(object.dataHash) + ? bytesFromBase64(object.dataHash) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? types_1.AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = types_1.AccessConfig.toJSON(message.instantiatePermission); + } + return obj; + }, + create(base) { + return exports.CodeInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCodeInfoResponse(); + message.codeId = object.codeId ?? 0; + message.creator = object.creator ?? ""; + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? types_1.AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + return message; + }, +}; +function createBaseQueryCodeResponse() { + return { codeInfo: undefined, data: new Uint8Array(0) }; +} +exports.QueryCodeResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeInfo !== undefined) { + exports.CodeInfoResponse.encode(message.codeInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.codeInfo = exports.CodeInfoResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeInfo: isSet(object.codeInfo) + ? exports.CodeInfoResponse.fromJSON(object.codeInfo) + : undefined, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeInfo !== undefined) { + obj.codeInfo = exports.CodeInfoResponse.toJSON(message.codeInfo); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.QueryCodeResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryCodeResponse(); + message.codeInfo = + object.codeInfo !== undefined && object.codeInfo !== null + ? exports.CodeInfoResponse.fromPartial(object.codeInfo) + : undefined; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQueryCodesRequest() { + return { pagination: undefined }; +} +exports.QueryCodesRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryCodesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryCodesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryCodesResponse() { + return { codeInfos: [], pagination: undefined }; +} +exports.QueryCodesResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.codeInfos) { + exports.CodeInfoResponse.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.codeInfos.push(exports.CodeInfoResponse.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeInfos: globalThis.Array.isArray(object?.codeInfos) + ? object.codeInfos.map((e) => exports.CodeInfoResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeInfos?.length) { + obj.codeInfos = message.codeInfos.map((e) => exports.CodeInfoResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryCodesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryCodesResponse(); + message.codeInfos = + object.codeInfos?.map((e) => exports.CodeInfoResponse.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryPinnedCodesRequest() { + return { pagination: undefined }; +} +exports.QueryPinnedCodesRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPinnedCodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryPinnedCodesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryPinnedCodesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryPinnedCodesResponse() { + return { codeIds: [], pagination: undefined }; +} +exports.QueryPinnedCodesResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPinnedCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryPinnedCodesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryPinnedCodesResponse(); + message.codeIds = object.codeIds?.map((e) => e) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return {}; +} +exports.QueryParamsRequest = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +exports.QueryParamsResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.params !== undefined) { + types_1.Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = types_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? types_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = types_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? types_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseQueryContractsByCreatorRequest() { + return { creatorAddress: "", pagination: undefined }; +} +exports.QueryContractsByCreatorRequest = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.creatorAddress !== "") { + writer.uint32(10).string(message.creatorAddress); + } + if (message.pagination !== undefined) { + pagination_1.PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCreatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creatorAddress = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creatorAddress: isSet(object.creatorAddress) + ? globalThis.String(object.creatorAddress) + : "", + pagination: isSet(object.pagination) + ? pagination_1.PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creatorAddress !== "") { + obj.creatorAddress = message.creatorAddress; + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryContractsByCreatorRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractsByCreatorRequest(); + message.creatorAddress = object.creatorAddress ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryContractsByCreatorResponse() { + return { contractAddresses: [], pagination: undefined }; +} +exports.QueryContractsByCreatorResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + for (const v of message.contractAddresses) { + writer.uint32(10).string(v); + } + if (message.pagination !== undefined) { + pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCreatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contractAddresses.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contractAddresses: globalThis.Array.isArray(object?.contractAddresses) + ? object.contractAddresses.map((e) => globalThis.String(e)) + : [], + pagination: isSet(object.pagination) + ? pagination_1.PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.contractAddresses?.length) { + obj.contractAddresses = message.contractAddresses; + } + if (message.pagination !== undefined) { + obj.pagination = pagination_1.PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return exports.QueryContractsByCreatorResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractsByCreatorResponse(); + message.contractAddresses = object.contractAddresses?.map((e) => e) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? pagination_1.PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +exports.QueryServiceName = "cosmwasm.wasm.v1.Query"; +class QueryClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.QueryServiceName; + this.rpc = rpc; + this.ContractInfo = this.ContractInfo.bind(this); + this.ContractHistory = this.ContractHistory.bind(this); + this.ContractsByCode = this.ContractsByCode.bind(this); + this.AllContractState = this.AllContractState.bind(this); + this.RawContractState = this.RawContractState.bind(this); + this.SmartContractState = this.SmartContractState.bind(this); + this.Code = this.Code.bind(this); + this.Codes = this.Codes.bind(this); + this.PinnedCodes = this.PinnedCodes.bind(this); + this.Params = this.Params.bind(this); + this.ContractsByCreator = this.ContractsByCreator.bind(this); + } + ContractInfo(request) { + const data = exports.QueryContractInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ContractInfo", data); + return promise.then((data) => exports.QueryContractInfoResponse.decode(new binary_1.BinaryReader(data))); + } + ContractHistory(request) { + const data = exports.QueryContractHistoryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ContractHistory", data); + return promise.then((data) => exports.QueryContractHistoryResponse.decode(new binary_1.BinaryReader(data))); + } + ContractsByCode(request) { + const data = exports.QueryContractsByCodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ContractsByCode", data); + return promise.then((data) => exports.QueryContractsByCodeResponse.decode(new binary_1.BinaryReader(data))); + } + AllContractState(request) { + const data = exports.QueryAllContractStateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AllContractState", data); + return promise.then((data) => exports.QueryAllContractStateResponse.decode(new binary_1.BinaryReader(data))); + } + RawContractState(request) { + const data = exports.QueryRawContractStateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "RawContractState", data); + return promise.then((data) => exports.QueryRawContractStateResponse.decode(new binary_1.BinaryReader(data))); + } + SmartContractState(request) { + const data = exports.QuerySmartContractStateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SmartContractState", data); + return promise.then((data) => exports.QuerySmartContractStateResponse.decode(new binary_1.BinaryReader(data))); + } + Code(request) { + const data = exports.QueryCodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Code", data); + return promise.then((data) => exports.QueryCodeResponse.decode(new binary_1.BinaryReader(data))); + } + Codes(request) { + const data = exports.QueryCodesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Codes", data); + return promise.then((data) => exports.QueryCodesResponse.decode(new binary_1.BinaryReader(data))); + } + PinnedCodes(request) { + const data = exports.QueryPinnedCodesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PinnedCodes", data); + return promise.then((data) => exports.QueryPinnedCodesResponse.decode(new binary_1.BinaryReader(data))); + } + Params(request) { + const data = exports.QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => exports.QueryParamsResponse.decode(new binary_1.BinaryReader(data))); + } + ContractsByCreator(request) { + const data = exports.QueryContractsByCreatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ContractsByCreator", data); + return promise.then((data) => exports.QueryContractsByCreatorResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.QueryClientImpl = QueryClientImpl; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/wasm/v1/tx.d.ts b/dist/main/wasm/v1/tx.d.ts new file mode 100644 index 0000000..75e8392 --- /dev/null +++ b/dist/main/wasm/v1/tx.d.ts @@ -0,0 +1,416 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { AccessConfig, Params } from "./types"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** MsgStoreCode submit Wasm code to the system */ +export interface MsgStoreCode { + /** Sender is the actor that signed the messages */ + sender: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** + * InstantiatePermission access control to apply on contract creation, + * optional + */ + instantiatePermission: AccessConfig | undefined; +} +/** MsgStoreCodeResponse returns store result data. */ +export interface MsgStoreCodeResponse { + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Checksum is the sha256 hash of the stored code */ + checksum: Uint8Array; +} +/** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ +export interface MsgInstantiateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +/** MsgInstantiateContractResponse return instantiation result data */ +export interface MsgInstantiateContractResponse { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ +export interface MsgInstantiateContract2 { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; +} +/** MsgInstantiateContract2Response return instantiation result data */ +export interface MsgInstantiateContract2Response { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** MsgExecuteContract submits the given message data to a smart contract */ +export interface MsgExecuteContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on execution */ + funds: Coin[]; +} +/** MsgExecuteContractResponse returns execution result data. */ +export interface MsgExecuteContractResponse { + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ +export interface MsgMigrateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: number; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +/** MsgMigrateContractResponse returns contract migration result data. */ +export interface MsgMigrateContractResponse { + /** + * Data contains same raw bytes returned as data from the wasm contract. + * (May be empty) + */ + data: Uint8Array; +} +/** MsgUpdateAdmin sets a new admin for a smart contract */ +export interface MsgUpdateAdmin { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** MsgUpdateAdminResponse returns empty data */ +export interface MsgUpdateAdminResponse { +} +/** MsgClearAdmin removes any admin stored for a smart contract */ +export interface MsgClearAdmin { + /** Sender is the actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** MsgClearAdminResponse returns empty data */ +export interface MsgClearAdminResponse { +} +/** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ +export interface MsgUpdateInstantiateConfig { + /** Sender is the that actor that signed the messages */ + sender: string; + /** CodeID references the stored WASM code */ + codeId: number; + /** NewInstantiatePermission is the new access control */ + newInstantiatePermission: AccessConfig | undefined; +} +/** MsgUpdateInstantiateConfigResponse returns empty data */ +export interface MsgUpdateInstantiateConfigResponse { +} +/** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ +export interface MsgUpdateParams { + /** Authority is the address of the governance account. */ + authority: string; + /** + * params defines the x/wasm parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsResponse { +} +/** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ +export interface MsgSudoContract { + /** Authority is the address of the governance account. */ + authority: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; +} +/** + * MsgSudoContractResponse defines the response structure for executing a + * MsgSudoContract message. + * + * Since: 0.40 + */ +export interface MsgSudoContractResponse { + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ +export interface MsgPinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the new WASM codes */ + codeIds: number[]; +} +/** + * MsgPinCodesResponse defines the response structure for executing a + * MsgPinCodes message. + * + * Since: 0.40 + */ +export interface MsgPinCodesResponse { +} +/** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ +export interface MsgUnpinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the WASM codes */ + codeIds: number[]; +} +/** + * MsgUnpinCodesResponse defines the response structure for executing a + * MsgUnpinCodes message. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesResponse { +} +/** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig | undefined; + /** + * UnpinCode code on upload, optional. As default the uploaded contract is + * pinned to cache. + */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** + * Funds coins that are transferred from the authority account to the contract + * on instantiation + */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +/** + * MsgStoreAndInstantiateContractResponse defines the response structure + * for executing a MsgStoreAndInstantiateContract message. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractResponse { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export declare const MsgStoreCode: MessageFns; +export declare const MsgStoreCodeResponse: MessageFns; +export declare const MsgInstantiateContract: MessageFns; +export declare const MsgInstantiateContractResponse: MessageFns; +export declare const MsgInstantiateContract2: MessageFns; +export declare const MsgInstantiateContract2Response: MessageFns; +export declare const MsgExecuteContract: MessageFns; +export declare const MsgExecuteContractResponse: MessageFns; +export declare const MsgMigrateContract: MessageFns; +export declare const MsgMigrateContractResponse: MessageFns; +export declare const MsgUpdateAdmin: MessageFns; +export declare const MsgUpdateAdminResponse: MessageFns; +export declare const MsgClearAdmin: MessageFns; +export declare const MsgClearAdminResponse: MessageFns; +export declare const MsgUpdateInstantiateConfig: MessageFns; +export declare const MsgUpdateInstantiateConfigResponse: MessageFns; +export declare const MsgUpdateParams: MessageFns; +export declare const MsgUpdateParamsResponse: MessageFns; +export declare const MsgSudoContract: MessageFns; +export declare const MsgSudoContractResponse: MessageFns; +export declare const MsgPinCodes: MessageFns; +export declare const MsgPinCodesResponse: MessageFns; +export declare const MsgUnpinCodes: MessageFns; +export declare const MsgUnpinCodesResponse: MessageFns; +export declare const MsgStoreAndInstantiateContract: MessageFns; +export declare const MsgStoreAndInstantiateContractResponse: MessageFns; +/** Msg defines the wasm Msg service. */ +export interface Msg { + /** StoreCode to submit Wasm code to the system */ + StoreCode(request: MsgStoreCode): Promise; + /** + * InstantiateContract creates a new smart contract instance for the given + * code id. + */ + InstantiateContract(request: MsgInstantiateContract): Promise; + /** + * InstantiateContract2 creates a new smart contract instance for the given + * code id with a predictable address + */ + InstantiateContract2(request: MsgInstantiateContract2): Promise; + /** Execute submits the given message data to a smart contract */ + ExecuteContract(request: MsgExecuteContract): Promise; + /** Migrate runs a code upgrade/ downgrade for a smart contract */ + MigrateContract(request: MsgMigrateContract): Promise; + /** UpdateAdmin sets a new admin for a smart contract */ + UpdateAdmin(request: MsgUpdateAdmin): Promise; + /** ClearAdmin removes any admin stored for a smart contract */ + ClearAdmin(request: MsgClearAdmin): Promise; + /** UpdateInstantiateConfig updates instantiate config for a smart contract */ + UpdateInstantiateConfig(request: MsgUpdateInstantiateConfig): Promise; + /** + * UpdateParams defines a governance operation for updating the x/wasm + * module parameters. The authority is defined in the keeper. + * + * Since: 0.40 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SudoContract defines a governance operation for calling sudo + * on a contract. The authority is defined in the keeper. + * + * Since: 0.40 + */ + SudoContract(request: MsgSudoContract): Promise; + /** + * PinCodes defines a governance operation for pinning a set of + * code ids in the wasmvm cache. The authority is defined in the keeper. + * + * Since: 0.40 + */ + PinCodes(request: MsgPinCodes): Promise; + /** + * UnpinCodes defines a governance operation for unpinning a set of + * code ids in the wasmvm cache. The authority is defined in the keeper. + * + * Since: 0.40 + */ + UnpinCodes(request: MsgUnpinCodes): Promise; + /** + * StoreAndInstantiateContract defines a governance operation for storing + * and instantiating the contract. The authority is defined in the keeper. + * + * Since: 0.40 + */ + StoreAndInstantiateContract(request: MsgStoreAndInstantiateContract): Promise; +} +export declare const MsgServiceName = "cosmwasm.wasm.v1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + StoreCode(request: MsgStoreCode): Promise; + InstantiateContract(request: MsgInstantiateContract): Promise; + InstantiateContract2(request: MsgInstantiateContract2): Promise; + ExecuteContract(request: MsgExecuteContract): Promise; + MigrateContract(request: MsgMigrateContract): Promise; + UpdateAdmin(request: MsgUpdateAdmin): Promise; + ClearAdmin(request: MsgClearAdmin): Promise; + UpdateInstantiateConfig(request: MsgUpdateInstantiateConfig): Promise; + UpdateParams(request: MsgUpdateParams): Promise; + SudoContract(request: MsgSudoContract): Promise; + PinCodes(request: MsgPinCodes): Promise; + UnpinCodes(request: MsgUnpinCodes): Promise; + StoreAndInstantiateContract(request: MsgStoreAndInstantiateContract): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/wasm/v1/tx.js b/dist/main/wasm/v1/tx.js new file mode 100644 index 0000000..d3c5259 --- /dev/null +++ b/dist/main/wasm/v1/tx.js @@ -0,0 +1,2211 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/tx.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MsgClientImpl = exports.MsgServiceName = exports.MsgStoreAndInstantiateContractResponse = exports.MsgStoreAndInstantiateContract = exports.MsgUnpinCodesResponse = exports.MsgUnpinCodes = exports.MsgPinCodesResponse = exports.MsgPinCodes = exports.MsgSudoContractResponse = exports.MsgSudoContract = exports.MsgUpdateParamsResponse = exports.MsgUpdateParams = exports.MsgUpdateInstantiateConfigResponse = exports.MsgUpdateInstantiateConfig = exports.MsgClearAdminResponse = exports.MsgClearAdmin = exports.MsgUpdateAdminResponse = exports.MsgUpdateAdmin = exports.MsgMigrateContractResponse = exports.MsgMigrateContract = exports.MsgExecuteContractResponse = exports.MsgExecuteContract = exports.MsgInstantiateContract2Response = exports.MsgInstantiateContract2 = exports.MsgInstantiateContractResponse = exports.MsgInstantiateContract = exports.MsgStoreCodeResponse = exports.MsgStoreCode = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); +const types_1 = require("./types"); +exports.protobufPackage = "cosmwasm.wasm.v1"; +function createBaseMsgStoreCode() { + return { + sender: "", + wasmByteCode: new Uint8Array(0), + instantiatePermission: undefined, + }; +} +exports.MsgStoreCode = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + types_1.AccessConfig.encode(message.instantiatePermission, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.wasmByteCode = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.instantiatePermission = types_1.AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + wasmByteCode: isSet(object.wasmByteCode) + ? bytesFromBase64(object.wasmByteCode) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? types_1.AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.wasmByteCode.length !== 0) { + obj.wasmByteCode = base64FromBytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = types_1.AccessConfig.toJSON(message.instantiatePermission); + } + return obj; + }, + create(base) { + return exports.MsgStoreCode.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgStoreCode(); + message.sender = object.sender ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? types_1.AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + return message; + }, +}; +function createBaseMsgStoreCodeResponse() { + return { codeId: 0, checksum: new Uint8Array(0) }; +} +exports.MsgStoreCodeResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.checksum = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + checksum: isSet(object.checksum) + ? bytesFromBase64(object.checksum) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.checksum.length !== 0) { + obj.checksum = base64FromBytes(message.checksum); + } + return obj; + }, + create(base) { + return exports.MsgStoreCodeResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgStoreCodeResponse(); + message.codeId = object.codeId ?? 0; + message.checksum = object.checksum ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgInstantiateContract() { + return { + sender: "", + admin: "", + codeId: 0, + label: "", + msg: new Uint8Array(0), + funds: [], + }; +} +exports.MsgInstantiateContract = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== 0) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.admin = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.label = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.MsgInstantiateContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgInstantiateContract(); + message.sender = object.sender ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgInstantiateContractResponse() { + return { address: "", data: new Uint8Array(0) }; +} +exports.MsgInstantiateContractResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.MsgInstantiateContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgInstantiateContractResponse(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgInstantiateContract2() { + return { + sender: "", + admin: "", + codeId: 0, + label: "", + msg: new Uint8Array(0), + funds: [], + salt: new Uint8Array(0), + fixMsg: false, + }; +} +exports.MsgInstantiateContract2 = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== 0) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(50).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(58).bytes(message.salt); + } + if (message.fixMsg !== false) { + writer.uint32(64).bool(message.fixMsg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract2(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.admin = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.label = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.salt = reader.bytes(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.fixMsg = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + salt: isSet(object.salt) + ? bytesFromBase64(object.salt) + : new Uint8Array(0), + fixMsg: isSet(object.fixMsg) ? globalThis.Boolean(object.fixMsg) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + if (message.salt.length !== 0) { + obj.salt = base64FromBytes(message.salt); + } + if (message.fixMsg !== false) { + obj.fixMsg = message.fixMsg; + } + return obj; + }, + create(base) { + return exports.MsgInstantiateContract2.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgInstantiateContract2(); + message.sender = object.sender ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.salt = object.salt ?? new Uint8Array(0); + message.fixMsg = object.fixMsg ?? false; + return message; + }, +}; +function createBaseMsgInstantiateContract2Response() { + return { address: "", data: new Uint8Array(0) }; +} +exports.MsgInstantiateContract2Response = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.MsgInstantiateContract2Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgInstantiateContract2Response(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgExecuteContract() { + return { sender: "", contract: "", msg: new Uint8Array(0), funds: [] }; +} +exports.MsgExecuteContract = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecuteContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contract = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return exports.MsgExecuteContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgExecuteContract(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgExecuteContractResponse() { + return { data: new Uint8Array(0) }; +} +exports.MsgExecuteContractResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecuteContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.MsgExecuteContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgExecuteContractResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgMigrateContract() { + return { sender: "", contract: "", codeId: 0, msg: new Uint8Array(0) }; +} +exports.MsgMigrateContract = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.codeId !== 0) { + writer.uint32(24).uint64(message.codeId); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contract = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return exports.MsgMigrateContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgMigrateContract(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + message.codeId = object.codeId ?? 0; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgMigrateContractResponse() { + return { data: new Uint8Array(0) }; +} +exports.MsgMigrateContractResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.MsgMigrateContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgMigrateContractResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgUpdateAdmin() { + return { sender: "", newAdmin: "", contract: "" }; +} +exports.MsgUpdateAdmin = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newAdmin !== "") { + writer.uint32(18).string(message.newAdmin); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.newAdmin = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contract = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + newAdmin: isSet(object.newAdmin) + ? globalThis.String(object.newAdmin) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + return obj; + }, + create(base) { + return exports.MsgUpdateAdmin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateAdmin(); + message.sender = object.sender ?? ""; + message.newAdmin = object.newAdmin ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBaseMsgUpdateAdminResponse() { + return {}; +} +exports.MsgUpdateAdminResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.MsgUpdateAdminResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgUpdateAdminResponse(); + return message; + }, +}; +function createBaseMsgClearAdmin() { + return { sender: "", contract: "" }; +} +exports.MsgClearAdmin = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contract = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + return obj; + }, + create(base) { + return exports.MsgClearAdmin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClearAdmin(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBaseMsgClearAdminResponse() { + return {}; +} +exports.MsgClearAdminResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.MsgClearAdminResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgClearAdminResponse(); + return message; + }, +}; +function createBaseMsgUpdateInstantiateConfig() { + return { sender: "", codeId: 0, newInstantiatePermission: undefined }; +} +exports.MsgUpdateInstantiateConfig = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.codeId !== 0) { + writer.uint32(16).uint64(message.codeId); + } + if (message.newInstantiatePermission !== undefined) { + types_1.AccessConfig.encode(message.newInstantiatePermission, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateInstantiateConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.newInstantiatePermission = types_1.AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + newInstantiatePermission: isSet(object.newInstantiatePermission) + ? types_1.AccessConfig.fromJSON(object.newInstantiatePermission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.newInstantiatePermission !== undefined) { + obj.newInstantiatePermission = types_1.AccessConfig.toJSON(message.newInstantiatePermission); + } + return obj; + }, + create(base) { + return exports.MsgUpdateInstantiateConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateInstantiateConfig(); + message.sender = object.sender ?? ""; + message.codeId = object.codeId ?? 0; + message.newInstantiatePermission = + object.newInstantiatePermission !== undefined && + object.newInstantiatePermission !== null + ? types_1.AccessConfig.fromPartial(object.newInstantiatePermission) + : undefined; + return message; + }, +}; +function createBaseMsgUpdateInstantiateConfigResponse() { + return {}; +} +exports.MsgUpdateInstantiateConfigResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateInstantiateConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.MsgUpdateInstantiateConfigResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgUpdateInstantiateConfigResponse(); + return message; + }, +}; +function createBaseMsgUpdateParams() { + return { authority: "", params: undefined }; +} +exports.MsgUpdateParams = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + types_1.Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.params = types_1.Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + params: isSet(object.params) ? types_1.Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = types_1.Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return exports.MsgUpdateParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = + object.params !== undefined && object.params !== null + ? types_1.Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseMsgUpdateParamsResponse() { + return {}; +} +exports.MsgUpdateParamsResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.MsgUpdateParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; +function createBaseMsgSudoContract() { + return { authority: "", contract: "", msg: new Uint8Array(0) }; +} +exports.MsgSudoContract = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSudoContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contract = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return exports.MsgSudoContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSudoContract(); + message.authority = object.authority ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgSudoContractResponse() { + return { data: new Uint8Array(0) }; +} +exports.MsgSudoContractResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSudoContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.MsgSudoContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSudoContractResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgPinCodes() { + return { authority: "", codeIds: [] }; +} +exports.MsgPinCodes = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + writer.uint32(18).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPinCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag === 16) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + return obj; + }, + create(base) { + return exports.MsgPinCodes.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgPinCodes(); + message.authority = object.authority ?? ""; + message.codeIds = object.codeIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseMsgPinCodesResponse() { + return {}; +} +exports.MsgPinCodesResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPinCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.MsgPinCodesResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgPinCodesResponse(); + return message; + }, +}; +function createBaseMsgUnpinCodes() { + return { authority: "", codeIds: [] }; +} +exports.MsgUnpinCodes = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + writer.uint32(18).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpinCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag === 16) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + return obj; + }, + create(base) { + return exports.MsgUnpinCodes.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUnpinCodes(); + message.authority = object.authority ?? ""; + message.codeIds = object.codeIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseMsgUnpinCodesResponse() { + return {}; +} +exports.MsgUnpinCodesResponse = { + encode(_, writer = new binary_1.BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpinCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return exports.MsgUnpinCodesResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgUnpinCodesResponse(); + return message; + }, +}; +function createBaseMsgStoreAndInstantiateContract() { + return { + authority: "", + wasmByteCode: new Uint8Array(0), + instantiatePermission: undefined, + unpinCode: false, + admin: "", + label: "", + msg: new Uint8Array(0), + funds: [], + source: "", + builder: "", + codeHash: new Uint8Array(0), + }; +} +exports.MsgStoreAndInstantiateContract = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(26).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + types_1.AccessConfig.encode(message.instantiatePermission, writer.uint32(34).fork()).ldelim(); + } + if (message.unpinCode !== false) { + writer.uint32(40).bool(message.unpinCode); + } + if (message.admin !== "") { + writer.uint32(50).string(message.admin); + } + if (message.label !== "") { + writer.uint32(58).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(66).bytes(message.msg); + } + for (const v of message.funds) { + coin_1.Coin.encode(v, writer.uint32(74).fork()).ldelim(); + } + if (message.source !== "") { + writer.uint32(82).string(message.source); + } + if (message.builder !== "") { + writer.uint32(90).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(98).bytes(message.codeHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndInstantiateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.wasmByteCode = reader.bytes(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.instantiatePermission = types_1.AccessConfig.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.unpinCode = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.admin = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.label = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.funds.push(coin_1.Coin.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.source = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.builder = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.codeHash = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + wasmByteCode: isSet(object.wasmByteCode) + ? bytesFromBase64(object.wasmByteCode) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? types_1.AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + unpinCode: isSet(object.unpinCode) + ? globalThis.Boolean(object.unpinCode) + : false, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) + ? bytesFromBase64(object.msg) + : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => coin_1.Coin.fromJSON(e)) + : [], + source: isSet(object.source) ? globalThis.String(object.source) : "", + builder: isSet(object.builder) ? globalThis.String(object.builder) : "", + codeHash: isSet(object.codeHash) + ? bytesFromBase64(object.codeHash) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.wasmByteCode.length !== 0) { + obj.wasmByteCode = base64FromBytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = types_1.AccessConfig.toJSON(message.instantiatePermission); + } + if (message.unpinCode !== false) { + obj.unpinCode = message.unpinCode; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => coin_1.Coin.toJSON(e)); + } + if (message.source !== "") { + obj.source = message.source; + } + if (message.builder !== "") { + obj.builder = message.builder; + } + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + return obj; + }, + create(base) { + return exports.MsgStoreAndInstantiateContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgStoreAndInstantiateContract(); + message.authority = object.authority ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? types_1.AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + message.unpinCode = object.unpinCode ?? false; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => coin_1.Coin.fromPartial(e)) || []; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgStoreAndInstantiateContractResponse() { + return { address: "", data: new Uint8Array(0) }; +} +exports.MsgStoreAndInstantiateContractResponse = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndInstantiateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return exports.MsgStoreAndInstantiateContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgStoreAndInstantiateContractResponse(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +exports.MsgServiceName = "cosmwasm.wasm.v1.Msg"; +class MsgClientImpl { + constructor(rpc, opts) { + this.service = opts?.service || exports.MsgServiceName; + this.rpc = rpc; + this.StoreCode = this.StoreCode.bind(this); + this.InstantiateContract = this.InstantiateContract.bind(this); + this.InstantiateContract2 = this.InstantiateContract2.bind(this); + this.ExecuteContract = this.ExecuteContract.bind(this); + this.MigrateContract = this.MigrateContract.bind(this); + this.UpdateAdmin = this.UpdateAdmin.bind(this); + this.ClearAdmin = this.ClearAdmin.bind(this); + this.UpdateInstantiateConfig = this.UpdateInstantiateConfig.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.SudoContract = this.SudoContract.bind(this); + this.PinCodes = this.PinCodes.bind(this); + this.UnpinCodes = this.UnpinCodes.bind(this); + this.StoreAndInstantiateContract = + this.StoreAndInstantiateContract.bind(this); + } + StoreCode(request) { + const data = exports.MsgStoreCode.encode(request).finish(); + const promise = this.rpc.request(this.service, "StoreCode", data); + return promise.then((data) => exports.MsgStoreCodeResponse.decode(new binary_1.BinaryReader(data))); + } + InstantiateContract(request) { + const data = exports.MsgInstantiateContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "InstantiateContract", data); + return promise.then((data) => exports.MsgInstantiateContractResponse.decode(new binary_1.BinaryReader(data))); + } + InstantiateContract2(request) { + const data = exports.MsgInstantiateContract2.encode(request).finish(); + const promise = this.rpc.request(this.service, "InstantiateContract2", data); + return promise.then((data) => exports.MsgInstantiateContract2Response.decode(new binary_1.BinaryReader(data))); + } + ExecuteContract(request) { + const data = exports.MsgExecuteContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExecuteContract", data); + return promise.then((data) => exports.MsgExecuteContractResponse.decode(new binary_1.BinaryReader(data))); + } + MigrateContract(request) { + const data = exports.MsgMigrateContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "MigrateContract", data); + return promise.then((data) => exports.MsgMigrateContractResponse.decode(new binary_1.BinaryReader(data))); + } + UpdateAdmin(request) { + const data = exports.MsgUpdateAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAdmin", data); + return promise.then((data) => exports.MsgUpdateAdminResponse.decode(new binary_1.BinaryReader(data))); + } + ClearAdmin(request) { + const data = exports.MsgClearAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClearAdmin", data); + return promise.then((data) => exports.MsgClearAdminResponse.decode(new binary_1.BinaryReader(data))); + } + UpdateInstantiateConfig(request) { + const data = exports.MsgUpdateInstantiateConfig.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateInstantiateConfig", data); + return promise.then((data) => exports.MsgUpdateInstantiateConfigResponse.decode(new binary_1.BinaryReader(data))); + } + UpdateParams(request) { + const data = exports.MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => exports.MsgUpdateParamsResponse.decode(new binary_1.BinaryReader(data))); + } + SudoContract(request) { + const data = exports.MsgSudoContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "SudoContract", data); + return promise.then((data) => exports.MsgSudoContractResponse.decode(new binary_1.BinaryReader(data))); + } + PinCodes(request) { + const data = exports.MsgPinCodes.encode(request).finish(); + const promise = this.rpc.request(this.service, "PinCodes", data); + return promise.then((data) => exports.MsgPinCodesResponse.decode(new binary_1.BinaryReader(data))); + } + UnpinCodes(request) { + const data = exports.MsgUnpinCodes.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnpinCodes", data); + return promise.then((data) => exports.MsgUnpinCodesResponse.decode(new binary_1.BinaryReader(data))); + } + StoreAndInstantiateContract(request) { + const data = exports.MsgStoreAndInstantiateContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "StoreAndInstantiateContract", data); + return promise.then((data) => exports.MsgStoreAndInstantiateContractResponse.decode(new binary_1.BinaryReader(data))); + } +} +exports.MsgClientImpl = MsgClientImpl; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/main/wasm/v1/types.d.ts b/dist/main/wasm/v1/types.d.ts new file mode 100644 index 0000000..c018f1d --- /dev/null +++ b/dist/main/wasm/v1/types.d.ts @@ -0,0 +1,139 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** AccessType permission types */ +export declare enum AccessType { + /** ACCESS_TYPE_UNSPECIFIED - AccessTypeUnspecified placeholder for empty value */ + ACCESS_TYPE_UNSPECIFIED = 0, + /** ACCESS_TYPE_NOBODY - AccessTypeNobody forbidden */ + ACCESS_TYPE_NOBODY = 1, + /** + * ACCESS_TYPE_ONLY_ADDRESS - AccessTypeOnlyAddress restricted to a single address + * Deprecated: use AccessTypeAnyOfAddresses instead + */ + ACCESS_TYPE_ONLY_ADDRESS = 2, + /** ACCESS_TYPE_EVERYBODY - AccessTypeEverybody unrestricted */ + ACCESS_TYPE_EVERYBODY = 3, + /** ACCESS_TYPE_ANY_OF_ADDRESSES - AccessTypeAnyOfAddresses allow any of the addresses */ + ACCESS_TYPE_ANY_OF_ADDRESSES = 4, + UNRECOGNIZED = -1 +} +export declare function accessTypeFromJSON(object: any): AccessType; +export declare function accessTypeToJSON(object: AccessType): string; +/** ContractCodeHistoryOperationType actions that caused a code change */ +export declare enum ContractCodeHistoryOperationType { + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED - ContractCodeHistoryOperationTypeUnspecified placeholder for empty value */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED = 0, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT - ContractCodeHistoryOperationTypeInit on chain contract instantiation */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT = 1, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE - ContractCodeHistoryOperationTypeMigrate code migration */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE = 2, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS - ContractCodeHistoryOperationTypeGenesis based on genesis data */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS = 3, + UNRECOGNIZED = -1 +} +export declare function contractCodeHistoryOperationTypeFromJSON(object: any): ContractCodeHistoryOperationType; +export declare function contractCodeHistoryOperationTypeToJSON(object: ContractCodeHistoryOperationType): string; +/** AccessTypeParam */ +export interface AccessTypeParam { + value: AccessType; +} +/** AccessConfig access control type. */ +export interface AccessConfig { + permission: AccessType; + /** + * Address + * Deprecated: replaced by addresses + */ + address: string; + addresses: string[]; +} +/** Params defines the set of wasm parameters. */ +export interface Params { + codeUploadAccess: AccessConfig | undefined; + instantiateDefaultPermission: AccessType; +} +/** CodeInfo is data for the uploaded contract WASM code */ +export interface CodeInfo { + /** CodeHash is the unique identifier created by wasmvm */ + codeHash: Uint8Array; + /** Creator address who initially stored the code */ + creator: string; + /** InstantiateConfig access control to apply on contract creation, optional */ + instantiateConfig: AccessConfig | undefined; +} +/** ContractInfo stores a WASM contract instance */ +export interface ContractInfo { + /** CodeID is the reference to the stored Wasm code */ + codeId: number; + /** Creator address who initially instantiated the contract */ + creator: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Created Tx position when the contract was instantiated. */ + created: AbsoluteTxPosition | undefined; + ibcPortId: string; + /** + * Extension is an extension point to store custom metadata within the + * persistence model. + */ + extension: Any | undefined; +} +/** ContractCodeHistoryEntry metadata to a contract. */ +export interface ContractCodeHistoryEntry { + operation: ContractCodeHistoryOperationType; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Updated Tx position when the operation was executed. */ + updated: AbsoluteTxPosition | undefined; + msg: Uint8Array; +} +/** + * AbsoluteTxPosition is a unique transaction position that allows for global + * ordering of transactions. + */ +export interface AbsoluteTxPosition { + /** BlockHeight is the block the contract was created at */ + blockHeight: number; + /** + * TxIndex is a monotonic counter within the block (actual transaction index, + * or gas consumed) + */ + txIndex: number; +} +/** Model is a struct that holds a KV pair */ +export interface Model { + /** hex-encode key to read it better (this is often ascii) */ + key: Uint8Array; + /** base64-encode raw value */ + value: Uint8Array; +} +export declare const AccessTypeParam: MessageFns; +export declare const AccessConfig: MessageFns; +export declare const Params: MessageFns; +export declare const CodeInfo: MessageFns; +export declare const ContractInfo: MessageFns; +export declare const ContractCodeHistoryEntry: MessageFns; +export declare const AbsoluteTxPosition: MessageFns; +export declare const Model: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/main/wasm/v1/types.js b/dist/main/wasm/v1/types.js new file mode 100644 index 0000000..c10ad87 --- /dev/null +++ b/dist/main/wasm/v1/types.js @@ -0,0 +1,884 @@ +"use strict"; +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/types.proto +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Model = exports.AbsoluteTxPosition = exports.ContractCodeHistoryEntry = exports.ContractInfo = exports.CodeInfo = exports.Params = exports.AccessConfig = exports.AccessTypeParam = exports.contractCodeHistoryOperationTypeToJSON = exports.contractCodeHistoryOperationTypeFromJSON = exports.ContractCodeHistoryOperationType = exports.accessTypeToJSON = exports.accessTypeFromJSON = exports.AccessType = exports.protobufPackage = void 0; +/* eslint-disable */ +const binary_1 = require("cosmjs-types/binary"); +const any_1 = require("cosmjs-types/google/protobuf/any"); +exports.protobufPackage = "cosmwasm.wasm.v1"; +/** AccessType permission types */ +var AccessType; +(function (AccessType) { + /** ACCESS_TYPE_UNSPECIFIED - AccessTypeUnspecified placeholder for empty value */ + AccessType[AccessType["ACCESS_TYPE_UNSPECIFIED"] = 0] = "ACCESS_TYPE_UNSPECIFIED"; + /** ACCESS_TYPE_NOBODY - AccessTypeNobody forbidden */ + AccessType[AccessType["ACCESS_TYPE_NOBODY"] = 1] = "ACCESS_TYPE_NOBODY"; + /** + * ACCESS_TYPE_ONLY_ADDRESS - AccessTypeOnlyAddress restricted to a single address + * Deprecated: use AccessTypeAnyOfAddresses instead + */ + AccessType[AccessType["ACCESS_TYPE_ONLY_ADDRESS"] = 2] = "ACCESS_TYPE_ONLY_ADDRESS"; + /** ACCESS_TYPE_EVERYBODY - AccessTypeEverybody unrestricted */ + AccessType[AccessType["ACCESS_TYPE_EVERYBODY"] = 3] = "ACCESS_TYPE_EVERYBODY"; + /** ACCESS_TYPE_ANY_OF_ADDRESSES - AccessTypeAnyOfAddresses allow any of the addresses */ + AccessType[AccessType["ACCESS_TYPE_ANY_OF_ADDRESSES"] = 4] = "ACCESS_TYPE_ANY_OF_ADDRESSES"; + AccessType[AccessType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(AccessType || (exports.AccessType = AccessType = {})); +function accessTypeFromJSON(object) { + switch (object) { + case 0: + case "ACCESS_TYPE_UNSPECIFIED": + return AccessType.ACCESS_TYPE_UNSPECIFIED; + case 1: + case "ACCESS_TYPE_NOBODY": + return AccessType.ACCESS_TYPE_NOBODY; + case 2: + case "ACCESS_TYPE_ONLY_ADDRESS": + return AccessType.ACCESS_TYPE_ONLY_ADDRESS; + case 3: + case "ACCESS_TYPE_EVERYBODY": + return AccessType.ACCESS_TYPE_EVERYBODY; + case 4: + case "ACCESS_TYPE_ANY_OF_ADDRESSES": + return AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES; + case -1: + case "UNRECOGNIZED": + default: + return AccessType.UNRECOGNIZED; + } +} +exports.accessTypeFromJSON = accessTypeFromJSON; +function accessTypeToJSON(object) { + switch (object) { + case AccessType.ACCESS_TYPE_UNSPECIFIED: + return "ACCESS_TYPE_UNSPECIFIED"; + case AccessType.ACCESS_TYPE_NOBODY: + return "ACCESS_TYPE_NOBODY"; + case AccessType.ACCESS_TYPE_ONLY_ADDRESS: + return "ACCESS_TYPE_ONLY_ADDRESS"; + case AccessType.ACCESS_TYPE_EVERYBODY: + return "ACCESS_TYPE_EVERYBODY"; + case AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES: + return "ACCESS_TYPE_ANY_OF_ADDRESSES"; + case AccessType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.accessTypeToJSON = accessTypeToJSON; +/** ContractCodeHistoryOperationType actions that caused a code change */ +var ContractCodeHistoryOperationType; +(function (ContractCodeHistoryOperationType) { + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED - ContractCodeHistoryOperationTypeUnspecified placeholder for empty value */ + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED"] = 0] = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED"; + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT - ContractCodeHistoryOperationTypeInit on chain contract instantiation */ + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT"] = 1] = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT"; + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE - ContractCodeHistoryOperationTypeMigrate code migration */ + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE"] = 2] = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE"; + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS - ContractCodeHistoryOperationTypeGenesis based on genesis data */ + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS"] = 3] = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS"; + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ContractCodeHistoryOperationType || (exports.ContractCodeHistoryOperationType = ContractCodeHistoryOperationType = {})); +function contractCodeHistoryOperationTypeFromJSON(object) { + switch (object) { + case 0: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED; + case 1: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT; + case 2: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE; + case 3: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS; + case -1: + case "UNRECOGNIZED": + default: + return ContractCodeHistoryOperationType.UNRECOGNIZED; + } +} +exports.contractCodeHistoryOperationTypeFromJSON = contractCodeHistoryOperationTypeFromJSON; +function contractCodeHistoryOperationTypeToJSON(object) { + switch (object) { + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS"; + case ContractCodeHistoryOperationType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +exports.contractCodeHistoryOperationTypeToJSON = contractCodeHistoryOperationTypeToJSON; +function createBaseAccessTypeParam() { + return { value: 0 }; +} +exports.AccessTypeParam = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.value !== 0) { + writer.uint32(8).int32(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessTypeParam(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.value = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + value: isSet(object.value) ? accessTypeFromJSON(object.value) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.value !== 0) { + obj.value = accessTypeToJSON(message.value); + } + return obj; + }, + create(base) { + return exports.AccessTypeParam.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAccessTypeParam(); + message.value = object.value ?? 0; + return message; + }, +}; +function createBaseAccessConfig() { + return { permission: 0, address: "", addresses: [] }; +} +exports.AccessConfig = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.permission !== 0) { + writer.uint32(8).int32(message.permission); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + for (const v of message.addresses) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.permission = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.address = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.addresses.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + permission: isSet(object.permission) + ? accessTypeFromJSON(object.permission) + : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.permission !== 0) { + obj.permission = accessTypeToJSON(message.permission); + } + if (message.address !== "") { + obj.address = message.address; + } + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + create(base) { + return exports.AccessConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAccessConfig(); + message.permission = object.permission ?? 0; + message.address = object.address ?? ""; + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; +function createBaseParams() { + return { codeUploadAccess: undefined, instantiateDefaultPermission: 0 }; +} +exports.Params = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeUploadAccess !== undefined) { + exports.AccessConfig.encode(message.codeUploadAccess, writer.uint32(10).fork()).ldelim(); + } + if (message.instantiateDefaultPermission !== 0) { + writer.uint32(16).int32(message.instantiateDefaultPermission); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.codeUploadAccess = exports.AccessConfig.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.instantiateDefaultPermission = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeUploadAccess: isSet(object.codeUploadAccess) + ? exports.AccessConfig.fromJSON(object.codeUploadAccess) + : undefined, + instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) + ? accessTypeFromJSON(object.instantiateDefaultPermission) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeUploadAccess !== undefined) { + obj.codeUploadAccess = exports.AccessConfig.toJSON(message.codeUploadAccess); + } + if (message.instantiateDefaultPermission !== 0) { + obj.instantiateDefaultPermission = accessTypeToJSON(message.instantiateDefaultPermission); + } + return obj; + }, + create(base) { + return exports.Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.codeUploadAccess = + object.codeUploadAccess !== undefined && object.codeUploadAccess !== null + ? exports.AccessConfig.fromPartial(object.codeUploadAccess) + : undefined; + message.instantiateDefaultPermission = + object.instantiateDefaultPermission ?? 0; + return message; + }, +}; +function createBaseCodeInfo() { + return { + codeHash: new Uint8Array(0), + creator: "", + instantiateConfig: undefined, + }; +} +exports.CodeInfo = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeHash.length !== 0) { + writer.uint32(10).bytes(message.codeHash); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.instantiateConfig !== undefined) { + exports.AccessConfig.encode(message.instantiateConfig, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.codeHash = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creator = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.instantiateConfig = exports.AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeHash: isSet(object.codeHash) + ? bytesFromBase64(object.codeHash) + : new Uint8Array(0), + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + instantiateConfig: isSet(object.instantiateConfig) + ? exports.AccessConfig.fromJSON(object.instantiateConfig) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.instantiateConfig !== undefined) { + obj.instantiateConfig = exports.AccessConfig.toJSON(message.instantiateConfig); + } + return obj; + }, + create(base) { + return exports.CodeInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCodeInfo(); + message.codeHash = object.codeHash ?? new Uint8Array(0); + message.creator = object.creator ?? ""; + message.instantiateConfig = + object.instantiateConfig !== undefined && + object.instantiateConfig !== null + ? exports.AccessConfig.fromPartial(object.instantiateConfig) + : undefined; + return message; + }, +}; +function createBaseContractInfo() { + return { + codeId: 0, + creator: "", + admin: "", + label: "", + created: undefined, + ibcPortId: "", + extension: undefined, + }; +} +exports.ContractInfo = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.created !== undefined) { + exports.AbsoluteTxPosition.encode(message.created, writer.uint32(42).fork()).ldelim(); + } + if (message.ibcPortId !== "") { + writer.uint32(50).string(message.ibcPortId); + } + if (message.extension !== undefined) { + any_1.Any.encode(message.extension, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.admin = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.label = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.created = exports.AbsoluteTxPosition.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.ibcPortId = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.extension = any_1.Any.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + label: isSet(object.label) ? globalThis.String(object.label) : "", + created: isSet(object.created) + ? exports.AbsoluteTxPosition.fromJSON(object.created) + : undefined, + ibcPortId: isSet(object.ibcPortId) + ? globalThis.String(object.ibcPortId) + : "", + extension: isSet(object.extension) + ? any_1.Any.fromJSON(object.extension) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.created !== undefined) { + obj.created = exports.AbsoluteTxPosition.toJSON(message.created); + } + if (message.ibcPortId !== "") { + obj.ibcPortId = message.ibcPortId; + } + if (message.extension !== undefined) { + obj.extension = any_1.Any.toJSON(message.extension); + } + return obj; + }, + create(base) { + return exports.ContractInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractInfo(); + message.codeId = object.codeId ?? 0; + message.creator = object.creator ?? ""; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.created = + object.created !== undefined && object.created !== null + ? exports.AbsoluteTxPosition.fromPartial(object.created) + : undefined; + message.ibcPortId = object.ibcPortId ?? ""; + message.extension = + object.extension !== undefined && object.extension !== null + ? any_1.Any.fromPartial(object.extension) + : undefined; + return message; + }, +}; +function createBaseContractCodeHistoryEntry() { + return { + operation: 0, + codeId: 0, + updated: undefined, + msg: new Uint8Array(0), + }; +} +exports.ContractCodeHistoryEntry = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.operation !== 0) { + writer.uint32(8).int32(message.operation); + } + if (message.codeId !== 0) { + writer.uint32(16).uint64(message.codeId); + } + if (message.updated !== undefined) { + exports.AbsoluteTxPosition.encode(message.updated, writer.uint32(26).fork()).ldelim(); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractCodeHistoryEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.operation = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.updated = exports.AbsoluteTxPosition.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + operation: isSet(object.operation) + ? contractCodeHistoryOperationTypeFromJSON(object.operation) + : 0, + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + updated: isSet(object.updated) + ? exports.AbsoluteTxPosition.fromJSON(object.updated) + : undefined, + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.operation !== 0) { + obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation); + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.updated !== undefined) { + obj.updated = exports.AbsoluteTxPosition.toJSON(message.updated); + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return exports.ContractCodeHistoryEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractCodeHistoryEntry(); + message.operation = object.operation ?? 0; + message.codeId = object.codeId ?? 0; + message.updated = + object.updated !== undefined && object.updated !== null + ? exports.AbsoluteTxPosition.fromPartial(object.updated) + : undefined; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseAbsoluteTxPosition() { + return { blockHeight: 0, txIndex: 0 }; +} +exports.AbsoluteTxPosition = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.blockHeight !== 0) { + writer.uint32(8).uint64(message.blockHeight); + } + if (message.txIndex !== 0) { + writer.uint32(16).uint64(message.txIndex); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAbsoluteTxPosition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.txIndex = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blockHeight: isSet(object.blockHeight) + ? globalThis.Number(object.blockHeight) + : 0, + txIndex: isSet(object.txIndex) ? globalThis.Number(object.txIndex) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.txIndex !== 0) { + obj.txIndex = Math.round(message.txIndex); + } + return obj; + }, + create(base) { + return exports.AbsoluteTxPosition.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAbsoluteTxPosition(); + message.blockHeight = object.blockHeight ?? 0; + message.txIndex = object.txIndex ?? 0; + return message; + }, +}; +function createBaseModel() { + return { key: new Uint8Array(0), value: new Uint8Array(0) }; +} +exports.Model = { + encode(message, writer = new binary_1.BinaryWriter()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + create(base) { + return exports.Model.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseModel(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/client/index.d.ts b/dist/module/client/index.d.ts new file mode 100644 index 0000000..ea3cfba --- /dev/null +++ b/dist/module/client/index.d.ts @@ -0,0 +1,82 @@ +import { CoreumNetworkConfig, CoreumNetworkKey } from "../types/coreum"; +import { EncodeObject, OfflineSigner, Registry } from "@cosmjs/proto-signing"; +import { TxRaw } from "../cosmos"; +import { ExtensionWallets, FeeCalculation, ClientQueryClient } from "../types"; +import { DeliverTxResponse, GasPrice, StargateClient } from "@cosmjs/stargate"; +import EventEmitter from "eventemitter3"; +import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; +interface WithExtensionOptions { + withWS?: boolean; +} +interface WithMnemonicOptions { + withWS?: boolean; +} +interface ClientProps { + network?: CoreumNetworkKey | string; + custom_ws_endpoint?: string; + custom_node_endpoint?: string; + tx_memo?: string; + /** Allow http:// and ws:// endpoints (development only). */ + allowInsecureEndpoints?: boolean; +} +export declare class Client { + private _tmClient; + private _queryClient; + private _wsClient; + private _client; + private _address; + private _feeModel; + private _eventSequence; + private readonly _config; + private readonly _customWsEndpoint?; + private readonly _customNodeEndpoint?; + private readonly _txMemo?; + private readonly _endpointOptions; + get config(): Readonly; + get queryClients(): ClientQueryClient | undefined; + constructor(props?: ClientProps); + disconnect(): void; + get address(): string | undefined; + get stargate(): SigningCosmWasmClient | StargateClient | undefined; + addCustomSigner(offlineSigner: OfflineSigner): Promise; + connect(options?: { + withWS?: boolean; + }): Promise; + connectWithExtension(extension?: ExtensionWallets, options?: WithExtensionOptions): Promise; + connectWithMnemonic(mnemonic: string, options?: WithMnemonicOptions): Promise; + getTxFee(msgs: readonly EncodeObject[]): Promise; + calculateGas(msgs: readonly EncodeObject[], options?: { + fromAddress?: string; + gasAdjustment?: number; + }): Promise; + getGasPrice(): Promise; + broadcastTx(transaction: Uint8Array, options?: { + timeoutMs?: number; + pollIntervalMs?: number; + }): Promise; + sendTx(msgs: readonly EncodeObject[], memo?: string): Promise; + signTx(msgs: readonly EncodeObject[], memo?: string, customSequence?: number): Promise; + subscribeToEvent(event: string): Promise<{ + events: EventEmitter; + unsubscribe: () => void; + }>; + createMultisigAccount(addresses: string[], threshold?: number): Promise; + static getRegistry(): Registry; + private _formatMemo; + private _getRpcEndpoint; + private _getWsEndpoint; + private _getWalletConfig; + private _assertConnectedAddress; + private _getGasPrice; + private _buildTxForSimulation; + private _isSigningClientInit; + private _initTendermintClient; + private _initQueryClient; + private _initFeeModel; + private _initWsClient; + private _createClient; + private _getKeplrSigner; + private _getCosmostationSigner; + private _getLeapSigner; +} +export {}; diff --git a/dist/module/client/index.js b/dist/module/client/index.js new file mode 100644 index 0000000..f1eabb1 --- /dev/null +++ b/dist/module/client/index.js @@ -0,0 +1,502 @@ +import { coreumRegistry, coreumAminoConverters, } from "../coreum"; +import { cosmwasmRegistry } from "../wasm/v1"; +import { setupFTExtension } from "../coreum/extensions/ft"; +import { setupNFTExtension } from "../coreum/extensions/nft"; +import { setupNFTBetaExtension } from "../coreum/extensions/nftbeta"; +import { setupDexExtension } from "../coreum/extensions/dex"; +import { connectKeplr, connectCosmostation, getCosmosOfflineSigner, connectLeap, getLeapOfflineSigner, getKeplrOfflineSigner, } from "../services"; +import { COREUM_CONFIG, } from "../types/coreum"; +import { QueryClientImpl as FeeModelClient } from "../coreum/feemodel/v1/query"; +import { Registry, } from "@cosmjs/proto-signing"; +import { Tendermint37Client, WebsocketClient } from "@cosmjs/tendermint-rpc"; +import { TxRaw } from "../cosmos"; +import { SignMode } from "cosmjs-types/cosmos/tx/signing/v1beta1/signing"; +import { ServiceClientImpl as TxServiceClient } from "cosmjs-types/cosmos/tx/v1beta1/service"; +import { PubKey } from "cosmjs-types/cosmos/crypto/secp256k1/keys"; +import { TxBody as TxBodyProto, AuthInfo as AuthInfoProto, } from "cosmjs-types/cosmos/tx/v1beta1/tx"; +import { ExtensionWallets } from "../types"; +import { assertValidCoreumAddress, generateWalletFromMnemonic, generateMultisigFromPubkeys, isValidCoreumAddress, } from "../utils"; +import { validateRpcEndpoint, validateWsEndpoint } from "../utils/endpoints"; +import { toTxJsError, normalizeWalletError } from "../errors"; +import { GasPrice, QueryClient, StargateClient, calculateFee, createProtobufRpcClient, decodeCosmosSdkDecFromProto, defaultRegistryTypes, setupAuthExtension, setupFeegrantExtension, setupIbcExtension, setupMintExtension, setupStakingExtension, setupTxExtension, } from "@cosmjs/stargate"; +import { toBech32 } from "@cosmjs/encoding"; +import { sha256, ripemd160 } from "@cosmjs/crypto"; +import { setupBankExtension, setupGovExtension, setupDistributionExtension, } from "../cosmos/extensions"; +import EventEmitter from "eventemitter3"; +import { parseSubscriptionEvents } from "../utils/event"; +import { cosmos } from "@cosmostation/extension-client"; +import { SigningCosmWasmClient, setupWasmExtension, } from "@cosmjs/cosmwasm-stargate"; +import BigNumber from "bignumber.js"; +const MAX_EVENT_QUERY_LENGTH = 512; +function isSigningClient(object) { + return (typeof object === "object" && + object !== null && + "signAndBroadcast" in object); +} +export class Client { + _tmClient; + _queryClient; + _wsClient; + _client; + _address; + _feeModel; + _eventSequence = 0; + _config; + _customWsEndpoint; + _customNodeEndpoint; + _txMemo; + _endpointOptions; + get config() { + return this._config; + } + get queryClients() { + return this._queryClient; + } + constructor(props) { + const networkKey = (props?.network ?? "mainnet"); + const baseConfig = COREUM_CONFIG[networkKey]; + if (!baseConfig) { + throw new Error(`Invalid network "${props?.network}". Expected one of: mainnet, testnet, devnet`); + } + if (props?.custom_node_endpoint && !props.network) { + throw new Error("If using a custom node, please specify the type of network."); + } + this._endpointOptions = { + allowInsecure: props?.allowInsecureEndpoints ?? false, + }; + this._config = Object.freeze({ ...baseConfig }); + this._txMemo = props?.tx_memo; + this._customNodeEndpoint = props?.custom_node_endpoint + ? validateRpcEndpoint(props.custom_node_endpoint, this._endpointOptions) + : undefined; + this._customWsEndpoint = props?.custom_ws_endpoint + ? validateWsEndpoint(props.custom_ws_endpoint, this._endpointOptions) + : undefined; + } + disconnect() { + if (this._client) { + this._client.disconnect(); + this._client = undefined; + } + if (this._tmClient) { + this._tmClient.disconnect(); + this._tmClient = undefined; + } + if (this._wsClient) { + this._wsClient.disconnect(); + this._wsClient = undefined; + } + this._address = undefined; + this._queryClient = undefined; + this._eventSequence = 0; + this._feeModel = undefined; + } + get address() { + return this._address; + } + get stargate() { + return this._client; + } + async addCustomSigner(offlineSigner) { + try { + const accounts = await offlineSigner.getAccounts(); + if (accounts.length === 0) { + throw new Error("Offline signer returned no accounts"); + } + assertValidCoreumAddress(accounts[0].address, this._config.chain_bech32_prefix); + if (!this._tmClient) { + await this._initTendermintClient(this._getRpcEndpoint()); + this._initQueryClient(); + this._initFeeModel(); + } + await this._createClient(offlineSigner); + } + catch (error) { + throw toTxJsError("addCustomSigner", error); + } + } + async connect(options) { + await this._initTendermintClient(this._getRpcEndpoint()); + await this._createClient(); + this._initQueryClient(); + this._initFeeModel(); + if (options?.withWS) { + await this._initWsClient(this._getWsEndpoint()); + } + } + async connectWithExtension(extension = ExtensionWallets.KEPLR, options) { + try { + const walletConfig = this._getWalletConfig(); + let offlineSigner; + switch (extension) { + case ExtensionWallets.COSMOSTATION: + offlineSigner = await this._getCosmostationSigner(walletConfig); + break; + case ExtensionWallets.LEAP: + offlineSigner = await this._getLeapSigner(walletConfig); + break; + default: + offlineSigner = await this._getKeplrSigner(walletConfig); + } + await this._initTendermintClient(this._getRpcEndpoint()); + await this._createClient(offlineSigner); + this._initQueryClient(); + this._initFeeModel(); + if (options?.withWS) { + await this._initWsClient(this._getWsEndpoint()); + } + } + catch (error) { + throw normalizeWalletError("connectWithExtension", error); + } + } + async connectWithMnemonic(mnemonic, options) { + try { + const offlineSigner = await generateWalletFromMnemonic(mnemonic, this._config.chain_bech32_prefix); + await this._initTendermintClient(this._getRpcEndpoint()); + this._initQueryClient(); + this._initFeeModel(); + await this._createClient(offlineSigner); + if (options?.withWS) { + await this._initWsClient(this._getWsEndpoint()); + } + } + catch (error) { + throw toTxJsError("connectWithMnemonic", error); + } + } + async getTxFee(msgs) { + this._isSigningClientInit(); + this._assertConnectedAddress(); + const signer = this._client; + const gasPrice = await this._getGasPrice(); + const gasWanted = await signer.simulate(this._address, msgs, ""); + const totalGasWanted = new BigNumber(gasWanted) + .multipliedBy(1.2) + .integerValue() + .toNumber(); + return { + gas_wanted: totalGasWanted, + fee: calculateFee(totalGasWanted, gasPrice), + }; + } + async calculateGas(msgs, options) { + if (!this._queryClient) { + throw new Error("Query client not initialized. Call connect() first."); + } + const { fromAddress, gasAdjustment = 1.2 } = options || {}; + if (fromAddress) { + assertValidCoreumAddress(fromAddress, this._config.chain_bech32_prefix); + } + let simAddress; + if (fromAddress) { + simAddress = fromAddress; + } + else { + const dummyHash = sha256(new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])); + const addressBytes = dummyHash.slice(0, 20); + simAddress = toBech32(this._config.chain_bech32_prefix, addressBytes); + } + let accountNumber = 0; + let sequence = 0; + if (fromAddress && this._client) { + try { + const account = await this._client.getAccount(fromAddress); + if (account) { + accountNumber = account.accountNumber; + sequence = account.sequence; + } + } + catch { + // If account doesn't exist, use defaults (0, 0) + } + } + const txBytes = await this._buildTxForSimulation(msgs, simAddress, accountNumber, sequence); + const rpcClient = createProtobufRpcClient(this._queryClient); + const txService = new TxServiceClient(rpcClient); + const simulateResponse = await txService.Simulate({ + txBytes: txBytes, + }); + if (!simulateResponse.gasInfo) { + throw new Error("Simulation failed: no gas info returned"); + } + const gasUsed = Number(simulateResponse.gasInfo.gasUsed || 0); + return Math.ceil(gasUsed * gasAdjustment); + } + async getGasPrice() { + return this._getGasPrice(); + } + async broadcastTx(transaction, options) { + try { + if (!this._client) { + throw new Error("Client is not connected"); + } + return await this._client.broadcastTx(transaction, options?.timeoutMs, options?.pollIntervalMs); + } + catch (error) { + throw toTxJsError("broadcastTx", error); + } + } + async sendTx(msgs, memo) { + try { + this._isSigningClientInit(); + this._assertConnectedAddress(); + const { fee } = await this.getTxFee(msgs); + return await this._client.signAndBroadcast(this._address, msgs, fee, this._formatMemo(memo)); + } + catch (error) { + throw toTxJsError("sendTx", error); + } + } + async signTx(msgs, memo = "", customSequence) { + try { + this._isSigningClientInit(); + this._assertConnectedAddress(); + const signingClient = this._client; + const account = await signingClient.getAccount(this._address); + if (!account) { + throw new Error(`Account not found for address ${this._address}`); + } + const { accountNumber, sequence } = account; + const { fee } = await this.getTxFee(msgs); + return signingClient.sign(this._address, msgs, fee, this._formatMemo(memo), { + accountNumber, + sequence: customSequence ?? sequence, + chainId: this._config.chain_id, + }); + } + catch (error) { + throw toTxJsError("signTx", error); + } + } + async subscribeToEvent(event) { + try { + if (!event || event.length > MAX_EVENT_QUERY_LENGTH) { + throw new Error("Invalid event query"); + } + if (this._wsClient === undefined) { + throw new Error("No Websocket client initialized"); + } + const emitter = new EventEmitter(); + const stream = this._wsClient.listen({ + jsonrpc: "2.0", + method: "subscribe", + id: this._eventSequence, + params: { query: event }, + }); + const listener = { + next: (x) => { + emitter.emit(event, { + data: x.data, + events: x.events ? parseSubscriptionEvents(x.events) : x, + }); + }, + error: (err) => { + emitter.emit("subscription-error", err); + }, + complete: () => { + emitter.emit("subscription-complete", { event }); + }, + }; + const subscription = stream.subscribe(listener); + this._eventSequence++; + return { + events: emitter, + unsubscribe: subscription.unsubscribe, + }; + } + catch (error) { + throw toTxJsError("subscribeToEvent", error); + } + } + async createMultisigAccount(addresses, threshold = 2) { + try { + if (addresses.length < 2) { + throw new Error("addresses param must be at least of length: 2"); + } + if (!this._client) { + throw new Error("Client is not connected"); + } + const pubkeys = []; + for (const address of addresses) { + assertValidCoreumAddress(address, this._config.chain_bech32_prefix); + const account = await this._client.getAccount(address); + if (!account?.pubkey) { + throw new Error(`${address} has no pubkey on chain, this address will need to send a transaction to appear on chain.`); + } + pubkeys.push(account.pubkey.value); + } + return generateMultisigFromPubkeys(pubkeys, threshold, this._config.chain_bech32_prefix); + } + catch (error) { + throw toTxJsError("createMultisigAccount", error); + } + } + static getRegistry() { + const registryTypes = [ + ...defaultRegistryTypes, + ...coreumRegistry, + ...cosmwasmRegistry, + ]; + return new Registry(registryTypes); + } + _formatMemo(memo) { + if (this._txMemo) { + return memo ? `${this._txMemo} - ${memo}` : this._txMemo; + } + return memo || ""; + } + _getRpcEndpoint() { + return this._customNodeEndpoint ?? this._config.chain_rpc_endpoint; + } + _getWsEndpoint() { + return this._customWsEndpoint ?? this._config.chain_ws_endpoint; + } + _getWalletConfig() { + return Object.freeze({ + ...this._config, + chain_rpc_endpoint: this._getRpcEndpoint(), + chain_ws_endpoint: this._getWsEndpoint(), + }); + } + _assertConnectedAddress() { + if (!this._address) { + throw new Error("No connected wallet address"); + } + if (!isValidCoreumAddress(this._address, this._config.chain_bech32_prefix)) { + throw new Error(`Invalid connected address: ${this._address}`); + } + } + async _getGasPrice() { + const gasPriceMultiplier = 1.1; + const feemodelParams = await this._feeModel.Params({}); + const minGasPriceRes = await this._feeModel.MinGasPrice({}); + const minGasPrice = decodeCosmosSdkDecFromProto(minGasPriceRes.minGasPrice?.amount || ""); + let gasPrice = minGasPrice.toFloatApproximation() * gasPriceMultiplier; + const initialGasPrice = decodeCosmosSdkDecFromProto(feemodelParams.params?.model?.initialGasPrice || "").toFloatApproximation(); + if (gasPrice > initialGasPrice) { + gasPrice = initialGasPrice; + } + return GasPrice.fromString(`${gasPrice}${minGasPriceRes.minGasPrice?.denom || ""}`); + } + async _buildTxForSimulation(msgs, fromAddress, accountNumber = 0, sequence = 0) { + if (!this._queryClient) { + throw new Error("Query client not initialized. Call connect() first."); + } + const registry = Client.getRegistry(); + const dummyPubKeyBytes = new Uint8Array(33).fill(0); + dummyPubKeyBytes[0] = 0x02; + const dummyPubKey = { + key: dummyPubKeyBytes, + }; + const pubkeyHash = sha256(dummyPubKeyBytes); + const addressBytes = ripemd160(pubkeyHash).slice(0, 20); + const derivedAddress = toBech32(this._config.chain_bech32_prefix, addressBytes); + const finalAddress = fromAddress || derivedAddress; + const signerInfo = { + publicKey: { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: PubKey.encode(dummyPubKey).finish(), + }, + modeInfo: { + single: { + mode: SignMode.SIGN_MODE_DIRECT, + }, + }, + sequence: BigInt(sequence), + }; + const fee = { + amount: [], + gasLimit: BigInt(0), + payer: "", + granter: "", + }; + const authInfo = { + signerInfos: [signerInfo], + fee: fee, + }; + const body = { + messages: msgs.map((msg) => { + const encoded = registry.encode(msg); + return { + typeUrl: msg.typeUrl, + value: encoded, + }; + }), + memo: "", + timeoutHeight: BigInt(0), + extensionOptions: [], + nonCriticalExtensionOptions: [], + }; + const bodyBytes = TxBodyProto.encode(body).finish(); + const authInfoBytes = AuthInfoProto.encode(authInfo).finish(); + const dummySignature = new Uint8Array(64).fill(0); + const txRaw = { + bodyBytes: bodyBytes, + authInfoBytes: authInfoBytes, + signatures: [dummySignature], + }; + return TxRaw.encode(txRaw).finish(); + } + _isSigningClientInit() { + if (!this._client || !isSigningClient(this._client)) { + throw new Error("Signing Client is not initialized"); + } + } + async _initTendermintClient(rpcEndpoint) { + this._tmClient = await Tendermint37Client.connect(rpcEndpoint); + } + _initQueryClient() { + this._queryClient = QueryClient.withExtensions(this._tmClient, setupFTExtension, setupNFTExtension, setupNFTBetaExtension, setupStakingExtension, setupBankExtension, setupDistributionExtension, setupTxExtension, setupAuthExtension, setupMintExtension, setupFeegrantExtension, setupGovExtension, setupIbcExtension, setupWasmExtension, setupDexExtension); + } + _initFeeModel() { + const rpcClient = createProtobufRpcClient(this._queryClient); + this._feeModel = new FeeModelClient(rpcClient); + } + async _initWsClient(wsEndpoint) { + this._wsClient = new WebsocketClient(wsEndpoint); + await this.subscribeToEvent("tm.event='NewBlock'"); + } + async _createClient(offlineSigner) { + const registry = Client.getRegistry(); + const clientOptions = { + registry, + gasPrice: GasPrice.fromString(this._config.gas_price), + }; + if (!offlineSigner) { + if (!this._tmClient) { + throw new Error("Tendermint client is not initialized"); + } + this._client = await StargateClient.create(this._tmClient); + return; + } + const [{ address }] = await offlineSigner.getAccounts(); + this._address = address; + if (this._tmClient) { + this._client = await SigningCosmWasmClient.createWithSigner(this._tmClient, offlineSigner, clientOptions); + } + else { + this._client = await SigningCosmWasmClient.connectWithSigner(this._getRpcEndpoint(), offlineSigner, clientOptions); + } + const clientWithAmino = this._client; + // CosmJS exposes aminoTypes as a private field; merge Coreum converters at runtime. + clientWithAmino.aminoTypes.register = { + ...clientWithAmino.aminoTypes.register, + ...coreumAminoConverters, + }; + } + async _getKeplrSigner(walletConfig) { + await connectKeplr(walletConfig); + return getKeplrOfflineSigner(walletConfig.chain_id); + } + async _getCosmostationSigner(walletConfig) { + await connectCosmostation(walletConfig); + const provider = await cosmos(); + await provider.requestAccount(walletConfig.chain_name); + return getCosmosOfflineSigner(walletConfig.chain_id); + } + async _getLeapSigner(walletConfig) { + await connectLeap(walletConfig); + return getLeapOfflineSigner(walletConfig.chain_id); + } +} diff --git a/dist/module/coreum/amino/index.d.ts b/dist/module/coreum/amino/index.d.ts new file mode 100644 index 0000000..e927ca0 --- /dev/null +++ b/dist/module/coreum/amino/index.d.ts @@ -0,0 +1 @@ +export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./types"; diff --git a/dist/module/coreum/amino/index.js b/dist/module/coreum/amino/index.js new file mode 100644 index 0000000..e927ca0 --- /dev/null +++ b/dist/module/coreum/amino/index.js @@ -0,0 +1 @@ +export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./types"; diff --git a/dist/module/coreum/amino/types.d.ts b/dist/module/coreum/amino/types.d.ts new file mode 100644 index 0000000..70998aa --- /dev/null +++ b/dist/module/coreum/amino/types.d.ts @@ -0,0 +1,7 @@ +import { AminoConverters, AminoTypes } from "@cosmjs/stargate"; +export declare const ftAminoConverters: AminoConverters; +export declare const dexAminoConverters: AminoConverters; +export declare const nftAminoConverters: AminoConverters; +export declare const nftBetaAminoConverters: AminoConverters; +export declare const coreumAminoConverters: AminoConverters; +export declare function createCoreumAminoTypes(): AminoTypes; diff --git a/dist/module/coreum/amino/types.js b/dist/module/coreum/amino/types.js new file mode 100644 index 0000000..3a4396c --- /dev/null +++ b/dist/module/coreum/amino/types.js @@ -0,0 +1,564 @@ +import { AminoTypes } from "@cosmjs/stargate"; +// FT (Fungible Token) Amino Types +export const ftAminoConverters = { + // MsgIssue - Issue new fungible token + "/coreum.asset.ft.v1.MsgIssue": { + aminoType: "aseestft/MsgIssue", + toAmino: ({ issuer, symbol, subunit, precision, initialAmount, description, features, burnRate, sendCommissionRate, uri, uriHash, extensionSettings, dexSettings, }) => ({ + issuer, + symbol, + subunit, + precision, + initial_amount: initialAmount, + description, + features, + burn_rate: burnRate, + send_commission_rate: sendCommissionRate, + uri, + uri_hash: uriHash, + extension_settings: extensionSettings, + dex_settings: dexSettings, + }), + fromAmino: ({ issuer, symbol, subunit, precision, initial_amount, description, features, burn_rate, send_commission_rate, uri, uri_hash, extension_settings, dex_settings, }) => ({ + issuer, + symbol, + subunit, + precision, + initialAmount: initial_amount, + description, + features, + burnRate: burn_rate, + sendCommissionRate: send_commission_rate, + uri, + uriHash: uri_hash, + extensionSettings: extension_settings, + dexSettings: dex_settings, + }), + }, + // MsgMint - Mint new fungible tokens + "/coreum.asset.ft.v1.MsgMint": { + aminoType: "aseestft/MsgMint", + toAmino: ({ sender, coin, recipient }) => ({ + sender, + coin, + recipient, + }), + fromAmino: ({ sender, coin, recipient }) => ({ + sender, + coin, + recipient, + }), + }, + // MsgBurn - Burn fungible tokens + "/coreum.asset.ft.v1.MsgBurn": { + aminoType: "aseestft/MsgBurn", + toAmino: ({ sender, coin }) => ({ + sender, + coin, + }), + fromAmino: ({ sender, coin }) => ({ + sender, + coin, + }), + }, + // MsgFreeze - Freeze fungible tokens + "/coreum.asset.ft.v1.MsgFreeze": { + aminoType: "aseestft/MsgFreeze", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgUnfreeze - Unfreeze fungible tokens + "/coreum.asset.ft.v1.MsgUnfreeze": { + aminoType: "aseestft/MsgUnfreeze", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgSetFrozen - Set frozen amount + "/coreum.asset.ft.v1.MsgSetFrozen": { + aminoType: "aseestft/MsgSetFrozen", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgGloballyFreeze - Globally freeze token + "/coreum.asset.ft.v1.MsgGloballyFreeze": { + aminoType: "aseestft/MsgGloballyFreeze", + toAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + fromAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + }, + // MsgGloballyUnfreeze - Globally unfreeze token + "/coreum.asset.ft.v1.MsgGloballyUnfreeze": { + aminoType: "aseestft/MsgGloballyUnfreeze", + toAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + fromAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + }, + // MsgClawback - Clawback tokens + "/coreum.asset.ft.v1.MsgClawback": { + aminoType: "aseestft/MsgClawback", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgSetWhitelistedLimit - Set whitelisted limit + "/coreum.asset.ft.v1.MsgSetWhitelistedLimit": { + aminoType: "aseestft/MsgSetWhitelistedLimit", + toAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + fromAmino: ({ sender, account, coin }) => ({ + sender, + account, + coin, + }), + }, + // MsgTransferAdmin - Transfer admin + "/coreum.asset.ft.v1.MsgTransferAdmin": { + aminoType: "aseestft/MsgTransferAdmin", + toAmino: ({ sender, account, denom }) => ({ + sender, + account, + denom, + }), + fromAmino: ({ sender, account, denom }) => ({ + sender, + account, + denom, + }), + }, + // MsgClearAdmin - Clear admin + "/coreum.asset.ft.v1.MsgClearAdmin": { + aminoType: "aseestft/MsgClearAdmin", + toAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + fromAmino: ({ sender, denom }) => ({ + sender, + denom, + }), + }, + // MsgUpgradeTokenV1 - Upgrade token to V1 + "/coreum.asset.ft.v1.MsgUpgradeTokenV1": { + aminoType: "aseestft/MsgUpgradeTokenV1", + toAmino: ({ sender, denom, ibcEnabled }) => ({ + sender, + denom, + ibc_enabled: ibcEnabled, + }), + fromAmino: ({ sender, denom, ibc_enabled }) => ({ + sender, + denom, + ibcEnabled: ibc_enabled, + }), + }, + // MsgUpdateParams - Update parameters + "/coreum.asset.ft.v1.MsgUpdateParams": { + aminoType: "aseestft/MsgUpdateParams", + toAmino: ({ authority, params }) => ({ + authority, + params, + }), + fromAmino: ({ authority, params }) => ({ + authority, + params, + }), + }, + // MsgUpdateDEXUnifiedRefAmount - Update DEX unified ref amount + "/coreum.asset.ft.v1.MsgUpdateDEXUnifiedRefAmount": { + aminoType: "aseestft/MsgUpdateDEXUnifiedRefAmount", + toAmino: ({ sender, denom, unifiedRefAmount, }) => ({ + sender, + denom, + unified_ref_amount: unifiedRefAmount, + }), + fromAmino: ({ sender, denom, unified_ref_amount, }) => ({ + sender, + denom, + unifiedRefAmount: unified_ref_amount, + }), + }, + // MsgUpdateDEXWhitelistedDenoms - Update DEX whitelisted denoms + "/coreum.asset.ft.v1.MsgUpdateDEXWhitelistedDenoms": { + aminoType: "aseestft/MsgUpdateDEXWhitelistedDenoms", + toAmino: ({ sender, denom, whitelistedDenoms, }) => ({ + sender, + denom, + whitelisted_denoms: whitelistedDenoms, + }), + fromAmino: ({ sender, denom, whitelisted_denoms, }) => ({ + sender, + denom, + whitelistedDenoms: whitelisted_denoms, + }), + }, +}; +// DEX Amino Types +export const dexAminoConverters = { + // MsgUpdateParams - Update DEX parameters + "/coreum.dex.v1.MsgUpdateParams": { + aminoType: "dex/MsgUpdateParams", + toAmino: ({ authority, params }) => ({ + authority, + params, + }), + fromAmino: ({ authority, params }) => ({ + authority, + params, + }), + }, + // MsgPlaceOrder - Place order on DEX + "/coreum.dex.v1.MsgPlaceOrder": { + aminoType: "dex/MsgPlaceOrder", + toAmino: ({ sender, type, id, baseDenom, quoteDenom, price, quantity, side, goodTil, timeInForce, }) => ({ + sender, + type, + id, + base_denom: baseDenom, + quote_denom: quoteDenom, + price, + quantity, + side, + good_til: goodTil + ? goodTil.goodTilBlockHeight != null + ? { blocks: String(goodTil.goodTilBlockHeight) } + : goodTil.goodTilBlockTime + ? { time: goodTil.goodTilBlockTime.toISOString() } + : undefined + : undefined, + time_in_force: timeInForce, // number + }), + fromAmino: ({ sender, type, id, base_denom, quote_denom, price, quantity, side, good_til, time_in_force, }) => ({ + sender, + type, + id, + baseDenom: base_denom, + quoteDenom: quote_denom, + price, + quantity, + side, + goodTil: good_til + ? good_til.blocks != null + ? { + goodTilBlockHeight: Number(good_til.blocks), + goodTilBlockTime: undefined, + } + : good_til.time != null + ? { + goodTilBlockHeight: 0, + goodTilBlockTime: new Date(good_til.time), + } + : undefined + : undefined, + timeInForce: time_in_force, // number -> enum + }), + }, + // MsgCancelOrder - Cancel order + "/coreum.dex.v1.MsgCancelOrder": { + aminoType: "dex/MsgCancelOrder", + toAmino: ({ sender, id }) => ({ + sender, + id, + }), + fromAmino: ({ sender, id }) => ({ + sender, + id, + }), + }, + // MsgCancelOrdersByDenom - Cancel orders by denom + "/coreum.dex.v1.MsgCancelOrdersByDenom": { + aminoType: "dex/MsgCancelOrdersByDenom", + toAmino: ({ sender, account, denom }) => ({ + sender, + account, + denom, + }), + fromAmino: ({ sender, account, denom }) => ({ + sender, + account, + denom, + }), + }, +}; +// NFT (Non-Fungible Token) Amino Types +export const nftAminoConverters = { + // MsgIssueClass - Issue new NFT class + "/coreum.asset.nft.v1.MsgIssueClass": { + aminoType: "assetnft/MsgIssueClass", + toAmino: ({ issuer, symbol, name, description, uri, uriHash, data, features, royaltyRate, }) => ({ + issuer, + symbol, + name, + description, + uri, + uri_hash: uriHash, + data, + features, + royalty_rate: royaltyRate, + }), + fromAmino: ({ issuer, symbol, name, description, uri, uri_hash, data, features, royalty_rate, }) => ({ + issuer, + symbol, + name, + description, + uri, + uriHash: uri_hash, + data, + features, + royaltyRate: royalty_rate, + }), + }, + // MsgMint - Mint NFT + "/coreum.asset.nft.v1.MsgMint": { + aminoType: "assetnft/MsgMint", + toAmino: ({ sender, classId, id, uri, uriHash, data, recipient, }) => ({ + sender, + class_id: classId, + id, + uri, + uri_hash: uriHash, + data, + recipient, + }), + fromAmino: ({ sender, class_id, id, uri, uri_hash, data, recipient, }) => ({ + sender, + classId: class_id, + id, + uri, + uriHash: uri_hash, + data, + recipient, + }), + }, + // MsgUpdateData - Update NFT data + "/coreum.asset.nft.v1.MsgUpdateData": { + aminoType: "assetnft/MsgUpdateData", + toAmino: ({ sender, classId, id, items }) => ({ + sender, + class_id: classId, + id, + items, + }), + fromAmino: ({ sender, class_id, id, items }) => ({ + sender, + classId: class_id, + id, + items, + }), + }, + // MsgBurn - Burn NFT + "/coreum.asset.nft.v1.MsgBurn": { + aminoType: "assetnft/MsgBurn", + toAmino: ({ sender, classId, id }) => ({ + sender, + class_id: classId, + id, + }), + fromAmino: ({ sender, class_id, id }) => ({ + sender, + classId: class_id, + id, + }), + }, + // MsgFreeze - Freeze NFT + "/coreum.asset.nft.v1.MsgFreeze": { + aminoType: "assetnft/MsgFreeze", + toAmino: ({ sender, classId, id }) => ({ + sender, + class_id: classId, + id, + }), + fromAmino: ({ sender, class_id, id }) => ({ + sender, + classId: class_id, + id, + }), + }, + // MsgUnfreeze - Unfreeze NFT + "/coreum.asset.nft.v1.MsgUnfreeze": { + aminoType: "assetnft/MsgUnfreeze", + toAmino: ({ sender, classId, id }) => ({ + sender, + class_id: classId, + id, + }), + fromAmino: ({ sender, class_id, id }) => ({ + sender, + classId: class_id, + id, + }), + }, + // MsgClassFreeze - Freeze NFT class for account + "/coreum.asset.nft.v1.MsgClassFreeze": { + aminoType: "assetnft/MsgClassFreeze", + toAmino: ({ sender, classId, account }) => ({ + sender, + class_id: classId, + account, + }), + fromAmino: ({ sender, class_id, account }) => ({ + sender, + classId: class_id, + account, + }), + }, + // MsgClassUnfreeze - Unfreeze NFT class for account + "/coreum.asset.nft.v1.MsgClassUnfreeze": { + aminoType: "assetnft/MsgClassUnfreeze", + toAmino: ({ sender, classId, account }) => ({ + sender, + class_id: classId, + account, + }), + fromAmino: ({ sender, class_id, account }) => ({ + sender, + classId: class_id, + account, + }), + }, + // MsgAddToWhitelist - Add account to NFT whitelist + "/coreum.asset.nft.v1.MsgAddToWhitelist": { + aminoType: "assetnft/MsgAddToWhitelist", + toAmino: ({ sender, classId, id, account }) => ({ + sender, + class_id: classId, + id, + account, + }), + fromAmino: ({ sender, class_id, id, account }) => ({ + sender, + classId: class_id, + id, + account, + }), + }, + // MsgRemoveFromWhitelist - Remove account from NFT whitelist + "/coreum.asset.nft.v1.MsgRemoveFromWhitelist": { + aminoType: "assetnft/MsgRemoveFromWhitelist", + toAmino: ({ sender, classId, id, account }) => ({ + sender, + class_id: classId, + id, + account, + }), + fromAmino: ({ sender, class_id, id, account, }) => ({ + sender, + classId: class_id, + id, + account, + }), + }, + // MsgAddToClassWhitelist - Add account to NFT class whitelist + "/coreum.asset.nft.v1.MsgAddToClassWhitelist": { + aminoType: "assetnft/MsgAddToClassWhitelist", + toAmino: ({ sender, classId, account }) => ({ + sender, + class_id: classId, + account, + }), + fromAmino: ({ sender, class_id, account, }) => ({ + sender, + classId: class_id, + account, + }), + }, + // MsgRemoveFromClassWhitelist - Remove account from NFT class whitelist + "/coreum.asset.nft.v1.MsgRemoveFromClassWhitelist": { + aminoType: "assetnft/MsgRemoveFromClassWhitelist", + toAmino: ({ sender, classId, account }) => ({ + sender, + class_id: classId, + account, + }), + fromAmino: ({ sender, class_id, account, }) => ({ + sender, + classId: class_id, + account, + }), + }, + // MsgUpdateParams - Update NFT module parameters + "/coreum.asset.nft.v1.MsgUpdateParams": { + aminoType: "assetnft/MsgUpdateParams", + toAmino: ({ authority, params }) => ({ + authority, + params, + }), + fromAmino: ({ authority, params }) => ({ + authority, + params, + }), + }, +}; +// NFT Beta Amino Types +export const nftBetaAminoConverters = { + // MsgSend - Send NFT + "/cosmos.nft.v1beta1.MsgSend": { + aminoType: "cosmos-sdk/MsgSend", + toAmino: ({ classId, id, sender, receiver }) => ({ + class_id: classId, + id, + sender, + receiver, + }), + fromAmino: ({ class_id, id, sender, receiver }) => ({ + classId: class_id, + id, + sender, + receiver, + }), + }, +}; +// Combined Amino Converters +export const coreumAminoConverters = { + ...ftAminoConverters, + ...dexAminoConverters, + ...nftAminoConverters, + // ...nftBetaAminoConverters, +}; +// Create AminoTypes instance +export function createCoreumAminoTypes() { + return new AminoTypes(coreumAminoConverters); +} diff --git a/dist/module/coreum/asset/ft/v1/authz.d.ts b/dist/module/coreum/asset/ft/v1/authz.d.ts new file mode 100644 index 0000000..154edbc --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/authz.d.ts @@ -0,0 +1,38 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** + * MintAuthorization allows the grantee to mint up to mint_limit coin from + * the granter's account. + */ +export interface MintAuthorization { + mintLimit: Coin[]; +} +/** + * BurnAuthorization allows the grantee to burn up to burn_limit coin from + * the granter's account. + */ +export interface BurnAuthorization { + burnLimit: Coin[]; +} +export declare const MintAuthorization: MessageFns; +export declare const BurnAuthorization: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/ft/v1/authz.js b/dist/module/coreum/asset/ft/v1/authz.js new file mode 100644 index 0000000..4a86155 --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/authz.js @@ -0,0 +1,119 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/authz.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +export const protobufPackage = "coreum.asset.ft.v1"; +function createBaseMintAuthorization() { + return { mintLimit: [] }; +} +export const MintAuthorization = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.mintLimit) { + Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMintAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.mintLimit.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mintLimit: globalThis.Array.isArray(object?.mintLimit) + ? object.mintLimit.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.mintLimit?.length) { + obj.mintLimit = message.mintLimit.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return MintAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMintAuthorization(); + message.mintLimit = object.mintLimit?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseBurnAuthorization() { + return { burnLimit: [] }; +} +export const BurnAuthorization = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.burnLimit) { + Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBurnAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.burnLimit.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + burnLimit: globalThis.Array.isArray(object?.burnLimit) + ? object.burnLimit.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.burnLimit?.length) { + obj.burnLimit = message.burnLimit.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return BurnAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBurnAuthorization(); + message.burnLimit = object.burnLimit?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; diff --git a/dist/module/coreum/asset/ft/v1/event.d.ts b/dist/module/coreum/asset/ft/v1/event.d.ts new file mode 100644 index 0000000..8c03d58 --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/event.d.ts @@ -0,0 +1,90 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DEXSettings, Feature } from "./token"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** EventIssued is emitted on MsgIssue. */ +export interface EventIssued { + denom: string; + issuer: string; + symbol: string; + subunit: string; + precision: number; + initialAmount: string; + description: string; + features: Feature[]; + burnRate: string; + sendCommissionRate: string; + uri: string; + uriHash: string; + admin: string; + dexSettings: DEXSettings | undefined; +} +export interface EventFrozenAmountChanged { + account: string; + denom: string; + previousAmount: string; + currentAmount: string; +} +export interface EventAmountClawedBack { + account: string; + denom: string; + amount: string; +} +export interface EventWhitelistedAmountChanged { + account: string; + denom: string; + previousAmount: string; + currentAmount: string; +} +export interface EventDEXLockedAmountChanged { + account: string; + denom: string; + previousAmount: string; + currentAmount: string; +} +export interface EventDEXExpectedToReceiveAmountChanged { + account: string; + denom: string; + previousAmount: string; + currentAmount: string; +} +export interface EventAdminTransferred { + denom: string; + previousAdmin: string; + currentAdmin: string; +} +export interface EventAdminCleared { + denom: string; + previousAdmin: string; +} +export interface EventDEXSettingsChanged { + previousSettings: DEXSettings | undefined; + newSettings: DEXSettings | undefined; +} +export declare const EventIssued: MessageFns; +export declare const EventFrozenAmountChanged: MessageFns; +export declare const EventAmountClawedBack: MessageFns; +export declare const EventWhitelistedAmountChanged: MessageFns; +export declare const EventDEXLockedAmountChanged: MessageFns; +export declare const EventDEXExpectedToReceiveAmountChanged: MessageFns; +export declare const EventAdminTransferred: MessageFns; +export declare const EventAdminCleared: MessageFns; +export declare const EventDEXSettingsChanged: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/ft/v1/event.js b/dist/module/coreum/asset/ft/v1/event.js new file mode 100644 index 0000000..fb678ab --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/event.js @@ -0,0 +1,1027 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/event.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DEXSettings, featureFromJSON, featureToJSON } from "./token"; +export const protobufPackage = "coreum.asset.ft.v1"; +function createBaseEventIssued() { + return { + denom: "", + issuer: "", + symbol: "", + subunit: "", + precision: 0, + initialAmount: "", + description: "", + features: [], + burnRate: "", + sendCommissionRate: "", + uri: "", + uriHash: "", + admin: "", + dexSettings: undefined, + }; +} +export const EventIssued = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.subunit !== "") { + writer.uint32(34).string(message.subunit); + } + if (message.precision !== 0) { + writer.uint32(40).uint32(message.precision); + } + if (message.initialAmount !== "") { + writer.uint32(50).string(message.initialAmount); + } + if (message.description !== "") { + writer.uint32(58).string(message.description); + } + writer.uint32(66).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.burnRate !== "") { + writer.uint32(74).string(message.burnRate); + } + if (message.sendCommissionRate !== "") { + writer.uint32(82).string(message.sendCommissionRate); + } + if (message.uri !== "") { + writer.uint32(90).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(98).string(message.uriHash); + } + if (message.admin !== "") { + writer.uint32(106).string(message.admin); + } + if (message.dexSettings !== undefined) { + DEXSettings.encode(message.dexSettings, writer.uint32(114).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventIssued(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.symbol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.subunit = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.precision = reader.uint32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.initialAmount = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.description = reader.string(); + continue; + } + case 8: { + if (tag === 64) { + message.features.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag !== 74) { + break; + } + message.burnRate = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.sendCommissionRate = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.uri = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.admin = reader.string(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.dexSettings = DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + subunit: isSet(object.subunit) ? globalThis.String(object.subunit) : "", + precision: isSet(object.precision) + ? globalThis.Number(object.precision) + : 0, + initialAmount: isSet(object.initialAmount) + ? globalThis.String(object.initialAmount) + : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => featureFromJSON(e)) + : [], + burnRate: isSet(object.burnRate) + ? globalThis.String(object.burnRate) + : "", + sendCommissionRate: isSet(object.sendCommissionRate) + ? globalThis.String(object.sendCommissionRate) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + dexSettings: isSet(object.dexSettings) + ? DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.subunit !== "") { + obj.subunit = message.subunit; + } + if (message.precision !== 0) { + obj.precision = Math.round(message.precision); + } + if (message.initialAmount !== "") { + obj.initialAmount = message.initialAmount; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.features?.length) { + obj.features = message.features.map((e) => featureToJSON(e)); + } + if (message.burnRate !== "") { + obj.burnRate = message.burnRate; + } + if (message.sendCommissionRate !== "") { + obj.sendCommissionRate = message.sendCommissionRate; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.dexSettings !== undefined) { + obj.dexSettings = DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return EventIssued.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventIssued(); + message.denom = object.denom ?? ""; + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.subunit = object.subunit ?? ""; + message.precision = object.precision ?? 0; + message.initialAmount = object.initialAmount ?? ""; + message.description = object.description ?? ""; + message.features = object.features?.map((e) => e) || []; + message.burnRate = object.burnRate ?? ""; + message.sendCommissionRate = object.sendCommissionRate ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.admin = object.admin ?? ""; + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +function createBaseEventFrozenAmountChanged() { + return { account: "", denom: "", previousAmount: "", currentAmount: "" }; +} +export const EventFrozenAmountChanged = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.previousAmount !== "") { + writer.uint32(26).string(message.previousAmount); + } + if (message.currentAmount !== "") { + writer.uint32(34).string(message.currentAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventFrozenAmountChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.previousAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.currentAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAmount: isSet(object.previousAmount) + ? globalThis.String(object.previousAmount) + : "", + currentAmount: isSet(object.currentAmount) + ? globalThis.String(object.currentAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAmount !== "") { + obj.previousAmount = message.previousAmount; + } + if (message.currentAmount !== "") { + obj.currentAmount = message.currentAmount; + } + return obj; + }, + create(base) { + return EventFrozenAmountChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventFrozenAmountChanged(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.previousAmount = object.previousAmount ?? ""; + message.currentAmount = object.currentAmount ?? ""; + return message; + }, +}; +function createBaseEventAmountClawedBack() { + return { account: "", denom: "", amount: "" }; +} +export const EventAmountClawedBack = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(26).string(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAmountClawedBack(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.amount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + create(base) { + return EventAmountClawedBack.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAmountClawedBack(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseEventWhitelistedAmountChanged() { + return { account: "", denom: "", previousAmount: "", currentAmount: "" }; +} +export const EventWhitelistedAmountChanged = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.previousAmount !== "") { + writer.uint32(26).string(message.previousAmount); + } + if (message.currentAmount !== "") { + writer.uint32(34).string(message.currentAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventWhitelistedAmountChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.previousAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.currentAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAmount: isSet(object.previousAmount) + ? globalThis.String(object.previousAmount) + : "", + currentAmount: isSet(object.currentAmount) + ? globalThis.String(object.currentAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAmount !== "") { + obj.previousAmount = message.previousAmount; + } + if (message.currentAmount !== "") { + obj.currentAmount = message.currentAmount; + } + return obj; + }, + create(base) { + return EventWhitelistedAmountChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventWhitelistedAmountChanged(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.previousAmount = object.previousAmount ?? ""; + message.currentAmount = object.currentAmount ?? ""; + return message; + }, +}; +function createBaseEventDEXLockedAmountChanged() { + return { account: "", denom: "", previousAmount: "", currentAmount: "" }; +} +export const EventDEXLockedAmountChanged = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.previousAmount !== "") { + writer.uint32(26).string(message.previousAmount); + } + if (message.currentAmount !== "") { + writer.uint32(34).string(message.currentAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDEXLockedAmountChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.previousAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.currentAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAmount: isSet(object.previousAmount) + ? globalThis.String(object.previousAmount) + : "", + currentAmount: isSet(object.currentAmount) + ? globalThis.String(object.currentAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAmount !== "") { + obj.previousAmount = message.previousAmount; + } + if (message.currentAmount !== "") { + obj.currentAmount = message.currentAmount; + } + return obj; + }, + create(base) { + return EventDEXLockedAmountChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventDEXLockedAmountChanged(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.previousAmount = object.previousAmount ?? ""; + message.currentAmount = object.currentAmount ?? ""; + return message; + }, +}; +function createBaseEventDEXExpectedToReceiveAmountChanged() { + return { account: "", denom: "", previousAmount: "", currentAmount: "" }; +} +export const EventDEXExpectedToReceiveAmountChanged = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.previousAmount !== "") { + writer.uint32(26).string(message.previousAmount); + } + if (message.currentAmount !== "") { + writer.uint32(34).string(message.currentAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDEXExpectedToReceiveAmountChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.previousAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.currentAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAmount: isSet(object.previousAmount) + ? globalThis.String(object.previousAmount) + : "", + currentAmount: isSet(object.currentAmount) + ? globalThis.String(object.currentAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAmount !== "") { + obj.previousAmount = message.previousAmount; + } + if (message.currentAmount !== "") { + obj.currentAmount = message.currentAmount; + } + return obj; + }, + create(base) { + return EventDEXExpectedToReceiveAmountChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventDEXExpectedToReceiveAmountChanged(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + message.previousAmount = object.previousAmount ?? ""; + message.currentAmount = object.currentAmount ?? ""; + return message; + }, +}; +function createBaseEventAdminTransferred() { + return { denom: "", previousAdmin: "", currentAdmin: "" }; +} +export const EventAdminTransferred = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.previousAdmin !== "") { + writer.uint32(18).string(message.previousAdmin); + } + if (message.currentAdmin !== "") { + writer.uint32(26).string(message.currentAdmin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAdminTransferred(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.previousAdmin = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.currentAdmin = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAdmin: isSet(object.previousAdmin) + ? globalThis.String(object.previousAdmin) + : "", + currentAdmin: isSet(object.currentAdmin) + ? globalThis.String(object.currentAdmin) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAdmin !== "") { + obj.previousAdmin = message.previousAdmin; + } + if (message.currentAdmin !== "") { + obj.currentAdmin = message.currentAdmin; + } + return obj; + }, + create(base) { + return EventAdminTransferred.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAdminTransferred(); + message.denom = object.denom ?? ""; + message.previousAdmin = object.previousAdmin ?? ""; + message.currentAdmin = object.currentAdmin ?? ""; + return message; + }, +}; +function createBaseEventAdminCleared() { + return { denom: "", previousAdmin: "" }; +} +export const EventAdminCleared = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.previousAdmin !== "") { + writer.uint32(18).string(message.previousAdmin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAdminCleared(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.previousAdmin = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + previousAdmin: isSet(object.previousAdmin) + ? globalThis.String(object.previousAdmin) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.previousAdmin !== "") { + obj.previousAdmin = message.previousAdmin; + } + return obj; + }, + create(base) { + return EventAdminCleared.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAdminCleared(); + message.denom = object.denom ?? ""; + message.previousAdmin = object.previousAdmin ?? ""; + return message; + }, +}; +function createBaseEventDEXSettingsChanged() { + return { previousSettings: undefined, newSettings: undefined }; +} +export const EventDEXSettingsChanged = { + encode(message, writer = new BinaryWriter()) { + if (message.previousSettings !== undefined) { + DEXSettings.encode(message.previousSettings, writer.uint32(10).fork()).ldelim(); + } + if (message.newSettings !== undefined) { + DEXSettings.encode(message.newSettings, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventDEXSettingsChanged(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.previousSettings = DEXSettings.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.newSettings = DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + previousSettings: isSet(object.previousSettings) + ? DEXSettings.fromJSON(object.previousSettings) + : undefined, + newSettings: isSet(object.newSettings) + ? DEXSettings.fromJSON(object.newSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.previousSettings !== undefined) { + obj.previousSettings = DEXSettings.toJSON(message.previousSettings); + } + if (message.newSettings !== undefined) { + obj.newSettings = DEXSettings.toJSON(message.newSettings); + } + return obj; + }, + create(base) { + return EventDEXSettingsChanged.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventDEXSettingsChanged(); + message.previousSettings = + object.previousSettings !== undefined && object.previousSettings !== null + ? DEXSettings.fromPartial(object.previousSettings) + : undefined; + message.newSettings = + object.newSettings !== undefined && object.newSettings !== null + ? DEXSettings.fromPartial(object.newSettings) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/ft/v1/genesis.d.ts b/dist/module/coreum/asset/ft/v1/genesis.d.ts new file mode 100644 index 0000000..9c8069b --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/genesis.d.ts @@ -0,0 +1,61 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, Token } from "./token"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** GenesisState defines the module genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + /** tokens keep the fungible token state */ + tokens: Token[]; + /** frozen_balances contains the frozen balances on all of the accounts */ + frozenBalances: Balance[]; + /** whitelisted_balances contains the whitelisted balances on all of the accounts */ + whitelistedBalances: Balance[]; + /** pending_token_upgrades contains pending token upgrades. */ + pendingTokenUpgrades: PendingTokenUpgrade[]; + /** dex_locked_balances contains the DEX locked balances on all of the accounts */ + dexLockedBalances: Balance[]; + dexExpectedToReceiveBalances: Balance[]; + dexSettings: DEXSettingsWithDenom[]; +} +/** Balance defines an account address and balance pair used module genesis genesis state. */ +export interface Balance { + /** address is the address of the balance holder. */ + address: string; + /** coins defines the different coins this balance holds. */ + coins: Coin[]; +} +/** PendingTokenUpgrade stores the version of pending token upgrade. */ +export interface PendingTokenUpgrade { + denom: string; + version: number; +} +export interface DEXSettingsWithDenom { + denom: string; + dexSettings: DEXSettings | undefined; +} +export declare const GenesisState: MessageFns; +export declare const Balance: MessageFns; +export declare const PendingTokenUpgrade: MessageFns; +export declare const DEXSettingsWithDenom: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/ft/v1/genesis.js b/dist/module/coreum/asset/ft/v1/genesis.js new file mode 100644 index 0000000..dc13c29 --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/genesis.js @@ -0,0 +1,417 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/genesis.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, Token } from "./token"; +export const protobufPackage = "coreum.asset.ft.v1"; +function createBaseGenesisState() { + return { + params: undefined, + tokens: [], + frozenBalances: [], + whitelistedBalances: [], + pendingTokenUpgrades: [], + dexLockedBalances: [], + dexExpectedToReceiveBalances: [], + dexSettings: [], + }; +} +export const GenesisState = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.tokens) { + Token.encode(v, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.frozenBalances) { + Balance.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.whitelistedBalances) { + Balance.encode(v, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.pendingTokenUpgrades) { + PendingTokenUpgrade.encode(v, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.dexLockedBalances) { + Balance.encode(v, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.dexExpectedToReceiveBalances) { + Balance.encode(v, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.dexSettings) { + DEXSettingsWithDenom.encode(v, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokens.push(Token.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.frozenBalances.push(Balance.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.whitelistedBalances.push(Balance.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.pendingTokenUpgrades.push(PendingTokenUpgrade.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.dexLockedBalances.push(Balance.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.dexExpectedToReceiveBalances.push(Balance.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.dexSettings.push(DEXSettingsWithDenom.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + tokens: globalThis.Array.isArray(object?.tokens) + ? object.tokens.map((e) => Token.fromJSON(e)) + : [], + frozenBalances: globalThis.Array.isArray(object?.frozenBalances) + ? object.frozenBalances.map((e) => Balance.fromJSON(e)) + : [], + whitelistedBalances: globalThis.Array.isArray(object?.whitelistedBalances) + ? object.whitelistedBalances.map((e) => Balance.fromJSON(e)) + : [], + pendingTokenUpgrades: globalThis.Array.isArray(object?.pendingTokenUpgrades) + ? object.pendingTokenUpgrades.map((e) => PendingTokenUpgrade.fromJSON(e)) + : [], + dexLockedBalances: globalThis.Array.isArray(object?.dexLockedBalances) + ? object.dexLockedBalances.map((e) => Balance.fromJSON(e)) + : [], + dexExpectedToReceiveBalances: globalThis.Array.isArray(object?.dexExpectedToReceiveBalances) + ? object.dexExpectedToReceiveBalances.map((e) => Balance.fromJSON(e)) + : [], + dexSettings: globalThis.Array.isArray(object?.dexSettings) + ? object.dexSettings.map((e) => DEXSettingsWithDenom.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.tokens?.length) { + obj.tokens = message.tokens.map((e) => Token.toJSON(e)); + } + if (message.frozenBalances?.length) { + obj.frozenBalances = message.frozenBalances.map((e) => Balance.toJSON(e)); + } + if (message.whitelistedBalances?.length) { + obj.whitelistedBalances = message.whitelistedBalances.map((e) => Balance.toJSON(e)); + } + if (message.pendingTokenUpgrades?.length) { + obj.pendingTokenUpgrades = message.pendingTokenUpgrades.map((e) => PendingTokenUpgrade.toJSON(e)); + } + if (message.dexLockedBalances?.length) { + obj.dexLockedBalances = message.dexLockedBalances.map((e) => Balance.toJSON(e)); + } + if (message.dexExpectedToReceiveBalances?.length) { + obj.dexExpectedToReceiveBalances = + message.dexExpectedToReceiveBalances.map((e) => Balance.toJSON(e)); + } + if (message.dexSettings?.length) { + obj.dexSettings = message.dexSettings.map((e) => DEXSettingsWithDenom.toJSON(e)); + } + return obj; + }, + create(base) { + return GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.tokens = object.tokens?.map((e) => Token.fromPartial(e)) || []; + message.frozenBalances = + object.frozenBalances?.map((e) => Balance.fromPartial(e)) || []; + message.whitelistedBalances = + object.whitelistedBalances?.map((e) => Balance.fromPartial(e)) || []; + message.pendingTokenUpgrades = + object.pendingTokenUpgrades?.map((e) => PendingTokenUpgrade.fromPartial(e)) || []; + message.dexLockedBalances = + object.dexLockedBalances?.map((e) => Balance.fromPartial(e)) || []; + message.dexExpectedToReceiveBalances = + object.dexExpectedToReceiveBalances?.map((e) => Balance.fromPartial(e)) || + []; + message.dexSettings = + object.dexSettings?.map((e) => DEXSettingsWithDenom.fromPartial(e)) || []; + return message; + }, +}; +function createBaseBalance() { + return { address: "", coins: [] }; +} +export const Balance = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBalance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) + ? object.coins.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return Balance.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBalance(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBasePendingTokenUpgrade() { + return { denom: "", version: 0 }; +} +export const PendingTokenUpgrade = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.version !== 0) { + writer.uint32(16).uint32(message.version); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePendingTokenUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.version = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + create(base) { + return PendingTokenUpgrade.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePendingTokenUpgrade(); + message.denom = object.denom ?? ""; + message.version = object.version ?? 0; + return message; + }, +}; +function createBaseDEXSettingsWithDenom() { + return { denom: "", dexSettings: undefined }; +} +export const DEXSettingsWithDenom = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.dexSettings !== undefined) { + DEXSettings.encode(message.dexSettings, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDEXSettingsWithDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.dexSettings = DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + dexSettings: isSet(object.dexSettings) + ? DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.dexSettings !== undefined) { + obj.dexSettings = DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return DEXSettingsWithDenom.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDEXSettingsWithDenom(); + message.denom = object.denom ?? ""; + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/ft/v1/params.d.ts b/dist/module/coreum/asset/ft/v1/params.d.ts new file mode 100644 index 0000000..b854a0f --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/params.d.ts @@ -0,0 +1,33 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Duration } from "cosmjs-types/google/protobuf/duration"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** Params store gov manageable parameters. */ +export interface Params { + /** issue_fee is the fee burnt each time new token is issued. */ + issueFee: Coin | undefined; + /** token_upgrade_decision_timeout defines the end of the decision period for upgrading the token. */ + tokenUpgradeDecisionTimeout: Date | undefined; + /** token_upgrade_grace_period the period after which the token upgrade is executed effectively. */ + tokenUpgradeGracePeriod: Duration | undefined; +} +export declare const Params: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/ft/v1/params.js b/dist/module/coreum/asset/ft/v1/params.js new file mode 100644 index 0000000..f5a07ed --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/params.js @@ -0,0 +1,138 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/params.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Duration } from "cosmjs-types/google/protobuf/duration"; +import { Timestamp } from "cosmjs-types/google/protobuf/timestamp"; +export const protobufPackage = "coreum.asset.ft.v1"; +function createBaseParams() { + return { + issueFee: undefined, + tokenUpgradeDecisionTimeout: undefined, + tokenUpgradeGracePeriod: undefined, + }; +} +export const Params = { + encode(message, writer = new BinaryWriter()) { + if (message.issueFee !== undefined) { + Coin.encode(message.issueFee, writer.uint32(10).fork()).ldelim(); + } + if (message.tokenUpgradeDecisionTimeout !== undefined) { + Timestamp.encode(toTimestamp(message.tokenUpgradeDecisionTimeout), writer.uint32(18).fork()).ldelim(); + } + if (message.tokenUpgradeGracePeriod !== undefined) { + Duration.encode(message.tokenUpgradeGracePeriod, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.issueFee = Coin.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokenUpgradeDecisionTimeout = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.tokenUpgradeGracePeriod = Duration.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + issueFee: isSet(object.issueFee) + ? Coin.fromJSON(object.issueFee) + : undefined, + tokenUpgradeDecisionTimeout: isSet(object.tokenUpgradeDecisionTimeout) + ? fromJsonTimestamp(object.tokenUpgradeDecisionTimeout) + : undefined, + tokenUpgradeGracePeriod: isSet(object.tokenUpgradeGracePeriod) + ? Duration.fromJSON(object.tokenUpgradeGracePeriod) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.issueFee !== undefined) { + obj.issueFee = Coin.toJSON(message.issueFee); + } + if (message.tokenUpgradeDecisionTimeout !== undefined) { + obj.tokenUpgradeDecisionTimeout = + message.tokenUpgradeDecisionTimeout.toISOString(); + } + if (message.tokenUpgradeGracePeriod !== undefined) { + obj.tokenUpgradeGracePeriod = Duration.toJSON(message.tokenUpgradeGracePeriod); + } + return obj; + }, + create(base) { + return Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.issueFee = + object.issueFee !== undefined && object.issueFee !== null + ? Coin.fromPartial(object.issueFee) + : undefined; + message.tokenUpgradeDecisionTimeout = + object.tokenUpgradeDecisionTimeout ?? undefined; + message.tokenUpgradeGracePeriod = + object.tokenUpgradeGracePeriod !== undefined && + object.tokenUpgradeGracePeriod !== null + ? Duration.fromPartial(object.tokenUpgradeGracePeriod) + : undefined; + return message; + }, +}; +function toTimestamp(date) { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds: BigInt(seconds), nanos }; +} +function fromTimestamp(t) { + const seconds = BigInt(t.seconds || 0); + const nanos = BigInt(t.nanos || 0); + const millis = seconds * BigInt(1_000) + nanos / BigInt(1_000_000); + return new Date(Number(millis)); // Convert bigint to number +} +function fromJsonTimestamp(o) { + if (o instanceof globalThis.Date) { + return o; + } + else if (typeof o === "string") { + return new globalThis.Date(o); + } + else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/ft/v1/query.d.ts b/dist/module/coreum/asset/ft/v1/query.d.ts new file mode 100644 index 0000000..10996db --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/query.d.ts @@ -0,0 +1,191 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, Token, TokenUpgradeStatuses } from "./token"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** QueryParamsRequest defines the request type for querying x/asset/ft parameters. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse defines the response type for querying x/asset/ft parameters. */ +export interface QueryParamsResponse { + params: Params | undefined; +} +export interface QueryTokenRequest { + denom: string; +} +export interface QueryTokenResponse { + token: Token | undefined; +} +export interface QueryTokenUpgradeStatusesRequest { + denom: string; +} +export interface QueryTokenUpgradeStatusesResponse { + statuses: TokenUpgradeStatuses | undefined; +} +export interface QueryTokensRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + issuer: string; +} +export interface QueryTokensResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + tokens: Token[]; +} +export interface QueryBalanceRequest { + /** account specifies the account onto which we query balances */ + account: string; + /** denom specifies balances on a specific denom */ + denom: string; +} +export interface QueryBalanceResponse { + /** balance contains the balance with the queried account and denom */ + balance: string; + /** whitelisted is the whitelisted amount of the denom on the account. */ + whitelisted: string; + /** frozen is the frozen amount of the denom on the account. */ + frozen: string; + /** locked is the balance locked in vesting and DEX. */ + locked: string; + /** locked_in_vesting is the balance locked in bank vesting. */ + lockedInVesting: string; + /** locked_in_dex is the balance locked in DEX. */ + lockedInDex: string; + expectedToReceiveInDex: string; +} +export interface QueryFrozenBalancesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + /** account specifies the account onto which we query frozen balances */ + account: string; +} +export interface QueryFrozenBalancesResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + /** balances contains the frozen balances on the queried account */ + balances: Coin[]; +} +export interface QueryFrozenBalanceRequest { + /** account specifies the account onto which we query frozen balances */ + account: string; + /** denom specifies frozen balances on a specific denom */ + denom: string; +} +export interface QueryFrozenBalanceResponse { + /** balance contains the frozen balance with the queried account and denom */ + balance: Coin | undefined; +} +export interface QueryWhitelistedBalancesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + /** account specifies the account onto which we query whitelisted balances */ + account: string; +} +export interface QueryWhitelistedBalancesResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + /** balances contains the whitelisted balances on the queried account */ + balances: Coin[]; +} +export interface QueryWhitelistedBalanceRequest { + /** account specifies the account onto which we query whitelisted balances */ + account: string; + /** denom specifies whitelisted balances on a specific denom */ + denom: string; +} +export interface QueryWhitelistedBalanceResponse { + /** balance contains the whitelisted balance with the queried account and denom */ + balance: Coin | undefined; +} +export interface QueryDEXSettingsRequest { + /** denom specifies the denom onto which we query DEX settings */ + denom: string; +} +export interface QueryDEXSettingsResponse { + /** dex_settings contains the DEX settings */ + dexSettings: DEXSettings | undefined; +} +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +export declare const QueryTokenRequest: MessageFns; +export declare const QueryTokenResponse: MessageFns; +export declare const QueryTokenUpgradeStatusesRequest: MessageFns; +export declare const QueryTokenUpgradeStatusesResponse: MessageFns; +export declare const QueryTokensRequest: MessageFns; +export declare const QueryTokensResponse: MessageFns; +export declare const QueryBalanceRequest: MessageFns; +export declare const QueryBalanceResponse: MessageFns; +export declare const QueryFrozenBalancesRequest: MessageFns; +export declare const QueryFrozenBalancesResponse: MessageFns; +export declare const QueryFrozenBalanceRequest: MessageFns; +export declare const QueryFrozenBalanceResponse: MessageFns; +export declare const QueryWhitelistedBalancesRequest: MessageFns; +export declare const QueryWhitelistedBalancesResponse: MessageFns; +export declare const QueryWhitelistedBalanceRequest: MessageFns; +export declare const QueryWhitelistedBalanceResponse: MessageFns; +export declare const QueryDEXSettingsRequest: MessageFns; +export declare const QueryDEXSettingsResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/asset/ft module. */ + Params(request: QueryParamsRequest): Promise; + /** Tokens queries the fungible tokens of the module. */ + Tokens(request: QueryTokensRequest): Promise; + /** Token queries the fungible token of the module. */ + Token(request: QueryTokenRequest): Promise; + /** TokenUpgradeStatuses returns token upgrades info. */ + TokenUpgradeStatuses(request: QueryTokenUpgradeStatusesRequest): Promise; + /** Balance returns balance of the denom for the account. */ + Balance(request: QueryBalanceRequest): Promise; + /** FrozenBalances returns all the frozen balances for the account. */ + FrozenBalances(request: QueryFrozenBalancesRequest): Promise; + /** FrozenBalance returns frozen balance of the denom for the account. */ + FrozenBalance(request: QueryFrozenBalanceRequest): Promise; + /** WhitelistedBalances returns all the whitelisted balances for the account. */ + WhitelistedBalances(request: QueryWhitelistedBalancesRequest): Promise; + /** WhitelistedBalance returns whitelisted balance of the denom for the account. */ + WhitelistedBalance(request: QueryWhitelistedBalanceRequest): Promise; + /** DEXSettings returns DEX settings of the denom. */ + DEXSettings(request: QueryDEXSettingsRequest): Promise; +} +export declare const QueryServiceName = "coreum.asset.ft.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Params(request: QueryParamsRequest): Promise; + Tokens(request: QueryTokensRequest): Promise; + Token(request: QueryTokenRequest): Promise; + TokenUpgradeStatuses(request: QueryTokenUpgradeStatusesRequest): Promise; + Balance(request: QueryBalanceRequest): Promise; + FrozenBalances(request: QueryFrozenBalancesRequest): Promise; + FrozenBalance(request: QueryFrozenBalanceRequest): Promise; + WhitelistedBalances(request: QueryWhitelistedBalancesRequest): Promise; + WhitelistedBalance(request: QueryWhitelistedBalanceRequest): Promise; + DEXSettings(request: QueryDEXSettingsRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/ft/v1/query.js b/dist/module/coreum/asset/ft/v1/query.js new file mode 100644 index 0000000..dc16945 --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/query.js @@ -0,0 +1,1431 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/query.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse, } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, Token, TokenUpgradeStatuses } from "./token"; +export const protobufPackage = "coreum.asset.ft.v1"; +function createBaseQueryParamsRequest() { + return {}; +} +export const QueryParamsRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +export const QueryParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseQueryTokenRequest() { + return { denom: "" }; +} +export const QueryTokenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return QueryTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokenRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryTokenResponse() { + return { token: undefined }; +} +export const QueryTokenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.token !== undefined) { + Token.encode(message.token, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.token = Token.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + token: isSet(object.token) ? Token.fromJSON(object.token) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.token !== undefined) { + obj.token = Token.toJSON(message.token); + } + return obj; + }, + create(base) { + return QueryTokenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokenResponse(); + message.token = + object.token !== undefined && object.token !== null + ? Token.fromPartial(object.token) + : undefined; + return message; + }, +}; +function createBaseQueryTokenUpgradeStatusesRequest() { + return { denom: "" }; +} +export const QueryTokenUpgradeStatusesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokenUpgradeStatusesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return QueryTokenUpgradeStatusesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokenUpgradeStatusesRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryTokenUpgradeStatusesResponse() { + return { statuses: undefined }; +} +export const QueryTokenUpgradeStatusesResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.statuses !== undefined) { + TokenUpgradeStatuses.encode(message.statuses, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokenUpgradeStatusesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.statuses = TokenUpgradeStatuses.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + statuses: isSet(object.statuses) + ? TokenUpgradeStatuses.fromJSON(object.statuses) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.statuses !== undefined) { + obj.statuses = TokenUpgradeStatuses.toJSON(message.statuses); + } + return obj; + }, + create(base) { + return QueryTokenUpgradeStatusesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokenUpgradeStatusesResponse(); + message.statuses = + object.statuses !== undefined && object.statuses !== null + ? TokenUpgradeStatuses.fromPartial(object.statuses) + : undefined; + return message; + }, +}; +function createBaseQueryTokensRequest() { + return { pagination: undefined, issuer: "" }; +} +export const QueryTokensRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokensRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + return obj; + }, + create(base) { + return QueryTokensRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokensRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.issuer = object.issuer ?? ""; + return message; + }, +}; +function createBaseQueryTokensResponse() { + return { pagination: undefined, tokens: [] }; +} +export const QueryTokensResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.tokens) { + Token.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTokensResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.tokens.push(Token.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + tokens: globalThis.Array.isArray(object?.tokens) + ? object.tokens.map((e) => Token.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.tokens?.length) { + obj.tokens = message.tokens.map((e) => Token.toJSON(e)); + } + return obj; + }, + create(base) { + return QueryTokensResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryTokensResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.tokens = object.tokens?.map((e) => Token.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryBalanceRequest() { + return { account: "", denom: "" }; +} +export const QueryBalanceRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return QueryBalanceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBalanceRequest(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryBalanceResponse() { + return { + balance: "", + whitelisted: "", + frozen: "", + locked: "", + lockedInVesting: "", + lockedInDex: "", + expectedToReceiveInDex: "", + }; +} +export const QueryBalanceResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.balance !== "") { + writer.uint32(10).string(message.balance); + } + if (message.whitelisted !== "") { + writer.uint32(18).string(message.whitelisted); + } + if (message.frozen !== "") { + writer.uint32(26).string(message.frozen); + } + if (message.locked !== "") { + writer.uint32(34).string(message.locked); + } + if (message.lockedInVesting !== "") { + writer.uint32(42).string(message.lockedInVesting); + } + if (message.lockedInDex !== "") { + writer.uint32(50).string(message.lockedInDex); + } + if (message.expectedToReceiveInDex !== "") { + writer.uint32(58).string(message.expectedToReceiveInDex); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.balance = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.whitelisted = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.frozen = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.locked = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.lockedInVesting = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.lockedInDex = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.expectedToReceiveInDex = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + whitelisted: isSet(object.whitelisted) + ? globalThis.String(object.whitelisted) + : "", + frozen: isSet(object.frozen) ? globalThis.String(object.frozen) : "", + locked: isSet(object.locked) ? globalThis.String(object.locked) : "", + lockedInVesting: isSet(object.lockedInVesting) + ? globalThis.String(object.lockedInVesting) + : "", + lockedInDex: isSet(object.lockedInDex) + ? globalThis.String(object.lockedInDex) + : "", + expectedToReceiveInDex: isSet(object.expectedToReceiveInDex) + ? globalThis.String(object.expectedToReceiveInDex) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.balance !== "") { + obj.balance = message.balance; + } + if (message.whitelisted !== "") { + obj.whitelisted = message.whitelisted; + } + if (message.frozen !== "") { + obj.frozen = message.frozen; + } + if (message.locked !== "") { + obj.locked = message.locked; + } + if (message.lockedInVesting !== "") { + obj.lockedInVesting = message.lockedInVesting; + } + if (message.lockedInDex !== "") { + obj.lockedInDex = message.lockedInDex; + } + if (message.expectedToReceiveInDex !== "") { + obj.expectedToReceiveInDex = message.expectedToReceiveInDex; + } + return obj; + }, + create(base) { + return QueryBalanceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBalanceResponse(); + message.balance = object.balance ?? ""; + message.whitelisted = object.whitelisted ?? ""; + message.frozen = object.frozen ?? ""; + message.locked = object.locked ?? ""; + message.lockedInVesting = object.lockedInVesting ?? ""; + message.lockedInDex = object.lockedInDex ?? ""; + message.expectedToReceiveInDex = object.expectedToReceiveInDex ?? ""; + return message; + }, +}; +function createBaseQueryFrozenBalancesRequest() { + return { pagination: undefined, account: "" }; +} +export const QueryFrozenBalancesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return QueryFrozenBalancesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenBalancesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseQueryFrozenBalancesResponse() { + return { pagination: undefined, balances: [] }; +} +export const QueryFrozenBalancesResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.balances) { + Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + balances: globalThis.Array.isArray(object?.balances) + ? object.balances.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return QueryFrozenBalancesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenBalancesResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.balances = object.balances?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryFrozenBalanceRequest() { + return { account: "", denom: "" }; +} +export const QueryFrozenBalanceRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return QueryFrozenBalanceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenBalanceRequest(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryFrozenBalanceResponse() { + return { balance: undefined }; +} +export const QueryFrozenBalanceResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + balance: isSet(object.balance) + ? Coin.fromJSON(object.balance) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + create(base) { + return QueryFrozenBalanceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenBalanceResponse(); + message.balance = + object.balance !== undefined && object.balance !== null + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; +function createBaseQueryWhitelistedBalancesRequest() { + return { pagination: undefined, account: "" }; +} +export const QueryWhitelistedBalancesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return QueryWhitelistedBalancesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedBalancesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseQueryWhitelistedBalancesResponse() { + return { pagination: undefined, balances: [] }; +} +export const QueryWhitelistedBalancesResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.balances) { + Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + balances: globalThis.Array.isArray(object?.balances) + ? object.balances.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return QueryWhitelistedBalancesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedBalancesResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.balances = object.balances?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryWhitelistedBalanceRequest() { + return { account: "", denom: "" }; +} +export const QueryWhitelistedBalanceRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return QueryWhitelistedBalanceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedBalanceRequest(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryWhitelistedBalanceResponse() { + return { balance: undefined }; +} +export const QueryWhitelistedBalanceResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + balance: isSet(object.balance) + ? Coin.fromJSON(object.balance) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + create(base) { + return QueryWhitelistedBalanceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedBalanceResponse(); + message.balance = + object.balance !== undefined && object.balance !== null + ? Coin.fromPartial(object.balance) + : undefined; + return message; + }, +}; +function createBaseQueryDEXSettingsRequest() { + return { denom: "" }; +} +export const QueryDEXSettingsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDEXSettingsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return QueryDEXSettingsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryDEXSettingsRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryDEXSettingsResponse() { + return { dexSettings: undefined }; +} +export const QueryDEXSettingsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.dexSettings !== undefined) { + DEXSettings.encode(message.dexSettings, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDEXSettingsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dexSettings = DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + dexSettings: isSet(object.dexSettings) + ? DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.dexSettings !== undefined) { + obj.dexSettings = DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return QueryDEXSettingsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryDEXSettingsResponse(); + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +export const QueryServiceName = "coreum.asset.ft.v1.Query"; +export class QueryClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Tokens = this.Tokens.bind(this); + this.Token = this.Token.bind(this); + this.TokenUpgradeStatuses = this.TokenUpgradeStatuses.bind(this); + this.Balance = this.Balance.bind(this); + this.FrozenBalances = this.FrozenBalances.bind(this); + this.FrozenBalance = this.FrozenBalance.bind(this); + this.WhitelistedBalances = this.WhitelistedBalances.bind(this); + this.WhitelistedBalance = this.WhitelistedBalance.bind(this); + this.DEXSettings = this.DEXSettings.bind(this); + } + Params(request) { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data))); + } + Tokens(request) { + const data = QueryTokensRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Tokens", data); + return promise.then((data) => QueryTokensResponse.decode(new BinaryReader(data))); + } + Token(request) { + const data = QueryTokenRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Token", data); + return promise.then((data) => QueryTokenResponse.decode(new BinaryReader(data))); + } + TokenUpgradeStatuses(request) { + const data = QueryTokenUpgradeStatusesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "TokenUpgradeStatuses", data); + return promise.then((data) => QueryTokenUpgradeStatusesResponse.decode(new BinaryReader(data))); + } + Balance(request) { + const data = QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => QueryBalanceResponse.decode(new BinaryReader(data))); + } + FrozenBalances(request) { + const data = QueryFrozenBalancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FrozenBalances", data); + return promise.then((data) => QueryFrozenBalancesResponse.decode(new BinaryReader(data))); + } + FrozenBalance(request) { + const data = QueryFrozenBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "FrozenBalance", data); + return promise.then((data) => QueryFrozenBalanceResponse.decode(new BinaryReader(data))); + } + WhitelistedBalances(request) { + const data = QueryWhitelistedBalancesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "WhitelistedBalances", data); + return promise.then((data) => QueryWhitelistedBalancesResponse.decode(new BinaryReader(data))); + } + WhitelistedBalance(request) { + const data = QueryWhitelistedBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "WhitelistedBalance", data); + return promise.then((data) => QueryWhitelistedBalanceResponse.decode(new BinaryReader(data))); + } + DEXSettings(request) { + const data = QueryDEXSettingsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "DEXSettings", data); + return promise.then((data) => QueryDEXSettingsResponse.decode(new BinaryReader(data))); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/ft/v1/token.d.ts b/dist/module/coreum/asset/ft/v1/token.d.ts new file mode 100644 index 0000000..6e3d5ac --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/token.d.ts @@ -0,0 +1,114 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** Feature defines possible features of fungible token. */ +export declare enum Feature { + minting = 0, + burning = 1, + freezing = 2, + whitelisting = 3, + ibc = 4, + block_smart_contracts = 5, + clawback = 6, + extension = 7, + dex_block = 8, + dex_whitelisted_denoms = 9, + dex_order_cancellation = 10, + dex_unified_ref_amount_change = 11, + UNRECOGNIZED = -1 +} +export declare function featureFromJSON(object: any): Feature; +export declare function featureToJSON(object: Feature): string; +/** Definition defines the fungible token settings to store. */ +export interface Definition { + denom: string; + issuer: string; + features: Feature[]; + /** + * burn_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * burn_amount. This value will be burnt on top of the send amount. + */ + burnRate: string; + /** + * send_commission_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * amount sent to the token admin account. + */ + sendCommissionRate: string; + version: number; + uri: string; + uriHash: string; + extensionCwAddress: string; + admin: string; +} +/** Token is a full representation of the fungible token. */ +export interface Token { + denom: string; + issuer: string; + symbol: string; + subunit: string; + precision: number; + description: string; + globallyFrozen: boolean; + features: Feature[]; + /** + * burn_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * burn_amount. This value will be burnt on top of the send amount. + */ + burnRate: string; + /** + * send_commission_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * amount sent to the token admin account. + */ + sendCommissionRate: string; + version: number; + uri: string; + uriHash: string; + extensionCwAddress: string; + admin: string; + dexSettings: DEXSettings | undefined; +} +/** DelayedTokenUpgradeV1 is executed by the delay module when it's time to enable IBC. */ +export interface DelayedTokenUpgradeV1 { + denom: string; +} +/** TokenUpgradeV1Status defines the current status of the v1 token migration. */ +export interface TokenUpgradeV1Status { + ibcEnabled: boolean; + startTime: Date | undefined; + endTime: Date | undefined; +} +/** TokenUpgradeStatuses defines all statuses of the token migrations. */ +export interface TokenUpgradeStatuses { + v1: TokenUpgradeV1Status | undefined; +} +/** DEXSettings defines the token settings of the dex. */ +export interface DEXSettings { + /** unified_ref_amount is the approximate amount you need to buy 1USD, used to define the price tick size */ + unifiedRefAmount: string; + /** whitelisted_denoms is the list of denoms to trade with. */ + whitelistedDenoms: string[]; +} +export declare const Definition: MessageFns; +export declare const Token: MessageFns; +export declare const DelayedTokenUpgradeV1: MessageFns; +export declare const TokenUpgradeV1Status: MessageFns; +export declare const TokenUpgradeStatuses: MessageFns; +export declare const DEXSettings: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/ft/v1/token.js b/dist/module/coreum/asset/ft/v1/token.js new file mode 100644 index 0000000..8508f81 --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/token.js @@ -0,0 +1,937 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/token.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Timestamp } from "cosmjs-types/google/protobuf/timestamp"; +export const protobufPackage = "coreum.asset.ft.v1"; +/** Feature defines possible features of fungible token. */ +export var Feature; +(function (Feature) { + Feature[Feature["minting"] = 0] = "minting"; + Feature[Feature["burning"] = 1] = "burning"; + Feature[Feature["freezing"] = 2] = "freezing"; + Feature[Feature["whitelisting"] = 3] = "whitelisting"; + Feature[Feature["ibc"] = 4] = "ibc"; + Feature[Feature["block_smart_contracts"] = 5] = "block_smart_contracts"; + Feature[Feature["clawback"] = 6] = "clawback"; + Feature[Feature["extension"] = 7] = "extension"; + Feature[Feature["dex_block"] = 8] = "dex_block"; + Feature[Feature["dex_whitelisted_denoms"] = 9] = "dex_whitelisted_denoms"; + Feature[Feature["dex_order_cancellation"] = 10] = "dex_order_cancellation"; + Feature[Feature["dex_unified_ref_amount_change"] = 11] = "dex_unified_ref_amount_change"; + Feature[Feature["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(Feature || (Feature = {})); +export function featureFromJSON(object) { + switch (object) { + case 0: + case "minting": + return Feature.minting; + case 1: + case "burning": + return Feature.burning; + case 2: + case "freezing": + return Feature.freezing; + case 3: + case "whitelisting": + return Feature.whitelisting; + case 4: + case "ibc": + return Feature.ibc; + case 5: + case "block_smart_contracts": + return Feature.block_smart_contracts; + case 6: + case "clawback": + return Feature.clawback; + case 7: + case "extension": + return Feature.extension; + case 8: + case "dex_block": + return Feature.dex_block; + case 9: + case "dex_whitelisted_denoms": + return Feature.dex_whitelisted_denoms; + case 10: + case "dex_order_cancellation": + return Feature.dex_order_cancellation; + case 11: + case "dex_unified_ref_amount_change": + return Feature.dex_unified_ref_amount_change; + case -1: + case "UNRECOGNIZED": + default: + return Feature.UNRECOGNIZED; + } +} +export function featureToJSON(object) { + switch (object) { + case Feature.minting: + return "minting"; + case Feature.burning: + return "burning"; + case Feature.freezing: + return "freezing"; + case Feature.whitelisting: + return "whitelisting"; + case Feature.ibc: + return "ibc"; + case Feature.block_smart_contracts: + return "block_smart_contracts"; + case Feature.clawback: + return "clawback"; + case Feature.extension: + return "extension"; + case Feature.dex_block: + return "dex_block"; + case Feature.dex_whitelisted_denoms: + return "dex_whitelisted_denoms"; + case Feature.dex_order_cancellation: + return "dex_order_cancellation"; + case Feature.dex_unified_ref_amount_change: + return "dex_unified_ref_amount_change"; + case Feature.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseDefinition() { + return { + denom: "", + issuer: "", + features: [], + burnRate: "", + sendCommissionRate: "", + version: 0, + uri: "", + uriHash: "", + extensionCwAddress: "", + admin: "", + }; +} +export const Definition = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + writer.uint32(26).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.burnRate !== "") { + writer.uint32(34).string(message.burnRate); + } + if (message.sendCommissionRate !== "") { + writer.uint32(42).string(message.sendCommissionRate); + } + if (message.version !== 0) { + writer.uint32(48).uint32(message.version); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + if (message.extensionCwAddress !== "") { + writer.uint32(74).string(message.extensionCwAddress); + } + if (message.admin !== "") { + writer.uint32(82).string(message.admin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDefinition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.features.push(reader.int32()); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 4: { + if (tag !== 34) { + break; + } + message.burnRate = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.sendCommissionRate = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.version = reader.uint32(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.uri = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.extensionCwAddress = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.admin = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => featureFromJSON(e)) + : [], + burnRate: isSet(object.burnRate) + ? globalThis.String(object.burnRate) + : "", + sendCommissionRate: isSet(object.sendCommissionRate) + ? globalThis.String(object.sendCommissionRate) + : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + extensionCwAddress: isSet(object.extensionCwAddress) + ? globalThis.String(object.extensionCwAddress) + : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.features?.length) { + obj.features = message.features.map((e) => featureToJSON(e)); + } + if (message.burnRate !== "") { + obj.burnRate = message.burnRate; + } + if (message.sendCommissionRate !== "") { + obj.sendCommissionRate = message.sendCommissionRate; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.extensionCwAddress !== "") { + obj.extensionCwAddress = message.extensionCwAddress; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + return obj; + }, + create(base) { + return Definition.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDefinition(); + message.denom = object.denom ?? ""; + message.issuer = object.issuer ?? ""; + message.features = object.features?.map((e) => e) || []; + message.burnRate = object.burnRate ?? ""; + message.sendCommissionRate = object.sendCommissionRate ?? ""; + message.version = object.version ?? 0; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.extensionCwAddress = object.extensionCwAddress ?? ""; + message.admin = object.admin ?? ""; + return message; + }, +}; +function createBaseToken() { + return { + denom: "", + issuer: "", + symbol: "", + subunit: "", + precision: 0, + description: "", + globallyFrozen: false, + features: [], + burnRate: "", + sendCommissionRate: "", + version: 0, + uri: "", + uriHash: "", + extensionCwAddress: "", + admin: "", + dexSettings: undefined, + }; +} +export const Token = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.subunit !== "") { + writer.uint32(34).string(message.subunit); + } + if (message.precision !== 0) { + writer.uint32(40).uint32(message.precision); + } + if (message.description !== "") { + writer.uint32(50).string(message.description); + } + if (message.globallyFrozen !== false) { + writer.uint32(56).bool(message.globallyFrozen); + } + writer.uint32(66).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.burnRate !== "") { + writer.uint32(74).string(message.burnRate); + } + if (message.sendCommissionRate !== "") { + writer.uint32(82).string(message.sendCommissionRate); + } + if (message.version !== 0) { + writer.uint32(88).uint32(message.version); + } + if (message.uri !== "") { + writer.uint32(98).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(106).string(message.uriHash); + } + if (message.extensionCwAddress !== "") { + writer.uint32(114).string(message.extensionCwAddress); + } + if (message.admin !== "") { + writer.uint32(122).string(message.admin); + } + if (message.dexSettings !== undefined) { + DEXSettings.encode(message.dexSettings, writer.uint32(130).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.symbol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.subunit = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.precision = reader.uint32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.description = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.globallyFrozen = reader.bool(); + continue; + } + case 8: { + if (tag === 64) { + message.features.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag !== 74) { + break; + } + message.burnRate = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.sendCommissionRate = reader.string(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.version = reader.uint32(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.uri = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.extensionCwAddress = reader.string(); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + message.admin = reader.string(); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + message.dexSettings = DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + subunit: isSet(object.subunit) ? globalThis.String(object.subunit) : "", + precision: isSet(object.precision) + ? globalThis.Number(object.precision) + : 0, + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + globallyFrozen: isSet(object.globallyFrozen) + ? globalThis.Boolean(object.globallyFrozen) + : false, + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => featureFromJSON(e)) + : [], + burnRate: isSet(object.burnRate) + ? globalThis.String(object.burnRate) + : "", + sendCommissionRate: isSet(object.sendCommissionRate) + ? globalThis.String(object.sendCommissionRate) + : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + extensionCwAddress: isSet(object.extensionCwAddress) + ? globalThis.String(object.extensionCwAddress) + : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + dexSettings: isSet(object.dexSettings) + ? DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.subunit !== "") { + obj.subunit = message.subunit; + } + if (message.precision !== 0) { + obj.precision = Math.round(message.precision); + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.globallyFrozen !== false) { + obj.globallyFrozen = message.globallyFrozen; + } + if (message.features?.length) { + obj.features = message.features.map((e) => featureToJSON(e)); + } + if (message.burnRate !== "") { + obj.burnRate = message.burnRate; + } + if (message.sendCommissionRate !== "") { + obj.sendCommissionRate = message.sendCommissionRate; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.extensionCwAddress !== "") { + obj.extensionCwAddress = message.extensionCwAddress; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.dexSettings !== undefined) { + obj.dexSettings = DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return Token.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseToken(); + message.denom = object.denom ?? ""; + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.subunit = object.subunit ?? ""; + message.precision = object.precision ?? 0; + message.description = object.description ?? ""; + message.globallyFrozen = object.globallyFrozen ?? false; + message.features = object.features?.map((e) => e) || []; + message.burnRate = object.burnRate ?? ""; + message.sendCommissionRate = object.sendCommissionRate ?? ""; + message.version = object.version ?? 0; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.extensionCwAddress = object.extensionCwAddress ?? ""; + message.admin = object.admin ?? ""; + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +function createBaseDelayedTokenUpgradeV1() { + return { denom: "" }; +} +export const DelayedTokenUpgradeV1 = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedTokenUpgradeV1(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return DelayedTokenUpgradeV1.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDelayedTokenUpgradeV1(); + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseTokenUpgradeV1Status() { + return { ibcEnabled: false, startTime: undefined, endTime: undefined }; +} +export const TokenUpgradeV1Status = { + encode(message, writer = new BinaryWriter()) { + if (message.ibcEnabled !== false) { + writer.uint32(8).bool(message.ibcEnabled); + } + if (message.startTime !== undefined) { + Timestamp.encode(toTimestamp(message.startTime), writer.uint32(18).fork()).ldelim(); + } + if (message.endTime !== undefined) { + Timestamp.encode(toTimestamp(message.endTime), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenUpgradeV1Status(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.ibcEnabled = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + ibcEnabled: isSet(object.ibcEnabled) + ? globalThis.Boolean(object.ibcEnabled) + : false, + startTime: isSet(object.startTime) + ? fromJsonTimestamp(object.startTime) + : undefined, + endTime: isSet(object.endTime) + ? fromJsonTimestamp(object.endTime) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.ibcEnabled !== false) { + obj.ibcEnabled = message.ibcEnabled; + } + if (message.startTime !== undefined) { + obj.startTime = message.startTime.toISOString(); + } + if (message.endTime !== undefined) { + obj.endTime = message.endTime.toISOString(); + } + return obj; + }, + create(base) { + return TokenUpgradeV1Status.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenUpgradeV1Status(); + message.ibcEnabled = object.ibcEnabled ?? false; + message.startTime = object.startTime ?? undefined; + message.endTime = object.endTime ?? undefined; + return message; + }, +}; +function createBaseTokenUpgradeStatuses() { + return { v1: undefined }; +} +export const TokenUpgradeStatuses = { + encode(message, writer = new BinaryWriter()) { + if (message.v1 !== undefined) { + TokenUpgradeV1Status.encode(message.v1, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTokenUpgradeStatuses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.v1 = TokenUpgradeV1Status.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + v1: isSet(object.v1) + ? TokenUpgradeV1Status.fromJSON(object.v1) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.v1 !== undefined) { + obj.v1 = TokenUpgradeV1Status.toJSON(message.v1); + } + return obj; + }, + create(base) { + return TokenUpgradeStatuses.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTokenUpgradeStatuses(); + message.v1 = + object.v1 !== undefined && object.v1 !== null + ? TokenUpgradeV1Status.fromPartial(object.v1) + : undefined; + return message; + }, +}; +function createBaseDEXSettings() { + return { unifiedRefAmount: "", whitelistedDenoms: [] }; +} +export const DEXSettings = { + encode(message, writer = new BinaryWriter()) { + if (message.unifiedRefAmount !== "") { + writer.uint32(10).string(message.unifiedRefAmount); + } + for (const v of message.whitelistedDenoms) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDEXSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.unifiedRefAmount = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.whitelistedDenoms.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + unifiedRefAmount: isSet(object.unifiedRefAmount) + ? globalThis.String(object.unifiedRefAmount) + : "", + whitelistedDenoms: globalThis.Array.isArray(object?.whitelistedDenoms) + ? object.whitelistedDenoms.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.unifiedRefAmount !== "") { + obj.unifiedRefAmount = message.unifiedRefAmount; + } + if (message.whitelistedDenoms?.length) { + obj.whitelistedDenoms = message.whitelistedDenoms; + } + return obj; + }, + create(base) { + return DEXSettings.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDEXSettings(); + message.unifiedRefAmount = object.unifiedRefAmount ?? ""; + message.whitelistedDenoms = object.whitelistedDenoms?.map((e) => e) || []; + return message; + }, +}; +function toTimestamp(date) { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds: BigInt(seconds), nanos }; +} +function fromTimestamp(t) { + const seconds = BigInt(t.seconds || 0); + const nanos = BigInt(t.nanos || 0); + const millis = seconds * BigInt(1000) + nanos / BigInt(1_000_000); + return new Date(Number(millis)); +} +function fromJsonTimestamp(o) { + if (o instanceof globalThis.Date) { + return o; + } + else if (typeof o === "string") { + return new globalThis.Date(o); + } + else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/ft/v1/tx.d.ts b/dist/module/coreum/asset/ft/v1/tx.d.ts new file mode 100644 index 0000000..d2bbd26 --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/tx.d.ts @@ -0,0 +1,237 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, Feature } from "./token"; +export declare const protobufPackage = "coreum.asset.ft.v1"; +/** MsgIssue defines message to issue new fungible token. */ +export interface MsgIssue { + issuer: string; + symbol: string; + subunit: string; + precision: number; + initialAmount: string; + description: string; + features: Feature[]; + /** + * burn_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * burn_amount. This value will be burnt on top of the send amount. + */ + burnRate: string; + /** + * send_commission_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * amount sent to the token admin account. + */ + sendCommissionRate: string; + uri: string; + uriHash: string; + /** extension_settings must be provided in case wasm extensions are enabled. */ + extensionSettings: ExtensionIssueSettings | undefined; + /** dex_settings allowed to be customized by issuer */ + dexSettings: DEXSettings | undefined; +} +/** + * ExtensionIssueSettings are settings that will be used to Instantiate the smart contract which contains + * the source code for the extension. + */ +export interface ExtensionIssueSettings { + /** code_id is the reference to the stored WASM code */ + codeId: number; + /** label is optional metadata to be stored with a contract instance. */ + label: string; + /** funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** optional json encoded data to pass to WASM on instantiation by the ft issuer */ + issuanceMsg: Uint8Array; +} +export interface MsgMint { + sender: string; + coin: Coin | undefined; + recipient: string; +} +export interface MsgBurn { + sender: string; + coin: Coin | undefined; +} +export interface MsgFreeze { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgUnfreeze { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgSetFrozen { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgGloballyFreeze { + sender: string; + denom: string; +} +export interface MsgGloballyUnfreeze { + sender: string; + denom: string; +} +export interface MsgClawback { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgSetWhitelistedLimit { + sender: string; + account: string; + coin: Coin | undefined; +} +export interface MsgTransferAdmin { + sender: string; + account: string; + denom: string; +} +export interface MsgClearAdmin { + sender: string; + denom: string; +} +/** MsgUpgradeTokenV1 is the message upgrading token to V1. */ +export interface MsgUpgradeTokenV1 { + sender: string; + denom: string; + ibcEnabled: boolean; +} +export interface MsgUpdateParams { + authority: string; + params: Params | undefined; +} +export interface MsgUpdateDEXUnifiedRefAmount { + sender: string; + denom: string; + /** unified_ref_amount is the approximate amount you need to buy 1USD, used to define the price tick size */ + unifiedRefAmount: string; +} +export interface MsgUpdateDEXWhitelistedDenoms { + sender: string; + denom: string; + /** whitelisted_denoms is the list of denoms to trade with. */ + whitelistedDenoms: string[]; +} +export interface EmptyResponse { +} +export declare const MsgIssue: MessageFns; +export declare const ExtensionIssueSettings: MessageFns; +export declare const MsgMint: MessageFns; +export declare const MsgBurn: MessageFns; +export declare const MsgFreeze: MessageFns; +export declare const MsgUnfreeze: MessageFns; +export declare const MsgSetFrozen: MessageFns; +export declare const MsgGloballyFreeze: MessageFns; +export declare const MsgGloballyUnfreeze: MessageFns; +export declare const MsgClawback: MessageFns; +export declare const MsgSetWhitelistedLimit: MessageFns; +export declare const MsgTransferAdmin: MessageFns; +export declare const MsgClearAdmin: MessageFns; +export declare const MsgUpgradeTokenV1: MessageFns; +export declare const MsgUpdateParams: MessageFns; +export declare const MsgUpdateDEXUnifiedRefAmount: MessageFns; +export declare const MsgUpdateDEXWhitelistedDenoms: MessageFns; +export declare const EmptyResponse: MessageFns; +/** Msg defines the Msg service. */ +export interface Msg { + /** Issue defines a method to issue a new fungible token. */ + Issue(request: MsgIssue): Promise; + /** Mint mints new fungible tokens. */ + Mint(request: MsgMint): Promise; + /** Burn burns the specified fungible tokens from senders balance if the sender has enough balance. */ + Burn(request: MsgBurn): Promise; + /** + * Freeze freezes a part of the fungible tokens in an + * account, only if the freezable feature is enabled on that token. + */ + Freeze(request: MsgFreeze): Promise; + /** + * Unfreeze unfreezes a part of the frozen fungible tokens in an + * account, only if there are such frozen tokens on that account. + */ + Unfreeze(request: MsgUnfreeze): Promise; + /** SetFrozen sets the absolute value of frozen amount. */ + SetFrozen(request: MsgSetFrozen): Promise; + /** + * GloballyFreeze freezes fungible token so no operations are allowed with it before unfrozen. + * This operation is idempotent so global freeze of already frozen token does nothing. + */ + GloballyFreeze(request: MsgGloballyFreeze): Promise; + /** + * GloballyUnfreeze unfreezes fungible token and unblocks basic operations on it. + * This operation is idempotent so global unfreezing of non-frozen token does nothing. + */ + GloballyUnfreeze(request: MsgGloballyUnfreeze): Promise; + /** + * Clawback confiscates a part of fungible tokens from an account + * to the admin, only if the clawback feature is enabled on that token. + */ + Clawback(request: MsgClawback): Promise; + /** SetWhitelistedLimit sets the limit of how many tokens a specific account may hold. */ + SetWhitelistedLimit(request: MsgSetWhitelistedLimit): Promise; + /** TransferAdmin changes admin of a fungible token. */ + TransferAdmin(request: MsgTransferAdmin): Promise; + /** ClearAdmin removes admin of a fungible token. */ + ClearAdmin(request: MsgClearAdmin): Promise; + /** TokenUpgradeV1 upgrades token to version V1. */ + UpgradeTokenV1(request: MsgUpgradeTokenV1): Promise; + /** + * UpdateParams is a governance operation to modify the parameters of the module. + * NOTE: all parameters must be provided. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** UpdateDEXUnifiedRefAmount updates DEX unified ref amount. */ + UpdateDEXUnifiedRefAmount(request: MsgUpdateDEXUnifiedRefAmount): Promise; + /** UpdateDEXWhitelistedDenoms updates DEX whitelisted denoms. */ + UpdateDEXWhitelistedDenoms(request: MsgUpdateDEXWhitelistedDenoms): Promise; +} +export declare const MsgServiceName = "coreum.asset.ft.v1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Issue(request: MsgIssue): Promise; + Mint(request: MsgMint): Promise; + Burn(request: MsgBurn): Promise; + Freeze(request: MsgFreeze): Promise; + Unfreeze(request: MsgUnfreeze): Promise; + SetFrozen(request: MsgSetFrozen): Promise; + GloballyFreeze(request: MsgGloballyFreeze): Promise; + GloballyUnfreeze(request: MsgGloballyUnfreeze): Promise; + Clawback(request: MsgClawback): Promise; + SetWhitelistedLimit(request: MsgSetWhitelistedLimit): Promise; + TransferAdmin(request: MsgTransferAdmin): Promise; + ClearAdmin(request: MsgClearAdmin): Promise; + UpgradeTokenV1(request: MsgUpgradeTokenV1): Promise; + UpdateParams(request: MsgUpdateParams): Promise; + UpdateDEXUnifiedRefAmount(request: MsgUpdateDEXUnifiedRefAmount): Promise; + UpdateDEXWhitelistedDenoms(request: MsgUpdateDEXWhitelistedDenoms): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/ft/v1/tx.js b/dist/module/coreum/asset/ft/v1/tx.js new file mode 100644 index 0000000..8b78060 --- /dev/null +++ b/dist/module/coreum/asset/ft/v1/tx.js @@ -0,0 +1,1777 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/ft/tx.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +import { DEXSettings, featureFromJSON, featureToJSON } from "./token"; +export const protobufPackage = "coreum.asset.ft.v1"; +function createBaseMsgIssue() { + return { + issuer: "", + symbol: "", + subunit: "", + precision: 0, + initialAmount: "", + description: "", + features: [], + burnRate: "", + sendCommissionRate: "", + uri: "", + uriHash: "", + extensionSettings: undefined, + dexSettings: undefined, + }; +} +export const MsgIssue = { + encode(message, writer = new BinaryWriter()) { + if (message.issuer !== "") { + writer.uint32(10).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(18).string(message.symbol); + } + if (message.subunit !== "") { + writer.uint32(26).string(message.subunit); + } + if (message.precision !== 0) { + writer.uint32(32).uint32(message.precision); + } + if (message.initialAmount !== "") { + writer.uint32(42).string(message.initialAmount); + } + if (message.description !== "") { + writer.uint32(50).string(message.description); + } + writer.uint32(58).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.burnRate !== "") { + writer.uint32(66).string(message.burnRate); + } + if (message.sendCommissionRate !== "") { + writer.uint32(74).string(message.sendCommissionRate); + } + if (message.uri !== "") { + writer.uint32(82).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(90).string(message.uriHash); + } + if (message.extensionSettings !== undefined) { + ExtensionIssueSettings.encode(message.extensionSettings, writer.uint32(98).fork()).ldelim(); + } + if (message.dexSettings !== undefined) { + DEXSettings.encode(message.dexSettings, writer.uint32(106).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIssue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.issuer = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.symbol = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.subunit = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.precision = reader.uint32(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.initialAmount = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.description = reader.string(); + continue; + } + case 7: { + if (tag === 56) { + message.features.push(reader.int32()); + continue; + } + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 8: { + if (tag !== 66) { + break; + } + message.burnRate = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.sendCommissionRate = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.uri = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.extensionSettings = ExtensionIssueSettings.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.dexSettings = DEXSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + subunit: isSet(object.subunit) ? globalThis.String(object.subunit) : "", + precision: isSet(object.precision) + ? globalThis.Number(object.precision) + : 0, + initialAmount: isSet(object.initialAmount) + ? globalThis.String(object.initialAmount) + : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => featureFromJSON(e)) + : [], + burnRate: isSet(object.burnRate) + ? globalThis.String(object.burnRate) + : "", + sendCommissionRate: isSet(object.sendCommissionRate) + ? globalThis.String(object.sendCommissionRate) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + extensionSettings: isSet(object.extensionSettings) + ? ExtensionIssueSettings.fromJSON(object.extensionSettings) + : undefined, + dexSettings: isSet(object.dexSettings) + ? DEXSettings.fromJSON(object.dexSettings) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.subunit !== "") { + obj.subunit = message.subunit; + } + if (message.precision !== 0) { + obj.precision = Math.round(message.precision); + } + if (message.initialAmount !== "") { + obj.initialAmount = message.initialAmount; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.features?.length) { + obj.features = message.features.map((e) => featureToJSON(e)); + } + if (message.burnRate !== "") { + obj.burnRate = message.burnRate; + } + if (message.sendCommissionRate !== "") { + obj.sendCommissionRate = message.sendCommissionRate; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.extensionSettings !== undefined) { + obj.extensionSettings = ExtensionIssueSettings.toJSON(message.extensionSettings); + } + if (message.dexSettings !== undefined) { + obj.dexSettings = DEXSettings.toJSON(message.dexSettings); + } + return obj; + }, + create(base) { + return MsgIssue.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIssue(); + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.subunit = object.subunit ?? ""; + message.precision = object.precision ?? 0; + message.initialAmount = object.initialAmount ?? ""; + message.description = object.description ?? ""; + message.features = object.features?.map((e) => e) || []; + message.burnRate = object.burnRate ?? ""; + message.sendCommissionRate = object.sendCommissionRate ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.extensionSettings = + object.extensionSettings !== undefined && + object.extensionSettings !== null + ? ExtensionIssueSettings.fromPartial(object.extensionSettings) + : undefined; + message.dexSettings = + object.dexSettings !== undefined && object.dexSettings !== null + ? DEXSettings.fromPartial(object.dexSettings) + : undefined; + return message; + }, +}; +function createBaseExtensionIssueSettings() { + return { codeId: 0, label: "", funds: [], issuanceMsg: new Uint8Array(0) }; +} +export const ExtensionIssueSettings = { + encode(message, writer = new BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(18).string(message.label); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(26).fork()).ldelim(); + } + if (message.issuanceMsg.length !== 0) { + writer.uint32(34).bytes(message.issuanceMsg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionIssueSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.label = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.issuanceMsg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + issuanceMsg: isSet(object.issuanceMsg) + ? bytesFromBase64(object.issuanceMsg) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + if (message.issuanceMsg.length !== 0) { + obj.issuanceMsg = base64FromBytes(message.issuanceMsg); + } + return obj; + }, + create(base) { + return ExtensionIssueSettings.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtensionIssueSettings(); + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + message.issuanceMsg = object.issuanceMsg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgMint() { + return { sender: "", coin: undefined, recipient: "" }; +} +export const MsgMint = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(18).fork()).ldelim(); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.recipient = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + recipient: isSet(object.recipient) + ? globalThis.String(object.recipient) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.coin !== undefined) { + obj.coin = Coin.toJSON(message.coin); + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + return obj; + }, + create(base) { + return MsgMint.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgMint(); + message.sender = object.sender ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? Coin.fromPartial(object.coin) + : undefined; + message.recipient = object.recipient ?? ""; + return message; + }, +}; +function createBaseMsgBurn() { + return { sender: "", coin: undefined }; +} +export const MsgBurn = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.coin !== undefined) { + obj.coin = Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return MsgBurn.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgBurn(); + message.sender = object.sender ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgFreeze() { + return { sender: "", account: "", coin: undefined }; +} +export const MsgFreeze = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return MsgFreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgFreeze(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgUnfreeze() { + return { sender: "", account: "", coin: undefined }; +} +export const MsgUnfreeze = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnfreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return MsgUnfreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUnfreeze(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgSetFrozen() { + return { sender: "", account: "", coin: undefined }; +} +export const MsgSetFrozen = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetFrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return MsgSetFrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSetFrozen(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgGloballyFreeze() { + return { sender: "", denom: "" }; +} +export const MsgGloballyFreeze = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGloballyFreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return MsgGloballyFreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgGloballyFreeze(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseMsgGloballyUnfreeze() { + return { sender: "", denom: "" }; +} +export const MsgGloballyUnfreeze = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGloballyUnfreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return MsgGloballyUnfreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgGloballyUnfreeze(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseMsgClawback() { + return { sender: "", account: "", coin: undefined }; +} +export const MsgClawback = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClawback(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return MsgClawback.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClawback(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgSetWhitelistedLimit() { + return { sender: "", account: "", coin: undefined }; +} +export const MsgSetWhitelistedLimit = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.coin !== undefined) { + Coin.encode(message.coin, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWhitelistedLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.coin = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + coin: isSet(object.coin) ? Coin.fromJSON(object.coin) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.coin !== undefined) { + obj.coin = Coin.toJSON(message.coin); + } + return obj; + }, + create(base) { + return MsgSetWhitelistedLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSetWhitelistedLimit(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.coin = + object.coin !== undefined && object.coin !== null + ? Coin.fromPartial(object.coin) + : undefined; + return message; + }, +}; +function createBaseMsgTransferAdmin() { + return { sender: "", account: "", denom: "" }; +} +export const MsgTransferAdmin = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.denom !== "") { + writer.uint32(26).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransferAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return MsgTransferAdmin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgTransferAdmin(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseMsgClearAdmin() { + return { sender: "", denom: "" }; +} +export const MsgClearAdmin = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return MsgClearAdmin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClearAdmin(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseMsgUpgradeTokenV1() { + return { sender: "", denom: "", ibcEnabled: false }; +} +export const MsgUpgradeTokenV1 = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.ibcEnabled !== false) { + writer.uint32(24).bool(message.ibcEnabled); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeTokenV1(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.ibcEnabled = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + ibcEnabled: isSet(object.ibcEnabled) + ? globalThis.Boolean(object.ibcEnabled) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.ibcEnabled !== false) { + obj.ibcEnabled = message.ibcEnabled; + } + return obj; + }, + create(base) { + return MsgUpgradeTokenV1.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpgradeTokenV1(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.ibcEnabled = object.ibcEnabled ?? false; + return message; + }, +}; +function createBaseMsgUpdateParams() { + return { authority: "", params: undefined }; +} +export const MsgUpdateParams = { + encode(message, writer = new BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return MsgUpdateParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseMsgUpdateDEXUnifiedRefAmount() { + return { sender: "", denom: "", unifiedRefAmount: "" }; +} +export const MsgUpdateDEXUnifiedRefAmount = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.unifiedRefAmount !== "") { + writer.uint32(26).string(message.unifiedRefAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateDEXUnifiedRefAmount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.unifiedRefAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + unifiedRefAmount: isSet(object.unifiedRefAmount) + ? globalThis.String(object.unifiedRefAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.unifiedRefAmount !== "") { + obj.unifiedRefAmount = message.unifiedRefAmount; + } + return obj; + }, + create(base) { + return MsgUpdateDEXUnifiedRefAmount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateDEXUnifiedRefAmount(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.unifiedRefAmount = object.unifiedRefAmount ?? ""; + return message; + }, +}; +function createBaseMsgUpdateDEXWhitelistedDenoms() { + return { sender: "", denom: "", whitelistedDenoms: [] }; +} +export const MsgUpdateDEXWhitelistedDenoms = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + for (const v of message.whitelistedDenoms) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateDEXWhitelistedDenoms(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.whitelistedDenoms.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + whitelistedDenoms: globalThis.Array.isArray(object?.whitelistedDenoms) + ? object.whitelistedDenoms.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.whitelistedDenoms?.length) { + obj.whitelistedDenoms = message.whitelistedDenoms; + } + return obj; + }, + create(base) { + return MsgUpdateDEXWhitelistedDenoms.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateDEXWhitelistedDenoms(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.whitelistedDenoms = object.whitelistedDenoms?.map((e) => e) || []; + return message; + }, +}; +function createBaseEmptyResponse() { + return {}; +} +export const EmptyResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmptyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return EmptyResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseEmptyResponse(); + return message; + }, +}; +export const MsgServiceName = "coreum.asset.ft.v1.Msg"; +export class MsgClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.Issue = this.Issue.bind(this); + this.Mint = this.Mint.bind(this); + this.Burn = this.Burn.bind(this); + this.Freeze = this.Freeze.bind(this); + this.Unfreeze = this.Unfreeze.bind(this); + this.SetFrozen = this.SetFrozen.bind(this); + this.GloballyFreeze = this.GloballyFreeze.bind(this); + this.GloballyUnfreeze = this.GloballyUnfreeze.bind(this); + this.Clawback = this.Clawback.bind(this); + this.SetWhitelistedLimit = this.SetWhitelistedLimit.bind(this); + this.TransferAdmin = this.TransferAdmin.bind(this); + this.ClearAdmin = this.ClearAdmin.bind(this); + this.UpgradeTokenV1 = this.UpgradeTokenV1.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.UpdateDEXUnifiedRefAmount = this.UpdateDEXUnifiedRefAmount.bind(this); + this.UpdateDEXWhitelistedDenoms = + this.UpdateDEXWhitelistedDenoms.bind(this); + } + Issue(request) { + const data = MsgIssue.encode(request).finish(); + const promise = this.rpc.request(this.service, "Issue", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Mint(request) { + const data = MsgMint.encode(request).finish(); + const promise = this.rpc.request(this.service, "Mint", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Burn(request) { + const data = MsgBurn.encode(request).finish(); + const promise = this.rpc.request(this.service, "Burn", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Freeze(request) { + const data = MsgFreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "Freeze", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Unfreeze(request) { + const data = MsgUnfreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "Unfreeze", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + SetFrozen(request) { + const data = MsgSetFrozen.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetFrozen", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + GloballyFreeze(request) { + const data = MsgGloballyFreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "GloballyFreeze", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + GloballyUnfreeze(request) { + const data = MsgGloballyUnfreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "GloballyUnfreeze", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Clawback(request) { + const data = MsgClawback.encode(request).finish(); + const promise = this.rpc.request(this.service, "Clawback", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + SetWhitelistedLimit(request) { + const data = MsgSetWhitelistedLimit.encode(request).finish(); + const promise = this.rpc.request(this.service, "SetWhitelistedLimit", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + TransferAdmin(request) { + const data = MsgTransferAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "TransferAdmin", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + ClearAdmin(request) { + const data = MsgClearAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClearAdmin", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + UpgradeTokenV1(request) { + const data = MsgUpgradeTokenV1.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpgradeTokenV1", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + UpdateParams(request) { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + UpdateDEXUnifiedRefAmount(request) { + const data = MsgUpdateDEXUnifiedRefAmount.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateDEXUnifiedRefAmount", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + UpdateDEXWhitelistedDenoms(request) { + const data = MsgUpdateDEXWhitelistedDenoms.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateDEXWhitelistedDenoms", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } +} +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/index.d.ts b/dist/module/coreum/asset/index.d.ts new file mode 100644 index 0000000..73495db --- /dev/null +++ b/dist/module/coreum/asset/index.d.ts @@ -0,0 +1,2 @@ +export declare const assetNftRegistry: ReadonlyArray<[string, any]>; +export declare const assetFtRegistry: ReadonlyArray<[string, any]>; diff --git a/dist/module/coreum/asset/index.js b/dist/module/coreum/asset/index.js new file mode 100644 index 0000000..e6ebe85 --- /dev/null +++ b/dist/module/coreum/asset/index.js @@ -0,0 +1,31 @@ +import { CoreumTypeUrl } from "../../types"; +import { MsgAddToWhitelist, MsgBurn, MsgIssueClass, MsgRemoveFromWhitelist, MsgMint, MsgFreeze, MsgUnfreeze, } from "./nft/v1/tx"; +import { MsgIssue, MsgFreeze as MsgFreezeFT, MsgGloballyFreeze, MsgGloballyUnfreeze, MsgMint as MsgMintFT, MsgBurn as MsgBurnFT, MsgSetWhitelistedLimit, MsgUnfreeze as MsgUnfreezeFT, MsgClawback, MsgUpdateDEXUnifiedRefAmount, MsgUpdateDEXWhitelistedDenoms, } from "./ft/v1/tx"; +export const assetNftRegistry = [ + [CoreumTypeUrl.NFT + "MsgIssueClass", MsgIssueClass], + [CoreumTypeUrl.NFT + "MsgAddToWhitelist", MsgAddToWhitelist], + [CoreumTypeUrl.NFT + "MsgRemoveFromWhitelist", MsgRemoveFromWhitelist], + [CoreumTypeUrl.NFT + "MsgMint", MsgMint], + [CoreumTypeUrl.NFT + "MsgBurn", MsgBurn], + [CoreumTypeUrl.NFT + "MsgFreeze", MsgFreeze], + [CoreumTypeUrl.NFT + "MsgUnfreeze", MsgUnfreeze], +]; +export const assetFtRegistry = [ + [CoreumTypeUrl.FT + "MsgIssue", MsgIssue], + [CoreumTypeUrl.FT + "MsgFreeze", MsgFreezeFT], + [CoreumTypeUrl.FT + "MsgMint", MsgMintFT], + [CoreumTypeUrl.FT + "MsgBurn", MsgBurnFT], + [CoreumTypeUrl.FT + "MsgUnfreeze", MsgUnfreezeFT], + [CoreumTypeUrl.FT + "MsgGloballyFreeze", MsgGloballyFreeze], + [CoreumTypeUrl.FT + "MsgGloballyUnfreeze", MsgGloballyUnfreeze], + [CoreumTypeUrl.FT + "MsgSetWhitelistedLimit", MsgSetWhitelistedLimit], + [CoreumTypeUrl.FT + "MsgClawback", MsgClawback], + [ + CoreumTypeUrl.FT + "MsgUpdateDEXWhitelistedDenoms", + MsgUpdateDEXWhitelistedDenoms, + ], + [ + CoreumTypeUrl.FT + "MsgUpdateDEXUnifiedRefAmount", + MsgUpdateDEXUnifiedRefAmount, + ], +]; diff --git a/dist/module/coreum/asset/nft/v1/authz.d.ts b/dist/module/coreum/asset/nft/v1/authz.d.ts new file mode 100644 index 0000000..8459ca0 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/authz.d.ts @@ -0,0 +1,33 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** SendAuthorization allows the grantee to send specific NFTs from the granter's account. */ +export interface SendAuthorization { + nfts: NFTIdentifier[]; +} +export interface NFTIdentifier { + /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ + classId: string; + /** id defines the unique identification of nft */ + id: string; +} +export declare const SendAuthorization: MessageFns; +export declare const NFTIdentifier: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/nft/v1/authz.js b/dist/module/coreum/asset/nft/v1/authz.js new file mode 100644 index 0000000..22367b6 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/authz.js @@ -0,0 +1,134 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/authz.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export const protobufPackage = "coreum.asset.nft.v1"; +function createBaseSendAuthorization() { + return { nfts: [] }; +} +export const SendAuthorization = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.nfts) { + NFTIdentifier.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.nfts.push(NFTIdentifier.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nfts: globalThis.Array.isArray(object?.nfts) + ? object.nfts.map((e) => NFTIdentifier.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => NFTIdentifier.toJSON(e)); + } + return obj; + }, + create(base) { + return SendAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSendAuthorization(); + message.nfts = object.nfts?.map((e) => NFTIdentifier.fromPartial(e)) || []; + return message; + }, +}; +function createBaseNFTIdentifier() { + return { classId: "", id: "" }; +} +export const NFTIdentifier = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNFTIdentifier(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return NFTIdentifier.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNFTIdentifier(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/nft/v1/event.d.ts b/dist/module/coreum/asset/nft/v1/event.d.ts new file mode 100644 index 0000000..0202ec3 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/event.d.ts @@ -0,0 +1,79 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { ClassFeature } from "./nft"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** EventClassIssued is emitted on MsgIssueClass. */ +export interface EventClassIssued { + id: string; + issuer: string; + symbol: string; + name: string; + description: string; + uri: string; + uriHash: string; + features: ClassFeature[]; + royaltyRate: string; +} +export interface EventFrozen { + classId: string; + id: string; + owner: string; +} +export interface EventUnfrozen { + classId: string; + id: string; + owner: string; +} +export interface EventClassFrozen { + classId: string; + account: string; +} +export interface EventClassUnfrozen { + classId: string; + account: string; +} +export interface EventAddedToWhitelist { + classId: string; + id: string; + account: string; +} +export interface EventRemovedFromWhitelist { + classId: string; + id: string; + account: string; +} +export interface EventAddedToClassWhitelist { + classId: string; + account: string; +} +export interface EventRemovedFromClassWhitelist { + classId: string; + account: string; +} +export declare const EventClassIssued: MessageFns; +export declare const EventFrozen: MessageFns; +export declare const EventUnfrozen: MessageFns; +export declare const EventClassFrozen: MessageFns; +export declare const EventClassUnfrozen: MessageFns; +export declare const EventAddedToWhitelist: MessageFns; +export declare const EventRemovedFromWhitelist: MessageFns; +export declare const EventAddedToClassWhitelist: MessageFns; +export declare const EventRemovedFromClassWhitelist: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/nft/v1/event.js b/dist/module/coreum/asset/nft/v1/event.js new file mode 100644 index 0000000..7f52dc5 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/event.js @@ -0,0 +1,814 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/event.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { classFeatureFromJSON, classFeatureToJSON } from "./nft"; +export const protobufPackage = "coreum.asset.nft.v1"; +function createBaseEventClassIssued() { + return { + id: "", + issuer: "", + symbol: "", + name: "", + description: "", + uri: "", + uriHash: "", + features: [], + royaltyRate: "", + }; +} +export const EventClassIssued = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.name !== "") { + writer.uint32(34).string(message.name); + } + if (message.description !== "") { + writer.uint32(42).string(message.description); + } + if (message.uri !== "") { + writer.uint32(50).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(58).string(message.uriHash); + } + writer.uint32(66).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.royaltyRate !== "") { + writer.uint32(74).string(message.royaltyRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventClassIssued(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.symbol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.name = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.description = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.uri = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 8: { + if (tag === 64) { + message.features.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag !== 74) { + break; + } + message.royaltyRate = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => classFeatureFromJSON(e)) + : [], + royaltyRate: isSet(object.royaltyRate) + ? globalThis.String(object.royaltyRate) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.features?.length) { + obj.features = message.features.map((e) => classFeatureToJSON(e)); + } + if (message.royaltyRate !== "") { + obj.royaltyRate = message.royaltyRate; + } + return obj; + }, + create(base) { + return EventClassIssued.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventClassIssued(); + message.id = object.id ?? ""; + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.features = object.features?.map((e) => e) || []; + message.royaltyRate = object.royaltyRate ?? ""; + return message; + }, +}; +function createBaseEventFrozen() { + return { classId: "", id: "", owner: "" }; +} +export const EventFrozen = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventFrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return EventFrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventFrozen(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseEventUnfrozen() { + return { classId: "", id: "", owner: "" }; +} +export const EventUnfrozen = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventUnfrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return EventUnfrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventUnfrozen(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseEventClassFrozen() { + return { classId: "", account: "" }; +} +export const EventClassFrozen = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventClassFrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return EventClassFrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventClassFrozen(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventClassUnfrozen() { + return { classId: "", account: "" }; +} +export const EventClassUnfrozen = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventClassUnfrozen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return EventClassUnfrozen.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventClassUnfrozen(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventAddedToWhitelist() { + return { classId: "", id: "", account: "" }; +} +export const EventAddedToWhitelist = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAddedToWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return EventAddedToWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAddedToWhitelist(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventRemovedFromWhitelist() { + return { classId: "", id: "", account: "" }; +} +export const EventRemovedFromWhitelist = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRemovedFromWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return EventRemovedFromWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventRemovedFromWhitelist(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventAddedToClassWhitelist() { + return { classId: "", account: "" }; +} +export const EventAddedToClassWhitelist = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAddedToClassWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return EventAddedToClassWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAddedToClassWhitelist(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseEventRemovedFromClassWhitelist() { + return { classId: "", account: "" }; +} +export const EventRemovedFromClassWhitelist = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRemovedFromClassWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return EventRemovedFromClassWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventRemovedFromClassWhitelist(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/nft/v1/genesis.d.ts b/dist/module/coreum/asset/nft/v1/genesis.d.ts new file mode 100644 index 0000000..eea09ae --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/genesis.d.ts @@ -0,0 +1,62 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { ClassDefinition } from "./nft"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** GenesisState defines the nftasset module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + /** class_definitions keep the non-fungible token class definitions state */ + classDefinitions: ClassDefinition[]; + frozenNfts: FrozenNFT[]; + whitelistedNftAccounts: WhitelistedNFTAccounts[]; + burntNfts: BurntNFT[]; + classWhitelistedAccounts: ClassWhitelistedAccounts[]; + classFrozenAccounts: ClassFrozenAccounts[]; +} +export interface FrozenNFT { + classID: string; + nftIDs: string[]; +} +export interface WhitelistedNFTAccounts { + classID: string; + nftID: string; + accounts: string[]; +} +export interface ClassWhitelistedAccounts { + classID: string; + accounts: string[]; +} +export interface ClassFrozenAccounts { + classID: string; + accounts: string[]; +} +export interface BurntNFT { + classID: string; + nftIDs: string[]; +} +export declare const GenesisState: MessageFns; +export declare const FrozenNFT: MessageFns; +export declare const WhitelistedNFTAccounts: MessageFns; +export declare const ClassWhitelistedAccounts: MessageFns; +export declare const ClassFrozenAccounts: MessageFns; +export declare const BurntNFT: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/nft/v1/genesis.js b/dist/module/coreum/asset/nft/v1/genesis.js new file mode 100644 index 0000000..20f05c6 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/genesis.js @@ -0,0 +1,550 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/genesis.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { ClassDefinition } from "./nft"; +import { Params } from "./params"; +export const protobufPackage = "coreum.asset.nft.v1"; +function createBaseGenesisState() { + return { + params: undefined, + classDefinitions: [], + frozenNfts: [], + whitelistedNftAccounts: [], + burntNfts: [], + classWhitelistedAccounts: [], + classFrozenAccounts: [], + }; +} +export const GenesisState = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.classDefinitions) { + ClassDefinition.encode(v, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.frozenNfts) { + FrozenNFT.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.whitelistedNftAccounts) { + WhitelistedNFTAccounts.encode(v, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.burntNfts) { + BurntNFT.encode(v, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.classWhitelistedAccounts) { + ClassWhitelistedAccounts.encode(v, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.classFrozenAccounts) { + ClassFrozenAccounts.encode(v, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classDefinitions.push(ClassDefinition.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.frozenNfts.push(FrozenNFT.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.whitelistedNftAccounts.push(WhitelistedNFTAccounts.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.burntNfts.push(BurntNFT.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.classWhitelistedAccounts.push(ClassWhitelistedAccounts.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.classFrozenAccounts.push(ClassFrozenAccounts.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + classDefinitions: globalThis.Array.isArray(object?.classDefinitions) + ? object.classDefinitions.map((e) => ClassDefinition.fromJSON(e)) + : [], + frozenNfts: globalThis.Array.isArray(object?.frozenNfts) + ? object.frozenNfts.map((e) => FrozenNFT.fromJSON(e)) + : [], + whitelistedNftAccounts: globalThis.Array.isArray(object?.whitelistedNftAccounts) + ? object.whitelistedNftAccounts.map((e) => WhitelistedNFTAccounts.fromJSON(e)) + : [], + burntNfts: globalThis.Array.isArray(object?.burntNfts) + ? object.burntNfts.map((e) => BurntNFT.fromJSON(e)) + : [], + classWhitelistedAccounts: globalThis.Array.isArray(object?.classWhitelistedAccounts) + ? object.classWhitelistedAccounts.map((e) => ClassWhitelistedAccounts.fromJSON(e)) + : [], + classFrozenAccounts: globalThis.Array.isArray(object?.classFrozenAccounts) + ? object.classFrozenAccounts.map((e) => ClassFrozenAccounts.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.classDefinitions?.length) { + obj.classDefinitions = message.classDefinitions.map((e) => ClassDefinition.toJSON(e)); + } + if (message.frozenNfts?.length) { + obj.frozenNfts = message.frozenNfts.map((e) => FrozenNFT.toJSON(e)); + } + if (message.whitelistedNftAccounts?.length) { + obj.whitelistedNftAccounts = message.whitelistedNftAccounts.map((e) => WhitelistedNFTAccounts.toJSON(e)); + } + if (message.burntNfts?.length) { + obj.burntNfts = message.burntNfts.map((e) => BurntNFT.toJSON(e)); + } + if (message.classWhitelistedAccounts?.length) { + obj.classWhitelistedAccounts = message.classWhitelistedAccounts.map((e) => ClassWhitelistedAccounts.toJSON(e)); + } + if (message.classFrozenAccounts?.length) { + obj.classFrozenAccounts = message.classFrozenAccounts.map((e) => ClassFrozenAccounts.toJSON(e)); + } + return obj; + }, + create(base) { + return GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.classDefinitions = + object.classDefinitions?.map((e) => ClassDefinition.fromPartial(e)) || []; + message.frozenNfts = + object.frozenNfts?.map((e) => FrozenNFT.fromPartial(e)) || []; + message.whitelistedNftAccounts = + object.whitelistedNftAccounts?.map((e) => WhitelistedNFTAccounts.fromPartial(e)) || []; + message.burntNfts = + object.burntNfts?.map((e) => BurntNFT.fromPartial(e)) || []; + message.classWhitelistedAccounts = + object.classWhitelistedAccounts?.map((e) => ClassWhitelistedAccounts.fromPartial(e)) || []; + message.classFrozenAccounts = + object.classFrozenAccounts?.map((e) => ClassFrozenAccounts.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFrozenNFT() { + return { classID: "", nftIDs: [] }; +} +export const FrozenNFT = { + encode(message, writer = new BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + for (const v of message.nftIDs) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFrozenNFT(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftIDs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + nftIDs: globalThis.Array.isArray(object?.nftIDs) + ? object.nftIDs.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.nftIDs?.length) { + obj.nftIDs = message.nftIDs; + } + return obj; + }, + create(base) { + return FrozenNFT.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFrozenNFT(); + message.classID = object.classID ?? ""; + message.nftIDs = object.nftIDs?.map((e) => e) || []; + return message; + }, +}; +function createBaseWhitelistedNFTAccounts() { + return { classID: "", nftID: "", accounts: [] }; +} +export const WhitelistedNFTAccounts = { + encode(message, writer = new BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + if (message.nftID !== "") { + writer.uint32(18).string(message.nftID); + } + for (const v of message.accounts) { + writer.uint32(34).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWhitelistedNFTAccounts(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftID = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + nftID: isSet(object.nftID) ? globalThis.String(object.nftID) : "", + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.nftID !== "") { + obj.nftID = message.nftID; + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return WhitelistedNFTAccounts.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseWhitelistedNFTAccounts(); + message.classID = object.classID ?? ""; + message.nftID = object.nftID ?? ""; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseClassWhitelistedAccounts() { + return { classID: "", accounts: [] }; +} +export const ClassWhitelistedAccounts = { + encode(message, writer = new BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClassWhitelistedAccounts(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return ClassWhitelistedAccounts.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassWhitelistedAccounts(); + message.classID = object.classID ?? ""; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseClassFrozenAccounts() { + return { classID: "", accounts: [] }; +} +export const ClassFrozenAccounts = { + encode(message, writer = new BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClassFrozenAccounts(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return ClassFrozenAccounts.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassFrozenAccounts(); + message.classID = object.classID ?? ""; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseBurntNFT() { + return { classID: "", nftIDs: [] }; +} +export const BurntNFT = { + encode(message, writer = new BinaryWriter()) { + if (message.classID !== "") { + writer.uint32(10).string(message.classID); + } + for (const v of message.nftIDs) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBurntNFT(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classID = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftIDs.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classID: isSet(object.classID) ? globalThis.String(object.classID) : "", + nftIDs: globalThis.Array.isArray(object?.nftIDs) + ? object.nftIDs.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classID !== "") { + obj.classID = message.classID; + } + if (message.nftIDs?.length) { + obj.nftIDs = message.nftIDs; + } + return obj; + }, + create(base) { + return BurntNFT.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBurntNFT(); + message.classID = object.classID ?? ""; + message.nftIDs = object.nftIDs?.map((e) => e) || []; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/nft/v1/nft.d.ts b/dist/module/coreum/asset/nft/v1/nft.d.ts new file mode 100644 index 0000000..e59c31d --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/nft.d.ts @@ -0,0 +1,65 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** ClassFeature defines possible features of non-fungible token class. */ +export declare enum ClassFeature { + burning = 0, + freezing = 1, + whitelisting = 2, + disable_sending = 3, + soulbound = 4, + UNRECOGNIZED = -1 +} +export declare function classFeatureFromJSON(object: any): ClassFeature; +export declare function classFeatureToJSON(object: ClassFeature): string; +/** ClassDefinition defines the non-fungible token class settings to store. */ +export interface ClassDefinition { + id: string; + issuer: string; + features: ClassFeature[]; + /** + * royalty_rate is a number between 0 and 1,which will be used in coreum native DEX. + * whenever an NFT this class is traded on the DEX, the traded amount will be multiplied by this value + * that will be transferred to the issuer of the NFT. + */ + royaltyRate: string; +} +/** Class is a full representation of the non-fungible token class. */ +export interface Class { + id: string; + issuer: string; + name: string; + symbol: string; + description: string; + uri: string; + uriHash: string; + data: Any | undefined; + features: ClassFeature[]; + /** + * royalty_rate is a number between 0 and 1,which will be used in coreum native DEX. + * whenever an NFT this class is traded on the DEX, the traded amount will be multiplied by this value + * that will be transferred to the issuer of the NFT. + */ + royaltyRate: string; +} +export declare const ClassDefinition: MessageFns; +export declare const Class: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/nft/v1/nft.js b/dist/module/coreum/asset/nft/v1/nft.js new file mode 100644 index 0000000..e073cde --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/nft.js @@ -0,0 +1,390 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/nft.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export const protobufPackage = "coreum.asset.nft.v1"; +/** ClassFeature defines possible features of non-fungible token class. */ +export var ClassFeature; +(function (ClassFeature) { + ClassFeature[ClassFeature["burning"] = 0] = "burning"; + ClassFeature[ClassFeature["freezing"] = 1] = "freezing"; + ClassFeature[ClassFeature["whitelisting"] = 2] = "whitelisting"; + ClassFeature[ClassFeature["disable_sending"] = 3] = "disable_sending"; + ClassFeature[ClassFeature["soulbound"] = 4] = "soulbound"; + ClassFeature[ClassFeature["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ClassFeature || (ClassFeature = {})); +export function classFeatureFromJSON(object) { + switch (object) { + case 0: + case "burning": + return ClassFeature.burning; + case 1: + case "freezing": + return ClassFeature.freezing; + case 2: + case "whitelisting": + return ClassFeature.whitelisting; + case 3: + case "disable_sending": + return ClassFeature.disable_sending; + case 4: + case "soulbound": + return ClassFeature.soulbound; + case -1: + case "UNRECOGNIZED": + default: + return ClassFeature.UNRECOGNIZED; + } +} +export function classFeatureToJSON(object) { + switch (object) { + case ClassFeature.burning: + return "burning"; + case ClassFeature.freezing: + return "freezing"; + case ClassFeature.whitelisting: + return "whitelisting"; + case ClassFeature.disable_sending: + return "disable_sending"; + case ClassFeature.soulbound: + return "soulbound"; + case ClassFeature.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseClassDefinition() { + return { id: "", issuer: "", features: [], royaltyRate: "" }; +} +export const ClassDefinition = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + writer.uint32(26).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.royaltyRate !== "") { + writer.uint32(34).string(message.royaltyRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClassDefinition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.features.push(reader.int32()); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 4: { + if (tag !== 34) { + break; + } + message.royaltyRate = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => classFeatureFromJSON(e)) + : [], + royaltyRate: isSet(object.royaltyRate) + ? globalThis.String(object.royaltyRate) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.features?.length) { + obj.features = message.features.map((e) => classFeatureToJSON(e)); + } + if (message.royaltyRate !== "") { + obj.royaltyRate = message.royaltyRate; + } + return obj; + }, + create(base) { + return ClassDefinition.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClassDefinition(); + message.id = object.id ?? ""; + message.issuer = object.issuer ?? ""; + message.features = object.features?.map((e) => e) || []; + message.royaltyRate = object.royaltyRate ?? ""; + return message; + }, +}; +function createBaseClass() { + return { + id: "", + issuer: "", + name: "", + symbol: "", + description: "", + uri: "", + uriHash: "", + data: undefined, + features: [], + royaltyRate: "", + }; +} +export const Class = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(34).string(message.symbol); + } + if (message.description !== "") { + writer.uint32(42).string(message.description); + } + if (message.uri !== "") { + writer.uint32(50).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(58).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(66).fork()).ldelim(); + } + writer.uint32(74).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.royaltyRate !== "") { + writer.uint32(82).string(message.royaltyRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.symbol = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.description = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.uri = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.data = Any.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag === 72) { + message.features.push(reader.int32()); + continue; + } + if (tag === 74) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 10: { + if (tag !== 82) { + break; + } + message.royaltyRate = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => classFeatureFromJSON(e)) + : [], + royaltyRate: isSet(object.royaltyRate) + ? globalThis.String(object.royaltyRate) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + if (message.features?.length) { + obj.features = message.features.map((e) => classFeatureToJSON(e)); + } + if (message.royaltyRate !== "") { + obj.royaltyRate = message.royaltyRate; + } + return obj; + }, + create(base) { + return Class.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClass(); + message.id = object.id ?? ""; + message.issuer = object.issuer ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? Any.fromPartial(object.data) + : undefined; + message.features = object.features?.map((e) => e) || []; + message.royaltyRate = object.royaltyRate ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/nft/v1/params.d.ts b/dist/module/coreum/asset/nft/v1/params.d.ts new file mode 100644 index 0000000..4ab5c0f --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/params.d.ts @@ -0,0 +1,28 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** Params store gov manageable parameters. */ +export interface Params { + /** mint_fee is the fee burnt each time new NFT is minted */ + mintFee: Coin | undefined; +} +export declare const Params: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/nft/v1/params.js b/dist/module/coreum/asset/nft/v1/params.js new file mode 100644 index 0000000..8c4b543 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/params.js @@ -0,0 +1,70 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/params.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +export const protobufPackage = "coreum.asset.nft.v1"; +function createBaseParams() { + return { mintFee: undefined }; +} +export const Params = { + encode(message, writer = new BinaryWriter()) { + if (message.mintFee !== undefined) { + Coin.encode(message.mintFee, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.mintFee = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + mintFee: isSet(object.mintFee) + ? Coin.fromJSON(object.mintFee) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.mintFee !== undefined) { + obj.mintFee = Coin.toJSON(message.mintFee); + } + return obj; + }, + create(base) { + return Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.mintFee = + object.mintFee !== undefined && object.mintFee !== null + ? Coin.fromPartial(object.mintFee) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/nft/v1/query.d.ts b/dist/module/coreum/asset/nft/v1/query.d.ts new file mode 100644 index 0000000..314b751 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/query.d.ts @@ -0,0 +1,189 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Class } from "./nft"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** QueryParamsRequest defines the request type for querying x/asset/nft parameters. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse defines the response type for querying x/asset/nft parameters. */ +export interface QueryParamsResponse { + params: Params | undefined; +} +/** QueryTokenRequest is request type for the Query/Class RPC method. */ +export interface QueryClassRequest { + /** we don't use the gogoproto.customname here since the google.api.http ignores it and generates invalid code. */ + id: string; +} +/** QueryClassResponse is response type for the Query/Class RPC method. */ +export interface QueryClassResponse { + class: Class | undefined; +} +/** QueryTokenRequest is request type for the Query/Classes RPC method. */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + issuer: string; +} +/** QueryClassResponse is response type for the Query/Classes RPC method. */ +export interface QueryClassesResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + classes: Class[]; +} +export interface QueryFrozenRequest { + id: string; + classId: string; +} +export interface QueryFrozenResponse { + frozen: boolean; +} +export interface QueryClassFrozenRequest { + classId: string; + account: string; +} +export interface QueryClassFrozenResponse { + frozen: boolean; +} +export interface QueryWhitelistedRequest { + id: string; + classId: string; + account: string; +} +export interface QueryWhitelistedResponse { + whitelisted: boolean; +} +export interface QueryWhitelistedAccountsForNFTRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + id: string; + classId: string; +} +export interface QueryWhitelistedAccountsForNFTResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + accounts: string[]; +} +export interface QueryClassWhitelistedAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + classId: string; +} +export interface QueryClassWhitelistedAccountsResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + accounts: string[]; +} +export interface QueryClassFrozenAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; + classId: string; +} +export interface QueryClassFrozenAccountsResponse { + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; + accounts: string[]; +} +export interface QueryBurntNFTRequest { + classId: string; + nftId: string; +} +export interface QueryBurntNFTResponse { + burnt: boolean; +} +export interface QueryBurntNFTsInClassRequest { + pagination: PageRequest | undefined; + classId: string; +} +export interface QueryBurntNFTsInClassResponse { + pagination: PageResponse | undefined; + nftIds: string[]; +} +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +export declare const QueryClassRequest: MessageFns; +export declare const QueryClassResponse: MessageFns; +export declare const QueryClassesRequest: MessageFns; +export declare const QueryClassesResponse: MessageFns; +export declare const QueryFrozenRequest: MessageFns; +export declare const QueryFrozenResponse: MessageFns; +export declare const QueryClassFrozenRequest: MessageFns; +export declare const QueryClassFrozenResponse: MessageFns; +export declare const QueryWhitelistedRequest: MessageFns; +export declare const QueryWhitelistedResponse: MessageFns; +export declare const QueryWhitelistedAccountsForNFTRequest: MessageFns; +export declare const QueryWhitelistedAccountsForNFTResponse: MessageFns; +export declare const QueryClassWhitelistedAccountsRequest: MessageFns; +export declare const QueryClassWhitelistedAccountsResponse: MessageFns; +export declare const QueryClassFrozenAccountsRequest: MessageFns; +export declare const QueryClassFrozenAccountsResponse: MessageFns; +export declare const QueryBurntNFTRequest: MessageFns; +export declare const QueryBurntNFTResponse: MessageFns; +export declare const QueryBurntNFTsInClassRequest: MessageFns; +export declare const QueryBurntNFTsInClassResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Params queries the parameters of x/asset/nft module. */ + Params(request: QueryParamsRequest): Promise; + /** Class queries the non-fungible token class of the module. */ + Class(request: QueryClassRequest): Promise; + /** Classes queries the non-fungible token classes of the module. */ + Classes(request: QueryClassesRequest): Promise; + /** Frozen queries to check if an NFT is frozen or not. */ + Frozen(request: QueryFrozenRequest): Promise; + /** ClassFrozen queries to check if an account if frozen for an NFT class. */ + ClassFrozen(request: QueryClassFrozenRequest): Promise; + /** QueryClassFrozenAccountsRequest returns the list of accounts which are frozen to hold NFTs in this class. */ + ClassFrozenAccounts(request: QueryClassFrozenAccountsRequest): Promise; + /** Whitelisted queries to check if an account is whitelited to hold an NFT or not. */ + Whitelisted(request: QueryWhitelistedRequest): Promise; + /** WhitelistedAccountsForNFT returns the list of accounts which are whitelisted to hold this NFT. */ + WhitelistedAccountsForNFT(request: QueryWhitelistedAccountsForNFTRequest): Promise; + /** ClassWhitelistedAccounts returns the list of accounts which are whitelisted to hold NFTs in this class. */ + ClassWhitelistedAccounts(request: QueryClassWhitelistedAccountsRequest): Promise; + /** BurntNFTsInClass checks if an nft if is in burnt NFTs list. */ + BurntNFT(request: QueryBurntNFTRequest): Promise; + /** BurntNFTsInClass returns the list of burnt nfts in a class. */ + BurntNFTsInClass(request: QueryBurntNFTsInClassRequest): Promise; +} +export declare const QueryServiceName = "coreum.asset.nft.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Params(request: QueryParamsRequest): Promise; + Class(request: QueryClassRequest): Promise; + Classes(request: QueryClassesRequest): Promise; + Frozen(request: QueryFrozenRequest): Promise; + ClassFrozen(request: QueryClassFrozenRequest): Promise; + ClassFrozenAccounts(request: QueryClassFrozenAccountsRequest): Promise; + Whitelisted(request: QueryWhitelistedRequest): Promise; + WhitelistedAccountsForNFT(request: QueryWhitelistedAccountsForNFTRequest): Promise; + ClassWhitelistedAccounts(request: QueryClassWhitelistedAccountsRequest): Promise; + BurntNFT(request: QueryBurntNFTRequest): Promise; + BurntNFTsInClass(request: QueryBurntNFTsInClassRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/nft/v1/query.js b/dist/module/coreum/asset/nft/v1/query.js new file mode 100644 index 0000000..f7fcd55 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/query.js @@ -0,0 +1,1545 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/query.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse, } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Class } from "./nft"; +import { Params } from "./params"; +export const protobufPackage = "coreum.asset.nft.v1"; +function createBaseQueryParamsRequest() { + return {}; +} +export const QueryParamsRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +export const QueryParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseQueryClassRequest() { + return { id: "" }; +} +export const QueryClassRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return QueryClassRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassRequest(); + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseQueryClassResponse() { + return { class: undefined }; +} +export const QueryClassResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.class !== undefined) { + Class.encode(message.class, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.class = Class.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + class: isSet(object.class) ? Class.fromJSON(object.class) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.class !== undefined) { + obj.class = Class.toJSON(message.class); + } + return obj; + }, + create(base) { + return QueryClassResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassResponse(); + message.class = + object.class !== undefined && object.class !== null + ? Class.fromPartial(object.class) + : undefined; + return message; + }, +}; +function createBaseQueryClassesRequest() { + return { pagination: undefined, issuer: "" }; +} +export const QueryClassesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.issuer !== "") { + writer.uint32(18).string(message.issuer); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.issuer = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + return obj; + }, + create(base) { + return QueryClassesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.issuer = object.issuer ?? ""; + return message; + }, +}; +function createBaseQueryClassesResponse() { + return { pagination: undefined, classes: [] }; +} +export const QueryClassesResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.classes) { + Class.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classes.push(Class.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + classes: globalThis.Array.isArray(object?.classes) + ? object.classes.map((e) => Class.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.classes?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + return obj; + }, + create(base) { + return QueryClassesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassesResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.classes = object.classes?.map((e) => Class.fromPartial(e)) || []; + return message; + }, +}; +function createBaseQueryFrozenRequest() { + return { id: "", classId: "" }; +} +export const QueryFrozenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return QueryFrozenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenRequest(); + message.id = object.id ?? ""; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryFrozenResponse() { + return { frozen: false }; +} +export const QueryFrozenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.frozen !== false) { + writer.uint32(8).bool(message.frozen); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFrozenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.frozen = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + frozen: isSet(object.frozen) ? globalThis.Boolean(object.frozen) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.frozen !== false) { + obj.frozen = message.frozen; + } + return obj; + }, + create(base) { + return QueryFrozenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryFrozenResponse(); + message.frozen = object.frozen ?? false; + return message; + }, +}; +function createBaseQueryClassFrozenRequest() { + return { classId: "", account: "" }; +} +export const QueryClassFrozenRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassFrozenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return QueryClassFrozenRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassFrozenRequest(); + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseQueryClassFrozenResponse() { + return { frozen: false }; +} +export const QueryClassFrozenResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.frozen !== false) { + writer.uint32(8).bool(message.frozen); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassFrozenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.frozen = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + frozen: isSet(object.frozen) ? globalThis.Boolean(object.frozen) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.frozen !== false) { + obj.frozen = message.frozen; + } + return obj; + }, + create(base) { + return QueryClassFrozenResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassFrozenResponse(); + message.frozen = object.frozen ?? false; + return message; + }, +}; +function createBaseQueryWhitelistedRequest() { + return { id: "", classId: "", account: "" }; +} +export const QueryWhitelistedRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return QueryWhitelistedRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedRequest(); + message.id = object.id ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseQueryWhitelistedResponse() { + return { whitelisted: false }; +} +export const QueryWhitelistedResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.whitelisted !== false) { + writer.uint32(8).bool(message.whitelisted); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.whitelisted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + whitelisted: isSet(object.whitelisted) + ? globalThis.Boolean(object.whitelisted) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.whitelisted !== false) { + obj.whitelisted = message.whitelisted; + } + return obj; + }, + create(base) { + return QueryWhitelistedResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedResponse(); + message.whitelisted = object.whitelisted ?? false; + return message; + }, +}; +function createBaseQueryWhitelistedAccountsForNFTRequest() { + return { pagination: undefined, id: "", classId: "" }; +} +export const QueryWhitelistedAccountsForNFTRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.classId !== "") { + writer.uint32(26).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedAccountsForNFTRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + id: isSet(object.id) ? globalThis.String(object.id) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return QueryWhitelistedAccountsForNFTRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedAccountsForNFTRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.id = object.id ?? ""; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryWhitelistedAccountsForNFTResponse() { + return { pagination: undefined, accounts: [] }; +} +export const QueryWhitelistedAccountsForNFTResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryWhitelistedAccountsForNFTResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return QueryWhitelistedAccountsForNFTResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryWhitelistedAccountsForNFTResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseQueryClassWhitelistedAccountsRequest() { + return { pagination: undefined, classId: "" }; +} +export const QueryClassWhitelistedAccountsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassWhitelistedAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return QueryClassWhitelistedAccountsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassWhitelistedAccountsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryClassWhitelistedAccountsResponse() { + return { pagination: undefined, accounts: [] }; +} +export const QueryClassWhitelistedAccountsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassWhitelistedAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return QueryClassWhitelistedAccountsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassWhitelistedAccountsResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseQueryClassFrozenAccountsRequest() { + return { pagination: undefined, classId: "" }; +} +export const QueryClassFrozenAccountsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassFrozenAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return QueryClassFrozenAccountsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassFrozenAccountsRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryClassFrozenAccountsResponse() { + return { pagination: undefined, accounts: [] }; +} +export const QueryClassFrozenAccountsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.accounts) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassFrozenAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.accounts.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + accounts: globalThis.Array.isArray(object?.accounts) + ? object.accounts.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.accounts?.length) { + obj.accounts = message.accounts; + } + return obj; + }, + create(base) { + return QueryClassFrozenAccountsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassFrozenAccountsResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.accounts = object.accounts?.map((e) => e) || []; + return message; + }, +}; +function createBaseQueryBurntNFTRequest() { + return { classId: "", nftId: "" }; +} +export const QueryBurntNFTRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.nftId !== "") { + writer.uint32(18).string(message.nftId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBurntNFTRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + nftId: isSet(object.nftId) ? globalThis.String(object.nftId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.nftId !== "") { + obj.nftId = message.nftId; + } + return obj; + }, + create(base) { + return QueryBurntNFTRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBurntNFTRequest(); + message.classId = object.classId ?? ""; + message.nftId = object.nftId ?? ""; + return message; + }, +}; +function createBaseQueryBurntNFTResponse() { + return { burnt: false }; +} +export const QueryBurntNFTResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.burnt !== false) { + writer.uint32(8).bool(message.burnt); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBurntNFTResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.burnt = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + burnt: isSet(object.burnt) ? globalThis.Boolean(object.burnt) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.burnt !== false) { + obj.burnt = message.burnt; + } + return obj; + }, + create(base) { + return QueryBurntNFTResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBurntNFTResponse(); + message.burnt = object.burnt ?? false; + return message; + }, +}; +function createBaseQueryBurntNFTsInClassRequest() { + return { pagination: undefined, classId: "" }; +} +export const QueryBurntNFTsInClassRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBurntNFTsInClassRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return QueryBurntNFTsInClassRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBurntNFTsInClassRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryBurntNFTsInClassResponse() { + return { pagination: undefined, nftIds: [] }; +} +export const QueryBurntNFTsInClassResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.nftIds) { + writer.uint32(18).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBurntNFTsInClassResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nftIds.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + nftIds: globalThis.Array.isArray(object?.nftIds) + ? object.nftIds.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + if (message.nftIds?.length) { + obj.nftIds = message.nftIds; + } + return obj; + }, + create(base) { + return QueryBurntNFTsInClassResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBurntNFTsInClassResponse(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + message.nftIds = object.nftIds?.map((e) => e) || []; + return message; + }, +}; +export const QueryServiceName = "coreum.asset.nft.v1.Query"; +export class QueryClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Class = this.Class.bind(this); + this.Classes = this.Classes.bind(this); + this.Frozen = this.Frozen.bind(this); + this.ClassFrozen = this.ClassFrozen.bind(this); + this.ClassFrozenAccounts = this.ClassFrozenAccounts.bind(this); + this.Whitelisted = this.Whitelisted.bind(this); + this.WhitelistedAccountsForNFT = this.WhitelistedAccountsForNFT.bind(this); + this.ClassWhitelistedAccounts = this.ClassWhitelistedAccounts.bind(this); + this.BurntNFT = this.BurntNFT.bind(this); + this.BurntNFTsInClass = this.BurntNFTsInClass.bind(this); + } + Params(request) { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data))); + } + Class(request) { + const data = QueryClassRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Class", data); + return promise.then((data) => QueryClassResponse.decode(new BinaryReader(data))); + } + Classes(request) { + const data = QueryClassesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Classes", data); + return promise.then((data) => QueryClassesResponse.decode(new BinaryReader(data))); + } + Frozen(request) { + const data = QueryFrozenRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Frozen", data); + return promise.then((data) => QueryFrozenResponse.decode(new BinaryReader(data))); + } + ClassFrozen(request) { + const data = QueryClassFrozenRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassFrozen", data); + return promise.then((data) => QueryClassFrozenResponse.decode(new BinaryReader(data))); + } + ClassFrozenAccounts(request) { + const data = QueryClassFrozenAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassFrozenAccounts", data); + return promise.then((data) => QueryClassFrozenAccountsResponse.decode(new BinaryReader(data))); + } + Whitelisted(request) { + const data = QueryWhitelistedRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Whitelisted", data); + return promise.then((data) => QueryWhitelistedResponse.decode(new BinaryReader(data))); + } + WhitelistedAccountsForNFT(request) { + const data = QueryWhitelistedAccountsForNFTRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "WhitelistedAccountsForNFT", data); + return promise.then((data) => QueryWhitelistedAccountsForNFTResponse.decode(new BinaryReader(data))); + } + ClassWhitelistedAccounts(request) { + const data = QueryClassWhitelistedAccountsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassWhitelistedAccounts", data); + return promise.then((data) => QueryClassWhitelistedAccountsResponse.decode(new BinaryReader(data))); + } + BurntNFT(request) { + const data = QueryBurntNFTRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "BurntNFT", data); + return promise.then((data) => QueryBurntNFTResponse.decode(new BinaryReader(data))); + } + BurntNFTsInClass(request) { + const data = QueryBurntNFTsInClassRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "BurntNFTsInClass", data); + return promise.then((data) => QueryBurntNFTsInClassResponse.decode(new BinaryReader(data))); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/nft/v1/tx.d.ts b/dist/module/coreum/asset/nft/v1/tx.d.ts new file mode 100644 index 0000000..63e658e --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/tx.d.ts @@ -0,0 +1,192 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +import { ClassFeature } from "./nft"; +import { Params } from "./params"; +import { DataDynamicIndexedItem } from "./types"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** MsgIssueClass defines message for the IssueClass method. */ +export interface MsgIssueClass { + issuer: string; + symbol: string; + name: string; + description: string; + uri: string; + uriHash: string; + data: Any | undefined; + features: ClassFeature[]; + royaltyRate: string; +} +/** MsgMint defines message for the Mint method. */ +export interface MsgMint { + sender: string; + classId: string; + id: string; + uri: string; + uriHash: string; + /** Data can be DataBytes or DataDynamic. */ + data: Any | undefined; + recipient: string; +} +/** MsgUpdateData defines message to update the dynamic data. */ +export interface MsgUpdateData { + sender: string; + classId: string; + id: string; + items: DataDynamicIndexedItem[]; +} +/** MsgBurn defines message for the Burn method. */ +export interface MsgBurn { + sender: string; + classId: string; + id: string; +} +export interface MsgFreeze { + sender: string; + classId: string; + id: string; +} +export interface MsgUnfreeze { + sender: string; + classId: string; + id: string; +} +export interface MsgClassFreeze { + sender: string; + classId: string; + account: string; +} +export interface MsgClassUnfreeze { + sender: string; + classId: string; + account: string; +} +export interface MsgAddToWhitelist { + sender: string; + classId: string; + id: string; + account: string; +} +export interface MsgRemoveFromWhitelist { + sender: string; + classId: string; + id: string; + account: string; +} +export interface MsgAddToClassWhitelist { + sender: string; + classId: string; + account: string; +} +export interface MsgRemoveFromClassWhitelist { + sender: string; + classId: string; + account: string; +} +export interface MsgUpdateParams { + authority: string; + params: Params | undefined; +} +export interface EmptyResponse { +} +export declare const MsgIssueClass: MessageFns; +export declare const MsgMint: MessageFns; +export declare const MsgUpdateData: MessageFns; +export declare const MsgBurn: MessageFns; +export declare const MsgFreeze: MessageFns; +export declare const MsgUnfreeze: MessageFns; +export declare const MsgClassFreeze: MessageFns; +export declare const MsgClassUnfreeze: MessageFns; +export declare const MsgAddToWhitelist: MessageFns; +export declare const MsgRemoveFromWhitelist: MessageFns; +export declare const MsgAddToClassWhitelist: MessageFns; +export declare const MsgRemoveFromClassWhitelist: MessageFns; +export declare const MsgUpdateParams: MessageFns; +export declare const EmptyResponse: MessageFns; +/** Msg defines the Msg service. */ +export interface Msg { + /** IssueClass creates new non-fungible token class. */ + IssueClass(request: MsgIssueClass): Promise; + /** Mint mints new non-fungible token in the class. */ + Mint(request: MsgMint): Promise; + /** UpdateData updates the existing non-fungible token data in the class. */ + UpdateData(request: MsgUpdateData): Promise; + /** Burn burns the existing non-fungible token in the class. */ + Burn(request: MsgBurn): Promise; + /** Freeze freezes an NFT */ + Freeze(request: MsgFreeze): Promise; + /** Unfreeze removes the freeze effect already put on an NFT */ + Unfreeze(request: MsgUnfreeze): Promise; + /** AddToWhitelist sets the account as whitelisted to hold the NFT */ + AddToWhitelist(request: MsgAddToWhitelist): Promise; + /** RemoveFromWhitelist removes an account from whitelisted list of the NFT */ + RemoveFromWhitelist(request: MsgRemoveFromWhitelist): Promise; + /** + * AddToClassWhitelist adds account as whitelist for all the NFTs in the class + * NOTE: class whitelist does not affect the individual nft whitelisting. + */ + AddToClassWhitelist(request: MsgAddToClassWhitelist): Promise; + /** + * RemoveFromClassWhitelist removes account as whitelist for the entire class + * NOTE: + * class whitelist does not affect the individual nft whitelisting. + * ie. if specific whitelist is granted for an NFT, that whitelist will + * still be valid, ater we add and remove it from the class whitelist. + */ + RemoveFromClassWhitelist(request: MsgRemoveFromClassWhitelist): Promise; + /** ClassFreeze freezes all NFTs of a class held by an account. */ + ClassFreeze(request: MsgClassFreeze): Promise; + /** + * ClassUnfreeze removes class-freeze on an account for an NFT class. + * NOTE: + * class unfreeze does not affect the individual nft freeze. + */ + ClassUnfreeze(request: MsgClassUnfreeze): Promise; + /** + * UpdateParams is a governance operation that sets the parameters of the module. + * NOTE: all parameters must be provided. + */ + UpdateParams(request: MsgUpdateParams): Promise; +} +export declare const MsgServiceName = "coreum.asset.nft.v1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + IssueClass(request: MsgIssueClass): Promise; + Mint(request: MsgMint): Promise; + UpdateData(request: MsgUpdateData): Promise; + Burn(request: MsgBurn): Promise; + Freeze(request: MsgFreeze): Promise; + Unfreeze(request: MsgUnfreeze): Promise; + AddToWhitelist(request: MsgAddToWhitelist): Promise; + RemoveFromWhitelist(request: MsgRemoveFromWhitelist): Promise; + AddToClassWhitelist(request: MsgAddToClassWhitelist): Promise; + RemoveFromClassWhitelist(request: MsgRemoveFromClassWhitelist): Promise; + ClassFreeze(request: MsgClassFreeze): Promise; + ClassUnfreeze(request: MsgClassUnfreeze): Promise; + UpdateParams(request: MsgUpdateParams): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/nft/v1/tx.js b/dist/module/coreum/asset/nft/v1/tx.js new file mode 100644 index 0000000..f8ffe38 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/tx.js @@ -0,0 +1,1447 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/tx.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +import { classFeatureFromJSON, classFeatureToJSON } from "./nft"; +import { Params } from "./params"; +import { DataDynamicIndexedItem } from "./types"; +export const protobufPackage = "coreum.asset.nft.v1"; +function createBaseMsgIssueClass() { + return { + issuer: "", + symbol: "", + name: "", + description: "", + uri: "", + uriHash: "", + data: undefined, + features: [], + royaltyRate: "", + }; +} +export const MsgIssueClass = { + encode(message, writer = new BinaryWriter()) { + if (message.issuer !== "") { + writer.uint32(10).string(message.issuer); + } + if (message.symbol !== "") { + writer.uint32(18).string(message.symbol); + } + if (message.name !== "") { + writer.uint32(26).string(message.name); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + if (message.uri !== "") { + writer.uint32(42).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(50).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(58).fork()).ldelim(); + } + writer.uint32(66).fork(); + for (const v of message.features) { + writer.int32(v); + } + writer.ldelim(); + if (message.royaltyRate !== "") { + writer.uint32(74).string(message.royaltyRate); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIssueClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.issuer = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.symbol = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.description = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.uri = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.data = Any.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag === 64) { + message.features.push(reader.int32()); + continue; + } + if (tag === 66) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.features.push(reader.int32()); + } + continue; + } + break; + } + case 9: { + if (tag !== 74) { + break; + } + message.royaltyRate = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + features: globalThis.Array.isArray(object?.features) + ? object.features.map((e) => classFeatureFromJSON(e)) + : [], + royaltyRate: isSet(object.royaltyRate) + ? globalThis.String(object.royaltyRate) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.issuer !== "") { + obj.issuer = message.issuer; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + if (message.features?.length) { + obj.features = message.features.map((e) => classFeatureToJSON(e)); + } + if (message.royaltyRate !== "") { + obj.royaltyRate = message.royaltyRate; + } + return obj; + }, + create(base) { + return MsgIssueClass.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIssueClass(); + message.issuer = object.issuer ?? ""; + message.symbol = object.symbol ?? ""; + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? Any.fromPartial(object.data) + : undefined; + message.features = object.features?.map((e) => e) || []; + message.royaltyRate = object.royaltyRate ?? ""; + return message; + }, +}; +function createBaseMsgMint() { + return { + sender: "", + classId: "", + id: "", + uri: "", + uriHash: "", + data: undefined, + recipient: "", + }; +} +export const MsgMint = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.uri !== "") { + writer.uint32(34).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(42).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(50).fork()).ldelim(); + } + if (message.recipient !== "") { + writer.uint32(58).string(message.recipient); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.uri = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.data = Any.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.recipient = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + recipient: isSet(object.recipient) + ? globalThis.String(object.recipient) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + return obj; + }, + create(base) { + return MsgMint.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgMint(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? Any.fromPartial(object.data) + : undefined; + message.recipient = object.recipient ?? ""; + return message; + }, +}; +function createBaseMsgUpdateData() { + return { sender: "", classId: "", id: "", items: [] }; +} +export const MsgUpdateData = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + for (const v of message.items) { + DataDynamicIndexedItem.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.items.push(DataDynamicIndexedItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e) => DataDynamicIndexedItem.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.items?.length) { + obj.items = message.items.map((e) => DataDynamicIndexedItem.toJSON(e)); + } + return obj; + }, + create(base) { + return MsgUpdateData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateData(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.items = + object.items?.map((e) => DataDynamicIndexedItem.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgBurn() { + return { sender: "", classId: "", id: "" }; +} +export const MsgBurn = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return MsgBurn.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgBurn(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseMsgFreeze() { + return { sender: "", classId: "", id: "" }; +} +export const MsgFreeze = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return MsgFreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgFreeze(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseMsgUnfreeze() { + return { sender: "", classId: "", id: "" }; +} +export const MsgUnfreeze = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnfreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return MsgUnfreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUnfreeze(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseMsgClassFreeze() { + return { sender: "", classId: "", account: "" }; +} +export const MsgClassFreeze = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClassFreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return MsgClassFreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClassFreeze(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgClassUnfreeze() { + return { sender: "", classId: "", account: "" }; +} +export const MsgClassUnfreeze = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClassUnfreeze(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return MsgClassUnfreeze.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClassUnfreeze(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgAddToWhitelist() { + return { sender: "", classId: "", id: "", account: "" }; +} +export const MsgAddToWhitelist = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.account !== "") { + writer.uint32(34).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddToWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return MsgAddToWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgAddToWhitelist(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgRemoveFromWhitelist() { + return { sender: "", classId: "", id: "", account: "" }; +} +export const MsgRemoveFromWhitelist = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.account !== "") { + writer.uint32(34).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveFromWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return MsgRemoveFromWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgRemoveFromWhitelist(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgAddToClassWhitelist() { + return { sender: "", classId: "", account: "" }; +} +export const MsgAddToClassWhitelist = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddToClassWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return MsgAddToClassWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgAddToClassWhitelist(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgRemoveFromClassWhitelist() { + return { sender: "", classId: "", account: "" }; +} +export const MsgRemoveFromClassWhitelist = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.classId !== "") { + writer.uint32(18).string(message.classId); + } + if (message.account !== "") { + writer.uint32(26).string(message.account); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveFromClassWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.classId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.account = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.account !== "") { + obj.account = message.account; + } + return obj; + }, + create(base) { + return MsgRemoveFromClassWhitelist.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgRemoveFromClassWhitelist(); + message.sender = object.sender ?? ""; + message.classId = object.classId ?? ""; + message.account = object.account ?? ""; + return message; + }, +}; +function createBaseMsgUpdateParams() { + return { authority: "", params: undefined }; +} +export const MsgUpdateParams = { + encode(message, writer = new BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return MsgUpdateParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseEmptyResponse() { + return {}; +} +export const EmptyResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmptyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return EmptyResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseEmptyResponse(); + return message; + }, +}; +export const MsgServiceName = "coreum.asset.nft.v1.Msg"; +export class MsgClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.IssueClass = this.IssueClass.bind(this); + this.Mint = this.Mint.bind(this); + this.UpdateData = this.UpdateData.bind(this); + this.Burn = this.Burn.bind(this); + this.Freeze = this.Freeze.bind(this); + this.Unfreeze = this.Unfreeze.bind(this); + this.AddToWhitelist = this.AddToWhitelist.bind(this); + this.RemoveFromWhitelist = this.RemoveFromWhitelist.bind(this); + this.AddToClassWhitelist = this.AddToClassWhitelist.bind(this); + this.RemoveFromClassWhitelist = this.RemoveFromClassWhitelist.bind(this); + this.ClassFreeze = this.ClassFreeze.bind(this); + this.ClassUnfreeze = this.ClassUnfreeze.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + IssueClass(request) { + const data = MsgIssueClass.encode(request).finish(); + const promise = this.rpc.request(this.service, "IssueClass", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Mint(request) { + const data = MsgMint.encode(request).finish(); + const promise = this.rpc.request(this.service, "Mint", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + UpdateData(request) { + const data = MsgUpdateData.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateData", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Burn(request) { + const data = MsgBurn.encode(request).finish(); + const promise = this.rpc.request(this.service, "Burn", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Freeze(request) { + const data = MsgFreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "Freeze", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + Unfreeze(request) { + const data = MsgUnfreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "Unfreeze", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + AddToWhitelist(request) { + const data = MsgAddToWhitelist.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddToWhitelist", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + RemoveFromWhitelist(request) { + const data = MsgRemoveFromWhitelist.encode(request).finish(); + const promise = this.rpc.request(this.service, "RemoveFromWhitelist", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + AddToClassWhitelist(request) { + const data = MsgAddToClassWhitelist.encode(request).finish(); + const promise = this.rpc.request(this.service, "AddToClassWhitelist", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + RemoveFromClassWhitelist(request) { + const data = MsgRemoveFromClassWhitelist.encode(request).finish(); + const promise = this.rpc.request(this.service, "RemoveFromClassWhitelist", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + ClassFreeze(request) { + const data = MsgClassFreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassFreeze", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + ClassUnfreeze(request) { + const data = MsgClassUnfreeze.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClassUnfreeze", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + UpdateParams(request) { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/asset/nft/v1/types.d.ts b/dist/module/coreum/asset/nft/v1/types.d.ts new file mode 100644 index 0000000..b4d7c18 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/types.d.ts @@ -0,0 +1,52 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.asset.nft.v1"; +/** DataEditor defines possible data editors. */ +export declare enum DataEditor { + admin = 0, + owner = 1, + UNRECOGNIZED = -1 +} +export declare function dataEditorFromJSON(object: any): DataEditor; +export declare function dataEditorToJSON(object: DataEditor): string; +/** DataBytes represents the immutable data. */ +export interface DataBytes { + Data: Uint8Array; +} +/** DataDynamicItem contains the updatable data and modification types. */ +export interface DataDynamicItem { + /** contains the set of the data editors, if empty no one can update. */ + editors: DataEditor[]; + data: Uint8Array; +} +/** DataDynamicIndexed contains the data and it's index in the DataDynamic. */ +export interface DataDynamicIndexedItem { + index: number; + data: Uint8Array; +} +/** DataDynamic is dynamic data which contains the list of the items allowed to be modified base on their modification types. */ +export interface DataDynamic { + items: DataDynamicItem[]; +} +export declare const DataBytes: MessageFns; +export declare const DataDynamicItem: MessageFns; +export declare const DataDynamicIndexedItem: MessageFns; +export declare const DataDynamic: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/asset/nft/v1/types.js b/dist/module/coreum/asset/nft/v1/types.js new file mode 100644 index 0000000..e70bee0 --- /dev/null +++ b/dist/module/coreum/asset/nft/v1/types.js @@ -0,0 +1,330 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/nft/types.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export const protobufPackage = "coreum.asset.nft.v1"; +/** DataEditor defines possible data editors. */ +export var DataEditor; +(function (DataEditor) { + DataEditor[DataEditor["admin"] = 0] = "admin"; + DataEditor[DataEditor["owner"] = 1] = "owner"; + DataEditor[DataEditor["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(DataEditor || (DataEditor = {})); +export function dataEditorFromJSON(object) { + switch (object) { + case 0: + case "admin": + return DataEditor.admin; + case 1: + case "owner": + return DataEditor.owner; + case -1: + case "UNRECOGNIZED": + default: + return DataEditor.UNRECOGNIZED; + } +} +export function dataEditorToJSON(object) { + switch (object) { + case DataEditor.admin: + return "admin"; + case DataEditor.owner: + return "owner"; + case DataEditor.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseDataBytes() { + return { Data: new Uint8Array(0) }; +} +export const DataBytes = { + encode(message, writer = new BinaryWriter()) { + if (message.Data.length !== 0) { + writer.uint32(10).bytes(message.Data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDataBytes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.Data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + Data: isSet(object.Data) + ? bytesFromBase64(object.Data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.Data.length !== 0) { + obj.Data = base64FromBytes(message.Data); + } + return obj; + }, + create(base) { + return DataBytes.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataBytes(); + message.Data = object.Data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseDataDynamicItem() { + return { editors: [], data: new Uint8Array(0) }; +} +export const DataDynamicItem = { + encode(message, writer = new BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.editors) { + writer.int32(v); + } + writer.ldelim(); + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDataDynamicItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.editors.push(reader.int32()); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.editors.push(reader.int32()); + } + continue; + } + break; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + editors: globalThis.Array.isArray(object?.editors) + ? object.editors.map((e) => dataEditorFromJSON(e)) + : [], + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.editors?.length) { + obj.editors = message.editors.map((e) => dataEditorToJSON(e)); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return DataDynamicItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataDynamicItem(); + message.editors = object.editors?.map((e) => e) || []; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseDataDynamicIndexedItem() { + return { index: 0, data: new Uint8Array(0) }; +} +export const DataDynamicIndexedItem = { + encode(message, writer = new BinaryWriter()) { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDataDynamicIndexedItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.index = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return DataDynamicIndexedItem.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataDynamicIndexedItem(); + message.index = object.index ?? 0; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseDataDynamic() { + return { items: [] }; +} +export const DataDynamic = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.items) { + DataDynamicItem.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDataDynamic(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.items.push(DataDynamicItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e) => DataDynamicItem.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.items?.length) { + obj.items = message.items.map((e) => DataDynamicItem.toJSON(e)); + } + return obj; + }, + create(base) { + return DataDynamic.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDataDynamic(); + message.items = + object.items?.map((e) => DataDynamicItem.fromPartial(e)) || []; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/customparams/v1/genesis.d.ts b/dist/module/coreum/customparams/v1/genesis.d.ts new file mode 100644 index 0000000..a8b69c7 --- /dev/null +++ b/dist/module/coreum/customparams/v1/genesis.d.ts @@ -0,0 +1,28 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { StakingParams } from "./params"; +export declare const protobufPackage = "coreum.customparams.v1"; +/** GenesisState defines the module's genesis state. */ +export interface GenesisState { + /** staking_params defines staking parameters of the module. */ + stakingParams: StakingParams | undefined; +} +export declare const GenesisState: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/customparams/v1/genesis.js b/dist/module/coreum/customparams/v1/genesis.js new file mode 100644 index 0000000..e174a9a --- /dev/null +++ b/dist/module/coreum/customparams/v1/genesis.js @@ -0,0 +1,70 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/customparams/genesis.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { StakingParams } from "./params"; +export const protobufPackage = "coreum.customparams.v1"; +function createBaseGenesisState() { + return { stakingParams: undefined }; +} +export const GenesisState = { + encode(message, writer = new BinaryWriter()) { + if (message.stakingParams !== undefined) { + StakingParams.encode(message.stakingParams, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.stakingParams = StakingParams.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + stakingParams: isSet(object.stakingParams) + ? StakingParams.fromJSON(object.stakingParams) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.stakingParams !== undefined) { + obj.stakingParams = StakingParams.toJSON(message.stakingParams); + } + return obj; + }, + create(base) { + return GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.stakingParams = + object.stakingParams !== undefined && object.stakingParams !== null + ? StakingParams.fromPartial(object.stakingParams) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/customparams/v1/params.d.ts b/dist/module/coreum/customparams/v1/params.d.ts new file mode 100644 index 0000000..126725e --- /dev/null +++ b/dist/module/coreum/customparams/v1/params.d.ts @@ -0,0 +1,27 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.customparams.v1"; +/** StakingParams defines the set of additional staking params for the staking module wrapper. */ +export interface StakingParams { + /** min_self_delegation is the validators global self declared minimum for delegation. */ + minSelfDelegation: string; +} +export declare const StakingParams: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/customparams/v1/params.js b/dist/module/coreum/customparams/v1/params.js new file mode 100644 index 0000000..2cad726 --- /dev/null +++ b/dist/module/coreum/customparams/v1/params.js @@ -0,0 +1,66 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/customparams/params.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export const protobufPackage = "coreum.customparams.v1"; +function createBaseStakingParams() { + return { minSelfDelegation: "" }; +} +export const StakingParams = { + encode(message, writer = new BinaryWriter()) { + if (message.minSelfDelegation !== "") { + writer.uint32(10).string(message.minSelfDelegation); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.minSelfDelegation = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + minSelfDelegation: isSet(object.minSelfDelegation) + ? globalThis.String(object.minSelfDelegation) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.minSelfDelegation !== "") { + obj.minSelfDelegation = message.minSelfDelegation; + } + return obj; + }, + create(base) { + return StakingParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStakingParams(); + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/customparams/v1/query.d.ts b/dist/module/coreum/customparams/v1/query.d.ts new file mode 100644 index 0000000..603bb20 --- /dev/null +++ b/dist/module/coreum/customparams/v1/query.d.ts @@ -0,0 +1,48 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { StakingParams } from "./params"; +export declare const protobufPackage = "coreum.customparams.v1"; +/** QueryStakingParamsRequest defines the request type for querying x/customparams staking parameters. */ +export interface QueryStakingParamsRequest { +} +/** QueryStakingParamsResponse defines the response type for querying x/customparams staking parameters. */ +export interface QueryStakingParamsResponse { + params: StakingParams | undefined; +} +export declare const QueryStakingParamsRequest: MessageFns; +export declare const QueryStakingParamsResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** StakingParams queries the staking parameters of the module. */ + StakingParams(request: QueryStakingParamsRequest): Promise; +} +export declare const QueryServiceName = "coreum.customparams.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + StakingParams(request: QueryStakingParamsRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/customparams/v1/query.js b/dist/module/coreum/customparams/v1/query.js new file mode 100644 index 0000000..8bc6632 --- /dev/null +++ b/dist/module/coreum/customparams/v1/query.js @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/customparams/query.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { StakingParams } from "./params"; +export const protobufPackage = "coreum.customparams.v1"; +function createBaseQueryStakingParamsRequest() { + return {}; +} +export const QueryStakingParamsRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakingParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return QueryStakingParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryStakingParamsRequest(); + return message; + }, +}; +function createBaseQueryStakingParamsResponse() { + return { params: undefined }; +} +export const QueryStakingParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + StakingParams.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStakingParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = StakingParams.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) + ? StakingParams.fromJSON(object.params) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = StakingParams.toJSON(message.params); + } + return obj; + }, + create(base) { + return QueryStakingParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryStakingParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? StakingParams.fromPartial(object.params) + : undefined; + return message; + }, +}; +export const QueryServiceName = "coreum.customparams.v1.Query"; +export class QueryClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.StakingParams = this.StakingParams.bind(this); + } + StakingParams(request) { + const data = QueryStakingParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "StakingParams", data); + return promise.then((data) => QueryStakingParamsResponse.decode(new BinaryReader(data))); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/index.d.ts b/dist/module/coreum/dex/index.d.ts new file mode 100644 index 0000000..7a12ee2 --- /dev/null +++ b/dist/module/coreum/dex/index.d.ts @@ -0,0 +1 @@ +export declare const dexRegistry: ReadonlyArray<[string, any]>; diff --git a/dist/module/coreum/dex/index.js b/dist/module/coreum/dex/index.js new file mode 100644 index 0000000..893afc7 --- /dev/null +++ b/dist/module/coreum/dex/index.js @@ -0,0 +1,8 @@ +import { CoreumTypeUrl } from "../../types"; +import { MsgCancelOrder, MsgPlaceOrder, MsgUpdateParams, MsgCancelOrdersByDenom, } from "./v1/tx"; +export const dexRegistry = [ + [CoreumTypeUrl.DEX + "MsgCancelOrder", MsgCancelOrder], + [CoreumTypeUrl.DEX + "MsgPlaceOrder", MsgPlaceOrder], + [CoreumTypeUrl.DEX + "MsgUpdateParams", MsgUpdateParams], + [CoreumTypeUrl.DEX + "MsgCancelOrdersByDenom", MsgCancelOrdersByDenom], +]; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.d.ts b/dist/module/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.d.ts new file mode 100644 index 0000000..8ba02e9 --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.d.ts @@ -0,0 +1,80 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "cosmos_proto"; +export declare enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1 +} +export declare function scalarTypeFromJSON(object: any): ScalarType; +export declare function scalarTypeToJSON(object: ScalarType): string; +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} +export declare const InterfaceDescriptor: MessageFns; +export declare const ScalarDescriptor: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.js b/dist/module/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.js new file mode 100644 index 0000000..d64b6a1 --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-proto/proto/cosmos_proto/cosmos.js @@ -0,0 +1,210 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-proto/proto/cosmos_proto/cosmos.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export const protobufPackage = "cosmos_proto"; +export var ScalarType; +(function (ScalarType) { + ScalarType[ScalarType["SCALAR_TYPE_UNSPECIFIED"] = 0] = "SCALAR_TYPE_UNSPECIFIED"; + ScalarType[ScalarType["SCALAR_TYPE_STRING"] = 1] = "SCALAR_TYPE_STRING"; + ScalarType[ScalarType["SCALAR_TYPE_BYTES"] = 2] = "SCALAR_TYPE_BYTES"; + ScalarType[ScalarType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ScalarType || (ScalarType = {})); +export function scalarTypeFromJSON(object) { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} +export function scalarTypeToJSON(object) { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseInterfaceDescriptor() { + return { name: "", description: "" }; +} +export const InterfaceDescriptor = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + create(base) { + return InterfaceDescriptor.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; +function createBaseScalarDescriptor() { + return { name: "", description: "", fieldType: [] }; +} +export const ScalarDescriptor = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.join(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.fieldType.push(reader.int32()); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push(reader.int32()); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + fieldType: globalThis.Array.isArray(object?.fieldType) + ? object.fieldType.map((e) => scalarTypeFromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.fieldType?.length) { + obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e)); + } + return obj; + }, + create(base) { + return ScalarDescriptor.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map((e) => e) || []; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.d.ts b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.d.ts new file mode 100644 index 0000000..dbf887c --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "amino"; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.js b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.js new file mode 100644 index 0000000..07fb3ce --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/amino/amino.js @@ -0,0 +1,7 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/amino/amino.proto +/* eslint-disable */ +export const protobufPackage = "amino"; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.d.ts b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.d.ts new file mode 100644 index 0000000..6a15cbc --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.d.ts @@ -0,0 +1,86 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare 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. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} +export declare const PageRequest: MessageFns; +export declare const PageResponse: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.js b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.js new file mode 100644 index 0000000..49960cb --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.js @@ -0,0 +1,227 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export const protobufPackage = "cosmos.base.query.v1beta1"; +function createBasePageRequest() { + return { key: new Uint8Array(0), offset: 0, limit: 0, countTotal: false, reverse: false }; +} +export const PageRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal !== false) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.offset = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.limit = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.countTotal = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.reverse = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? globalThis.Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.countTotal !== false) { + obj.countTotal = message.countTotal; + } + if (message.reverse !== false) { + obj.reverse = message.reverse; + } + return obj; + }, + create(base) { + return PageRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; +function createBasePageResponse() { + return { nextKey: new Uint8Array(0), total: 0 }; +} +export const PageResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.nextKey = reader.bytes(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.total = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.nextKey.length !== 0) { + obj.nextKey = base64FromBytes(message.nextKey); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + create(base) { + return PageResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.d.ts b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.d.ts new file mode 100644 index 0000000..5a0a4d6 --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.d.ts @@ -0,0 +1,53 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "cosmos.base.v1beta1"; +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProto { + int: string; +} +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProto { + dec: string; +} +export declare const Coin: MessageFns; +export declare const DecCoin: MessageFns; +export declare const IntProto: MessageFns; +export declare const DecProto: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.js b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.js new file mode 100644 index 0000000..7a23554 --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.js @@ -0,0 +1,249 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export const protobufPackage = "cosmos.base.v1beta1"; +function createBaseCoin() { + return { denom: "", amount: "" }; +} +export const Coin = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.amount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + create(base) { + return Coin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseDecCoin() { + return { denom: "", amount: "" }; +} +export const DecCoin = { + encode(message, writer = new BinaryWriter()) { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.denom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.amount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + create(base) { + return DecCoin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; +function createBaseIntProto() { + return { int: "" }; +} +export const IntProto = { + encode(message, writer = new BinaryWriter()) { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.int = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.int !== "") { + obj.int = message.int; + } + return obj; + }, + create(base) { + return IntProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; +function createBaseDecProto() { + return { dec: "" }; +} +export const DecProto = { + encode(message, writer = new BinaryWriter()) { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.dec = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; + }, + toJSON(message) { + const obj = {}; + if (message.dec !== "") { + obj.dec = message.dec; + } + return obj; + }, + create(base) { + return DecProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.d.ts b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.d.ts new file mode 100644 index 0000000..5e50803 --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "cosmos.msg.v1"; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.js b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.js new file mode 100644 index 0000000..386c06f --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.js @@ -0,0 +1,7 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/cosmos/msg/v1/msg.proto +/* eslint-disable */ +export const protobufPackage = "cosmos.msg.v1"; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.d.ts b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.d.ts new file mode 100644 index 0000000..6ebcef9 --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "cosmos.query.v1"; diff --git a/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.js b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.js new file mode 100644 index 0000000..8b7ebbf --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/cosmos-sdk/proto/cosmos/query/v1/query.js @@ -0,0 +1,7 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/cosmos-sdk/proto/cosmos/query/v1/query.proto +/* eslint-disable */ +export const protobufPackage = "cosmos.query.v1"; diff --git a/dist/module/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.d.ts b/dist/module/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.d.ts new file mode 100644 index 0000000..885d30b --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "gogoproto"; diff --git a/dist/module/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.js b/dist/module/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.js new file mode 100644 index 0000000..00ef38a --- /dev/null +++ b/dist/module/coreum/dex/v1/cosmos/gogoproto/gogoproto/gogo.js @@ -0,0 +1,7 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: cosmos/gogoproto/gogoproto/gogo.proto +/* eslint-disable */ +export const protobufPackage = "gogoproto"; diff --git a/dist/module/coreum/dex/v1/event.d.ts b/dist/module/coreum/dex/v1/event.d.ts new file mode 100644 index 0000000..9cae3c3 --- /dev/null +++ b/dist/module/coreum/dex/v1/event.d.ts @@ -0,0 +1,73 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "coreum.dex.v1"; +/** EventOrderPlaced is emitted when a new order is placed and new sequence is generated for it. */ +export interface EventOrderPlaced { + /** creator is order creator address. */ + creator: string; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence. */ + sequence: number; +} +/** EventOrderReduced is emitted when the order is reduced during the matching. */ +export interface EventOrderReduced { + /** creator is order creator address. */ + creator: string; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence. */ + sequence: number; + /** sent_coin is coin sent during matching. */ + sentCoin: string; + /** received_coin is coin received during matching. */ + receivedCoin: string; +} +/** EventOrderCreated is emitted when the limit order is saved to the order book. */ +export interface EventOrderCreated { + /** creator is order creator address. */ + creator: string; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence. */ + sequence: number; + /** remaining_base_quantity - is remaining quantity of base denom which user wants to sell or buy. */ + remainingBaseQuantity: string; + /** remaining_spendable_balance - is balance up to which user wants to spend to execute the order. */ + remainingSpendableBalance: string; +} +/** EventOrderClosed is emitted when the order is closed during matching or manually, and removed from the order book. */ +export interface EventOrderClosed { + /** creator is order creator address. */ + creator: string; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence. */ + sequence: number; + /** remaining_base_quantity - is remaining quantity of base denom which user wants to sell or buy. */ + remainingBaseQuantity: string; + /** remaining_spendable_balance - is balance up to which user wants to spend to execute the order. */ + remainingSpendableBalance: string; +} +export declare const EventOrderPlaced: MessageFns; +export declare const EventOrderReduced: MessageFns; +export declare const EventOrderCreated: MessageFns; +export declare const EventOrderClosed: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/event.js b/dist/module/coreum/dex/v1/event.js new file mode 100644 index 0000000..2b9e676 --- /dev/null +++ b/dist/module/coreum/dex/v1/event.js @@ -0,0 +1,447 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/event.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export const protobufPackage = "coreum.dex.v1"; +function createBaseEventOrderPlaced() { + return { creator: "", id: "", sequence: 0 }; +} +export const EventOrderPlaced = { + encode(message, writer = new BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventOrderPlaced(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + create(base) { + return EventOrderPlaced.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventOrderPlaced(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + return message; + }, +}; +function createBaseEventOrderReduced() { + return { creator: "", id: "", sequence: 0, sentCoin: "", receivedCoin: "" }; +} +export const EventOrderReduced = { + encode(message, writer = new BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + if (message.sentCoin !== "") { + writer.uint32(34).string(message.sentCoin); + } + if (message.receivedCoin !== "") { + writer.uint32(42).string(message.receivedCoin); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventOrderReduced(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.sentCoin = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.receivedCoin = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + sentCoin: isSet(object.sentCoin) ? globalThis.String(object.sentCoin) : "", + receivedCoin: isSet(object.receivedCoin) ? globalThis.String(object.receivedCoin) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.sentCoin !== "") { + obj.sentCoin = message.sentCoin; + } + if (message.receivedCoin !== "") { + obj.receivedCoin = message.receivedCoin; + } + return obj; + }, + create(base) { + return EventOrderReduced.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventOrderReduced(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + message.sentCoin = object.sentCoin ?? ""; + message.receivedCoin = object.receivedCoin ?? ""; + return message; + }, +}; +function createBaseEventOrderCreated() { + return { creator: "", id: "", sequence: 0, remainingBaseQuantity: "", remainingSpendableBalance: "" }; +} +export const EventOrderCreated = { + encode(message, writer = new BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + if (message.remainingBaseQuantity !== "") { + writer.uint32(34).string(message.remainingBaseQuantity); + } + if (message.remainingSpendableBalance !== "") { + writer.uint32(42).string(message.remainingSpendableBalance); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventOrderCreated(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.remainingBaseQuantity = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.remainingSpendableBalance = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + remainingBaseQuantity: isSet(object.remainingBaseQuantity) ? globalThis.String(object.remainingBaseQuantity) : "", + remainingSpendableBalance: isSet(object.remainingSpendableBalance) + ? globalThis.String(object.remainingSpendableBalance) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.remainingBaseQuantity !== "") { + obj.remainingBaseQuantity = message.remainingBaseQuantity; + } + if (message.remainingSpendableBalance !== "") { + obj.remainingSpendableBalance = message.remainingSpendableBalance; + } + return obj; + }, + create(base) { + return EventOrderCreated.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventOrderCreated(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + message.remainingBaseQuantity = object.remainingBaseQuantity ?? ""; + message.remainingSpendableBalance = object.remainingSpendableBalance ?? ""; + return message; + }, +}; +function createBaseEventOrderClosed() { + return { creator: "", id: "", sequence: 0, remainingBaseQuantity: "", remainingSpendableBalance: "" }; +} +export const EventOrderClosed = { + encode(message, writer = new BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + if (message.remainingBaseQuantity !== "") { + writer.uint32(34).string(message.remainingBaseQuantity); + } + if (message.remainingSpendableBalance !== "") { + writer.uint32(42).string(message.remainingSpendableBalance); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventOrderClosed(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.remainingBaseQuantity = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.remainingSpendableBalance = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + remainingBaseQuantity: isSet(object.remainingBaseQuantity) ? globalThis.String(object.remainingBaseQuantity) : "", + remainingSpendableBalance: isSet(object.remainingSpendableBalance) + ? globalThis.String(object.remainingSpendableBalance) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.remainingBaseQuantity !== "") { + obj.remainingBaseQuantity = message.remainingBaseQuantity; + } + if (message.remainingSpendableBalance !== "") { + obj.remainingSpendableBalance = message.remainingSpendableBalance; + } + return obj; + }, + create(base) { + return EventOrderClosed.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventOrderClosed(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + message.remainingBaseQuantity = object.remainingBaseQuantity ?? ""; + message.remainingSpendableBalance = object.remainingSpendableBalance ?? ""; + return message; + }, +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/genesis.d.ts b/dist/module/coreum/dex/v1/genesis.d.ts new file mode 100644 index 0000000..19c6808 --- /dev/null +++ b/dist/module/coreum/dex/v1/genesis.d.ts @@ -0,0 +1,50 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Order, OrderBookData } from "./order"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.dex.v1"; +/** GenesisState defines the module genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + orderBooks: OrderBookDataWithID[]; + orders: Order[]; + /** order_sequence is current order sequence; */ + orderSequence: number; + accountsDenomsOrdersCounts: AccountDenomOrdersCount[]; + reservedOrderIds: Uint8Array[]; +} +/** OrderBookDataWithID is a order book data with it's corresponding ID. */ +export interface OrderBookDataWithID { + /** id is order book ID. */ + id: number; + /** data is order book data. */ + data: OrderBookData | undefined; +} +/** AccountDenomOrderCount is a count of orders per account and denom. */ +export interface AccountDenomOrdersCount { + accountNumber: number; + denom: string; + ordersCount: number; +} +export declare const GenesisState: MessageFns; +export declare const OrderBookDataWithID: MessageFns; +export declare const AccountDenomOrdersCount: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/genesis.js b/dist/module/coreum/dex/v1/genesis.js new file mode 100644 index 0000000..a30809d --- /dev/null +++ b/dist/module/coreum/dex/v1/genesis.js @@ -0,0 +1,358 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/genesis.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Order, OrderBookData } from "./order"; +import { Params } from "./params"; +export const protobufPackage = "coreum.dex.v1"; +function createBaseGenesisState() { + return { + params: undefined, + orderBooks: [], + orders: [], + orderSequence: 0, + accountsDenomsOrdersCounts: [], + reservedOrderIds: [], + }; +} +export const GenesisState = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.orderBooks) { + OrderBookDataWithID.encode(v, writer.uint32(18).fork()).join(); + } + for (const v of message.orders) { + Order.encode(v, writer.uint32(26).fork()).join(); + } + if (message.orderSequence !== 0) { + writer.uint32(32).uint64(message.orderSequence); + } + for (const v of message.accountsDenomsOrdersCounts) { + AccountDenomOrdersCount.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.reservedOrderIds) { + writer.uint32(50).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.orderBooks.push(OrderBookDataWithID.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.orders.push(Order.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.orderSequence = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.accountsDenomsOrdersCounts.push(AccountDenomOrdersCount.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.reservedOrderIds.push(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + orderBooks: globalThis.Array.isArray(object?.orderBooks) + ? object.orderBooks.map((e) => OrderBookDataWithID.fromJSON(e)) + : [], + orders: globalThis.Array.isArray(object?.orders) + ? object.orders.map((e) => Order.fromJSON(e)) + : [], + orderSequence: isSet(object.orderSequence) + ? globalThis.Number(object.orderSequence) + : 0, + accountsDenomsOrdersCounts: globalThis.Array.isArray(object?.accountsDenomsOrdersCounts) + ? object.accountsDenomsOrdersCounts.map((e) => AccountDenomOrdersCount.fromJSON(e)) + : [], + reservedOrderIds: globalThis.Array.isArray(object?.reservedOrderIds) + ? object.reservedOrderIds.map((e) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.orderBooks?.length) { + obj.orderBooks = message.orderBooks.map((e) => OrderBookDataWithID.toJSON(e)); + } + if (message.orders?.length) { + obj.orders = message.orders.map((e) => Order.toJSON(e)); + } + if (message.orderSequence !== 0) { + obj.orderSequence = Math.round(message.orderSequence); + } + if (message.accountsDenomsOrdersCounts?.length) { + obj.accountsDenomsOrdersCounts = message.accountsDenomsOrdersCounts.map((e) => AccountDenomOrdersCount.toJSON(e)); + } + if (message.reservedOrderIds?.length) { + obj.reservedOrderIds = message.reservedOrderIds.map((e) => base64FromBytes(e)); + } + return obj; + }, + create(base) { + return GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.orderBooks = + object.orderBooks?.map((e) => OrderBookDataWithID.fromPartial(e)) || []; + message.orders = object.orders?.map((e) => Order.fromPartial(e)) || []; + message.orderSequence = object.orderSequence ?? 0; + message.accountsDenomsOrdersCounts = + object.accountsDenomsOrdersCounts?.map((e) => AccountDenomOrdersCount.fromPartial(e)) || []; + message.reservedOrderIds = object.reservedOrderIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseOrderBookDataWithID() { + return { id: 0, data: undefined }; +} +export const OrderBookDataWithID = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.data !== undefined) { + OrderBookData.encode(message.data, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderBookDataWithID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.id = reader.uint32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = OrderBookData.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + data: isSet(object.data) + ? OrderBookData.fromJSON(object.data) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.data !== undefined) { + obj.data = OrderBookData.toJSON(message.data); + } + return obj; + }, + create(base) { + return OrderBookDataWithID.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrderBookDataWithID(); + message.id = object.id ?? 0; + message.data = + object.data !== undefined && object.data !== null + ? OrderBookData.fromPartial(object.data) + : undefined; + return message; + }, +}; +function createBaseAccountDenomOrdersCount() { + return { accountNumber: 0, denom: "", ordersCount: 0 }; +} +export const AccountDenomOrdersCount = { + encode(message, writer = new BinaryWriter()) { + if (message.accountNumber !== 0) { + writer.uint32(8).uint64(message.accountNumber); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.ordersCount !== 0) { + writer.uint32(24).uint64(message.ordersCount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountDenomOrdersCount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.ordersCount = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + accountNumber: isSet(object.accountNumber) + ? globalThis.Number(object.accountNumber) + : 0, + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + ordersCount: isSet(object.ordersCount) + ? globalThis.Number(object.ordersCount) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.ordersCount !== 0) { + obj.ordersCount = Math.round(message.ordersCount); + } + return obj; + }, + create(base) { + return AccountDenomOrdersCount.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAccountDenomOrdersCount(); + message.accountNumber = object.accountNumber ?? 0; + message.denom = object.denom ?? ""; + message.ordersCount = object.ordersCount ?? 0; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/google/googleapis/google/api/annotations.d.ts b/dist/module/coreum/dex/v1/google/googleapis/google/api/annotations.d.ts new file mode 100644 index 0000000..a64daf0 --- /dev/null +++ b/dist/module/coreum/dex/v1/google/googleapis/google/api/annotations.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "google.api"; diff --git a/dist/module/coreum/dex/v1/google/googleapis/google/api/annotations.js b/dist/module/coreum/dex/v1/google/googleapis/google/api/annotations.js new file mode 100644 index 0000000..2e0bf36 --- /dev/null +++ b/dist/module/coreum/dex/v1/google/googleapis/google/api/annotations.js @@ -0,0 +1,7 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: google/googleapis/google/api/annotations.proto +/* eslint-disable */ +export const protobufPackage = "google.api"; diff --git a/dist/module/coreum/dex/v1/google/googleapis/google/api/http.d.ts b/dist/module/coreum/dex/v1/google/googleapis/google/api/http.d.ts new file mode 100644 index 0000000..e7250ba --- /dev/null +++ b/dist/module/coreum/dex/v1/google/googleapis/google/api/http.d.ts @@ -0,0 +1,379 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "google.api"; +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fullyDecodeReservedExpansion: boolean; +} +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRule { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: string | undefined; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: string | undefined; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: string | undefined; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: string | undefined; + /** Maps to HTTP PATCH. 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 request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} +export declare const Http: MessageFns; +export declare const HttpRule: MessageFns; +export declare const CustomHttpPattern: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/google/googleapis/google/api/http.js b/dist/module/coreum/dex/v1/google/googleapis/google/api/http.js new file mode 100644 index 0000000..110aeae --- /dev/null +++ b/dist/module/coreum/dex/v1/google/googleapis/google/api/http.js @@ -0,0 +1,352 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: google/googleapis/google/api/http.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export const protobufPackage = "google.api"; +function createBaseHttp() { + return { rules: [], fullyDecodeReservedExpansion: false }; +} +export const Http = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.rules) { + HttpRule.encode(v, writer.uint32(10).fork()).join(); + } + if (message.fullyDecodeReservedExpansion !== false) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.rules.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.fullyDecodeReservedExpansion = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? globalThis.Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); + } + if (message.fullyDecodeReservedExpansion !== false) { + obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + } + return obj; + }, + create(base) { + return Http.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; +function createBaseHttpRule() { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} +export const HttpRule = { + encode(message, writer = new BinaryWriter()) { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v, writer.uint32(90).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.selector = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.get = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.put = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.post = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.delete = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.patch = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.body = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.responseBody = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + selector: isSet(object.selector) ? globalThis.String(object.selector) : "", + get: isSet(object.get) ? globalThis.String(object.get) : undefined, + put: isSet(object.put) ? globalThis.String(object.put) : undefined, + post: isSet(object.post) ? globalThis.String(object.post) : undefined, + delete: isSet(object.delete) ? globalThis.String(object.delete) : undefined, + patch: isSet(object.patch) ? globalThis.String(object.patch) : undefined, + custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? globalThis.String(object.body) : "", + responseBody: isSet(object.responseBody) ? globalThis.String(object.responseBody) : "", + additionalBindings: globalThis.Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e) => HttpRule.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.selector !== "") { + obj.selector = message.selector; + } + if (message.get !== undefined) { + obj.get = message.get; + } + if (message.put !== undefined) { + obj.put = message.put; + } + if (message.post !== undefined) { + obj.post = message.post; + } + if (message.delete !== undefined) { + obj.delete = message.delete; + } + if (message.patch !== undefined) { + obj.patch = message.patch; + } + if (message.custom !== undefined) { + obj.custom = CustomHttpPattern.toJSON(message.custom); + } + if (message.body !== "") { + obj.body = message.body; + } + if (message.responseBody !== "") { + obj.responseBody = message.responseBody; + } + if (message.additionalBindings?.length) { + obj.additionalBindings = message.additionalBindings.map((e) => HttpRule.toJSON(e)); + } + return obj; + }, + create(base) { + return HttpRule.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = (object.custom !== undefined && object.custom !== null) + ? CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCustomHttpPattern() { + return { kind: "", path: "" }; +} +export const CustomHttpPattern = { + encode(message, writer = new BinaryWriter()) { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + path: isSet(object.path) ? globalThis.String(object.path) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + create(base) { + return CustomHttpPattern.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/google/protobuf/descriptor.d.ts b/dist/module/coreum/dex/v1/google/protobuf/descriptor.d.ts new file mode 100644 index 0000000..67ba410 --- /dev/null +++ b/dist/module/coreum/dex/v1/google/protobuf/descriptor.d.ts @@ -0,0 +1,1336 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export declare enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relied on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1 +} +export declare function editionFromJSON(object: any): Edition; +export declare function editionToJSON(object: Edition): string; +/** + * Describes the 'visibility' of a symbol with respect to the proto import + * system. Symbols can only be imported when the visibility rules do not prevent + * it (ex: local symbols cannot be imported). Visibility modifiers can only set + * on `message` and `enum` as they are the only types available to be referenced + * from other files. + */ +export declare enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2, + UNRECOGNIZED = -1 +} +export declare function symbolVisibilityFromJSON(object: any): SymbolVisibility; +export declare function symbolVisibilityToJSON(object: SymbolVisibility): string; +/** + * 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 | undefined; + /** e.g. "foo", "foo.bar", etc. */ + package?: string | undefined; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** + * Names of files imported by this file purely for the purpose of providing + * option extensions. These are excluded from the dependency list above. + */ + optionDependency: string[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: 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. + */ + sourceCodeInfo?: SourceCodeInfo | undefined; + /** + * The syntax of the proto file. + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + syntax?: string | undefined; + /** + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + edition?: Edition | undefined; +} +/** Describes a message type. */ +export interface DescriptorProto { + name?: string | undefined; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions | undefined; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; + /** Support for `export` and `local` keywords on enums. */ + visibility?: SymbolVisibility | undefined; +} +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start?: number | undefined; + /** Exclusive. */ + end?: number | undefined; + 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 | undefined; + /** Exclusive. */ + end?: number | undefined; +} +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} +/** The verification state of the extension range. */ +export declare enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1 +} +export declare function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState; +export declare function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string; +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: number | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: string | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: string | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: boolean | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name?: string | undefined; + number?: number | undefined; + label?: FieldDescriptorProto_Label | undefined; + /** + * 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 | undefined; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + typeName?: string | undefined; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee?: string | undefined; + /** + * 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. + */ + defaultValue?: string | undefined; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex?: number | undefined; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + jsonName?: string | undefined; + 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 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`. + */ + proto3Optional?: boolean | undefined; +} +export declare 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 after google.protobuf. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1 +} +export declare function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type; +export declare function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Type): string; +export declare enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, + UNRECOGNIZED = -1 +} +export declare function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label; +export declare function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string; +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name?: string | undefined; + options?: OneofOptions | undefined; +} +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name?: string | undefined; + 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. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; + /** Support for `export` and `local` keywords on enums. */ + visibility?: SymbolVisibility | undefined; +} +/** + * 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 | undefined; + /** Inclusive. */ + end?: number | undefined; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; +} +/** Describes a service. */ +export interface ServiceDescriptorProto { + name?: string | undefined; + method: MethodDescriptorProto[]; + options?: ServiceOptions | undefined; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name?: string | undefined; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType?: string | undefined; + outputType?: string | undefined; + options?: MethodOptions | undefined; + /** Identifies if client streams multiple client messages */ + clientStreaming?: boolean | undefined; + /** Identifies if server streams multiple server messages */ + serverStreaming?: boolean | undefined; +} +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage?: string | undefined; + /** + * 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. + */ + javaOuterClassname?: string | undefined; + /** + * 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. + */ + javaMultipleFiles?: boolean | undefined; + /** + * This option does nothing. + * + * @deprecated + */ + javaGenerateEqualsAndHash?: boolean | undefined; + /** + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. + */ + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: FileOptions_OptimizeMode | undefined; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage?: string | undefined; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: boolean | undefined; + /** + * 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 | undefined; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas?: boolean | undefined; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix?: string | undefined; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace?: string | undefined; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix?: string | undefined; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix?: string | undefined; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace?: string | undefined; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace?: string | undefined; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage?: string | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} +/** Generated classes can be optimized for speed or code size. */ +export declare 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 declare function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode; +export declare function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode): string; +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + messageSetWireFormat?: boolean | undefined; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor?: boolean | undefined; + /** + * 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 | undefined; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry?: boolean | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: boolean | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface FieldOptions { + /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. + */ + ctype?: FieldOptions_CType | undefined; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. + */ + packed?: boolean | undefined; + /** + * 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 | undefined; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: boolean | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverifiedLazy?: boolean | undefined; + /** + * 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 | undefined; + /** + * DEPRECATED. DO NOT USE! + * For Google-internal migration only. Do not use. + * + * @deprecated + */ + weak?: boolean | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + featureSupport?: FieldOptions_FeatureSupport | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export declare enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1 +} +export declare function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType; +export declare function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string; +export declare 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 declare function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType; +export declare function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string; +/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ +export declare enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1 +} +export declare function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention; +export declare function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string; +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. + */ +export declare enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1 +} +export declare function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType; +export declare function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string; +export interface FieldOptions_EditionDefault { + edition?: Edition | undefined; + /** Textproto value. */ + value?: string | undefined; +} +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: Edition | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: Edition | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: string | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} +export interface OneofOptions { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias?: boolean | undefined; + /** + * 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 | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: boolean | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: 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 | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: boolean | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: FieldOptions_FeatureSupport | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface ServiceOptions { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** + * 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 | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: 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 | undefined; + idempotencyLevel?: MethodOptions_IdempotencyLevel | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: 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 declare 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 declare function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel; +export declare function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_IdempotencyLevel): string; +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; +} +/** + * 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], ["moo", false] } represents + * "foo.(bar.baz).moo". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} +/** + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. + */ +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; + enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined; + defaultSymbolVisibility?: FeatureSet_VisibilityFeature_DefaultSymbolVisibility | undefined; +} +export declare enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1 +} +export declare function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence; +export declare function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string; +export declare enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType; +export declare function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string; +export declare enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding; +export declare function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string; +export declare enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1 +} +export declare function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation; +export declare function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string; +export declare enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding; +export declare function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string; +export declare enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat; +export declare function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string; +export declare enum FeatureSet_EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2, + UNRECOGNIZED = -1 +} +export declare function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle; +export declare function featureSet_EnforceNamingStyleToJSON(object: FeatureSet_EnforceNamingStyle): string; +export interface FeatureSet_VisibilityFeature { +} +export declare enum FeatureSet_VisibilityFeature_DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + /** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */ + EXPORT_ALL = 1, + /** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */ + EXPORT_TOP_LEVEL = 2, + /** LOCAL_ALL - All symbols default to local. */ + LOCAL_ALL = 3, + /** + * STRICT - All symbols local by default. Nested types cannot be exported. + * With special case caveat for message { enum {} reserved 1 to max; } + * This is the recommended setting for new protos. + */ + STRICT = 4, + UNRECOGNIZED = -1 +} +export declare function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object: any): FeatureSet_VisibilityFeature_DefaultSymbolVisibility; +export declare function featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(object: FeatureSet_VisibilityFeature_DefaultSymbolVisibility): string; +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: Edition | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: Edition | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: FeatureSet | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} +/** + * 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 appears. + * For example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to moo. + * // + * // Another line attached to moo. + * optional double moo = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to moo or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. * / + * /* Block comment attached to + * * grault. * / + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments?: string | undefined; + trailingComments?: string | undefined; + leadingDetachedComments: 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. */ + sourceFile?: string | undefined; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin?: number | undefined; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified object. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export declare enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1 +} +export declare function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic; +export declare function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string; +export declare const FileDescriptorSet: MessageFns; +export declare const FileDescriptorProto: MessageFns; +export declare const DescriptorProto: MessageFns; +export declare const DescriptorProto_ExtensionRange: MessageFns; +export declare const DescriptorProto_ReservedRange: MessageFns; +export declare const ExtensionRangeOptions: MessageFns; +export declare const ExtensionRangeOptions_Declaration: MessageFns; +export declare const FieldDescriptorProto: MessageFns; +export declare const OneofDescriptorProto: MessageFns; +export declare const EnumDescriptorProto: MessageFns; +export declare const EnumDescriptorProto_EnumReservedRange: MessageFns; +export declare const EnumValueDescriptorProto: MessageFns; +export declare const ServiceDescriptorProto: MessageFns; +export declare const MethodDescriptorProto: MessageFns; +export declare const FileOptions: MessageFns; +export declare const MessageOptions: MessageFns; +export declare const FieldOptions: MessageFns; +export declare const FieldOptions_EditionDefault: MessageFns; +export declare const FieldOptions_FeatureSupport: MessageFns; +export declare const OneofOptions: MessageFns; +export declare const EnumOptions: MessageFns; +export declare const EnumValueOptions: MessageFns; +export declare const ServiceOptions: MessageFns; +export declare const MethodOptions: MessageFns; +export declare const UninterpretedOption: MessageFns; +export declare const UninterpretedOption_NamePart: MessageFns; +export declare const FeatureSet: MessageFns; +export declare const FeatureSet_VisibilityFeature: MessageFns; +export declare const FeatureSetDefaults: MessageFns; +export declare const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns; +export declare const SourceCodeInfo: MessageFns; +export declare const SourceCodeInfo_Location: MessageFns; +export declare const GeneratedCodeInfo: MessageFns; +export declare const GeneratedCodeInfo_Annotation: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/google/protobuf/descriptor.js b/dist/module/coreum/dex/v1/google/protobuf/descriptor.js new file mode 100644 index 0000000..b6c7fed --- /dev/null +++ b/dist/module/coreum/dex/v1/google/protobuf/descriptor.js @@ -0,0 +1,5329 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: google/protobuf/descriptor.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export const protobufPackage = "google.protobuf"; +/** The full set of known editions. */ +export var Edition; +(function (Edition) { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + Edition[Edition["EDITION_UNKNOWN"] = 0] = "EDITION_UNKNOWN"; + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + Edition[Edition["EDITION_LEGACY"] = 900] = "EDITION_LEGACY"; + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + Edition[Edition["EDITION_PROTO2"] = 998] = "EDITION_PROTO2"; + Edition[Edition["EDITION_PROTO3"] = 999] = "EDITION_PROTO3"; + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + Edition[Edition["EDITION_2023"] = 1000] = "EDITION_2023"; + Edition[Edition["EDITION_2024"] = 1001] = "EDITION_2024"; + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relied on outside of tests. + */ + Edition[Edition["EDITION_1_TEST_ONLY"] = 1] = "EDITION_1_TEST_ONLY"; + Edition[Edition["EDITION_2_TEST_ONLY"] = 2] = "EDITION_2_TEST_ONLY"; + Edition[Edition["EDITION_99997_TEST_ONLY"] = 99997] = "EDITION_99997_TEST_ONLY"; + Edition[Edition["EDITION_99998_TEST_ONLY"] = 99998] = "EDITION_99998_TEST_ONLY"; + Edition[Edition["EDITION_99999_TEST_ONLY"] = 99999] = "EDITION_99999_TEST_ONLY"; + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + Edition[Edition["EDITION_MAX"] = 2147483647] = "EDITION_MAX"; + Edition[Edition["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(Edition || (Edition = {})); +export function editionFromJSON(object) { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} +export function editionToJSON(object) { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Describes the 'visibility' of a symbol with respect to the proto import + * system. Symbols can only be imported when the visibility rules do not prevent + * it (ex: local symbols cannot be imported). Visibility modifiers can only set + * on `message` and `enum` as they are the only types available to be referenced + * from other files. + */ +export var SymbolVisibility; +(function (SymbolVisibility) { + SymbolVisibility[SymbolVisibility["VISIBILITY_UNSET"] = 0] = "VISIBILITY_UNSET"; + SymbolVisibility[SymbolVisibility["VISIBILITY_LOCAL"] = 1] = "VISIBILITY_LOCAL"; + SymbolVisibility[SymbolVisibility["VISIBILITY_EXPORT"] = 2] = "VISIBILITY_EXPORT"; + SymbolVisibility[SymbolVisibility["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(SymbolVisibility || (SymbolVisibility = {})); +export function symbolVisibilityFromJSON(object) { + switch (object) { + case 0: + case "VISIBILITY_UNSET": + return SymbolVisibility.VISIBILITY_UNSET; + case 1: + case "VISIBILITY_LOCAL": + return SymbolVisibility.VISIBILITY_LOCAL; + case 2: + case "VISIBILITY_EXPORT": + return SymbolVisibility.VISIBILITY_EXPORT; + case -1: + case "UNRECOGNIZED": + default: + return SymbolVisibility.UNRECOGNIZED; + } +} +export function symbolVisibilityToJSON(object) { + switch (object) { + case SymbolVisibility.VISIBILITY_UNSET: + return "VISIBILITY_UNSET"; + case SymbolVisibility.VISIBILITY_LOCAL: + return "VISIBILITY_LOCAL"; + case SymbolVisibility.VISIBILITY_EXPORT: + return "VISIBILITY_EXPORT"; + case SymbolVisibility.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** The verification state of the extension range. */ +export var ExtensionRangeOptions_VerificationState; +(function (ExtensionRangeOptions_VerificationState) { + /** DECLARATION - All the extensions of the range must be declared. */ + ExtensionRangeOptions_VerificationState[ExtensionRangeOptions_VerificationState["DECLARATION"] = 0] = "DECLARATION"; + ExtensionRangeOptions_VerificationState[ExtensionRangeOptions_VerificationState["UNVERIFIED"] = 1] = "UNVERIFIED"; + ExtensionRangeOptions_VerificationState[ExtensionRangeOptions_VerificationState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ExtensionRangeOptions_VerificationState || (ExtensionRangeOptions_VerificationState = {})); +export function extensionRangeOptions_VerificationStateFromJSON(object) { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} +export function extensionRangeOptions_VerificationStateToJSON(object) { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FieldDescriptorProto_Type; +(function (FieldDescriptorProto_Type) { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_DOUBLE"] = 1] = "TYPE_DOUBLE"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FLOAT"] = 2] = "TYPE_FLOAT"; + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_INT64"] = 3] = "TYPE_INT64"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_UINT64"] = 4] = "TYPE_UINT64"; + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_INT32"] = 5] = "TYPE_INT32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FIXED64"] = 6] = "TYPE_FIXED64"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FIXED32"] = 7] = "TYPE_FIXED32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_BOOL"] = 8] = "TYPE_BOOL"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_STRING"] = 9] = "TYPE_STRING"; + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported after google.protobuf. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_GROUP"] = 10] = "TYPE_GROUP"; + /** TYPE_MESSAGE - Length-delimited aggregate. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_MESSAGE"] = 11] = "TYPE_MESSAGE"; + /** TYPE_BYTES - New in version 2. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_BYTES"] = 12] = "TYPE_BYTES"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_UINT32"] = 13] = "TYPE_UINT32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_ENUM"] = 14] = "TYPE_ENUM"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SFIXED32"] = 15] = "TYPE_SFIXED32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SFIXED64"] = 16] = "TYPE_SFIXED64"; + /** TYPE_SINT32 - Uses ZigZag encoding. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SINT32"] = 17] = "TYPE_SINT32"; + /** TYPE_SINT64 - Uses ZigZag encoding. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SINT64"] = 18] = "TYPE_SINT64"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldDescriptorProto_Type || (FieldDescriptorProto_Type = {})); +export function fieldDescriptorProto_TypeFromJSON(object) { + 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) { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FieldDescriptorProto_Label; +(function (FieldDescriptorProto_Label) { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_OPTIONAL"] = 1] = "LABEL_OPTIONAL"; + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_REPEATED"] = 3] = "LABEL_REPEATED"; + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_REQUIRED"] = 2] = "LABEL_REQUIRED"; + FieldDescriptorProto_Label[FieldDescriptorProto_Label["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldDescriptorProto_Label || (FieldDescriptorProto_Label = {})); +export function fieldDescriptorProto_LabelFromJSON(object) { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} +export function fieldDescriptorProto_LabelToJSON(object) { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Generated classes can be optimized for speed or code size. */ +export var FileOptions_OptimizeMode; +(function (FileOptions_OptimizeMode) { + /** SPEED - Generate complete code for parsing, serialization, */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["SPEED"] = 1] = "SPEED"; + /** CODE_SIZE - etc. */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["CODE_SIZE"] = 2] = "CODE_SIZE"; + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["LITE_RUNTIME"] = 3] = "LITE_RUNTIME"; + FileOptions_OptimizeMode[FileOptions_OptimizeMode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FileOptions_OptimizeMode || (FileOptions_OptimizeMode = {})); +export function fileOptions_OptimizeModeFromJSON(object) { + 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) { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FieldOptions_CType; +(function (FieldOptions_CType) { + /** STRING - Default mode. */ + FieldOptions_CType[FieldOptions_CType["STRING"] = 0] = "STRING"; + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ + FieldOptions_CType[FieldOptions_CType["CORD"] = 1] = "CORD"; + FieldOptions_CType[FieldOptions_CType["STRING_PIECE"] = 2] = "STRING_PIECE"; + FieldOptions_CType[FieldOptions_CType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldOptions_CType || (FieldOptions_CType = {})); +export function fieldOptions_CTypeFromJSON(object) { + 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) { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptions_CType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FieldOptions_JSType; +(function (FieldOptions_JSType) { + /** JS_NORMAL - Use the default type. */ + FieldOptions_JSType[FieldOptions_JSType["JS_NORMAL"] = 0] = "JS_NORMAL"; + /** JS_STRING - Use JavaScript strings. */ + FieldOptions_JSType[FieldOptions_JSType["JS_STRING"] = 1] = "JS_STRING"; + /** JS_NUMBER - Use JavaScript numbers. */ + FieldOptions_JSType[FieldOptions_JSType["JS_NUMBER"] = 2] = "JS_NUMBER"; + FieldOptions_JSType[FieldOptions_JSType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldOptions_JSType || (FieldOptions_JSType = {})); +export function fieldOptions_JSTypeFromJSON(object) { + 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) { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ +export var FieldOptions_OptionRetention; +(function (FieldOptions_OptionRetention) { + FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_UNKNOWN"] = 0] = "RETENTION_UNKNOWN"; + FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_RUNTIME"] = 1] = "RETENTION_RUNTIME"; + FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_SOURCE"] = 2] = "RETENTION_SOURCE"; + FieldOptions_OptionRetention[FieldOptions_OptionRetention["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldOptions_OptionRetention || (FieldOptions_OptionRetention = {})); +export function fieldOptions_OptionRetentionFromJSON(object) { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} +export function fieldOptions_OptionRetentionToJSON(object) { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. + */ +export var FieldOptions_OptionTargetType; +(function (FieldOptions_OptionTargetType) { + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_UNKNOWN"] = 0] = "TARGET_TYPE_UNKNOWN"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_FILE"] = 1] = "TARGET_TYPE_FILE"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_EXTENSION_RANGE"] = 2] = "TARGET_TYPE_EXTENSION_RANGE"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_MESSAGE"] = 3] = "TARGET_TYPE_MESSAGE"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_FIELD"] = 4] = "TARGET_TYPE_FIELD"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ONEOF"] = 5] = "TARGET_TYPE_ONEOF"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ENUM"] = 6] = "TARGET_TYPE_ENUM"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ENUM_ENTRY"] = 7] = "TARGET_TYPE_ENUM_ENTRY"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_SERVICE"] = 8] = "TARGET_TYPE_SERVICE"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_METHOD"] = 9] = "TARGET_TYPE_METHOD"; + FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FieldOptions_OptionTargetType || (FieldOptions_OptionTargetType = {})); +export function fieldOptions_OptionTargetTypeFromJSON(object) { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} +export function fieldOptions_OptionTargetTypeToJSON(object) { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + */ +export var MethodOptions_IdempotencyLevel; +(function (MethodOptions_IdempotencyLevel) { + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["IDEMPOTENCY_UNKNOWN"] = 0] = "IDEMPOTENCY_UNKNOWN"; + /** NO_SIDE_EFFECTS - implies idempotent */ + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["NO_SIDE_EFFECTS"] = 1] = "NO_SIDE_EFFECTS"; + /** IDEMPOTENT - idempotent, but may have side effects */ + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["IDEMPOTENT"] = 2] = "IDEMPOTENT"; + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(MethodOptions_IdempotencyLevel || (MethodOptions_IdempotencyLevel = {})); +export function methodOptions_IdempotencyLevelFromJSON(object) { + 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) { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FeatureSet_FieldPresence; +(function (FeatureSet_FieldPresence) { + FeatureSet_FieldPresence[FeatureSet_FieldPresence["FIELD_PRESENCE_UNKNOWN"] = 0] = "FIELD_PRESENCE_UNKNOWN"; + FeatureSet_FieldPresence[FeatureSet_FieldPresence["EXPLICIT"] = 1] = "EXPLICIT"; + FeatureSet_FieldPresence[FeatureSet_FieldPresence["IMPLICIT"] = 2] = "IMPLICIT"; + FeatureSet_FieldPresence[FeatureSet_FieldPresence["LEGACY_REQUIRED"] = 3] = "LEGACY_REQUIRED"; + FeatureSet_FieldPresence[FeatureSet_FieldPresence["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_FieldPresence || (FeatureSet_FieldPresence = {})); +export function featureSet_FieldPresenceFromJSON(object) { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} +export function featureSet_FieldPresenceToJSON(object) { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FeatureSet_EnumType; +(function (FeatureSet_EnumType) { + FeatureSet_EnumType[FeatureSet_EnumType["ENUM_TYPE_UNKNOWN"] = 0] = "ENUM_TYPE_UNKNOWN"; + FeatureSet_EnumType[FeatureSet_EnumType["OPEN"] = 1] = "OPEN"; + FeatureSet_EnumType[FeatureSet_EnumType["CLOSED"] = 2] = "CLOSED"; + FeatureSet_EnumType[FeatureSet_EnumType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_EnumType || (FeatureSet_EnumType = {})); +export function featureSet_EnumTypeFromJSON(object) { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} +export function featureSet_EnumTypeToJSON(object) { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FeatureSet_RepeatedFieldEncoding; +(function (FeatureSet_RepeatedFieldEncoding) { + FeatureSet_RepeatedFieldEncoding[FeatureSet_RepeatedFieldEncoding["REPEATED_FIELD_ENCODING_UNKNOWN"] = 0] = "REPEATED_FIELD_ENCODING_UNKNOWN"; + FeatureSet_RepeatedFieldEncoding[FeatureSet_RepeatedFieldEncoding["PACKED"] = 1] = "PACKED"; + FeatureSet_RepeatedFieldEncoding[FeatureSet_RepeatedFieldEncoding["EXPANDED"] = 2] = "EXPANDED"; + FeatureSet_RepeatedFieldEncoding[FeatureSet_RepeatedFieldEncoding["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_RepeatedFieldEncoding || (FeatureSet_RepeatedFieldEncoding = {})); +export function featureSet_RepeatedFieldEncodingFromJSON(object) { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} +export function featureSet_RepeatedFieldEncodingToJSON(object) { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FeatureSet_Utf8Validation; +(function (FeatureSet_Utf8Validation) { + FeatureSet_Utf8Validation[FeatureSet_Utf8Validation["UTF8_VALIDATION_UNKNOWN"] = 0] = "UTF8_VALIDATION_UNKNOWN"; + FeatureSet_Utf8Validation[FeatureSet_Utf8Validation["VERIFY"] = 2] = "VERIFY"; + FeatureSet_Utf8Validation[FeatureSet_Utf8Validation["NONE"] = 3] = "NONE"; + FeatureSet_Utf8Validation[FeatureSet_Utf8Validation["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_Utf8Validation || (FeatureSet_Utf8Validation = {})); +export function featureSet_Utf8ValidationFromJSON(object) { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} +export function featureSet_Utf8ValidationToJSON(object) { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FeatureSet_MessageEncoding; +(function (FeatureSet_MessageEncoding) { + FeatureSet_MessageEncoding[FeatureSet_MessageEncoding["MESSAGE_ENCODING_UNKNOWN"] = 0] = "MESSAGE_ENCODING_UNKNOWN"; + FeatureSet_MessageEncoding[FeatureSet_MessageEncoding["LENGTH_PREFIXED"] = 1] = "LENGTH_PREFIXED"; + FeatureSet_MessageEncoding[FeatureSet_MessageEncoding["DELIMITED"] = 2] = "DELIMITED"; + FeatureSet_MessageEncoding[FeatureSet_MessageEncoding["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_MessageEncoding || (FeatureSet_MessageEncoding = {})); +export function featureSet_MessageEncodingFromJSON(object) { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} +export function featureSet_MessageEncodingToJSON(object) { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FeatureSet_JsonFormat; +(function (FeatureSet_JsonFormat) { + FeatureSet_JsonFormat[FeatureSet_JsonFormat["JSON_FORMAT_UNKNOWN"] = 0] = "JSON_FORMAT_UNKNOWN"; + FeatureSet_JsonFormat[FeatureSet_JsonFormat["ALLOW"] = 1] = "ALLOW"; + FeatureSet_JsonFormat[FeatureSet_JsonFormat["LEGACY_BEST_EFFORT"] = 2] = "LEGACY_BEST_EFFORT"; + FeatureSet_JsonFormat[FeatureSet_JsonFormat["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_JsonFormat || (FeatureSet_JsonFormat = {})); +export function featureSet_JsonFormatFromJSON(object) { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} +export function featureSet_JsonFormatToJSON(object) { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FeatureSet_EnforceNamingStyle; +(function (FeatureSet_EnforceNamingStyle) { + FeatureSet_EnforceNamingStyle[FeatureSet_EnforceNamingStyle["ENFORCE_NAMING_STYLE_UNKNOWN"] = 0] = "ENFORCE_NAMING_STYLE_UNKNOWN"; + FeatureSet_EnforceNamingStyle[FeatureSet_EnforceNamingStyle["STYLE2024"] = 1] = "STYLE2024"; + FeatureSet_EnforceNamingStyle[FeatureSet_EnforceNamingStyle["STYLE_LEGACY"] = 2] = "STYLE_LEGACY"; + FeatureSet_EnforceNamingStyle[FeatureSet_EnforceNamingStyle["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_EnforceNamingStyle || (FeatureSet_EnforceNamingStyle = {})); +export function featureSet_EnforceNamingStyleFromJSON(object) { + switch (object) { + case 0: + case "ENFORCE_NAMING_STYLE_UNKNOWN": + return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; + case 1: + case "STYLE2024": + return FeatureSet_EnforceNamingStyle.STYLE2024; + case 2: + case "STYLE_LEGACY": + return FeatureSet_EnforceNamingStyle.STYLE_LEGACY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnforceNamingStyle.UNRECOGNIZED; + } +} +export function featureSet_EnforceNamingStyleToJSON(object) { + switch (object) { + case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN: + return "ENFORCE_NAMING_STYLE_UNKNOWN"; + case FeatureSet_EnforceNamingStyle.STYLE2024: + return "STYLE2024"; + case FeatureSet_EnforceNamingStyle.STYLE_LEGACY: + return "STYLE_LEGACY"; + case FeatureSet_EnforceNamingStyle.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var FeatureSet_VisibilityFeature_DefaultSymbolVisibility; +(function (FeatureSet_VisibilityFeature_DefaultSymbolVisibility) { + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"; + /** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */ + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["EXPORT_ALL"] = 1] = "EXPORT_ALL"; + /** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */ + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["EXPORT_TOP_LEVEL"] = 2] = "EXPORT_TOP_LEVEL"; + /** LOCAL_ALL - All symbols default to local. */ + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["LOCAL_ALL"] = 3] = "LOCAL_ALL"; + /** + * STRICT - All symbols local by default. Nested types cannot be exported. + * With special case caveat for message { enum {} reserved 1 to max; } + * This is the recommended setting for new protos. + */ + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["STRICT"] = 4] = "STRICT"; + FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(FeatureSet_VisibilityFeature_DefaultSymbolVisibility || (FeatureSet_VisibilityFeature_DefaultSymbolVisibility = {})); +export function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object) { + switch (object) { + case 0: + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN; + case 1: + case "EXPORT_ALL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL; + case 2: + case "EXPORT_TOP_LEVEL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL; + case 3: + case "LOCAL_ALL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL; + case 4: + case "STRICT": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED; + } +} +export function featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(object) { + switch (object) { + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN: + return "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL: + return "EXPORT_ALL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL: + return "EXPORT_TOP_LEVEL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL: + return "LOCAL_ALL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT: + return "STRICT"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export var GeneratedCodeInfo_Annotation_Semantic; +(function (GeneratedCodeInfo_Annotation_Semantic) { + /** NONE - There is no effect or the effect is indescribable. */ + GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["NONE"] = 0] = "NONE"; + /** SET - The element is set or otherwise mutated. */ + GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["SET"] = 1] = "SET"; + /** ALIAS - An alias to the element is returned. */ + GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["ALIAS"] = 2] = "ALIAS"; + GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(GeneratedCodeInfo_Annotation_Semantic || (GeneratedCodeInfo_Annotation_Semantic = {})); +export function generatedCodeInfo_Annotation_SemanticFromJSON(object) { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} +export function generatedCodeInfo_Annotation_SemanticToJSON(object) { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseFileDescriptorSet() { + return { file: [] }; +} +export const FileDescriptorSet = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.file) { + FileDescriptorProto.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e) => FileDescriptorProto.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.file?.length) { + obj.file = message.file.map((e) => FileDescriptorProto.toJSON(e)); + } + return obj; + }, + create(base) { + return FileDescriptorSet.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFileDescriptorProto() { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + optionDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "", + edition: 0, + }; +} +export const FileDescriptorProto = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== undefined && message.package !== "") { + writer.uint32(18).string(message.package); + } + for (const v of message.dependency) { + writer.uint32(26).string(v); + } + writer.uint32(82).fork(); + for (const v of message.publicDependency) { + writer.int32(v); + } + writer.join(); + writer.uint32(90).fork(); + for (const v of message.weakDependency) { + writer.int32(v); + } + writer.join(); + for (const v of message.optionDependency) { + writer.uint32(122).string(v); + } + for (const v of message.messageType) { + DescriptorProto.encode(v, writer.uint32(34).fork()).join(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v, writer.uint32(50).fork()).join(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v, writer.uint32(58).fork()).join(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.sourceCodeInfo !== undefined) { + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); + } + if (message.syntax !== undefined && message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.package = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dependency.push(reader.string()); + continue; + } + case 10: { + if (tag === 80) { + message.publicDependency.push(reader.int32()); + continue; + } + if (tag === 82) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.publicDependency.push(reader.int32()); + } + continue; + } + break; + } + case 11: { + if (tag === 88) { + message.weakDependency.push(reader.int32()); + continue; + } + if (tag === 90) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weakDependency.push(reader.int32()); + } + continue; + } + break; + } + case 15: { + if (tag !== 122) { + break; + } + message.optionDependency.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.messageType.push(DescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.options = FileOptions.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.sourceCodeInfo = SourceCodeInfo.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.syntax = reader.string(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + message.edition = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e) => globalThis.Number(e)) + : [], + optionDependency: globalThis.Array.isArray(object?.optionDependency) + ? object.optionDependency.map((e) => globalThis.String(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) + ? object.messageType.map((e) => DescriptorProto.fromJSON(e)) + : [], + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) + ? object.extension.map((e) => FieldDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, + sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.package !== undefined && message.package !== "") { + obj.package = message.package; + } + if (message.dependency?.length) { + obj.dependency = message.dependency; + } + if (message.publicDependency?.length) { + obj.publicDependency = message.publicDependency.map((e) => Math.round(e)); + } + if (message.weakDependency?.length) { + obj.weakDependency = message.weakDependency.map((e) => Math.round(e)); + } + if (message.optionDependency?.length) { + obj.optionDependency = message.optionDependency; + } + if (message.messageType?.length) { + obj.messageType = message.messageType.map((e) => DescriptorProto.toJSON(e)); + } + if (message.enumType?.length) { + obj.enumType = message.enumType.map((e) => EnumDescriptorProto.toJSON(e)); + } + if (message.service?.length) { + obj.service = message.service.map((e) => ServiceDescriptorProto.toJSON(e)); + } + if (message.extension?.length) { + obj.extension = message.extension.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = FileOptions.toJSON(message.options); + } + if (message.sourceCodeInfo !== undefined) { + obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); + } + if (message.syntax !== undefined && message.syntax !== "") { + obj.syntax = message.syntax; + } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + return obj; + }, + create(base) { + return FileDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map((e) => e) || []; + message.publicDependency = object.publicDependency?.map((e) => e) || []; + message.weakDependency = object.weakDependency?.map((e) => e) || []; + message.optionDependency = object.optionDependency?.map((e) => e) || []; + message.messageType = object.messageType?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.service = object.service?.map((e) => ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? FileOptions.fromPartial(object.options) + : undefined; + message.sourceCodeInfo = (object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null) + ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) + : undefined; + message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; + return message; + }, +}; +function createBaseDescriptorProto() { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [], + visibility: 0, + }; +} +export const DescriptorProto = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v, writer.uint32(18).fork()).join(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v, writer.uint32(50).fork()).join(); + } + for (const v of message.nestedType) { + DescriptorProto.encode(v, writer.uint32(26).fork()).join(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v, writer.uint32(34).fork()).join(); + } + for (const v of message.extensionRange) { + DescriptorProto_ExtensionRange.encode(v, writer.uint32(42).fork()).join(); + } + for (const v of message.oneofDecl) { + OneofDescriptorProto.encode(v, writer.uint32(66).fork()).join(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); + } + for (const v of message.reservedRange) { + DescriptorProto_ReservedRange.encode(v, writer.uint32(74).fork()).join(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v); + } + if (message.visibility !== undefined && message.visibility !== 0) { + writer.uint32(88).int32(message.visibility); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.nestedType.push(DescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.extensionRange.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.oneofDecl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.options = MessageOptions.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.reservedRange.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.reservedName.push(reader.string()); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.visibility = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) + ? object.extension.map((e) => FieldDescriptorProto.fromJSON(e)) + : [], + nestedType: globalThis.Array.isArray(object?.nestedType) + ? object.nestedType.map((e) => DescriptorProto.fromJSON(e)) + : [], + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) + ? object.extensionRange.map((e) => DescriptorProto_ExtensionRange.fromJSON(e)) + : [], + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) + ? object.oneofDecl.map((e) => OneofDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, + reservedRange: globalThis.Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e) => DescriptorProto_ReservedRange.fromJSON(e)) + : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e) => globalThis.String(e)) + : [], + visibility: isSet(object.visibility) ? symbolVisibilityFromJSON(object.visibility) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.field?.length) { + obj.field = message.field.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.extension?.length) { + obj.extension = message.extension.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.nestedType?.length) { + obj.nestedType = message.nestedType.map((e) => DescriptorProto.toJSON(e)); + } + if (message.enumType?.length) { + obj.enumType = message.enumType.map((e) => EnumDescriptorProto.toJSON(e)); + } + if (message.extensionRange?.length) { + obj.extensionRange = message.extensionRange.map((e) => DescriptorProto_ExtensionRange.toJSON(e)); + } + if (message.oneofDecl?.length) { + obj.oneofDecl = message.oneofDecl.map((e) => OneofDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = MessageOptions.toJSON(message.options); + } + if (message.reservedRange?.length) { + obj.reservedRange = message.reservedRange.map((e) => DescriptorProto_ReservedRange.toJSON(e)); + } + if (message.reservedName?.length) { + obj.reservedName = message.reservedName; + } + if (message.visibility !== undefined && message.visibility !== 0) { + obj.visibility = symbolVisibilityToJSON(message.visibility); + } + return obj; + }, + create(base) { + return DescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = object.field?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.nestedType = object.nestedType?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.extensionRange = object.extensionRange?.map((e) => DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneofDecl = object.oneofDecl?.map((e) => OneofDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? MessageOptions.fromPartial(object.options) + : undefined; + message.reservedRange = object.reservedRange?.map((e) => DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map((e) => e) || []; + message.visibility = object.visibility ?? 0; + return message; + }, +}; +function createBaseDescriptorProto_ExtensionRange() { + return { start: 0, end: 0, options: undefined }; +} +export const DescriptorProto_ExtensionRange = { + encode(message, writer = new BinaryWriter()) { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.end = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.options !== undefined) { + obj.options = ExtensionRangeOptions.toJSON(message.options); + } + return obj; + }, + create(base) { + return DescriptorProto_ExtensionRange.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDescriptorProto_ExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.options = (object.options !== undefined && object.options !== null) + ? ExtensionRangeOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; +function createBaseDescriptorProto_ReservedRange() { + return { start: 0, end: 0 }; +} +export const DescriptorProto_ReservedRange = { + encode(message, writer = new BinaryWriter()) { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.end = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + return obj; + }, + create(base) { + return DescriptorProto_ReservedRange.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; +function createBaseExtensionRangeOptions() { + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; +} +export const ExtensionRangeOptions = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.verification = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, + }; + }, + toJSON(message) { + const obj = {}; + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } + return obj; + }, + create(base) { + return ExtensionRangeOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; +function createBaseExtensionRangeOptions_Declaration() { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} +export const ExtensionRangeOptions_Declaration = { + encode(message, writer = new BinaryWriter()) { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.number = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.fullName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.type = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.reserved = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.repeated = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + create(base) { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; +function createBaseFieldDescriptorProto() { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} +export const FieldDescriptorProto = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { + writer.uint32(136).bool(message.proto3Optional); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.number = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.label = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.type = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.typeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.extendee = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.defaultValue = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.oneofIndex = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.jsonName = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.options = FieldOptions.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.proto3Optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", + options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.label !== undefined && message.label !== 1) { + obj.label = fieldDescriptorProto_LabelToJSON(message.label); + } + if (message.type !== undefined && message.type !== 1) { + obj.type = fieldDescriptorProto_TypeToJSON(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + obj.typeName = message.typeName; + } + if (message.extendee !== undefined && message.extendee !== "") { + obj.extendee = message.extendee; + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + obj.defaultValue = message.defaultValue; + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + obj.oneofIndex = Math.round(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + obj.jsonName = message.jsonName; + } + if (message.options !== undefined) { + obj.options = FieldOptions.toJSON(message.options); + } + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { + obj.proto3Optional = message.proto3Optional; + } + return obj; + }, + create(base) { + return FieldDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.typeName = object.typeName ?? ""; + message.extendee = object.extendee ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.oneofIndex = object.oneofIndex ?? 0; + message.jsonName = object.jsonName ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? FieldOptions.fromPartial(object.options) + : undefined; + message.proto3Optional = object.proto3Optional ?? false; + return message; + }, +}; +function createBaseOneofDescriptorProto() { + return { name: "", options: undefined }; +} +export const OneofDescriptorProto = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.options = OneofOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.options !== undefined) { + obj.options = OneofOptions.toJSON(message.options); + } + return obj; + }, + create(base) { + return OneofDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? OneofOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; +function createBaseEnumDescriptorProto() { + return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [], visibility: 0 }; +} +export const EnumDescriptorProto = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + for (const v of message.reservedRange) { + EnumDescriptorProto_EnumReservedRange.encode(v, writer.uint32(34).fork()).join(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v); + } + if (message.visibility !== undefined && message.visibility !== 0) { + writer.uint32(48).int32(message.visibility); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.options = EnumOptions.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.reservedRange.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.reservedName.push(reader.string()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.visibility = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e) => EnumValueDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, + reservedRange: globalThis.Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) + : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e) => globalThis.String(e)) + : [], + visibility: isSet(object.visibility) ? symbolVisibilityFromJSON(object.visibility) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.value?.length) { + obj.value = message.value.map((e) => EnumValueDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = EnumOptions.toJSON(message.options); + } + if (message.reservedRange?.length) { + obj.reservedRange = message.reservedRange.map((e) => EnumDescriptorProto_EnumReservedRange.toJSON(e)); + } + if (message.reservedName?.length) { + obj.reservedName = message.reservedName; + } + if (message.visibility !== undefined && message.visibility !== 0) { + obj.visibility = symbolVisibilityToJSON(message.visibility); + } + return obj; + }, + create(base) { + return EnumDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = object.value?.map((e) => EnumValueDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? EnumOptions.fromPartial(object.options) + : undefined; + message.reservedRange = object.reservedRange?.map((e) => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || + []; + message.reservedName = object.reservedName?.map((e) => e) || []; + message.visibility = object.visibility ?? 0; + return message; + }, +}; +function createBaseEnumDescriptorProto_EnumReservedRange() { + return { start: 0, end: 0 }; +} +export const EnumDescriptorProto_EnumReservedRange = { + encode(message, writer = new BinaryWriter()) { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.end = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + return obj; + }, + create(base) { + return EnumDescriptorProto_EnumReservedRange.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; +function createBaseEnumValueDescriptorProto() { + return { name: "", number: 0, options: undefined }; +} +export const EnumValueDescriptorProto = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.number = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.options = EnumValueOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.options !== undefined) { + obj.options = EnumValueOptions.toJSON(message.options); + } + return obj; + }, + create(base) { + return EnumValueDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.options = (object.options !== undefined && object.options !== null) + ? EnumValueOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; +function createBaseServiceDescriptorProto() { + return { name: "", method: [], options: undefined }; +} +export const ServiceDescriptorProto = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.options = ServiceOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.Array.isArray(object?.method) + ? object.method.map((e) => MethodDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.method?.length) { + obj.method = message.method.map((e) => MethodDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = ServiceOptions.toJSON(message.options); + } + return obj; + }, + create(base) { + return ServiceDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = object.method?.map((e) => MethodDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? ServiceOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; +function createBaseMethodDescriptorProto() { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false, + }; +} +export const MethodDescriptorProto = { + encode(message, writer = new BinaryWriter()) { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== undefined && message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== undefined && message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); + } + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.inputType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.outputType = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.options = MethodOptions.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.clientStreaming = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.serverStreaming = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", + options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.inputType !== undefined && message.inputType !== "") { + obj.inputType = message.inputType; + } + if (message.outputType !== undefined && message.outputType !== "") { + obj.outputType = message.outputType; + } + if (message.options !== undefined) { + obj.options = MethodOptions.toJSON(message.options); + } + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { + obj.clientStreaming = message.clientStreaming; + } + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { + obj.serverStreaming = message.serverStreaming; + } + return obj; + }, + create(base) { + return MethodDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.inputType = object.inputType ?? ""; + message.outputType = object.outputType ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? MethodOptions.fromPartial(object.options) + : undefined; + message.clientStreaming = object.clientStreaming ?? false; + message.serverStreaming = object.serverStreaming ?? false; + return message; + }, +}; +function createBaseFileOptions() { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + deprecated: false, + ccEnableArenas: true, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + features: undefined, + uninterpretedOption: [], + }; +} +export const FileOptions = { + encode(message, writer = new BinaryWriter()) { + if (message.javaPackage !== undefined && message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { + writer.uint32(72).int32(message.optimizeFor); + } + if (message.goPackage !== undefined && message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.javaPackage = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.javaOuterClassname = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.javaMultipleFiles = reader.bool(); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + message.javaGenerateEqualsAndHash = reader.bool(); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + message.javaStringCheckUtf8 = reader.bool(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.optimizeFor = reader.int32(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.goPackage = reader.string(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + message.ccGenericServices = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.javaGenericServices = reader.bool(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + message.pyGenericServices = reader.bool(); + continue; + } + case 23: { + if (tag !== 184) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 31: { + if (tag !== 248) { + break; + } + message.ccEnableArenas = reader.bool(); + continue; + } + case 36: { + if (tag !== 290) { + break; + } + message.objcClassPrefix = reader.string(); + continue; + } + case 37: { + if (tag !== 298) { + break; + } + message.csharpNamespace = reader.string(); + continue; + } + case 39: { + if (tag !== 314) { + break; + } + message.swiftPrefix = reader.string(); + continue; + } + case 40: { + if (tag !== 322) { + break; + } + message.phpClassPrefix = reader.string(); + continue; + } + case 41: { + if (tag !== 330) { + break; + } + message.phpNamespace = reader.string(); + continue; + } + case 44: { + if (tag !== 354) { + break; + } + message.phpMetadataNamespace = reader.string(); + continue; + } + case 45: { + if (tag !== 362) { + break; + } + message.rubyPackage = reader.string(); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, + javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) + : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, + optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.javaPackage !== undefined && message.javaPackage !== "") { + obj.javaPackage = message.javaPackage; + } + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { + obj.javaOuterClassname = message.javaOuterClassname; + } + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { + obj.javaMultipleFiles = message.javaMultipleFiles; + } + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { + obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + } + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { + obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; + } + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { + obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); + } + if (message.goPackage !== undefined && message.goPackage !== "") { + obj.goPackage = message.goPackage; + } + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { + obj.ccGenericServices = message.ccGenericServices; + } + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { + obj.javaGenericServices = message.javaGenericServices; + } + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { + obj.pyGenericServices = message.pyGenericServices; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { + obj.ccEnableArenas = message.ccEnableArenas; + } + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { + obj.objcClassPrefix = message.objcClassPrefix; + } + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { + obj.csharpNamespace = message.csharpNamespace; + } + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { + obj.swiftPrefix = message.swiftPrefix; + } + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { + obj.phpClassPrefix = message.phpClassPrefix; + } + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { + obj.phpNamespace = message.phpNamespace; + } + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { + obj.phpMetadataNamespace = message.phpMetadataNamespace; + } + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { + obj.rubyPackage = message.rubyPackage; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return FileOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFileOptions(); + message.javaPackage = object.javaPackage ?? ""; + message.javaOuterClassname = object.javaOuterClassname ?? ""; + message.javaMultipleFiles = object.javaMultipleFiles ?? false; + message.javaGenerateEqualsAndHash = object.javaGenerateEqualsAndHash ?? false; + message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; + message.optimizeFor = object.optimizeFor ?? 1; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; + message.objcClassPrefix = object.objcClassPrefix ?? ""; + message.csharpNamespace = object.csharpNamespace ?? ""; + message.swiftPrefix = object.swiftPrefix ?? ""; + message.phpClassPrefix = object.phpClassPrefix ?? ""; + message.phpNamespace = object.phpNamespace ?? ""; + message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; + message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMessageOptions() { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} +export const MessageOptions = { + encode(message, writer = new BinaryWriter()) { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry !== undefined && message.mapEntry !== false) { + writer.uint32(56).bool(message.mapEntry); + } + if (message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.messageSetWireFormat = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.noStandardDescriptorAccessor = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.mapEntry = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, + noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { + obj.messageSetWireFormat = message.messageSetWireFormat; + } + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { + obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.mapEntry !== undefined && message.mapEntry !== false) { + obj.mapEntry = message.mapEntry; + } + if (message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return MessageOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMessageOptions(); + message.messageSetWireFormat = object.messageSetWireFormat ?? false; + message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; + message.deprecated = object.deprecated ?? false; + message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFieldOptions() { + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; +} +export const FieldOptions = { + encode(message, writer = new BinaryWriter()) { + if (message.ctype !== undefined && message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed !== undefined && message.packed !== false) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== undefined && message.jstype !== 0) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy !== undefined && message.lazy !== false) { + writer.uint32(40).bool(message.lazy); + } + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak !== undefined && message.weak !== false) { + writer.uint32(80).bool(message.weak); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.ctype = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.packed = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.jstype = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.lazy = reader.bool(); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + message.unverifiedLazy = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.weak = reader.bool(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + message.debugRedact = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + message.retention = reader.int32(); + continue; + } + case 19: { + if (tag === 152) { + message.targets.push(reader.int32()); + continue; + } + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32()); + } + continue; + } + break; + } + case 20: { + if (tag !== 162) { + break; + } + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + packed: isSet(object.packed) ? globalThis.Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? globalThis.Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.ctype !== undefined && message.ctype !== 0) { + obj.ctype = fieldOptions_CTypeToJSON(message.ctype); + } + if (message.packed !== undefined && message.packed !== false) { + obj.packed = message.packed; + } + if (message.jstype !== undefined && message.jstype !== 0) { + obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); + } + if (message.lazy !== undefined && message.lazy !== false) { + obj.lazy = message.lazy; + } + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.weak !== undefined && message.weak !== false) { + obj.weak = message.weak; + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return FieldOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 0; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 0; + message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseFieldOptions_EditionDefault() { + return { edition: 0, value: "" }; +} +export const FieldOptions_EditionDefault = { + encode(message, writer = new BinaryWriter()) { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + message.edition = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + create(base) { + return FieldOptions_EditionDefault.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; +function createBaseFieldOptions_FeatureSupport() { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; +} +export const FieldOptions_FeatureSupport = { + encode(message, writer = new BinaryWriter()) { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); + } + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_FeatureSupport(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.editionIntroduced = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.editionDeprecated = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.deprecationWarning = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.editionRemoved = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + editionIntroduced: isSet(object.editionIntroduced) ? editionFromJSON(object.editionIntroduced) : 0, + editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0, + deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "", + editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); + } + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + create(base) { + return FieldOptions_FeatureSupport.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; +function createBaseOneofOptions() { + return { features: undefined, uninterpretedOption: [] }; +} +export const OneofOptions = { + encode(message, writer = new BinaryWriter()) { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return OneofOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEnumOptions() { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} +export const EnumOptions = { + encode(message, writer = new BinaryWriter()) { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 16) { + break; + } + message.allowAlias = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return EnumOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumOptions(); + message.allowAlias = object.allowAlias ?? false; + message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEnumValueOptions() { + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; +} +export const EnumValueOptions = { + encode(message, writer = new BinaryWriter()) { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(8).bool(message.deprecated); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.debugRedact = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return EnumValueOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseServiceOptions() { + return { features: undefined, deprecated: false, uninterpretedOption: [] }; +} +export const ServiceOptions = { + encode(message, writer = new BinaryWriter()) { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 34: { + if (tag !== 274) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 33: { + if (tag !== 264) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return ServiceOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMethodOptions() { + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; +} +export const MethodOptions = { + encode(message, writer = new BinaryWriter()) { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { + writer.uint32(272).int32(message.idempotencyLevel); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v, writer.uint32(7994).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + if (tag !== 264) { + break; + } + message.deprecated = reader.bool(); + continue; + } + case 34: { + if (tag !== 272) { + break; + } + message.idempotencyLevel = reader.int32(); + continue; + } + case 35: { + if (tag !== 282) { + break; + } + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + idempotencyLevel: isSet(object.idempotencyLevel) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) + : 0, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { + obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + create(base) { + return MethodOptions.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; +function createBaseUninterpretedOption() { + return { + name: [], + identifierValue: "", + positiveIntValue: 0, + negativeIntValue: 0, + doubleValue: 0, + stringValue: new Uint8Array(0), + aggregateValue: "", + }; +} +export const UninterpretedOption = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v, writer.uint32(18).fork()).join(); + } + if (message.identifierValue !== undefined && message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== undefined && message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue !== undefined && message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.name.push(UninterpretedOption_NamePart.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.identifierValue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.positiveIntValue = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.negativeIntValue = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + message.doubleValue = reader.double(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.stringValue = reader.bytes(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.aggregateValue = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, + stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.name?.length) { + obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); + } + if (message.identifierValue !== undefined && message.identifierValue !== "") { + obj.identifierValue = message.identifierValue; + } + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { + obj.positiveIntValue = Math.round(message.positiveIntValue); + } + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { + obj.negativeIntValue = Math.round(message.negativeIntValue); + } + if (message.doubleValue !== undefined && message.doubleValue !== 0) { + obj.doubleValue = message.doubleValue; + } + if (message.stringValue !== undefined && message.stringValue.length !== 0) { + obj.stringValue = base64FromBytes(message.stringValue); + } + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { + obj.aggregateValue = message.aggregateValue; + } + return obj; + }, + create(base) { + return UninterpretedOption.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map((e) => UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifierValue = object.identifierValue ?? ""; + message.positiveIntValue = object.positiveIntValue ?? 0; + message.negativeIntValue = object.negativeIntValue ?? 0; + message.doubleValue = object.doubleValue ?? 0; + message.stringValue = object.stringValue ?? new Uint8Array(0); + message.aggregateValue = object.aggregateValue ?? ""; + return message; + }, +}; +function createBaseUninterpretedOption_NamePart() { + return { namePart: "", isExtension: false }; +} +export const UninterpretedOption_NamePart = { + encode(message, writer = new BinaryWriter()) { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension !== false) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption_NamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.namePart = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.isExtension = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.namePart !== "") { + obj.namePart = message.namePart; + } + if (message.isExtension !== false) { + obj.isExtension = message.isExtension; + } + return obj; + }, + create(base) { + return UninterpretedOption_NamePart.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUninterpretedOption_NamePart(); + message.namePart = object.namePart ?? ""; + message.isExtension = object.isExtension ?? false; + return message; + }, +}; +function createBaseFeatureSet() { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + enforceNamingStyle: 0, + defaultSymbolVisibility: 0, + }; +} +export const FeatureSet = { + encode(message, writer = new BinaryWriter()) { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + if (message.enforceNamingStyle !== undefined && message.enforceNamingStyle !== 0) { + writer.uint32(56).int32(message.enforceNamingStyle); + } + if (message.defaultSymbolVisibility !== undefined && message.defaultSymbolVisibility !== 0) { + writer.uint32(64).int32(message.defaultSymbolVisibility); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.fieldPresence = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.enumType = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.repeatedFieldEncoding = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.utf8Validation = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.messageEncoding = reader.int32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.jsonFormat = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.enforceNamingStyle = reader.int32(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.defaultSymbolVisibility = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, + enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : 0, + utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, + messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, + jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, + enforceNamingStyle: isSet(object.enforceNamingStyle) + ? featureSet_EnforceNamingStyleFromJSON(object.enforceNamingStyle) + : 0, + defaultSymbolVisibility: isSet(object.defaultSymbolVisibility) + ? featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object.defaultSymbolVisibility) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + if (message.enforceNamingStyle !== undefined && message.enforceNamingStyle !== 0) { + obj.enforceNamingStyle = featureSet_EnforceNamingStyleToJSON(message.enforceNamingStyle); + } + if (message.defaultSymbolVisibility !== undefined && message.defaultSymbolVisibility !== 0) { + obj.defaultSymbolVisibility = featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(message.defaultSymbolVisibility); + } + return obj; + }, + create(base) { + return FeatureSet.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + message.enforceNamingStyle = object.enforceNamingStyle ?? 0; + message.defaultSymbolVisibility = object.defaultSymbolVisibility ?? 0; + return message; + }, +}; +function createBaseFeatureSet_VisibilityFeature() { + return {}; +} +export const FeatureSet_VisibilityFeature = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet_VisibilityFeature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return FeatureSet_VisibilityFeature.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseFeatureSet_VisibilityFeature(); + return message; + }, +}; +function createBaseFeatureSetDefaults() { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} +export const FeatureSetDefaults = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.minimumEdition = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.maximumEdition = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, + maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + create(base) { + return FeatureSetDefaults.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; +function createBaseFeatureSetDefaults_FeatureSetEditionDefault() { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} +export const FeatureSetDefaults_FeatureSetEditionDefault = { + encode(message, writer = new BinaryWriter()) { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + message.edition = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) ? FeatureSet.fromJSON(object.fixedFeatures) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + create(base) { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; +function createBaseSourceCodeInfo() { + return { location: [] }; +} +export const SourceCodeInfo = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.location.push(SourceCodeInfo_Location.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + location: globalThis.Array.isArray(object?.location) + ? object.location.map((e) => SourceCodeInfo_Location.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.location?.length) { + obj.location = message.location.map((e) => SourceCodeInfo_Location.toJSON(e)); + } + return obj; + }, + create(base) { + return SourceCodeInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, +}; +function createBaseSourceCodeInfo_Location() { + return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; +} +export const SourceCodeInfo_Location = { + encode(message, writer = new BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== undefined && message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } + for (const v of message.leadingDetachedComments) { + writer.uint32(50).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo_Location(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.path.push(reader.int32()); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + continue; + } + break; + } + case 2: { + if (tag === 16) { + message.span.push(reader.int32()); + continue; + } + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + continue; + } + break; + } + case 3: { + if (tag !== 26) { + break; + } + message.leadingComments = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.trailingComments = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.leadingDetachedComments.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: globalThis.Array.isArray(object?.path) ? object.path.map((e) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + if (message.span?.length) { + obj.span = message.span.map((e) => Math.round(e)); + } + if (message.leadingComments !== undefined && message.leadingComments !== "") { + obj.leadingComments = message.leadingComments; + } + if (message.trailingComments !== undefined && message.trailingComments !== "") { + obj.trailingComments = message.trailingComments; + } + if (message.leadingDetachedComments?.length) { + obj.leadingDetachedComments = message.leadingDetachedComments; + } + return obj; + }, + create(base) { + return SourceCodeInfo_Location.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map((e) => e) || []; + message.span = object.span?.map((e) => e) || []; + message.leadingComments = object.leadingComments ?? ""; + message.trailingComments = object.trailingComments ?? ""; + message.leadingDetachedComments = object.leadingDetachedComments?.map((e) => e) || []; + return message; + }, +}; +function createBaseGeneratedCodeInfo() { + return { annotation: [] }; +} +export const GeneratedCodeInfo = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.annotation.push(GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + annotation: globalThis.Array.isArray(object?.annotation) + ? object.annotation.map((e) => GeneratedCodeInfo_Annotation.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.annotation?.length) { + obj.annotation = message.annotation.map((e) => GeneratedCodeInfo_Annotation.toJSON(e)); + } + return obj; + }, + create(base) { + return GeneratedCodeInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map((e) => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, +}; +function createBaseGeneratedCodeInfo_Annotation() { + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; +} +export const GeneratedCodeInfo_Annotation = { + encode(message, writer = new BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== undefined && message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(32).int32(message.end); + } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo_Annotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.path.push(reader.int32()); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + continue; + } + break; + } + case 2: { + if (tag !== 18) { + break; + } + message.sourceFile = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.begin = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.end = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.semantic = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + path: globalThis.Array.isArray(object?.path) ? object.path.map((e) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + if (message.sourceFile !== undefined && message.sourceFile !== "") { + obj.sourceFile = message.sourceFile; + } + if (message.begin !== undefined && message.begin !== 0) { + obj.begin = Math.round(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } + return obj; + }, + create(base) { + return GeneratedCodeInfo_Annotation.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map((e) => e) || []; + message.sourceFile = object.sourceFile ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/google/protobuf/timestamp.d.ts b/dist/module/coreum/dex/v1/google/protobuf/timestamp.d.ts new file mode 100644 index 0000000..28a0c47 --- /dev/null +++ b/dist/module/coreum/dex/v1/google/protobuf/timestamp.d.ts @@ -0,0 +1,128 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export declare const protobufPackage = "google.protobuf"; +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} +export declare const Timestamp: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/google/protobuf/timestamp.js b/dist/module/coreum/dex/v1/google/protobuf/timestamp.js new file mode 100644 index 0000000..f953bc2 --- /dev/null +++ b/dist/module/coreum/dex/v1/google/protobuf/timestamp.js @@ -0,0 +1,89 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: google/protobuf/timestamp.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +export const protobufPackage = "google.protobuf"; +function createBaseTimestamp() { + return { seconds: 0, nanos: 0 }; +} +export const Timestamp = { + encode(message, writer = new BinaryWriter()) { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + create(base) { + return Timestamp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/order.d.ts b/dist/module/coreum/dex/v1/order.d.ts new file mode 100644 index 0000000..602edbc --- /dev/null +++ b/dist/module/coreum/dex/v1/order.d.ts @@ -0,0 +1,152 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "./cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin"; +export declare const protobufPackage = "coreum.dex.v1"; +/** Side is order side. */ +export declare enum Side { + /** SIDE_UNSPECIFIED - SIDE_UNSPECIFIED reserves the default value, to protect against unexpected settings. */ + SIDE_UNSPECIFIED = 0, + /** SIDE_BUY - SIDE_BUY means that the order is to buy base_denom quantity with the price. */ + SIDE_BUY = 1, + /** SIDE_SELL - SIDE_SELL means that the order is to sell base_denom quantity with the price. */ + SIDE_SELL = 2, + UNRECOGNIZED = -1 +} +export declare function sideFromJSON(object: any): Side; +export declare function sideToJSON(object: Side): string; +/** Type is order type. */ +export declare enum OrderType { + /** ORDER_TYPE_UNSPECIFIED - order_type_unspecified reserves the default value, to protect against unexpected settings. */ + ORDER_TYPE_UNSPECIFIED = 0, + /** ORDER_TYPE_LIMIT - order_type_limit means that the order is limit order. */ + ORDER_TYPE_LIMIT = 1, + /** ORDER_TYPE_MARKET - limit order_type_market that the order is market order. */ + ORDER_TYPE_MARKET = 2, + UNRECOGNIZED = -1 +} +export declare function orderTypeFromJSON(object: any): OrderType; +export declare function orderTypeToJSON(object: OrderType): string; +/** TimeInForce is order time in force. */ +export declare enum TimeInForce { + /** TIME_IN_FORCE_UNSPECIFIED - time_in_force_unspecified reserves the default value, to protect against unexpected settings. */ + TIME_IN_FORCE_UNSPECIFIED = 0, + /** TIME_IN_FORCE_GTC - time_in_force_gtc means that the order remains active until it is fully executed or manually canceled. */ + TIME_IN_FORCE_GTC = 1, + /** + * TIME_IN_FORCE_IOC - time_in_force_ioc means that order must be executed immediately, either in full or partially. Any portion of the + * order that cannot be filled immediately is canceled. + */ + TIME_IN_FORCE_IOC = 2, + /** TIME_IN_FORCE_FOK - time_in_force_fok means that order must be fully executed or canceled. */ + TIME_IN_FORCE_FOK = 3, + UNRECOGNIZED = -1 +} +export declare function timeInForceFromJSON(object: any): TimeInForce; +export declare function timeInForceToJSON(object: TimeInForce): string; +/** GoodTil is a good til order settings. */ +export interface GoodTil { + /** good_til_block_height means that order remains active until a specific blockchain block height is reached. */ + goodTilBlockHeight: number; + /** good_til_block_time means that order remains active until a specific blockchain block time is reached. */ + goodTilBlockTime: Date | undefined; +} +/** CancelGoodTil is a cancel good til message for the delay router. */ +export interface CancelGoodTil { + /** creator is order creator address. */ + creator: string; + /** order_sequence is order sequence. */ + orderSequence: number; +} +/** + * Order represents a DEX order, encapsulating both limit and market orders. It contains comprehensive information about + * the order's state. + */ +export interface Order { + /** creator is order creator address. */ + creator: string; + /** type is order type. */ + type: OrderType; + /** id is unique order ID. */ + id: string; + /** sequence is unique order sequence generated at the time of the order placement. */ + sequence: number; + /** base_denom is base order denom. */ + baseDenom: string; + /** quote_denom is quote order denom */ + quoteDenom: string; + /** price is value of one unit of the base_denom expressed in terms of the quote_denom. */ + price: string; + /** quantity is amount of the base base_denom being traded. */ + quantity: string; + /** side is order side. */ + side: Side; + /** remaining_base_quantity - is remaining quantity of base denom which user wants to sell or buy. */ + remainingBaseQuantity: string; + /** remaining_spendable_balance - is balance up to which user wants to spend to execute the order. */ + remainingSpendableBalance: string; + /** good_til is order good til */ + goodTil: GoodTil | undefined; + /** time_in_force is order time in force */ + timeInForce: TimeInForce; + /** reserve is the reserve required to save the order in the order book */ + reserve: Coin | undefined; +} +/** OrderData represents the order information for the store missing in the order book record. */ +export interface OrderData { + /** order ID provided by the creator. */ + orderId: string; + /** order_book_id is order book ID. */ + orderBookId: number; + /** price is value of one unit of the base_denom expressed in terms of the quote_denom. */ + price: string; + /** quantity is amount of the base base_denom being traded. */ + quantity: string; + /** side is order side. */ + side: Side; + /** good_til is order good til */ + goodTil: GoodTil | undefined; + /** reserve is the reserve required to save the order in the order book */ + reserve: Coin | undefined; +} +/** OrderBookData is a order book data used by order for the store. */ +export interface OrderBookData { + /** base_denom is base order book denom. */ + baseDenom: string; + /** quote_denom is quote order book denom */ + quoteDenom: string; +} +/** OrderBookRecordData is a single order book record used for the store. */ +export interface OrderBookRecordData { + /** order ID provided by the creator. */ + orderId: string; + /** account_number is account number which corresponds the order creator. */ + accountNumber: number; + /** remaining_base_quantity - is remaining quantity of base denom which user wants to sell or buy. */ + remainingBaseQuantity: string; + /** remaining_spendable_balance - is balance up to which user wants to spend to execute the order. */ + remainingSpendableBalance: string; +} +export declare const GoodTil: MessageFns; +export declare const CancelGoodTil: MessageFns; +export declare const Order: MessageFns; +export declare const OrderData: MessageFns; +export declare const OrderBookData: MessageFns; +export declare const OrderBookRecordData: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/order.js b/dist/module/coreum/dex/v1/order.js new file mode 100644 index 0000000..02abfb3 --- /dev/null +++ b/dist/module/coreum/dex/v1/order.js @@ -0,0 +1,950 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/order.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "./cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin"; +import { Timestamp } from "./google/protobuf/timestamp"; +export const protobufPackage = "coreum.dex.v1"; +/** Side is order side. */ +export var Side; +(function (Side) { + /** SIDE_UNSPECIFIED - SIDE_UNSPECIFIED reserves the default value, to protect against unexpected settings. */ + Side[Side["SIDE_UNSPECIFIED"] = 0] = "SIDE_UNSPECIFIED"; + /** SIDE_BUY - SIDE_BUY means that the order is to buy base_denom quantity with the price. */ + Side[Side["SIDE_BUY"] = 1] = "SIDE_BUY"; + /** SIDE_SELL - SIDE_SELL means that the order is to sell base_denom quantity with the price. */ + Side[Side["SIDE_SELL"] = 2] = "SIDE_SELL"; + Side[Side["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(Side || (Side = {})); +export function sideFromJSON(object) { + switch (object) { + case 0: + case "SIDE_UNSPECIFIED": + return Side.SIDE_UNSPECIFIED; + case 1: + case "SIDE_BUY": + return Side.SIDE_BUY; + case 2: + case "SIDE_SELL": + return Side.SIDE_SELL; + case -1: + case "UNRECOGNIZED": + default: + return Side.UNRECOGNIZED; + } +} +export function sideToJSON(object) { + switch (object) { + case Side.SIDE_UNSPECIFIED: + return "SIDE_UNSPECIFIED"; + case Side.SIDE_BUY: + return "SIDE_BUY"; + case Side.SIDE_SELL: + return "SIDE_SELL"; + case Side.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Type is order type. */ +export var OrderType; +(function (OrderType) { + /** ORDER_TYPE_UNSPECIFIED - order_type_unspecified reserves the default value, to protect against unexpected settings. */ + OrderType[OrderType["ORDER_TYPE_UNSPECIFIED"] = 0] = "ORDER_TYPE_UNSPECIFIED"; + /** ORDER_TYPE_LIMIT - order_type_limit means that the order is limit order. */ + OrderType[OrderType["ORDER_TYPE_LIMIT"] = 1] = "ORDER_TYPE_LIMIT"; + /** ORDER_TYPE_MARKET - limit order_type_market that the order is market order. */ + OrderType[OrderType["ORDER_TYPE_MARKET"] = 2] = "ORDER_TYPE_MARKET"; + OrderType[OrderType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(OrderType || (OrderType = {})); +export function orderTypeFromJSON(object) { + switch (object) { + case 0: + case "ORDER_TYPE_UNSPECIFIED": + return OrderType.ORDER_TYPE_UNSPECIFIED; + case 1: + case "ORDER_TYPE_LIMIT": + return OrderType.ORDER_TYPE_LIMIT; + case 2: + case "ORDER_TYPE_MARKET": + return OrderType.ORDER_TYPE_MARKET; + case -1: + case "UNRECOGNIZED": + default: + return OrderType.UNRECOGNIZED; + } +} +export function orderTypeToJSON(object) { + switch (object) { + case OrderType.ORDER_TYPE_UNSPECIFIED: + return "ORDER_TYPE_UNSPECIFIED"; + case OrderType.ORDER_TYPE_LIMIT: + return "ORDER_TYPE_LIMIT"; + case OrderType.ORDER_TYPE_MARKET: + return "ORDER_TYPE_MARKET"; + case OrderType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** TimeInForce is order time in force. */ +export var TimeInForce; +(function (TimeInForce) { + /** TIME_IN_FORCE_UNSPECIFIED - time_in_force_unspecified reserves the default value, to protect against unexpected settings. */ + TimeInForce[TimeInForce["TIME_IN_FORCE_UNSPECIFIED"] = 0] = "TIME_IN_FORCE_UNSPECIFIED"; + /** TIME_IN_FORCE_GTC - time_in_force_gtc means that the order remains active until it is fully executed or manually canceled. */ + TimeInForce[TimeInForce["TIME_IN_FORCE_GTC"] = 1] = "TIME_IN_FORCE_GTC"; + /** + * TIME_IN_FORCE_IOC - time_in_force_ioc means that order must be executed immediately, either in full or partially. Any portion of the + * order that cannot be filled immediately is canceled. + */ + TimeInForce[TimeInForce["TIME_IN_FORCE_IOC"] = 2] = "TIME_IN_FORCE_IOC"; + /** TIME_IN_FORCE_FOK - time_in_force_fok means that order must be fully executed or canceled. */ + TimeInForce[TimeInForce["TIME_IN_FORCE_FOK"] = 3] = "TIME_IN_FORCE_FOK"; + TimeInForce[TimeInForce["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(TimeInForce || (TimeInForce = {})); +export function timeInForceFromJSON(object) { + switch (object) { + case 0: + case "TIME_IN_FORCE_UNSPECIFIED": + return TimeInForce.TIME_IN_FORCE_UNSPECIFIED; + case 1: + case "TIME_IN_FORCE_GTC": + return TimeInForce.TIME_IN_FORCE_GTC; + case 2: + case "TIME_IN_FORCE_IOC": + return TimeInForce.TIME_IN_FORCE_IOC; + case 3: + case "TIME_IN_FORCE_FOK": + return TimeInForce.TIME_IN_FORCE_FOK; + case -1: + case "UNRECOGNIZED": + default: + return TimeInForce.UNRECOGNIZED; + } +} +export function timeInForceToJSON(object) { + switch (object) { + case TimeInForce.TIME_IN_FORCE_UNSPECIFIED: + return "TIME_IN_FORCE_UNSPECIFIED"; + case TimeInForce.TIME_IN_FORCE_GTC: + return "TIME_IN_FORCE_GTC"; + case TimeInForce.TIME_IN_FORCE_IOC: + return "TIME_IN_FORCE_IOC"; + case TimeInForce.TIME_IN_FORCE_FOK: + return "TIME_IN_FORCE_FOK"; + case TimeInForce.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseGoodTil() { + return { goodTilBlockHeight: 0, goodTilBlockTime: undefined }; +} +export const GoodTil = { + encode(message, writer = new BinaryWriter()) { + if (message.goodTilBlockHeight !== 0) { + writer.uint32(8).uint64(message.goodTilBlockHeight); + } + if (message.goodTilBlockTime !== undefined) { + Timestamp.encode(toTimestamp(message.goodTilBlockTime), writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGoodTil(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.goodTilBlockHeight = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.goodTilBlockTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + goodTilBlockHeight: isSet(object.goodTilBlockHeight) + ? globalThis.Number(object.goodTilBlockHeight) + : 0, + goodTilBlockTime: isSet(object.goodTilBlockTime) + ? fromJsonTimestamp(object.goodTilBlockTime) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.goodTilBlockHeight !== 0) { + obj.goodTilBlockHeight = Math.round(message.goodTilBlockHeight); + } + if (message.goodTilBlockTime !== undefined) { + obj.goodTilBlockTime = message.goodTilBlockTime.toISOString(); + } + return obj; + }, + create(base) { + return GoodTil.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGoodTil(); + message.goodTilBlockHeight = object.goodTilBlockHeight ?? 0; + message.goodTilBlockTime = object.goodTilBlockTime ?? undefined; + return message; + }, +}; +function createBaseCancelGoodTil() { + return { creator: "", orderSequence: 0 }; +} +export const CancelGoodTil = { + encode(message, writer = new BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.orderSequence !== 0) { + writer.uint32(16).uint64(message.orderSequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelGoodTil(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.orderSequence = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + orderSequence: isSet(object.orderSequence) + ? globalThis.Number(object.orderSequence) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.orderSequence !== 0) { + obj.orderSequence = Math.round(message.orderSequence); + } + return obj; + }, + create(base) { + return CancelGoodTil.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCancelGoodTil(); + message.creator = object.creator ?? ""; + message.orderSequence = object.orderSequence ?? 0; + return message; + }, +}; +function createBaseOrder() { + return { + creator: "", + type: 0, + id: "", + sequence: 0, + baseDenom: "", + quoteDenom: "", + price: "", + quantity: "", + side: 0, + remainingBaseQuantity: "", + remainingSpendableBalance: "", + goodTil: undefined, + timeInForce: 0, + reserve: undefined, + }; +} +export const Order = { + encode(message, writer = new BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + if (message.baseDenom !== "") { + writer.uint32(42).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(50).string(message.quoteDenom); + } + if (message.price !== "") { + writer.uint32(58).string(message.price); + } + if (message.quantity !== "") { + writer.uint32(66).string(message.quantity); + } + if (message.side !== 0) { + writer.uint32(72).int32(message.side); + } + if (message.remainingBaseQuantity !== "") { + writer.uint32(82).string(message.remainingBaseQuantity); + } + if (message.remainingSpendableBalance !== "") { + writer.uint32(90).string(message.remainingSpendableBalance); + } + if (message.goodTil !== undefined) { + GoodTil.encode(message.goodTil, writer.uint32(98).fork()).join(); + } + if (message.timeInForce !== 0) { + writer.uint32(104).int32(message.timeInForce); + } + if (message.reserve !== undefined) { + Coin.encode(message.reserve, writer.uint32(114).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.price = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.quantity = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + message.side = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.remainingBaseQuantity = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.remainingSpendableBalance = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.goodTil = GoodTil.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + message.timeInForce = reader.int32(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + message.reserve = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + type: isSet(object.type) ? orderTypeFromJSON(object.type) : 0, + id: isSet(object.id) ? globalThis.String(object.id) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + baseDenom: isSet(object.baseDenom) + ? globalThis.String(object.baseDenom) + : "", + quoteDenom: isSet(object.quoteDenom) + ? globalThis.String(object.quoteDenom) + : "", + price: isSet(object.price) ? globalThis.String(object.price) : "", + quantity: isSet(object.quantity) + ? globalThis.String(object.quantity) + : "", + side: isSet(object.side) ? sideFromJSON(object.side) : 0, + remainingBaseQuantity: isSet(object.remainingBaseQuantity) + ? globalThis.String(object.remainingBaseQuantity) + : "", + remainingSpendableBalance: isSet(object.remainingSpendableBalance) + ? globalThis.String(object.remainingSpendableBalance) + : "", + goodTil: isSet(object.goodTil) + ? GoodTil.fromJSON(object.goodTil) + : undefined, + timeInForce: isSet(object.timeInForce) + ? timeInForceFromJSON(object.timeInForce) + : 0, + reserve: isSet(object.reserve) + ? Coin.fromJSON(object.reserve) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.type !== 0) { + obj.type = orderTypeToJSON(message.type); + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + if (message.price !== "") { + obj.price = message.price; + } + if (message.quantity !== "") { + obj.quantity = message.quantity; + } + if (message.side !== 0) { + obj.side = sideToJSON(message.side); + } + if (message.remainingBaseQuantity !== "") { + obj.remainingBaseQuantity = message.remainingBaseQuantity; + } + if (message.remainingSpendableBalance !== "") { + obj.remainingSpendableBalance = message.remainingSpendableBalance; + } + if (message.goodTil !== undefined) { + obj.goodTil = GoodTil.toJSON(message.goodTil); + } + if (message.timeInForce !== 0) { + obj.timeInForce = timeInForceToJSON(message.timeInForce); + } + if (message.reserve !== undefined) { + obj.reserve = Coin.toJSON(message.reserve); + } + return obj; + }, + create(base) { + return Order.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrder(); + message.creator = object.creator ?? ""; + message.type = object.type ?? 0; + message.id = object.id ?? ""; + message.sequence = object.sequence ?? 0; + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + message.price = object.price ?? ""; + message.quantity = object.quantity ?? ""; + message.side = object.side ?? 0; + message.remainingBaseQuantity = object.remainingBaseQuantity ?? ""; + message.remainingSpendableBalance = object.remainingSpendableBalance ?? ""; + message.goodTil = + object.goodTil !== undefined && object.goodTil !== null + ? GoodTil.fromPartial(object.goodTil) + : undefined; + message.timeInForce = object.timeInForce ?? 0; + message.reserve = + object.reserve !== undefined && object.reserve !== null + ? Coin.fromPartial(object.reserve) + : undefined; + return message; + }, +}; +function createBaseOrderData() { + return { + orderId: "", + orderBookId: 0, + price: "", + quantity: "", + side: 0, + goodTil: undefined, + reserve: undefined, + }; +} +export const OrderData = { + encode(message, writer = new BinaryWriter()) { + if (message.orderId !== "") { + writer.uint32(10).string(message.orderId); + } + if (message.orderBookId !== 0) { + writer.uint32(16).uint32(message.orderBookId); + } + if (message.price !== "") { + writer.uint32(26).string(message.price); + } + if (message.quantity !== "") { + writer.uint32(34).string(message.quantity); + } + if (message.side !== 0) { + writer.uint32(40).int32(message.side); + } + if (message.goodTil !== undefined) { + GoodTil.encode(message.goodTil, writer.uint32(50).fork()).join(); + } + if (message.reserve !== undefined) { + Coin.encode(message.reserve, writer.uint32(58).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orderId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.orderBookId = reader.uint32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.price = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.quantity = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.side = reader.int32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.goodTil = GoodTil.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.reserve = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orderId: isSet(object.orderId) ? globalThis.String(object.orderId) : "", + orderBookId: isSet(object.orderBookId) + ? globalThis.Number(object.orderBookId) + : 0, + price: isSet(object.price) ? globalThis.String(object.price) : "", + quantity: isSet(object.quantity) + ? globalThis.String(object.quantity) + : "", + side: isSet(object.side) ? sideFromJSON(object.side) : 0, + goodTil: isSet(object.goodTil) + ? GoodTil.fromJSON(object.goodTil) + : undefined, + reserve: isSet(object.reserve) + ? Coin.fromJSON(object.reserve) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.orderId !== "") { + obj.orderId = message.orderId; + } + if (message.orderBookId !== 0) { + obj.orderBookId = Math.round(message.orderBookId); + } + if (message.price !== "") { + obj.price = message.price; + } + if (message.quantity !== "") { + obj.quantity = message.quantity; + } + if (message.side !== 0) { + obj.side = sideToJSON(message.side); + } + if (message.goodTil !== undefined) { + obj.goodTil = GoodTil.toJSON(message.goodTil); + } + if (message.reserve !== undefined) { + obj.reserve = Coin.toJSON(message.reserve); + } + return obj; + }, + create(base) { + return OrderData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrderData(); + message.orderId = object.orderId ?? ""; + message.orderBookId = object.orderBookId ?? 0; + message.price = object.price ?? ""; + message.quantity = object.quantity ?? ""; + message.side = object.side ?? 0; + message.goodTil = + object.goodTil !== undefined && object.goodTil !== null + ? GoodTil.fromPartial(object.goodTil) + : undefined; + message.reserve = + object.reserve !== undefined && object.reserve !== null + ? Coin.fromPartial(object.reserve) + : undefined; + return message; + }, +}; +function createBaseOrderBookData() { + return { baseDenom: "", quoteDenom: "" }; +} +export const OrderBookData = { + encode(message, writer = new BinaryWriter()) { + if (message.baseDenom !== "") { + writer.uint32(10).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(18).string(message.quoteDenom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderBookData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseDenom: isSet(object.baseDenom) + ? globalThis.String(object.baseDenom) + : "", + quoteDenom: isSet(object.quoteDenom) + ? globalThis.String(object.quoteDenom) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + return obj; + }, + create(base) { + return OrderBookData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrderBookData(); + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + return message; + }, +}; +function createBaseOrderBookRecordData() { + return { + orderId: "", + accountNumber: 0, + remainingBaseQuantity: "", + remainingSpendableBalance: "", + }; +} +export const OrderBookRecordData = { + encode(message, writer = new BinaryWriter()) { + if (message.orderId !== "") { + writer.uint32(10).string(message.orderId); + } + if (message.accountNumber !== 0) { + writer.uint32(16).uint64(message.accountNumber); + } + if (message.remainingBaseQuantity !== "") { + writer.uint32(26).string(message.remainingBaseQuantity); + } + if (message.remainingSpendableBalance !== "") { + writer.uint32(34).string(message.remainingSpendableBalance); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderBookRecordData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orderId = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.accountNumber = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.remainingBaseQuantity = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.remainingSpendableBalance = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orderId: isSet(object.orderId) ? globalThis.String(object.orderId) : "", + accountNumber: isSet(object.accountNumber) + ? globalThis.Number(object.accountNumber) + : 0, + remainingBaseQuantity: isSet(object.remainingBaseQuantity) + ? globalThis.String(object.remainingBaseQuantity) + : "", + remainingSpendableBalance: isSet(object.remainingSpendableBalance) + ? globalThis.String(object.remainingSpendableBalance) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.orderId !== "") { + obj.orderId = message.orderId; + } + if (message.accountNumber !== 0) { + obj.accountNumber = Math.round(message.accountNumber); + } + if (message.remainingBaseQuantity !== "") { + obj.remainingBaseQuantity = message.remainingBaseQuantity; + } + if (message.remainingSpendableBalance !== "") { + obj.remainingSpendableBalance = message.remainingSpendableBalance; + } + return obj; + }, + create(base) { + return OrderBookRecordData.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseOrderBookRecordData(); + message.orderId = object.orderId ?? ""; + message.accountNumber = object.accountNumber ?? 0; + message.remainingBaseQuantity = object.remainingBaseQuantity ?? ""; + message.remainingSpendableBalance = object.remainingSpendableBalance ?? ""; + return message; + }, +}; +function toTimestamp(date) { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} +function fromTimestamp(t) { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof globalThis.Date) { + return o; + } + else if (typeof o === "string") { + return new globalThis.Date(o); + } + else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/params.d.ts b/dist/module/coreum/dex/v1/params.d.ts new file mode 100644 index 0000000..cc68cdf --- /dev/null +++ b/dist/module/coreum/dex/v1/params.d.ts @@ -0,0 +1,36 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "./cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin"; +export declare const protobufPackage = "coreum.dex.v1"; +/** Params keeps gov manageable parameters. */ +export interface Params { + /** default_unified_ref_amount is the default approximate amount you need to buy 1USD, used to for tokens without custom value */ + defaultUnifiedRefAmount: string; + /** price_tick_exponent is the exponent used in price tick calculation formula */ + priceTickExponent: number; + /** quantity_step_exponent is the exponent used in quantity step calculation formula */ + quantityStepExponent: number; + /** max_orders_per_denom is the maximum number of orders per denom the user can have */ + maxOrdersPerDenom: number; + /** order_reserve is the reserve required to save the order in the order book */ + orderReserve: Coin | undefined; +} +export declare const Params: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/params.js b/dist/module/coreum/dex/v1/params.js new file mode 100644 index 0000000..efbd2dd --- /dev/null +++ b/dist/module/coreum/dex/v1/params.js @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/params.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Coin } from "./cosmos/cosmos-sdk/proto/cosmos/base/v1beta1/coin"; +export const protobufPackage = "coreum.dex.v1"; +function createBaseParams() { + return { + defaultUnifiedRefAmount: "", + priceTickExponent: 0, + quantityStepExponent: 0, + maxOrdersPerDenom: 0, + orderReserve: undefined, + }; +} +export const Params = { + encode(message, writer = new BinaryWriter()) { + if (message.defaultUnifiedRefAmount !== "") { + writer.uint32(10).string(message.defaultUnifiedRefAmount); + } + if (message.priceTickExponent !== 0) { + writer.uint32(16).int32(message.priceTickExponent); + } + if (message.quantityStepExponent !== 0) { + writer.uint32(40).int32(message.quantityStepExponent); + } + if (message.maxOrdersPerDenom !== 0) { + writer.uint32(24).uint64(message.maxOrdersPerDenom); + } + if (message.orderReserve !== undefined) { + Coin.encode(message.orderReserve, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.defaultUnifiedRefAmount = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.priceTickExponent = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.quantityStepExponent = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.maxOrdersPerDenom = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.orderReserve = Coin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + defaultUnifiedRefAmount: isSet(object.defaultUnifiedRefAmount) + ? globalThis.String(object.defaultUnifiedRefAmount) + : "", + priceTickExponent: isSet(object.priceTickExponent) + ? globalThis.Number(object.priceTickExponent) + : 0, + quantityStepExponent: isSet(object.quantityStepExponent) + ? globalThis.Number(object.quantityStepExponent) + : 0, + maxOrdersPerDenom: isSet(object.maxOrdersPerDenom) + ? globalThis.Number(object.maxOrdersPerDenom) + : 0, + orderReserve: isSet(object.orderReserve) + ? Coin.fromJSON(object.orderReserve) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.defaultUnifiedRefAmount !== "") { + obj.defaultUnifiedRefAmount = message.defaultUnifiedRefAmount; + } + if (message.priceTickExponent !== 0) { + obj.priceTickExponent = Math.round(message.priceTickExponent); + } + if (message.quantityStepExponent !== 0) { + obj.quantityStepExponent = Math.round(message.quantityStepExponent); + } + if (message.maxOrdersPerDenom !== 0) { + obj.maxOrdersPerDenom = Math.round(message.maxOrdersPerDenom); + } + if (message.orderReserve !== undefined) { + obj.orderReserve = Coin.toJSON(message.orderReserve); + } + return obj; + }, + create(base) { + return Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.defaultUnifiedRefAmount = object.defaultUnifiedRefAmount ?? ""; + message.priceTickExponent = object.priceTickExponent ?? 0; + message.quantityStepExponent = object.quantityStepExponent ?? 0; + message.maxOrdersPerDenom = object.maxOrdersPerDenom ?? 0; + message.orderReserve = + object.orderReserve !== undefined && object.orderReserve !== null + ? Coin.fromPartial(object.orderReserve) + : undefined; + return message; + }, +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/query.d.ts b/dist/module/coreum/dex/v1/query.d.ts new file mode 100644 index 0000000..242479a --- /dev/null +++ b/dist/module/coreum/dex/v1/query.d.ts @@ -0,0 +1,156 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse } from "./cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination"; +import { Order, OrderBookData, Side } from "./order"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.dex.v1"; +/** QueryParamsRequest defines the request type for querying x/dex parameters. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse defines the response type for querying x/dex parameters. */ +export interface QueryParamsResponse { + params: Params | undefined; +} +/** QueryOrderRequest defines the request type for the `Order` query. */ +export interface QueryOrderRequest { + /** creator is order creator's account. */ + creator: string; + /** id is order ID. */ + id: string; +} +/** QueryOrderRequestResponse defines the response type for the `Order` query. */ +export interface QueryOrderResponse { + order: Order | undefined; +} +/** QueryOrdersRequest defines the request type for the `Orders` query. */ +export interface QueryOrdersRequest { + /** creator is order creator's account. */ + creator: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryOrdersRequestResponse defines the response type for the `Order` query. */ +export interface QueryOrdersResponse { + orders: Order[]; + pagination: PageResponse | undefined; +} +/** QueryOrderBooksRequest defines the request type for the `OrderBooks` query. */ +export interface QueryOrderBooksRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryOrderBooksResponse defines the response type for the `OrderBooks` query. */ +export interface QueryOrderBooksResponse { + orderBooks: OrderBookData[]; + pagination: PageResponse | undefined; +} +/** QueryOrderBookParamsRequest defines the request type for the `OrderBookParams` query. */ +export interface QueryOrderBookParamsRequest { + /** base_denom is base order book denom. */ + baseDenom: string; + /** quote_denom is quote order book denom */ + quoteDenom: string; +} +/** QueryOrderBookParamsResponse defines the response type for the `OrderBookParams` query. */ +export interface QueryOrderBookParamsResponse { + /** price_tick is the minimum price movement an asset price can make, either upward or downward. */ + priceTick: string; + /** quantity_step is the the smallest allowable step for the base asset inside a market. */ + quantityStep: string; + /** base_denom_unified_ref_amount is needed to define price tick & quantity step of base denom */ + baseDenomUnifiedRefAmount: string; + /** quote_denom_unified_ref_amount is needed to define price tick & quantity step of quote denom */ + quoteDenomUnifiedRefAmount: string; +} +/** QueryOrderBookOrdersRequest defines the request type for the `OrderBookOrders` query. */ +export interface QueryOrderBookOrdersRequest { + /** base_denom is base order denom. */ + baseDenom: string; + /** quote_denom is quote order denom */ + quoteDenom: string; + /** side is order side. */ + side: Side; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryOrderBookOrdersResponse defines the response type for the `OrderBookOrders` query. */ +export interface QueryOrderBookOrdersResponse { + orders: Order[]; + pagination: PageResponse | undefined; +} +/** QueryAccountDenomOrdersCountRequest defines the request type for the `AccountDenomOrdersCount` query. */ +export interface QueryAccountDenomOrdersCountRequest { + account: string; + denom: string; +} +/** QueryAccountDenomOrdersCountResponse defines the response type for the `AccountDenomOrdersCount` query. */ +export interface QueryAccountDenomOrdersCountResponse { + count: number; +} +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +export declare const QueryOrderRequest: MessageFns; +export declare const QueryOrderResponse: MessageFns; +export declare const QueryOrdersRequest: MessageFns; +export declare const QueryOrdersResponse: MessageFns; +export declare const QueryOrderBooksRequest: MessageFns; +export declare const QueryOrderBooksResponse: MessageFns; +export declare const QueryOrderBookParamsRequest: MessageFns; +export declare const QueryOrderBookParamsResponse: MessageFns; +export declare const QueryOrderBookOrdersRequest: MessageFns; +export declare const QueryOrderBookOrdersResponse: MessageFns; +export declare const QueryAccountDenomOrdersCountRequest: MessageFns; +export declare const QueryAccountDenomOrdersCountResponse: MessageFns; +/** Query defines the gRPC query service. */ +export interface Query { + /** Params queries the parameters of x/dex module. */ + Params(request: QueryParamsRequest): Promise; + /** Order queries order by creator and ID. */ + Order(request: QueryOrderRequest): Promise; + /** Orders queries creator orders. */ + Orders(request: QueryOrdersRequest): Promise; + /** OrderBooks queries order books. */ + OrderBooks(request: QueryOrderBooksRequest): Promise; + /** OrderBookParams queries order book params. */ + OrderBookParams(request: QueryOrderBookParamsRequest): Promise; + /** OrderBookOrders queries order book orders. */ + OrderBookOrders(request: QueryOrderBookOrdersRequest): Promise; + /** AccountDenomOrdersCount queries account denom orders count. */ + AccountDenomOrdersCount(request: QueryAccountDenomOrdersCountRequest): Promise; +} +export declare const QueryServiceName = "coreum.dex.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Params(request: QueryParamsRequest): Promise; + Order(request: QueryOrderRequest): Promise; + Orders(request: QueryOrdersRequest): Promise; + OrderBooks(request: QueryOrderBooksRequest): Promise; + OrderBookParams(request: QueryOrderBookParamsRequest): Promise; + OrderBookOrders(request: QueryOrderBookOrdersRequest): Promise; + AccountDenomOrdersCount(request: QueryAccountDenomOrdersCountRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/query.js b/dist/module/coreum/dex/v1/query.js new file mode 100644 index 0000000..54924ec --- /dev/null +++ b/dist/module/coreum/dex/v1/query.js @@ -0,0 +1,1062 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/query.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { PageRequest, PageResponse, } from "./cosmos/cosmos-sdk/proto/cosmos/base/query/v1beta1/pagination"; +import { Order, OrderBookData, sideFromJSON, sideToJSON } from "./order"; +import { Params } from "./params"; +export const protobufPackage = "coreum.dex.v1"; +function createBaseQueryParamsRequest() { + return {}; +} +export const QueryParamsRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +export const QueryParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseQueryOrderRequest() { + return { creator: "", id: "" }; +} +export const QueryOrderRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return QueryOrderRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderRequest(); + message.creator = object.creator ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseQueryOrderResponse() { + return { order: undefined }; +} +export const QueryOrderResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.order !== undefined) { + Order.encode(message.order, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.order = Order.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + order: isSet(object.order) ? Order.fromJSON(object.order) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.order !== undefined) { + obj.order = Order.toJSON(message.order); + } + return obj; + }, + create(base) { + return QueryOrderResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderResponse(); + message.order = + object.order !== undefined && object.order !== null + ? Order.fromPartial(object.order) + : undefined; + return message; + }, +}; +function createBaseQueryOrdersRequest() { + return { creator: "", pagination: undefined }; +} +export const QueryOrdersRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrdersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creator = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryOrdersRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrdersRequest(); + message.creator = object.creator ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrdersResponse() { + return { orders: [], pagination: undefined }; +} +export const QueryOrdersResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.orders) { + Order.encode(v, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrdersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orders.push(Order.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orders: globalThis.Array.isArray(object?.orders) + ? object.orders.map((e) => Order.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.orders?.length) { + obj.orders = message.orders.map((e) => Order.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryOrdersResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrdersResponse(); + message.orders = object.orders?.map((e) => Order.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrderBooksRequest() { + return { pagination: undefined }; +} +export const QueryOrderBooksRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBooksRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryOrderBooksRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBooksRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrderBooksResponse() { + return { orderBooks: [], pagination: undefined }; +} +export const QueryOrderBooksResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.orderBooks) { + OrderBookData.encode(v, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBooksResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orderBooks.push(OrderBookData.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orderBooks: globalThis.Array.isArray(object?.orderBooks) + ? object.orderBooks.map((e) => OrderBookData.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.orderBooks?.length) { + obj.orderBooks = message.orderBooks.map((e) => OrderBookData.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryOrderBooksResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBooksResponse(); + message.orderBooks = + object.orderBooks?.map((e) => OrderBookData.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrderBookParamsRequest() { + return { baseDenom: "", quoteDenom: "" }; +} +export const QueryOrderBookParamsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.baseDenom !== "") { + writer.uint32(10).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(18).string(message.quoteDenom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBookParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseDenom: isSet(object.baseDenom) + ? globalThis.String(object.baseDenom) + : "", + quoteDenom: isSet(object.quoteDenom) + ? globalThis.String(object.quoteDenom) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + return obj; + }, + create(base) { + return QueryOrderBookParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBookParamsRequest(); + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + return message; + }, +}; +function createBaseQueryOrderBookParamsResponse() { + return { + priceTick: "", + quantityStep: "", + baseDenomUnifiedRefAmount: "", + quoteDenomUnifiedRefAmount: "", + }; +} +export const QueryOrderBookParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.priceTick !== "") { + writer.uint32(10).string(message.priceTick); + } + if (message.quantityStep !== "") { + writer.uint32(18).string(message.quantityStep); + } + if (message.baseDenomUnifiedRefAmount !== "") { + writer.uint32(26).string(message.baseDenomUnifiedRefAmount); + } + if (message.quoteDenomUnifiedRefAmount !== "") { + writer.uint32(34).string(message.quoteDenomUnifiedRefAmount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBookParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.priceTick = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.quantityStep = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.baseDenomUnifiedRefAmount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.quoteDenomUnifiedRefAmount = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + priceTick: isSet(object.priceTick) + ? globalThis.String(object.priceTick) + : "", + quantityStep: isSet(object.quantityStep) + ? globalThis.String(object.quantityStep) + : "", + baseDenomUnifiedRefAmount: isSet(object.baseDenomUnifiedRefAmount) + ? globalThis.String(object.baseDenomUnifiedRefAmount) + : "", + quoteDenomUnifiedRefAmount: isSet(object.quoteDenomUnifiedRefAmount) + ? globalThis.String(object.quoteDenomUnifiedRefAmount) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.priceTick !== "") { + obj.priceTick = message.priceTick; + } + if (message.quantityStep !== "") { + obj.quantityStep = message.quantityStep; + } + if (message.baseDenomUnifiedRefAmount !== "") { + obj.baseDenomUnifiedRefAmount = message.baseDenomUnifiedRefAmount; + } + if (message.quoteDenomUnifiedRefAmount !== "") { + obj.quoteDenomUnifiedRefAmount = message.quoteDenomUnifiedRefAmount; + } + return obj; + }, + create(base) { + return QueryOrderBookParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBookParamsResponse(); + message.priceTick = object.priceTick ?? ""; + message.quantityStep = object.quantityStep ?? ""; + message.baseDenomUnifiedRefAmount = + object.baseDenomUnifiedRefAmount ?? ""; + message.quoteDenomUnifiedRefAmount = + object.quoteDenomUnifiedRefAmount ?? ""; + return message; + }, +}; +function createBaseQueryOrderBookOrdersRequest() { + return { baseDenom: "", quoteDenom: "", side: 0, pagination: undefined }; +} +export const QueryOrderBookOrdersRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.baseDenom !== "") { + writer.uint32(10).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(18).string(message.quoteDenom); + } + if (message.side !== 0) { + writer.uint32(24).int32(message.side); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBookOrdersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.side = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + baseDenom: isSet(object.baseDenom) + ? globalThis.String(object.baseDenom) + : "", + quoteDenom: isSet(object.quoteDenom) + ? globalThis.String(object.quoteDenom) + : "", + side: isSet(object.side) ? sideFromJSON(object.side) : 0, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + if (message.side !== 0) { + obj.side = sideToJSON(message.side); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryOrderBookOrdersRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBookOrdersRequest(); + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + message.side = object.side ?? 0; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryOrderBookOrdersResponse() { + return { orders: [], pagination: undefined }; +} +export const QueryOrderBookOrdersResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.orders) { + Order.encode(v, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOrderBookOrdersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.orders.push(Order.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + orders: globalThis.Array.isArray(object?.orders) + ? object.orders.map((e) => Order.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.orders?.length) { + obj.orders = message.orders.map((e) => Order.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryOrderBookOrdersResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOrderBookOrdersResponse(); + message.orders = object.orders?.map((e) => Order.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAccountDenomOrdersCountRequest() { + return { account: "", denom: "" }; +} +export const QueryAccountDenomOrdersCountRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountDenomOrdersCountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.account = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return QueryAccountDenomOrdersCountRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryAccountDenomOrdersCountRequest(); + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseQueryAccountDenomOrdersCountResponse() { + return { count: 0 }; +} +export const QueryAccountDenomOrdersCountResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.count !== 0) { + writer.uint32(8).uint64(message.count); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountDenomOrdersCountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + create(base) { + return QueryAccountDenomOrdersCountResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryAccountDenomOrdersCountResponse(); + message.count = object.count ?? 0; + return message; + }, +}; +export const QueryServiceName = "coreum.dex.v1.Query"; +export class QueryClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Params = this.Params.bind(this); + this.Order = this.Order.bind(this); + this.Orders = this.Orders.bind(this); + this.OrderBooks = this.OrderBooks.bind(this); + this.OrderBookParams = this.OrderBookParams.bind(this); + this.OrderBookOrders = this.OrderBookOrders.bind(this); + this.AccountDenomOrdersCount = this.AccountDenomOrdersCount.bind(this); + } + Params(request) { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data))); + } + Order(request) { + const data = QueryOrderRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Order", data); + return promise.then((data) => QueryOrderResponse.decode(new BinaryReader(data))); + } + Orders(request) { + const data = QueryOrdersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Orders", data); + return promise.then((data) => QueryOrdersResponse.decode(new BinaryReader(data))); + } + OrderBooks(request) { + const data = QueryOrderBooksRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "OrderBooks", data); + return promise.then((data) => QueryOrderBooksResponse.decode(new BinaryReader(data))); + } + OrderBookParams(request) { + const data = QueryOrderBookParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "OrderBookParams", data); + return promise.then((data) => QueryOrderBookParamsResponse.decode(new BinaryReader(data))); + } + OrderBookOrders(request) { + const data = QueryOrderBookOrdersRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "OrderBookOrders", data); + return promise.then((data) => QueryOrderBookOrdersResponse.decode(new BinaryReader(data))); + } + AccountDenomOrdersCount(request) { + const data = QueryAccountDenomOrdersCountRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AccountDenomOrdersCount", data); + return promise.then((data) => QueryAccountDenomOrdersCountResponse.decode(new BinaryReader(data))); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/dex/v1/tx.d.ts b/dist/module/coreum/dex/v1/tx.d.ts new file mode 100644 index 0000000..68ef3eb --- /dev/null +++ b/dist/module/coreum/dex/v1/tx.d.ts @@ -0,0 +1,102 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { GoodTil, OrderType, Side, TimeInForce } from "./order"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.dex.v1"; +export interface MsgUpdateParams { + authority: string; + params: Params | undefined; +} +/** MsgPlaceOrder defines message to place an order on orderbook. */ +export interface MsgPlaceOrder { + /** sender is order creator address. */ + sender: string; + /** type is order type. */ + type: OrderType; + /** id is unique order ID. */ + id: string; + /** base_denom is base order denom. */ + baseDenom: string; + /** quote_denom is quote order denom */ + quoteDenom: string; + /** price is value of one unit of the base_denom expressed in terms of the quote_denom. */ + price: string; + /** quantity is amount of the base base_denom being traded. */ + quantity: string; + /** side is order side. */ + side: Side; + /** good_til is order good til */ + goodTil: GoodTil | undefined; + /** time_in_force is order time in force */ + timeInForce: TimeInForce; +} +/** MsgCancelOrder defines message to cancel the order in the orderbook. */ +export interface MsgCancelOrder { + /** sender is order creator address. */ + sender: string; + /** id is unique order ID. */ + id: string; +} +/** MsgCancelOrdersByDenom defines message to cancel all orders by denom and account. */ +export interface MsgCancelOrdersByDenom { + /** sender is order creator address. */ + sender: string; + /** account is order creator address. */ + account: string; + /** denom is orders denom. */ + denom: string; +} +export interface EmptyResponse { +} +export declare const MsgUpdateParams: MessageFns; +export declare const MsgPlaceOrder: MessageFns; +export declare const MsgCancelOrder: MessageFns; +export declare const MsgCancelOrdersByDenom: MessageFns; +export declare const EmptyResponse: MessageFns; +/** Msg defines the Msg service. */ +export interface Msg { + /** + * UpdateParams is a governance operation to modify the parameters of the module. + * NOTE: all parameters must be provided. + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** PlaceOrder place an order on orderbook. */ + PlaceOrder(request: MsgPlaceOrder): Promise; + /** CancelOrder cancels an order in the orderbook. */ + CancelOrder(request: MsgCancelOrder): Promise; + /** CancelOrdersByDenom cancels all orders by denom and account. */ + CancelOrdersByDenom(request: MsgCancelOrdersByDenom): Promise; +} +export declare const MsgServiceName = "coreum.dex.v1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + UpdateParams(request: MsgUpdateParams): Promise; + PlaceOrder(request: MsgPlaceOrder): Promise; + CancelOrder(request: MsgCancelOrder): Promise; + CancelOrdersByDenom(request: MsgCancelOrdersByDenom): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/dex/v1/tx.js b/dist/module/coreum/dex/v1/tx.js new file mode 100644 index 0000000..5e37733 --- /dev/null +++ b/dist/module/coreum/dex/v1/tx.js @@ -0,0 +1,505 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v6.32.0 +// source: coreum-protos/dex/tx.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { GoodTil, orderTypeFromJSON, orderTypeToJSON, sideFromJSON, sideToJSON, timeInForceFromJSON, timeInForceToJSON, } from "./order"; +import { Params } from "./params"; +export const protobufPackage = "coreum.dex.v1"; +function createBaseMsgUpdateParams() { + return { authority: "", params: undefined }; +} +export const MsgUpdateParams = { + encode(message, writer = new BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) ? globalThis.String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return MsgUpdateParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseMsgPlaceOrder() { + return { + sender: "", + type: 0, + id: "", + baseDenom: "", + quoteDenom: "", + price: "", + quantity: "", + side: 0, + goodTil: undefined, + timeInForce: 0, + }; +} +export const MsgPlaceOrder = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.id !== "") { + writer.uint32(26).string(message.id); + } + if (message.baseDenom !== "") { + writer.uint32(34).string(message.baseDenom); + } + if (message.quoteDenom !== "") { + writer.uint32(42).string(message.quoteDenom); + } + if (message.price !== "") { + writer.uint32(50).string(message.price); + } + if (message.quantity !== "") { + writer.uint32(58).string(message.quantity); + } + if (message.side !== 0) { + writer.uint32(64).int32(message.side); + } + if (message.goodTil !== undefined) { + GoodTil.encode(message.goodTil, writer.uint32(74).fork()).join(); + } + if (message.timeInForce !== 0) { + writer.uint32(80).int32(message.timeInForce); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPlaceOrder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.id = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.baseDenom = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.quoteDenom = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.price = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.quantity = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.side = reader.int32(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.goodTil = GoodTil.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.timeInForce = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + type: isSet(object.type) ? orderTypeFromJSON(object.type) : 0, + id: isSet(object.id) ? globalThis.String(object.id) : "", + baseDenom: isSet(object.baseDenom) ? globalThis.String(object.baseDenom) : "", + quoteDenom: isSet(object.quoteDenom) ? globalThis.String(object.quoteDenom) : "", + price: isSet(object.price) ? globalThis.String(object.price) : "", + quantity: isSet(object.quantity) ? globalThis.String(object.quantity) : "", + side: isSet(object.side) ? sideFromJSON(object.side) : 0, + goodTil: isSet(object.goodTil) ? GoodTil.fromJSON(object.goodTil) : undefined, + timeInForce: isSet(object.timeInForce) ? timeInForceFromJSON(object.timeInForce) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.type !== 0) { + obj.type = orderTypeToJSON(message.type); + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.baseDenom !== "") { + obj.baseDenom = message.baseDenom; + } + if (message.quoteDenom !== "") { + obj.quoteDenom = message.quoteDenom; + } + if (message.price !== "") { + obj.price = message.price; + } + if (message.quantity !== "") { + obj.quantity = message.quantity; + } + if (message.side !== 0) { + obj.side = sideToJSON(message.side); + } + if (message.goodTil !== undefined) { + obj.goodTil = GoodTil.toJSON(message.goodTil); + } + if (message.timeInForce !== 0) { + obj.timeInForce = timeInForceToJSON(message.timeInForce); + } + return obj; + }, + create(base) { + return MsgPlaceOrder.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgPlaceOrder(); + message.sender = object.sender ?? ""; + message.type = object.type ?? 0; + message.id = object.id ?? ""; + message.baseDenom = object.baseDenom ?? ""; + message.quoteDenom = object.quoteDenom ?? ""; + message.price = object.price ?? ""; + message.quantity = object.quantity ?? ""; + message.side = object.side ?? 0; + message.goodTil = (object.goodTil !== undefined && object.goodTil !== null) + ? GoodTil.fromPartial(object.goodTil) + : undefined; + message.timeInForce = object.timeInForce ?? 0; + return message; + }, +}; +function createBaseMsgCancelOrder() { + return { sender: "", id: "" }; +} +export const MsgCancelOrder = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelOrder(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return MsgCancelOrder.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgCancelOrder(); + message.sender = object.sender ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseMsgCancelOrdersByDenom() { + return { sender: "", account: "", denom: "" }; +} +export const MsgCancelOrdersByDenom = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.account !== "") { + writer.uint32(18).string(message.account); + } + if (message.denom !== "") { + writer.uint32(26).string(message.denom); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelOrdersByDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.account = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.denom = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + account: isSet(object.account) ? globalThis.String(object.account) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.account !== "") { + obj.account = message.account; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + create(base) { + return MsgCancelOrdersByDenom.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgCancelOrdersByDenom(); + message.sender = object.sender ?? ""; + message.account = object.account ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; +function createBaseEmptyResponse() { + return {}; +} +export const EmptyResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmptyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return EmptyResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseEmptyResponse(); + return message; + }, +}; +export const MsgServiceName = "coreum.dex.v1.Msg"; +export class MsgClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.UpdateParams = this.UpdateParams.bind(this); + this.PlaceOrder = this.PlaceOrder.bind(this); + this.CancelOrder = this.CancelOrder.bind(this); + this.CancelOrdersByDenom = this.CancelOrdersByDenom.bind(this); + } + UpdateParams(request) { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + PlaceOrder(request) { + const data = MsgPlaceOrder.encode(request).finish(); + const promise = this.rpc.request(this.service, "PlaceOrder", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + CancelOrder(request) { + const data = MsgCancelOrder.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelOrder", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } + CancelOrdersByDenom(request) { + const data = MsgCancelOrdersByDenom.encode(request).finish(); + const promise = this.rpc.request(this.service, "CancelOrdersByDenom", data); + return promise.then((data) => EmptyResponse.decode(new BinaryReader(data))); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/extensions/dex.d.ts b/dist/module/coreum/extensions/dex.d.ts new file mode 100644 index 0000000..9390e23 --- /dev/null +++ b/dist/module/coreum/extensions/dex.d.ts @@ -0,0 +1,13 @@ +import { QueryParamsResponse, QueryOrderRequest, QueryAccountDenomOrdersCountRequest, QueryAccountDenomOrdersCountResponse, QueryOrderBookOrdersRequest, QueryOrderBookOrdersResponse, QueryOrderBooksRequest, QueryOrderBooksResponse, QueryOrderResponse, QueryOrdersRequest, QueryOrdersResponse, QueryParamsRequest, QueryOrderBookParamsRequest, QueryOrderBookParamsResponse } from "../dex/v1/query"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupDexExtension(base: QueryClient): { + dex: { + params: (params: QueryParamsRequest) => Promise; + order: (params: QueryOrderRequest) => Promise; + orders: (params: QueryOrdersRequest) => Promise; + ordersCountByDenomAndAccount: (params: QueryAccountDenomOrdersCountRequest) => Promise; + orderbook: (params: QueryOrderBookOrdersRequest) => Promise; + orderbooks: (params: QueryOrderBooksRequest) => Promise; + orderbookParams: (params: QueryOrderBookParamsRequest) => Promise; + }; +}; diff --git a/dist/module/coreum/extensions/dex.js b/dist/module/coreum/extensions/dex.js new file mode 100644 index 0000000..1eb7b91 --- /dev/null +++ b/dist/module/coreum/extensions/dex.js @@ -0,0 +1,31 @@ +import { QueryClientImpl, } from "../dex/v1/query"; +import { createProtobufRpcClient } from "@cosmjs/stargate"; +export function setupDexExtension(base) { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + dex: { + params: async (params) => { + return await queryService.Params(params); + }, + order: async (params) => { + return await queryService.Order(params); + }, + orders: async (params) => { + return await queryService.Orders(params); + }, + ordersCountByDenomAndAccount: async (params) => { + return await queryService.AccountDenomOrdersCount(params); + }, + orderbook: async (params) => { + return await queryService.OrderBookOrders(params); + }, + orderbooks: async (params) => { + return await queryService.OrderBooks(params); + }, + orderbookParams: async (params) => { + return await queryService.OrderBookParams(params); + }, + }, + }; +} diff --git a/dist/module/coreum/extensions/ft.d.ts b/dist/module/coreum/extensions/ft.d.ts new file mode 100644 index 0000000..169ec09 --- /dev/null +++ b/dist/module/coreum/extensions/ft.d.ts @@ -0,0 +1,14 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryParamsResponse, QueryFrozenBalanceResponse, QueryFrozenBalancesResponse, QueryTokenResponse, QueryTokensResponse, QueryWhitelistedBalanceResponse, QueryWhitelistedBalancesResponse } from "../asset/ft/v1/query"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupFTExtension(base: QueryClient): { + ft: { + params: () => Promise; + tokens: (issuer: string, pagination?: PageRequest) => Promise; + token: (denom: string) => Promise; + frozenBalances: (account: string, pagination?: PageRequest) => Promise; + frozenBalance: (account: string, denom: string) => Promise; + whitelistedBalances: (account: string, pagination?: PageRequest) => Promise; + whitelistedBalance: (account: string, denom: string) => Promise; + }; +}; diff --git a/dist/module/coreum/extensions/ft.js b/dist/module/coreum/extensions/ft.js new file mode 100644 index 0000000..09823c6 --- /dev/null +++ b/dist/module/coreum/extensions/ft.js @@ -0,0 +1,31 @@ +import { QueryClientImpl, } from "../asset/ft/v1/query"; +import { createProtobufRpcClient } from "@cosmjs/stargate"; +export function setupFTExtension(base) { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + ft: { + params: async () => { + return await queryService.Params({}); + }, + tokens: async (issuer, pagination) => { + return await queryService.Tokens({ issuer, pagination }); + }, + token: async (denom) => { + return await queryService.Token({ denom }); + }, + frozenBalances: async (account, pagination) => { + return await queryService.FrozenBalances({ account, pagination }); + }, + frozenBalance: async (account, denom) => { + return await queryService.FrozenBalance({ account, denom }); + }, + whitelistedBalances: async (account, pagination) => { + return await queryService.WhitelistedBalances({ account, pagination }); + }, + whitelistedBalance: async (account, denom) => { + return await queryService.WhitelistedBalance({ account, denom }); + }, + }, + }; +} diff --git a/dist/module/coreum/extensions/nft.d.ts b/dist/module/coreum/extensions/nft.d.ts new file mode 100644 index 0000000..b22ea56 --- /dev/null +++ b/dist/module/coreum/extensions/nft.d.ts @@ -0,0 +1,12 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryClassResponse, QueryFrozenResponse, QueryWhitelistedAccountsForNFTResponse, QueryWhitelistedResponse, QueryParamsResponse } from "../asset/nft/v1/query"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupNFTExtension(base: QueryClient): { + nft: { + params: () => Promise; + class: (class_id: string) => Promise; + frozen: (nft_id: string, class_id: string) => Promise; + whitelisted: (nft_id: string, class_id: string, account: string) => Promise; + whitelistedAccountsForNFT: (nft_id: string, class_id: string, pagination?: PageRequest) => Promise; + }; +}; diff --git a/dist/module/coreum/extensions/nft.js b/dist/module/coreum/extensions/nft.js new file mode 100644 index 0000000..744aec6 --- /dev/null +++ b/dist/module/coreum/extensions/nft.js @@ -0,0 +1,33 @@ +import { QueryClientImpl, } from "../asset/nft/v1/query"; +import { createProtobufRpcClient } from "@cosmjs/stargate"; +export function setupNFTExtension(base) { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + nft: { + params: async () => { + return await queryService.Params({}); + }, + class: async (class_id) => { + return await queryService.Class({ id: class_id }); + }, + frozen: async (nft_id, class_id) => { + return await queryService.Frozen({ id: nft_id, classId: class_id }); + }, + whitelisted: async (nft_id, class_id, account) => { + return await queryService.Whitelisted({ + id: nft_id, + classId: class_id, + account, + }); + }, + whitelistedAccountsForNFT: async (nft_id, class_id, pagination) => { + return await queryService.WhitelistedAccountsForNFT({ + id: nft_id, + classId: class_id, + pagination, + }); + }, + }, + }; +} diff --git a/dist/module/coreum/extensions/nftbeta.d.ts b/dist/module/coreum/extensions/nftbeta.d.ts new file mode 100644 index 0000000..20668a8 --- /dev/null +++ b/dist/module/coreum/extensions/nftbeta.d.ts @@ -0,0 +1,14 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryBalanceResponse, QueryClassResponse, QueryClassesResponse, QueryNFTResponse, QueryNFTsResponse, QueryOwnerResponse, QuerySupplyResponse } from "../nft/v1beta1/query"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupNFTBetaExtension(base: QueryClient): { + nftbeta: { + balance: (class_id: string, owner: string) => Promise; + owner: (class_id: string, nft_id: string) => Promise; + supply: (class_id: string) => Promise; + nfts: (class_id: string, owner: string, pagination?: PageRequest) => Promise; + nft: (nft_id: string, class_id: string) => Promise; + class: (class_id: string) => Promise; + classes: (pagination?: PageRequest) => Promise; + }; +}; diff --git a/dist/module/coreum/extensions/nftbeta.js b/dist/module/coreum/extensions/nftbeta.js new file mode 100644 index 0000000..4ee9c50 --- /dev/null +++ b/dist/module/coreum/extensions/nftbeta.js @@ -0,0 +1,38 @@ +import { QueryClientImpl, } from "../nft/v1beta1/query"; +import { createProtobufRpcClient } from "@cosmjs/stargate"; +export function setupNFTBetaExtension(base) { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + nftbeta: { + balance: async (class_id, owner) => { + return await queryService.Balance({ classId: class_id, owner }); + }, + owner: async (class_id, nft_id) => { + return await queryService.Owner({ + classId: class_id, + id: nft_id, + }); + }, + supply: async (class_id) => { + return await queryService.Supply({ classId: class_id }); + }, + nfts: async (class_id, owner, pagination) => { + return await queryService.NFTs({ + classId: class_id, + owner, + pagination, + }); + }, + nft: async (nft_id, class_id) => { + return await queryService.NFT({ classId: class_id, id: nft_id }); + }, + class: async (class_id) => { + return await queryService.Class({ classId: class_id }); + }, + classes: async (pagination) => { + return await queryService.Classes({ pagination }); + }, + }, + }; +} diff --git a/dist/module/coreum/feemodel/v1/genesis.d.ts b/dist/module/coreum/feemodel/v1/genesis.d.ts new file mode 100644 index 0000000..8ebe638 --- /dev/null +++ b/dist/module/coreum/feemodel/v1/genesis.d.ts @@ -0,0 +1,31 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DecCoin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.feemodel.v1"; +/** GenesisState defines the module's genesis state. */ +export interface GenesisState { + /** params defines all the parameters of the module. */ + params: Params | undefined; + /** min_gas_price is the current minimum gas price required by the chain. */ + minGasPrice: DecCoin | undefined; +} +export declare const GenesisState: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/feemodel/v1/genesis.js b/dist/module/coreum/feemodel/v1/genesis.js new file mode 100644 index 0000000..f50bf1d --- /dev/null +++ b/dist/module/coreum/feemodel/v1/genesis.js @@ -0,0 +1,89 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/feemodel/genesis.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DecCoin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +export const protobufPackage = "coreum.feemodel.v1"; +function createBaseGenesisState() { + return { params: undefined, minGasPrice: undefined }; +} +export const GenesisState = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.minGasPrice !== undefined) { + DecCoin.encode(message.minGasPrice, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.minGasPrice = DecCoin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + minGasPrice: isSet(object.minGasPrice) + ? DecCoin.fromJSON(object.minGasPrice) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.minGasPrice !== undefined) { + obj.minGasPrice = DecCoin.toJSON(message.minGasPrice); + } + return obj; + }, + create(base) { + return GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.minGasPrice = + object.minGasPrice !== undefined && object.minGasPrice !== null + ? DecCoin.fromPartial(object.minGasPrice) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/feemodel/v1/params.d.ts b/dist/module/coreum/feemodel/v1/params.d.ts new file mode 100644 index 0000000..42fa5b2 --- /dev/null +++ b/dist/module/coreum/feemodel/v1/params.d.ts @@ -0,0 +1,61 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "coreum.feemodel.v1"; +/** + * ModelParams define fee model params. + * There are four regions on the fee model curve + * - between 0 and "long average block gas" where gas price goes down exponentially from InitialGasPrice to gas price with maximum discount (InitialGasPrice * (1 - MaxDiscount)) + * - between "long average block gas" and EscalationStartBlockGas (EscalationStartBlockGas = MaxBlockGas * EscalationStartFraction) where we offer gas price with maximum discount all the time + * - between EscalationStartBlockGas (EscalationStartBlockGas = MaxBlockGas * EscalationStartFraction) and MaxBlockGas where price goes up rapidly (being an output of a power function) from gas price with maximum discount to MaxGasPrice (MaxGasPrice = InitialGasPrice * MaxGasMultiplier) + * - above MaxBlockGas (if it happens for any reason) where price is equal to MaxGasPrice (MaxGasPrice = InitialGasPrice * MaxGasMultiplier) + * + * The input (x value) for that function is calculated by taking short block gas average. + * Price (y value) being an output of the fee model is used as the minimum gas price for next block. + */ +export interface ModelParams { + /** initial_gas_price is used when block gas short average is 0. It happens when there are no transactions being broadcasted. This value is also used to initialize gas price on brand-new chain. */ + initialGasPrice: string; + /** max_gas_price_multiplier is used to compute max_gas_price (max_gas_price = initial_gas_price * max_gas_price_multiplier). Max gas price is charged when block gas short average is greater than or equal to MaxBlockGas. This value is used to limit gas price escalation to avoid having possible infinity GasPrice value otherwise. */ + maxGasPriceMultiplier: string; + /** max_discount is th maximum discount we offer on top of initial gas price if short average block gas is between long average block gas and escalation start block gas. */ + maxDiscount: string; + /** escalation_start_fraction defines fraction of max block gas usage where gas price escalation starts if short average block gas is higher than this value. */ + escalationStartFraction: string; + /** max_block_gas sets the maximum capacity of block. This is enforced on tendermint level in genesis configuration. Once short average block gas goes above this value, gas price is a flat line equal to MaxGasPrice. */ + maxBlockGas: number; + /** + * short_ema_block_length defines inertia for short average long gas in EMA model. The equation is: NewAverage = ((ShortAverageBlockLength - 1)*PreviousAverage + GasUsedByCurrentBlock) / ShortAverageBlockLength + * The value might be interpreted as the number of blocks which are taken to calculate the average. It would be exactly like that in SMA model, in EMA this is an approximation. + */ + shortEmaBlockLength: number; + /** + * long_ema_block_length defines inertia for long average block gas in EMA model. The equation is: NewAverage = ((LongAverageBlockLength - 1)*PreviousAverage + GasUsedByCurrentBlock) / LongAverageBlockLength + * The value might be interpreted as the number of blocks which are taken to calculate the average. It would be exactly like that in SMA model, in EMA this is an approximation. + */ + longEmaBlockLength: number; +} +/** Params store gov manageable feemodel parameters. */ +export interface Params { + /** model is a fee model params. */ + model: ModelParams | undefined; +} +export declare const ModelParams: MessageFns; +export declare const Params: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/feemodel/v1/params.js b/dist/module/coreum/feemodel/v1/params.js new file mode 100644 index 0000000..c25eaf3 --- /dev/null +++ b/dist/module/coreum/feemodel/v1/params.js @@ -0,0 +1,244 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/feemodel/params.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export const protobufPackage = "coreum.feemodel.v1"; +function createBaseModelParams() { + return { + initialGasPrice: "", + maxGasPriceMultiplier: "", + maxDiscount: "", + escalationStartFraction: "", + maxBlockGas: 0, + shortEmaBlockLength: 0, + longEmaBlockLength: 0, + }; +} +export const ModelParams = { + encode(message, writer = new BinaryWriter()) { + if (message.initialGasPrice !== "") { + writer.uint32(10).string(message.initialGasPrice); + } + if (message.maxGasPriceMultiplier !== "") { + writer.uint32(18).string(message.maxGasPriceMultiplier); + } + if (message.maxDiscount !== "") { + writer.uint32(26).string(message.maxDiscount); + } + if (message.escalationStartFraction !== "") { + writer.uint32(34).string(message.escalationStartFraction); + } + if (message.maxBlockGas !== 0) { + writer.uint32(40).int64(message.maxBlockGas); + } + if (message.shortEmaBlockLength !== 0) { + writer.uint32(48).uint32(message.shortEmaBlockLength); + } + if (message.longEmaBlockLength !== 0) { + writer.uint32(56).uint32(message.longEmaBlockLength); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModelParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.initialGasPrice = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.maxGasPriceMultiplier = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.maxDiscount = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.escalationStartFraction = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.maxBlockGas = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.shortEmaBlockLength = reader.uint32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + message.longEmaBlockLength = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + initialGasPrice: isSet(object.initialGasPrice) + ? globalThis.String(object.initialGasPrice) + : "", + maxGasPriceMultiplier: isSet(object.maxGasPriceMultiplier) + ? globalThis.String(object.maxGasPriceMultiplier) + : "", + maxDiscount: isSet(object.maxDiscount) + ? globalThis.String(object.maxDiscount) + : "", + escalationStartFraction: isSet(object.escalationStartFraction) + ? globalThis.String(object.escalationStartFraction) + : "", + maxBlockGas: isSet(object.maxBlockGas) + ? globalThis.Number(object.maxBlockGas) + : 0, + shortEmaBlockLength: isSet(object.shortEmaBlockLength) + ? globalThis.Number(object.shortEmaBlockLength) + : 0, + longEmaBlockLength: isSet(object.longEmaBlockLength) + ? globalThis.Number(object.longEmaBlockLength) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.initialGasPrice !== "") { + obj.initialGasPrice = message.initialGasPrice; + } + if (message.maxGasPriceMultiplier !== "") { + obj.maxGasPriceMultiplier = message.maxGasPriceMultiplier; + } + if (message.maxDiscount !== "") { + obj.maxDiscount = message.maxDiscount; + } + if (message.escalationStartFraction !== "") { + obj.escalationStartFraction = message.escalationStartFraction; + } + if (message.maxBlockGas !== 0) { + obj.maxBlockGas = Math.round(message.maxBlockGas); + } + if (message.shortEmaBlockLength !== 0) { + obj.shortEmaBlockLength = Math.round(message.shortEmaBlockLength); + } + if (message.longEmaBlockLength !== 0) { + obj.longEmaBlockLength = Math.round(message.longEmaBlockLength); + } + return obj; + }, + create(base) { + return ModelParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseModelParams(); + message.initialGasPrice = object.initialGasPrice ?? ""; + message.maxGasPriceMultiplier = object.maxGasPriceMultiplier ?? ""; + message.maxDiscount = object.maxDiscount ?? ""; + message.escalationStartFraction = object.escalationStartFraction ?? ""; + message.maxBlockGas = object.maxBlockGas ?? 0; + message.shortEmaBlockLength = object.shortEmaBlockLength ?? 0; + message.longEmaBlockLength = object.longEmaBlockLength ?? 0; + return message; + }, +}; +function createBaseParams() { + return { model: undefined }; +} +export const Params = { + encode(message, writer = new BinaryWriter()) { + if (message.model !== undefined) { + ModelParams.encode(message.model, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.model = ModelParams.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + model: isSet(object.model) + ? ModelParams.fromJSON(object.model) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.model !== undefined) { + obj.model = ModelParams.toJSON(message.model); + } + return obj; + }, + create(base) { + return Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.model = + object.model !== undefined && object.model !== null + ? ModelParams.fromPartial(object.model) + : undefined; + return message; + }, +}; +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/feemodel/v1/query.d.ts b/dist/module/coreum/feemodel/v1/query.d.ts new file mode 100644 index 0000000..a64a55a --- /dev/null +++ b/dist/module/coreum/feemodel/v1/query.d.ts @@ -0,0 +1,75 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DecCoin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +export declare const protobufPackage = "coreum.feemodel.v1"; +/** QueryMinGasPriceRequest is the request type for the Query/MinGasPrice RPC method. */ +export interface QueryMinGasPriceRequest { +} +/** QueryMinGasPriceResponse is the response type for the Query/MinGasPrice RPC method. */ +export interface QueryMinGasPriceResponse { + /** min_gas_price is the current minimum gas price required by the network. */ + minGasPrice: DecCoin | undefined; +} +export interface QueryRecommendedGasPriceRequest { + afterBlocks: number; +} +export interface QueryRecommendedGasPriceResponse { + low: DecCoin | undefined; + med: DecCoin | undefined; + high: DecCoin | undefined; +} +/** QueryParamsRequest defines the request type for querying x/feemodel parameters. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse defines the response type for querying x/feemodel parameters. */ +export interface QueryParamsResponse { + params: Params | undefined; +} +export declare const QueryMinGasPriceRequest: MessageFns; +export declare const QueryMinGasPriceResponse: MessageFns; +export declare const QueryRecommendedGasPriceRequest: MessageFns; +export declare const QueryRecommendedGasPriceResponse: MessageFns; +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** MinGasPrice queries the current minimum gas price required by the network. */ + MinGasPrice(request: QueryMinGasPriceRequest): Promise; + /** RecommendedGasPrice queries the recommended gas price for the next n blocks. */ + RecommendedGasPrice(request: QueryRecommendedGasPriceRequest): Promise; + /** Params queries the parameters of x/feemodel module. */ + Params(request: QueryParamsRequest): Promise; +} +export declare const QueryServiceName = "coreum.feemodel.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + MinGasPrice(request: QueryMinGasPriceRequest): Promise; + RecommendedGasPrice(request: QueryRecommendedGasPriceRequest): Promise; + Params(request: QueryParamsRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/feemodel/v1/query.js b/dist/module/coreum/feemodel/v1/query.js new file mode 100644 index 0000000..fa58c76 --- /dev/null +++ b/dist/module/coreum/feemodel/v1/query.js @@ -0,0 +1,375 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: coreum-protos/feemodel/query.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { DecCoin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Params } from "./params"; +export const protobufPackage = "coreum.feemodel.v1"; +function createBaseQueryMinGasPriceRequest() { + return {}; +} +export const QueryMinGasPriceRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMinGasPriceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return QueryMinGasPriceRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryMinGasPriceRequest(); + return message; + }, +}; +function createBaseQueryMinGasPriceResponse() { + return { minGasPrice: undefined }; +} +export const QueryMinGasPriceResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.minGasPrice !== undefined) { + DecCoin.encode(message.minGasPrice, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMinGasPriceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.minGasPrice = DecCoin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + minGasPrice: isSet(object.minGasPrice) + ? DecCoin.fromJSON(object.minGasPrice) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.minGasPrice !== undefined) { + obj.minGasPrice = DecCoin.toJSON(message.minGasPrice); + } + return obj; + }, + create(base) { + return QueryMinGasPriceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryMinGasPriceResponse(); + message.minGasPrice = + object.minGasPrice !== undefined && object.minGasPrice !== null + ? DecCoin.fromPartial(object.minGasPrice) + : undefined; + return message; + }, +}; +function createBaseQueryRecommendedGasPriceRequest() { + return { afterBlocks: 0 }; +} +export const QueryRecommendedGasPriceRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.afterBlocks !== 0) { + writer.uint32(8).uint32(message.afterBlocks); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecommendedGasPriceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.afterBlocks = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + afterBlocks: isSet(object.afterBlocks) + ? globalThis.Number(object.afterBlocks) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.afterBlocks !== 0) { + obj.afterBlocks = Math.round(message.afterBlocks); + } + return obj; + }, + create(base) { + return QueryRecommendedGasPriceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryRecommendedGasPriceRequest(); + message.afterBlocks = object.afterBlocks ?? 0; + return message; + }, +}; +function createBaseQueryRecommendedGasPriceResponse() { + return { low: undefined, med: undefined, high: undefined }; +} +export const QueryRecommendedGasPriceResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.low !== undefined) { + DecCoin.encode(message.low, writer.uint32(10).fork()).ldelim(); + } + if (message.med !== undefined) { + DecCoin.encode(message.med, writer.uint32(18).fork()).ldelim(); + } + if (message.high !== undefined) { + DecCoin.encode(message.high, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRecommendedGasPriceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.low = DecCoin.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.med = DecCoin.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.high = DecCoin.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + low: isSet(object.low) ? DecCoin.fromJSON(object.low) : undefined, + med: isSet(object.med) ? DecCoin.fromJSON(object.med) : undefined, + high: isSet(object.high) ? DecCoin.fromJSON(object.high) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.low !== undefined) { + obj.low = DecCoin.toJSON(message.low); + } + if (message.med !== undefined) { + obj.med = DecCoin.toJSON(message.med); + } + if (message.high !== undefined) { + obj.high = DecCoin.toJSON(message.high); + } + return obj; + }, + create(base) { + return QueryRecommendedGasPriceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryRecommendedGasPriceResponse(); + message.low = + object.low !== undefined && object.low !== null + ? DecCoin.fromPartial(object.low) + : undefined; + message.med = + object.med !== undefined && object.med !== null + ? DecCoin.fromPartial(object.med) + : undefined; + message.high = + object.high !== undefined && object.high !== null + ? DecCoin.fromPartial(object.high) + : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return {}; +} +export const QueryParamsRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +export const QueryParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +export const QueryServiceName = "coreum.feemodel.v1.Query"; +export class QueryClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.MinGasPrice = this.MinGasPrice.bind(this); + this.RecommendedGasPrice = this.RecommendedGasPrice.bind(this); + this.Params = this.Params.bind(this); + } + MinGasPrice(request) { + const data = QueryMinGasPriceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "MinGasPrice", data); + return promise.then((data) => QueryMinGasPriceResponse.decode(new BinaryReader(data))); + } + RecommendedGasPrice(request) { + const data = QueryRecommendedGasPriceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "RecommendedGasPrice", data); + return promise.then((data) => QueryRecommendedGasPriceResponse.decode(new BinaryReader(data))); + } + Params(request) { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data))); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/index.d.ts b/dist/module/coreum/index.d.ts new file mode 100644 index 0000000..1eeab15 --- /dev/null +++ b/dist/module/coreum/index.d.ts @@ -0,0 +1,263 @@ +import { GeneratedType } from "@cosmjs/proto-signing"; +import { MsgSend as NFTMsgSend } from "./nft/v1beta1/tx"; +import { MsgIssueClass as NFTMsgIssueClass, MsgMint as NFTMsgMint, MsgAddToWhitelist as NFTMsgAddToWhitelist, MsgBurn as NFTMsgBurn, MsgRemoveFromWhitelist as NFTMsgRemoveFromWhitelist, MsgFreeze as NFTMsgFreeze, MsgUnfreeze as NFTMsgUnfreeze } from "./asset/nft/v1/tx"; +import { MsgIssue as FTMsgIssue, MsgMint as FTMsgMint, MsgBurn as FTMsgBurn, MsgFreeze as FTMsgFreeze, MsgUnfreeze as FTMsgUnfreeze, MsgGloballyFreeze as FTMsgGloballyFreeze, MsgGloballyUnfreeze as FTMsgGloballyUnfreeze, MsgSetWhitelistedLimit as FTMsgSetWhitelistedLimit, MsgClawback as FTMsgClawback, MsgUpdateDEXUnifiedRefAmount, MsgUpdateDEXWhitelistedDenoms } from "./asset/ft/v1/tx"; +import { MsgUpdateParams as DEXMsgUpdateParams, MsgPlaceOrder as DEXMsgPlaceOrder, MsgCancelOrder as DEXMsgCancelOrder, MsgCancelOrdersByDenom as DEXMsgCancelOrdersByDenom } from "./dex/v1/tx"; +import { FTMsgs, NFTMsgs } from "../types/msgs"; +export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./amino"; +export { Feature } from "./asset/ft/v1/token"; +export { ClassFeature } from "./asset/nft/v1/nft"; +/** @internal */ +export interface CoreumMessage { + typeUrl: string; + value: any; +} +/** + * Registry of the Custom Messages of the Coreum blockchain + */ +export declare const coreumRegistry: ReadonlyArray<[string, GeneratedType]>; +/** + * Transaction Module for the Fungible Tokens module. (assetft) + */ +export declare namespace FT { + /** MsgMint message creator + * Mints new fungible tokens. + * + * @param object Represents the properties available for this MsgMint message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Mint: (object: FTMsgs.MsgMint) => { + typeUrl: string; + value: FTMsgMint; + }; + /** MsgIssue message creator + * Defines a method to issue a new fungible token. + * + * @param object Represents the properties available for this MsgIssue message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Issue: (object: FTMsgs.MsgIssue) => { + typeUrl: string; + value: FTMsgIssue; + }; + /** MsgBurn message creator + * Burns the specified fungible tokens from senders balance if the sender has enough balance. + * + * @param object Represents the properties available for this MsgBurn message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Burn: (object: FTMsgs.MsgBurn) => { + typeUrl: string; + value: FTMsgBurn; + }; + /** MsgFreeze message creator + * Freezes a part of the fungible tokens in an account, only if the freezable feature is enabled on that token. + * + * @param object Represents the properties available for this MsgIssue message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Freeze: (object: FTMsgs.MsgFreeze) => { + typeUrl: string; + value: FTMsgFreeze; + }; + /** MsgGloballyFreeze message creator + * Freezes fungible token so no operations are allowed with it before unfrozen. This operation is idempotent so global freeze of already frozen token does nothing. + * + * @param object Represents the properties available for this MsgGloballyFreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const GloballyFreeze: (object: FTMsgs.MsgGloballyFreeze) => { + typeUrl: string; + value: FTMsgGloballyFreeze; + }; + /** MsgGloballyUnfreeze message creator + * Unfreezes fungible token and unblocks basic operations on it. This operation is idempotent so global unfreezing of non-frozen token does nothing. + * + * @param object Represents the properties available for this MsgGloballyUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const GloballyUnfreeze: (object: FTMsgs.MsgGloballyUnfreeze) => { + typeUrl: string; + value: FTMsgGloballyUnfreeze; + }; + /** MsgUnfreeze message creator + * Unfreezes a part of the frozen fungible tokens in an account, only if there are such frozen tokens on that account. + * + * @param object Represents the properties available for this MsgUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Unfreeze: (object: FTMsgs.MsgUnfreeze) => { + typeUrl: string; + value: FTMsgUnfreeze; + }; + /** MsgSetWhitelistedLimit message creator + * Sets the limit of how many tokens a specific account may hold. + * + * @param object Represents the properties available for this MsgSetWhitelistedLimit message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SetWhitelistedLimit: (object: FTMsgs.MsgSetWhitelistedLimit) => { + typeUrl: string; + value: FTMsgSetWhitelistedLimit; + }; + /** MsgClawback message creator + * Clawbacks the assets from the specific address. + * + * @param object Represents the properties available for this MsgClawback message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Clawback: (object: FTMsgs.MsgClawback) => { + typeUrl: string; + value: FTMsgClawback; + }; + /** MsgUpdateDEXUnifiedRefAmount + * Updates DEX unified ref amount. + * + * @param object Represents the properties available for this MsgUpdateDEXUnifiedRefAmount message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateDEXUnifiedRefAmount: (object: MsgUpdateDEXUnifiedRefAmount) => { + typeUrl: string; + value: MsgUpdateDEXUnifiedRefAmount; + }; + /** MsgUpdateDEXWhitelistedDenoms + * Updates DEX unified ref amount. + * + * @param object Represents the properties available for this MsgUpdateDEXWhitelistedDenoms message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateDEXWhitelistedDenoms: (object: MsgUpdateDEXWhitelistedDenoms) => { + typeUrl: string; + value: MsgUpdateDEXWhitelistedDenoms; + }; +} +/** + * Transaction Module for the Non-Fungible Tokens modules (assetnft, nftbeta). + */ +export declare namespace NFT { + /** MsgMint message creator + * Mints new non-fungible token in the class. + * + * @param object Represents the properties available for this MsgMint message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Mint: (object: NFTMsgs.MsgMint) => { + typeUrl: string; + value: NFTMsgMint; + }; + /** MsgAddToWhitelist message creator + * Sets the account as whitelisted to hold the NFT + * + * @param object Represents the properties available for this MsgAddToWhitelist message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const AddToWhitelist: (object: NFTMsgs.MsgAddToWhitelist) => { + typeUrl: string; + value: NFTMsgAddToWhitelist; + }; + /** MsgRemoveFromWhitelist message creator + * Removes an account from whitelisted list of the NFT + * + * @param object Represents the properties available for this MsgRemoveFromWhitelist message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const RemoveFromWhitelist: (object: NFTMsgs.MsgRemoveFromWhitelist) => { + typeUrl: string; + value: NFTMsgRemoveFromWhitelist; + }; + /** MsgBurn message creator + * Burns the existing non-fungible token in the class. + * + * @param object Represents the properties available for this MsgBurn message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Burn: (object: NFTMsgs.MsgBurn) => { + typeUrl: string; + value: NFTMsgBurn; + }; + /** MsgFreeze message creator + * Freezes an NFT + * + * @param object Represents the properties available for this MsgFreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Freeze: (object: NFTMsgs.MsgFreeze) => { + typeUrl: string; + value: NFTMsgFreeze; + }; + /** MsgUnfreeze message creator + * Removes the freeze effect already put on an NFT + * + * @param object Represents the properties available for this MsgUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Unfreeze: (object: NFTMsgs.MsgUnfreeze) => { + typeUrl: string; + value: NFTMsgUnfreeze; + }; + /** MsgIssueClass message creator + * Creates new non-fungible token class. + * + * @param object Represents the properties available for this MsgIssueClass message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const IssueClass: (object: NFTMsgIssueClass) => { + typeUrl: string; + value: NFTMsgIssueClass; + }; + /** MsgSend message creator + * Represents a message to send a nft from one account to another account. + * + * @param object Represents the properties available for this MsgSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Send: (object: NFTMsgs.MsgSend) => { + typeUrl: string; + value: NFTMsgSend; + }; +} +/** + * Transaction Module for the DEX module + */ +export declare namespace DEX { + /** MsgPlaceOrder message creator + * Places a new order on the native DEX + * + * @param object Represents the properties available for this MsgPlaceOrder message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const PlaceOrder: (object: DEXMsgPlaceOrder) => { + typeUrl: string; + value: DEXMsgPlaceOrder; + }; + /** MsgCancelOrder message creator + * Cancels an order by ID + * + * @param object Represents the properties available for this MsgCancelOrder message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CancelOrder: (object: DEXMsgCancelOrder) => { + typeUrl: string; + value: DEXMsgCancelOrder; + }; + /** MsgUpdateParams message creator + * Updates module parameters + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: DEXMsgUpdateParams) => { + typeUrl: string; + value: DEXMsgUpdateParams; + }; + /** MsgCancelOrdersByDenom message creator + * Cancels all existing orders by denom + * + * @param object Represents the properties available for this MsgCancelOrdersByDenom message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CancelOrdersByDenom: (object: DEXMsgCancelOrdersByDenom) => { + typeUrl: string; + value: DEXMsgCancelOrdersByDenom; + }; +} diff --git a/dist/module/coreum/index.js b/dist/module/coreum/index.js new file mode 100644 index 0000000..740a514 --- /dev/null +++ b/dist/module/coreum/index.js @@ -0,0 +1,314 @@ +import { assetNftRegistry, assetFtRegistry } from "./asset"; +import { nftBetaRegistry } from "./nft"; +import { dexRegistry } from "./dex"; +import { MsgSend as NFTMsgSend } from "./nft/v1beta1/tx"; +import { MsgIssueClass as NFTMsgIssueClass, MsgMint as NFTMsgMint, MsgAddToWhitelist as NFTMsgAddToWhitelist, MsgBurn as NFTMsgBurn, MsgRemoveFromWhitelist as NFTMsgRemoveFromWhitelist, MsgFreeze as NFTMsgFreeze, MsgUnfreeze as NFTMsgUnfreeze, } from "./asset/nft/v1/tx"; +import { MsgIssue as FTMsgIssue, MsgMint as FTMsgMint, MsgBurn as FTMsgBurn, MsgFreeze as FTMsgFreeze, MsgUnfreeze as FTMsgUnfreeze, MsgGloballyFreeze as FTMsgGloballyFreeze, MsgGloballyUnfreeze as FTMsgGloballyUnfreeze, MsgSetWhitelistedLimit as FTMsgSetWhitelistedLimit, MsgClawback as FTMsgClawback, MsgUpdateDEXUnifiedRefAmount, MsgUpdateDEXWhitelistedDenoms, } from "./asset/ft/v1/tx"; +import { MsgUpdateParams as DEXMsgUpdateParams, MsgPlaceOrder as DEXMsgPlaceOrder, MsgCancelOrder as DEXMsgCancelOrder, MsgCancelOrdersByDenom as DEXMsgCancelOrdersByDenom, } from "./dex/v1/tx"; +// Export AminoTypes +export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./amino"; +export { Feature } from "./asset/ft/v1/token"; +export { ClassFeature } from "./asset/nft/v1/nft"; +/** + * Registry of the Custom Messages of the Coreum blockchain + */ +export const coreumRegistry = [ + ...assetFtRegistry, + ...assetNftRegistry, + ...nftBetaRegistry, + ...dexRegistry, +]; +/** + * Transaction Module for the Fungible Tokens module. (assetft) + */ +export var FT; +(function (FT) { + /** MsgMint message creator + * Mints new fungible tokens. + * + * @param object Represents the properties available for this MsgMint message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Mint = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgMint", + value: FTMsgMint.fromPartial(object), + }; + }; + /** MsgIssue message creator + * Defines a method to issue a new fungible token. + * + * @param object Represents the properties available for this MsgIssue message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Issue = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgIssue", + value: FTMsgIssue.fromPartial(object), + }; + }; + /** MsgBurn message creator + * Burns the specified fungible tokens from senders balance if the sender has enough balance. + * + * @param object Represents the properties available for this MsgBurn message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Burn = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgBurn", + value: FTMsgBurn.fromPartial(object), + }; + }; + /** MsgFreeze message creator + * Freezes a part of the fungible tokens in an account, only if the freezable feature is enabled on that token. + * + * @param object Represents the properties available for this MsgIssue message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Freeze = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgFreeze", + value: FTMsgFreeze.fromPartial(object), + }; + }; + /** MsgGloballyFreeze message creator + * Freezes fungible token so no operations are allowed with it before unfrozen. This operation is idempotent so global freeze of already frozen token does nothing. + * + * @param object Represents the properties available for this MsgGloballyFreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.GloballyFreeze = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgGloballyFreeze", + value: FTMsgGloballyFreeze.fromPartial(object), + }; + }; + /** MsgGloballyUnfreeze message creator + * Unfreezes fungible token and unblocks basic operations on it. This operation is idempotent so global unfreezing of non-frozen token does nothing. + * + * @param object Represents the properties available for this MsgGloballyUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.GloballyUnfreeze = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgGloballyUnfreeze", + value: FTMsgGloballyUnfreeze.fromPartial(object), + }; + }; + /** MsgUnfreeze message creator + * Unfreezes a part of the frozen fungible tokens in an account, only if there are such frozen tokens on that account. + * + * @param object Represents the properties available for this MsgUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Unfreeze = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgUnfreeze", + value: FTMsgUnfreeze.fromPartial(object), + }; + }; + /** MsgSetWhitelistedLimit message creator + * Sets the limit of how many tokens a specific account may hold. + * + * @param object Represents the properties available for this MsgSetWhitelistedLimit message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.SetWhitelistedLimit = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgSetWhitelistedLimit", + value: FTMsgSetWhitelistedLimit.fromPartial(object), + }; + }; + /** MsgClawback message creator + * Clawbacks the assets from the specific address. + * + * @param object Represents the properties available for this MsgClawback message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.Clawback = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgClawback", + value: FTMsgClawback.fromPartial(object), + }; + }; + /** MsgUpdateDEXUnifiedRefAmount + * Updates DEX unified ref amount. + * + * @param object Represents the properties available for this MsgUpdateDEXUnifiedRefAmount message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.UpdateDEXUnifiedRefAmount = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgUpdateDEXUnifiedRefAmount", + value: MsgUpdateDEXUnifiedRefAmount.fromPartial(object), + }; + }; + /** MsgUpdateDEXWhitelistedDenoms + * Updates DEX unified ref amount. + * + * @param object Represents the properties available for this MsgUpdateDEXWhitelistedDenoms message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + FT.UpdateDEXWhitelistedDenoms = function (object) { + return { + typeUrl: "/coreum.asset.ft.v1.MsgUpdateDEXWhitelistedDenoms", + value: MsgUpdateDEXWhitelistedDenoms.fromPartial(object), + }; + }; +})(FT || (FT = {})); +/** + * Transaction Module for the Non-Fungible Tokens modules (assetnft, nftbeta). + */ +export var NFT; +(function (NFT) { + /** MsgMint message creator + * Mints new non-fungible token in the class. + * + * @param object Represents the properties available for this MsgMint message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Mint = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgMint", + value: NFTMsgMint.fromPartial(object), + }; + }; + /** MsgAddToWhitelist message creator + * Sets the account as whitelisted to hold the NFT + * + * @param object Represents the properties available for this MsgAddToWhitelist message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.AddToWhitelist = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgAddToWhitelist", + value: NFTMsgAddToWhitelist.fromPartial(object), + }; + }; + /** MsgRemoveFromWhitelist message creator + * Removes an account from whitelisted list of the NFT + * + * @param object Represents the properties available for this MsgRemoveFromWhitelist message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.RemoveFromWhitelist = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgRemoveFromWhitelist", + value: NFTMsgRemoveFromWhitelist.fromPartial(object), + }; + }; + /** MsgBurn message creator + * Burns the existing non-fungible token in the class. + * + * @param object Represents the properties available for this MsgBurn message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Burn = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgBurn", + value: NFTMsgBurn.fromPartial(object), + }; + }; + /** MsgFreeze message creator + * Freezes an NFT + * + * @param object Represents the properties available for this MsgFreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Freeze = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgFreeze", + value: NFTMsgFreeze.fromPartial(object), + }; + }; + /** MsgUnfreeze message creator + * Removes the freeze effect already put on an NFT + * + * @param object Represents the properties available for this MsgUnfreeze message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Unfreeze = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgUnfreeze", + value: NFTMsgUnfreeze.fromPartial(object), + }; + }; + /** MsgIssueClass message creator + * Creates new non-fungible token class. + * + * @param object Represents the properties available for this MsgIssueClass message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.IssueClass = function (object) { + return { + typeUrl: "/coreum.asset.nft.v1.MsgIssueClass", + value: NFTMsgIssueClass.fromPartial(object), + }; + }; + /** MsgSend message creator + * Represents a message to send a nft from one account to another account. + * + * @param object Represents the properties available for this MsgSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + NFT.Send = function (object) { + return { + typeUrl: "/cosmos.nft.v1beta1.MsgSend", + value: NFTMsgSend.fromPartial(object), + }; + }; +})(NFT || (NFT = {})); +/** + * Transaction Module for the DEX module + */ +export var DEX; +(function (DEX) { + /** MsgPlaceOrder message creator + * Places a new order on the native DEX + * + * @param object Represents the properties available for this MsgPlaceOrder message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + DEX.PlaceOrder = function (object) { + return { + typeUrl: "/coreum.dex.v1.MsgPlaceOrder", + value: DEXMsgPlaceOrder.fromPartial(object), + }; + }; + /** MsgCancelOrder message creator + * Cancels an order by ID + * + * @param object Represents the properties available for this MsgCancelOrder message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + DEX.CancelOrder = function (object) { + return { + typeUrl: "/coreum.dex.v1.MsgCancelOrder", + value: DEXMsgCancelOrder.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * Updates module parameters + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + DEX.UpdateParams = function (object) { + return { + typeUrl: "/coreum.dex.v1.MsgUpdateParams", + value: DEXMsgUpdateParams.fromPartial(object), + }; + }; + /** MsgCancelOrdersByDenom message creator + * Cancels all existing orders by denom + * + * @param object Represents the properties available for this MsgCancelOrdersByDenom message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + DEX.CancelOrdersByDenom = function (object) { + return { + typeUrl: "/coreum.dex.v1.MsgCancelOrdersByDenom", + value: DEXMsgCancelOrdersByDenom.fromPartial(object), + }; + }; +})(DEX || (DEX = {})); diff --git a/dist/module/coreum/nft/index.d.ts b/dist/module/coreum/nft/index.d.ts new file mode 100644 index 0000000..1a9585f --- /dev/null +++ b/dist/module/coreum/nft/index.d.ts @@ -0,0 +1 @@ +export declare const nftBetaRegistry: ReadonlyArray<[string, any]>; diff --git a/dist/module/coreum/nft/index.js b/dist/module/coreum/nft/index.js new file mode 100644 index 0000000..173279c --- /dev/null +++ b/dist/module/coreum/nft/index.js @@ -0,0 +1,5 @@ +import { CoreumTypeUrl } from "../../types"; +import { MsgSend } from "./v1beta1/tx"; +export const nftBetaRegistry = [ + [CoreumTypeUrl.NFTBeta + "MsgSend", MsgSend], +]; diff --git a/dist/module/coreum/nft/v1beta1/event.d.ts b/dist/module/coreum/nft/v1beta1/event.d.ts new file mode 100644 index 0000000..7391ae7 --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/event.d.ts @@ -0,0 +1,53 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** EventSend is emitted on Msg/Send */ +export interface EventSend { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} +/** EventMint is emitted on Mint */ +export interface EventMint { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} +/** EventBurn is emitted on Burn */ +export interface EventBurn { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the nft */ + id: string; + /** owner is the owner address of the nft */ + owner: string; +} +export declare const EventSend: MessageFns; +export declare const EventMint: MessageFns; +export declare const EventBurn: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/nft/v1beta1/event.js b/dist/module/coreum/nft/v1beta1/event.js new file mode 100644 index 0000000..8906408 --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/event.js @@ -0,0 +1,277 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/event.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export const protobufPackage = "cosmos.nft.v1beta1"; +function createBaseEventSend() { + return { classId: "", id: "", sender: "", receiver: "" }; +} +export const EventSend = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.sender = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.receiver = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) + ? globalThis.String(object.receiver) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + create(base) { + return EventSend.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; +function createBaseEventMint() { + return { classId: "", id: "", owner: "" }; +} +export const EventMint = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return EventMint.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventMint(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseEventBurn() { + return { classId: "", id: "", owner: "" }; +} +export const EventBurn = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.owner !== "") { + writer.uint32(26).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return EventBurn.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventBurn(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/nft/v1beta1/genesis.d.ts b/dist/module/coreum/nft/v1beta1/genesis.d.ts new file mode 100644 index 0000000..0ff0a81 --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/genesis.d.ts @@ -0,0 +1,38 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Class, NFT } from "./nft"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** GenesisState defines the nft module's genesis state. */ +export interface GenesisState { + /** class defines the class of the nft type. */ + classes: Class[]; + /** entry defines all nft owned by a person. */ + entries: Entry[]; +} +/** Entry Defines all nft owned by a person */ +export interface Entry { + /** owner is the owner address of the following nft */ + owner: string; + /** nfts is a group of nfts of the same owner */ + nfts: NFT[]; +} +export declare const GenesisState: MessageFns; +export declare const Entry: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/nft/v1beta1/genesis.js b/dist/module/coreum/nft/v1beta1/genesis.js new file mode 100644 index 0000000..388e30f --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/genesis.js @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/genesis.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Class, NFT } from "./nft"; +export const protobufPackage = "cosmos.nft.v1beta1"; +function createBaseGenesisState() { + return { classes: [], entries: [] }; +} +export const GenesisState = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.classes) { + Class.encode(v, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.entries) { + Entry.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classes.push(Class.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.entries.push(Entry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classes: globalThis.Array.isArray(object?.classes) + ? object.classes.map((e) => Class.fromJSON(e)) + : [], + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e) => Entry.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.classes?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => Entry.toJSON(e)); + } + return obj; + }, + create(base) { + return GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.classes = object.classes?.map((e) => Class.fromPartial(e)) || []; + message.entries = object.entries?.map((e) => Entry.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEntry() { + return { owner: "", nfts: [] }; +} +export const Entry = { + encode(message, writer = new BinaryWriter()) { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + for (const v of message.nfts) { + NFT.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.owner = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + nfts: globalThis.Array.isArray(object?.nfts) + ? object.nfts.map((e) => NFT.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + return obj; + }, + create(base) { + return Entry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEntry(); + message.owner = object.owner ?? ""; + message.nfts = object.nfts?.map((e) => NFT.fromPartial(e)) || []; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/nft/v1beta1/nft.d.ts b/dist/module/coreum/nft/v1beta1/nft.d.ts new file mode 100644 index 0000000..d9f51d2 --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/nft.d.ts @@ -0,0 +1,54 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** Class defines the class of the nft type. */ +export interface Class { + /** id defines the unique identifier of the NFT classification, similar to the contract address of ERC721 */ + id: string; + /** name defines the human-readable name of the NFT classification. Optional */ + name: string; + /** symbol is an abbreviated name for nft classification. Optional */ + symbol: string; + /** description is a brief description of nft classification. Optional */ + description: string; + /** uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional */ + uri: string; + /** uri_hash is a hash of the document pointed by uri. Optional */ + uriHash: string; + /** data is the app specific metadata of the NFT class. Optional */ + data: Any | undefined; +} +/** NFT defines the NFT. */ +export interface NFT { + /** class_id associated with the NFT, similar to the contract address of ERC721 */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; + /** uri for the NFT metadata stored off chain */ + uri: string; + /** uri_hash is a hash of the document pointed by uri */ + uriHash: string; + /** data is an app specific data of the NFT. Optional */ + data: Any | undefined; +} +export declare const Class: MessageFns; +export declare const NFT: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/nft/v1beta1/nft.js b/dist/module/coreum/nft/v1beta1/nft.js new file mode 100644 index 0000000..49e3de3 --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/nft.js @@ -0,0 +1,284 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/nft.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export const protobufPackage = "cosmos.nft.v1beta1"; +function createBaseClass() { + return { + id: "", + name: "", + symbol: "", + description: "", + uri: "", + uriHash: "", + data: undefined, + }; +} +export const Class = { + encode(message, writer = new BinaryWriter()) { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(26).string(message.symbol); + } + if (message.description !== "") { + writer.uint32(34).string(message.description); + } + if (message.uri !== "") { + writer.uint32(42).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(50).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClass(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.symbol = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.description = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.uri = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.data = Any.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + create(base) { + return Class.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClass(); + message.id = object.id ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.description = object.description ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? Any.fromPartial(object.data) + : undefined; + return message; + }, +}; +function createBaseNFT() { + return { classId: "", id: "", uri: "", uriHash: "", data: undefined }; +} +export const NFT = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.uri !== "") { + writer.uint32(26).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(34).string(message.uriHash); + } + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(82).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNFT(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.uri = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.uriHash = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.data = Any.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + uri: isSet(object.uri) ? globalThis.String(object.uri) : "", + uriHash: isSet(object.uriHash) ? globalThis.String(object.uriHash) : "", + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.uri !== "") { + obj.uri = message.uri; + } + if (message.uriHash !== "") { + obj.uriHash = message.uriHash; + } + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + return obj; + }, + create(base) { + return NFT.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseNFT(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + message.data = + object.data !== undefined && object.data !== null + ? Any.fromPartial(object.data) + : undefined; + return message; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/nft/v1beta1/query.d.ts b/dist/module/coreum/nft/v1beta1/query.d.ts new file mode 100644 index 0000000..2b4f2d1 --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/query.d.ts @@ -0,0 +1,159 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Class, NFT } from "./nft"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** QueryBalanceRequest is the request type for the Query/Balance RPC method */ +export interface QueryBalanceRequest { + /** class_id associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; +} +/** QueryBalanceResponse is the response type for the Query/Balance RPC method */ +export interface QueryBalanceResponse { + /** amount is the number of all NFTs of a given class owned by the owner */ + amount: number; +} +/** QueryOwnerRequest is the request type for the Query/Owner RPC method */ +export interface QueryOwnerRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} +/** QueryOwnerResponse is the response type for the Query/Owner RPC method */ +export interface QueryOwnerResponse { + /** owner is the owner address of the nft */ + owner: string; +} +/** QuerySupplyRequest is the request type for the Query/Supply RPC method */ +export interface QuerySupplyRequest { + /** class_id associated with the nft */ + classId: string; +} +/** QuerySupplyResponse is the response type for the Query/Supply RPC method */ +export interface QuerySupplyResponse { + /** amount is the number of all NFTs from the given class */ + amount: number; +} +/** QueryNFTstRequest is the request type for the Query/NFTs RPC method */ +export interface QueryNFTsRequest { + /** class_id associated with the nft */ + classId: string; + /** owner is the owner address of the nft */ + owner: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryNFTsResponse is the response type for the Query/NFTs RPC methods */ +export interface QueryNFTsResponse { + /** NFT defines the NFT */ + nfts: NFT[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** QueryNFTRequest is the request type for the Query/NFT RPC method */ +export interface QueryNFTRequest { + /** class_id associated with the nft */ + classId: string; + /** id is a unique identifier of the NFT */ + id: string; +} +/** QueryNFTResponse is the response type for the Query/NFT RPC method */ +export interface QueryNFTResponse { + /** owner is the owner address of the nft */ + nft: NFT | undefined; +} +/** QueryClassRequest is the request type for the Query/Class RPC method */ +export interface QueryClassRequest { + /** class_id associated with the nft */ + classId: string; +} +/** QueryClassResponse is the response type for the Query/Class RPC method */ +export interface QueryClassResponse { + /** class defines the class of the nft type. */ + class: Class | undefined; +} +/** QueryClassesRequest is the request type for the Query/Classes RPC method */ +export interface QueryClassesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryClassesResponse is the response type for the Query/Classes RPC method */ +export interface QueryClassesResponse { + /** class defines the class of the nft type. */ + classes: Class[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +export declare const QueryBalanceRequest: MessageFns; +export declare const QueryBalanceResponse: MessageFns; +export declare const QueryOwnerRequest: MessageFns; +export declare const QueryOwnerResponse: MessageFns; +export declare const QuerySupplyRequest: MessageFns; +export declare const QuerySupplyResponse: MessageFns; +export declare const QueryNFTsRequest: MessageFns; +export declare const QueryNFTsResponse: MessageFns; +export declare const QueryNFTRequest: MessageFns; +export declare const QueryNFTResponse: MessageFns; +export declare const QueryClassRequest: MessageFns; +export declare const QueryClassResponse: MessageFns; +export declare const QueryClassesRequest: MessageFns; +export declare const QueryClassesResponse: MessageFns; +/** Query defines the gRPC querier service. */ +export interface Query { + /** Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 */ + Balance(request: QueryBalanceRequest): Promise; + /** Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 */ + Owner(request: QueryOwnerRequest): Promise; + /** Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. */ + Supply(request: QuerySupplyRequest): Promise; + /** + * NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in + * ERC721Enumerable + */ + NFTs(request: QueryNFTsRequest): Promise; + /** NFT queries an NFT based on its class and id. */ + NFT(request: QueryNFTRequest): Promise; + /** Class queries an NFT class based on its id */ + Class(request: QueryClassRequest): Promise; + /** Classes queries all NFT classes */ + Classes(request: QueryClassesRequest): Promise; +} +export declare const QueryServiceName = "cosmos.nft.v1beta1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Balance(request: QueryBalanceRequest): Promise; + Owner(request: QueryOwnerRequest): Promise; + Supply(request: QuerySupplyRequest): Promise; + NFTs(request: QueryNFTsRequest): Promise; + NFT(request: QueryNFTRequest): Promise; + Class(request: QueryClassRequest): Promise; + Classes(request: QueryClassesRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/nft/v1beta1/query.js b/dist/module/coreum/nft/v1beta1/query.js new file mode 100644 index 0000000..ebca325 --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/query.js @@ -0,0 +1,949 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/query.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse, } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { Class, NFT } from "./nft"; +export const protobufPackage = "cosmos.nft.v1beta1"; +function createBaseQueryBalanceRequest() { + return { classId: "", owner: "" }; +} +export const QueryBalanceRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return QueryBalanceRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBalanceRequest(); + message.classId = object.classId ?? ""; + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseQueryBalanceResponse() { + return { amount: 0 }; +} +export const QueryBalanceResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.amount = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + create(base) { + return QueryBalanceResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryBalanceResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; +function createBaseQueryOwnerRequest() { + return { classId: "", id: "" }; +} +export const QueryOwnerRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOwnerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return QueryOwnerRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOwnerRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseQueryOwnerResponse() { + return { owner: "" }; +} +export const QueryOwnerResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryOwnerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.owner = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.owner !== "") { + obj.owner = message.owner; + } + return obj; + }, + create(base) { + return QueryOwnerResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryOwnerResponse(); + message.owner = object.owner ?? ""; + return message; + }, +}; +function createBaseQuerySupplyRequest() { + return { classId: "" }; +} +export const QuerySupplyRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return QuerySupplyRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQuerySupplyRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQuerySupplyResponse() { + return { amount: 0 }; +} +export const QuerySupplyResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.amount !== 0) { + writer.uint32(8).uint64(message.amount); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.amount = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.amount !== 0) { + obj.amount = Math.round(message.amount); + } + return obj; + }, + create(base) { + return QuerySupplyResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQuerySupplyResponse(); + message.amount = object.amount ?? 0; + return message; + }, +}; +function createBaseQueryNFTsRequest() { + return { classId: "", owner: "", pagination: undefined }; +} +export const QueryNFTsRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.owner !== "") { + writer.uint32(18).string(message.owner); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.owner = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + owner: isSet(object.owner) ? globalThis.String(object.owner) : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.owner !== "") { + obj.owner = message.owner; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryNFTsRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryNFTsRequest(); + message.classId = object.classId ?? ""; + message.owner = object.owner ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryNFTsResponse() { + return { nfts: [], pagination: undefined }; +} +export const QueryNFTsResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.nfts) { + NFT.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.nfts.push(NFT.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nfts: globalThis.Array.isArray(object?.nfts) + ? object.nfts.map((e) => NFT.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.nfts?.length) { + obj.nfts = message.nfts.map((e) => NFT.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryNFTsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryNFTsResponse(); + message.nfts = object.nfts?.map((e) => NFT.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryNFTRequest() { + return { classId: "", id: "" }; +} +export const QueryNFTRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + create(base) { + return QueryNFTRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryNFTRequest(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; +function createBaseQueryNFTResponse() { + return { nft: undefined }; +} +export const QueryNFTResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.nft !== undefined) { + NFT.encode(message.nft, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNFTResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.nft = NFT.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { nft: isSet(object.nft) ? NFT.fromJSON(object.nft) : undefined }; + }, + toJSON(message) { + const obj = {}; + if (message.nft !== undefined) { + obj.nft = NFT.toJSON(message.nft); + } + return obj; + }, + create(base) { + return QueryNFTResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryNFTResponse(); + message.nft = + object.nft !== undefined && object.nft !== null + ? NFT.fromPartial(object.nft) + : undefined; + return message; + }, +}; +function createBaseQueryClassRequest() { + return { classId: "" }; +} +export const QueryClassRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + return obj; + }, + create(base) { + return QueryClassRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassRequest(); + message.classId = object.classId ?? ""; + return message; + }, +}; +function createBaseQueryClassResponse() { + return { class: undefined }; +} +export const QueryClassResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.class !== undefined) { + Class.encode(message.class, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.class = Class.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + class: isSet(object.class) ? Class.fromJSON(object.class) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.class !== undefined) { + obj.class = Class.toJSON(message.class); + } + return obj; + }, + create(base) { + return QueryClassResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassResponse(); + message.class = + object.class !== undefined && object.class !== null + ? Class.fromPartial(object.class) + : undefined; + return message; + }, +}; +function createBaseQueryClassesRequest() { + return { pagination: undefined }; +} +export const QueryClassesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryClassesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryClassesResponse() { + return { classes: [], pagination: undefined }; +} +export const QueryClassesResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.classes) { + Class.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryClassesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classes.push(Class.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classes: globalThis.Array.isArray(object?.classes) + ? object.classes.map((e) => Class.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.classes?.length) { + obj.classes = message.classes.map((e) => Class.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryClassesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryClassesResponse(); + message.classes = object.classes?.map((e) => Class.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +export const QueryServiceName = "cosmos.nft.v1beta1.Query"; +export class QueryClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.Balance = this.Balance.bind(this); + this.Owner = this.Owner.bind(this); + this.Supply = this.Supply.bind(this); + this.NFTs = this.NFTs.bind(this); + this.NFT = this.NFT.bind(this); + this.Class = this.Class.bind(this); + this.Classes = this.Classes.bind(this); + } + Balance(request) { + const data = QueryBalanceRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Balance", data); + return promise.then((data) => QueryBalanceResponse.decode(new BinaryReader(data))); + } + Owner(request) { + const data = QueryOwnerRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Owner", data); + return promise.then((data) => QueryOwnerResponse.decode(new BinaryReader(data))); + } + Supply(request) { + const data = QuerySupplyRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Supply", data); + return promise.then((data) => QuerySupplyResponse.decode(new BinaryReader(data))); + } + NFTs(request) { + const data = QueryNFTsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "NFTs", data); + return promise.then((data) => QueryNFTsResponse.decode(new BinaryReader(data))); + } + NFT(request) { + const data = QueryNFTRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "NFT", data); + return promise.then((data) => QueryNFTResponse.decode(new BinaryReader(data))); + } + Class(request) { + const data = QueryClassRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Class", data); + return promise.then((data) => QueryClassResponse.decode(new BinaryReader(data))); + } + Classes(request) { + const data = QueryClassesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Classes", data); + return promise.then((data) => QueryClassesResponse.decode(new BinaryReader(data))); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/coreum/nft/v1beta1/tx.d.ts b/dist/module/coreum/nft/v1beta1/tx.d.ts new file mode 100644 index 0000000..7610a63 --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/tx.d.ts @@ -0,0 +1,54 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "cosmos.nft.v1beta1"; +/** MsgSend represents a message to send a nft from one account to another account. */ +export interface MsgSend { + /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ + classId: string; + /** id defines the unique identification of nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; +} +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponse { +} +export declare const MsgSend: MessageFns; +export declare const MsgSendResponse: MessageFns; +/** Msg defines the nft Msg service. */ +export interface Msg { + /** Send defines a method to send a nft from one account to another account. */ + Send(request: MsgSend): Promise; +} +export declare const MsgServiceName = "cosmos.nft.v1beta1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Send(request: MsgSend): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/coreum/nft/v1beta1/tx.js b/dist/module/coreum/nft/v1beta1/tx.js new file mode 100644 index 0000000..f2cca3f --- /dev/null +++ b/dist/module/coreum/nft/v1beta1/tx.js @@ -0,0 +1,163 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: cosmos-sdk/proto/cosmos/nft/v1beta1/tx.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export const protobufPackage = "cosmos.nft.v1beta1"; +function createBaseMsgSend() { + return { classId: "", id: "", sender: "", receiver: "" }; +} +export const MsgSend = { + encode(message, writer = new BinaryWriter()) { + if (message.classId !== "") { + writer.uint32(10).string(message.classId); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(34).string(message.receiver); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.classId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.sender = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.receiver = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + classId: isSet(object.classId) ? globalThis.String(object.classId) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + receiver: isSet(object.receiver) + ? globalThis.String(object.receiver) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.classId !== "") { + obj.classId = message.classId; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.receiver !== "") { + obj.receiver = message.receiver; + } + return obj; + }, + create(base) { + return MsgSend.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSend(); + message.classId = object.classId ?? ""; + message.id = object.id ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + return message; + }, +}; +function createBaseMsgSendResponse() { + return {}; +} +export const MsgSendResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return MsgSendResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgSendResponse(); + return message; + }, +}; +export const MsgServiceName = "cosmos.nft.v1beta1.Msg"; +export class MsgClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.Send = this.Send.bind(this); + } + Send(request) { + const data = MsgSend.encode(request).finish(); + const promise = this.rpc.request(this.service, "Send", data); + return promise.then((data) => MsgSendResponse.decode(new BinaryReader(data))); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/cosmos/extensions/bank.d.ts b/dist/module/cosmos/extensions/bank.d.ts new file mode 100644 index 0000000..4d8556b --- /dev/null +++ b/dist/module/cosmos/extensions/bank.d.ts @@ -0,0 +1,15 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupBankExtension(base: QueryClient): { + bank: { + balance: (address: string, denom: string) => Promise; + allBalances: (address: string) => Promise; + totalSupply: (pagination?: PageRequest) => Promise<{ + supply: import("cosmjs-types/cosmos/base/v1beta1/coin").Coin[]; + pagination: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + supplyOf: (denom: string) => Promise; + denomMetadata: (denom: string) => Promise; + denomsMetadata: (pagination?: PageRequest) => Promise; + }; +}; diff --git a/dist/module/cosmos/extensions/bank.js b/dist/module/cosmos/extensions/bank.js new file mode 100644 index 0000000..38c6985 --- /dev/null +++ b/dist/module/cosmos/extensions/bank.js @@ -0,0 +1,38 @@ +import { QueryAllBalancesRequest } from "cosmjs-types/cosmos/bank/v1beta1/query"; +import { QueryClientImpl } from "cosmjs-types/cosmos/bank/v1beta1/query"; +import { createProtobufRpcClient } from "@cosmjs/stargate"; +export function setupBankExtension(base) { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + bank: { + balance: async (address, denom) => { + const { balance } = await queryService.Balance({ address, denom }); + return balance; + }, + allBalances: async (address) => { + const { balances } = await queryService.AllBalances(QueryAllBalancesRequest.fromPartial({ address })); + return balances; + }, + totalSupply: async (pagination) => { + const supplyResponse = await queryService.TotalSupply({ pagination }); + return { + supply: supplyResponse.supply, + pagination: supplyResponse.pagination, + }; + }, + supplyOf: async (denom) => { + const { amount } = await queryService.SupplyOf({ denom }); + return amount; + }, + denomMetadata: async (denom) => { + const { metadata } = await queryService.DenomMetadata({ denom }); + return metadata; + }, + denomsMetadata: async (pagination) => { + const { metadatas } = await queryService.DenomsMetadata({ pagination }); + return metadatas; + }, + }, + }; +} diff --git a/dist/module/cosmos/extensions/distribution.d.ts b/dist/module/cosmos/extensions/distribution.d.ts new file mode 100644 index 0000000..c8e1c14 --- /dev/null +++ b/dist/module/cosmos/extensions/distribution.d.ts @@ -0,0 +1,35 @@ +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupDistributionExtension(base: QueryClient): { + distribution: { + communityPool: () => Promise<{ + pool: import("cosmjs-types/cosmos/base/v1beta1/coin").DecCoin[]; + }>; + delegationRewards: (delegator: string, validator: string) => Promise<{ + rewards: import("cosmjs-types/cosmos/base/v1beta1/coin").DecCoin[]; + }>; + delegationTotalRewards: (delegator: string) => Promise<{ + rewards: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").DelegationDelegatorReward[]; + total: import("cosmjs-types/cosmos/base/v1beta1/coin").DecCoin[]; + }>; + delegatorValidators: (delegator: string) => Promise<{ + validators: string[]; + }>; + delegatorWithdrawAddress: (delegator: string) => Promise<{ + withdrawAddress: string; + }>; + params: () => Promise<{ + params: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").Params; + }>; + validatorCommission: (validator: string) => Promise<{ + commission: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").ValidatorAccumulatedCommission; + }>; + validatorOutstandingRewards: (validator: string) => Promise<{ + rewards: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").ValidatorOutstandingRewards; + }>; + validatorSlashes: (validator: string, starting_height: bigint, ending_height: bigint, pagination?: PageRequest) => Promise<{ + slashes: import("cosmjs-types/cosmos/distribution/v1beta1/distribution").ValidatorSlashEvent[]; + pagination?: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + }; +}; diff --git a/dist/module/cosmos/extensions/distribution.js b/dist/module/cosmos/extensions/distribution.js new file mode 100644 index 0000000..5a9d5bf --- /dev/null +++ b/dist/module/cosmos/extensions/distribution.js @@ -0,0 +1,64 @@ +import { QueryClientImpl } from "cosmjs-types/cosmos/distribution/v1beta1/query"; +import { createProtobufRpcClient } from "@cosmjs/stargate"; +export function setupDistributionExtension(base) { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + distribution: { + communityPool: async () => { + const response = await queryService.CommunityPool({}); + return { ...response }; + }, + delegationRewards: async (delegator, validator) => { + const response = await queryService.DelegationRewards({ + delegatorAddress: delegator, + validatorAddress: validator, + }); + return { ...response }; + }, + delegationTotalRewards: async (delegator) => { + const response = await queryService.DelegationTotalRewards({ + delegatorAddress: delegator, + }); + return { ...response }; + }, + delegatorValidators: async (delegator) => { + const response = await queryService.DelegatorValidators({ + delegatorAddress: delegator, + }); + return { ...response }; + }, + delegatorWithdrawAddress: async (delegator) => { + const response = await queryService.DelegatorWithdrawAddress({ + delegatorAddress: delegator, + }); + return { ...response }; + }, + params: async () => { + const response = await queryService.Params({}); + return { ...response }; + }, + validatorCommission: async (validator) => { + const response = await queryService.ValidatorCommission({ + validatorAddress: validator, + }); + return { ...response }; + }, + validatorOutstandingRewards: async (validator) => { + const response = await queryService.ValidatorOutstandingRewards({ + validatorAddress: validator, + }); + return { ...response }; + }, + validatorSlashes: async (validator, starting_height, ending_height, pagination) => { + const response = await queryService.ValidatorSlashes({ + validatorAddress: validator, + startingHeight: starting_height, + endingHeight: ending_height, + pagination, + }); + return { ...response }; + }, + }, + }; +} diff --git a/dist/module/cosmos/extensions/gov.d.ts b/dist/module/cosmos/extensions/gov.d.ts new file mode 100644 index 0000000..2a726d2 --- /dev/null +++ b/dist/module/cosmos/extensions/gov.d.ts @@ -0,0 +1,36 @@ +import { ProposalStatus } from "cosmjs-types/cosmos/gov/v1beta1/gov"; +import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { QueryClient } from "@cosmjs/stargate"; +export declare function setupGovExtension(base: QueryClient): { + gov: { + params: (parametersType: "deposit" | "tallying" | "voting") => Promise<{ + votingParams: import("cosmjs-types/cosmos/gov/v1beta1/gov").VotingParams; + depositParams: import("cosmjs-types/cosmos/gov/v1beta1/gov").DepositParams; + tallyParams: import("cosmjs-types/cosmos/gov/v1beta1/gov").TallyParams; + }>; + proposals: (proposalStatus: ProposalStatus, depositor: string, voter: string, pagination?: PageRequest) => Promise<{ + proposals: import("cosmjs-types/cosmos/gov/v1beta1/gov").Proposal[]; + pagination?: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + proposal: (proposal_id: bigint) => Promise<{ + proposal: import("cosmjs-types/cosmos/gov/v1beta1/gov").Proposal; + }>; + deposits: (proposal_id: bigint, pagination?: PageRequest) => Promise<{ + deposits: import("cosmjs-types/cosmos/gov/v1beta1/gov").Deposit[]; + pagination?: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + deposit: (proposal_id: bigint, depositor: string) => Promise<{ + deposit: import("cosmjs-types/cosmos/gov/v1beta1/gov").Deposit; + }>; + tally: (proposal_id: bigint) => Promise<{ + tally: import("cosmjs-types/cosmos/gov/v1beta1/gov").TallyResult; + }>; + votes: (proposal_id: bigint, pagination?: PageRequest) => Promise<{ + votes: import("cosmjs-types/cosmos/gov/v1beta1/gov").Vote[]; + pagination?: import("cosmjs-types/cosmos/base/query/v1beta1/pagination").PageResponse | undefined; + }>; + vote: (proposal_id: bigint, voter: string) => Promise<{ + vote: import("cosmjs-types/cosmos/gov/v1beta1/gov").Vote; + }>; + }; +}; diff --git a/dist/module/cosmos/extensions/gov.js b/dist/module/cosmos/extensions/gov.js new file mode 100644 index 0000000..5f1d754 --- /dev/null +++ b/dist/module/cosmos/extensions/gov.js @@ -0,0 +1,71 @@ +import { QueryClientImpl } from "cosmjs-types/cosmos/gov/v1beta1/query"; +import { createProtobufRpcClient } from "@cosmjs/stargate"; +export function setupGovExtension(base) { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + gov: { + params: async (parametersType) => { + const response = await queryService.Params({ + paramsType: parametersType, + }); + return { + ...response, + }; + }, + proposals: async (proposalStatus, depositor, voter, pagination) => { + const response = await queryService.Proposals({ + proposalStatus, + depositor, + voter, + pagination, + }); + return { + ...response, + }; + }, + proposal: async (proposal_id) => { + const response = await queryService.Proposal({ + proposalId: proposal_id, + }); + return { ...response }; + }, + deposits: async (proposal_id, pagination) => { + const response = await queryService.Deposits({ + proposalId: proposal_id, + pagination, + }); + return { + ...response, + }; + }, + deposit: async (proposal_id, depositor) => { + const response = await queryService.Deposit({ + proposalId: proposal_id, + depositor, + }); + return { ...response }; + }, + tally: async (proposal_id) => { + const response = await queryService.TallyResult({ + proposalId: proposal_id, + }); + return { ...response }; + }, + votes: async (proposal_id, pagination) => { + const response = await queryService.Votes({ + proposalId: proposal_id, + pagination, + }); + return { ...response }; + }, + vote: async (proposal_id, voter) => { + const response = await queryService.Vote({ + proposalId: proposal_id, + voter, + }); + return { ...response }; + }, + }, + }; +} diff --git a/dist/module/cosmos/extensions/index.d.ts b/dist/module/cosmos/extensions/index.d.ts new file mode 100644 index 0000000..a246917 --- /dev/null +++ b/dist/module/cosmos/extensions/index.d.ts @@ -0,0 +1,3 @@ +export * from "./bank"; +export * from "./gov"; +export * from "./distribution"; diff --git a/dist/module/cosmos/extensions/index.js b/dist/module/cosmos/extensions/index.js new file mode 100644 index 0000000..a246917 --- /dev/null +++ b/dist/module/cosmos/extensions/index.js @@ -0,0 +1,3 @@ +export * from "./bank"; +export * from "./gov"; +export * from "./distribution"; diff --git a/dist/module/cosmos/index.d.ts b/dist/module/cosmos/index.d.ts new file mode 100644 index 0000000..e979a2f --- /dev/null +++ b/dist/module/cosmos/index.d.ts @@ -0,0 +1,316 @@ +import { MsgDeposit, MsgSubmitProposal, MsgVote, MsgVoteWeighted } from "cosmjs-types/cosmos/gov/v1beta1/tx"; +import { MsgGrantAllowance, MsgRevokeAllowance } from "cosmjs-types/cosmos/feegrant/v1beta1/tx"; +import { MsgCommunityPoolSpend, MsgFundCommunityPool, MsgSetWithdrawAddress, MsgUpdateParams as DMsgUpdateParams, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission } from "cosmjs-types/cosmos/distribution/v1beta1/tx"; +import { MsgCreatePeriodicVestingAccount, MsgCreatePermanentLockedAccount, MsgCreateVestingAccount } from "cosmjs-types/cosmos/vesting/v1beta1/tx"; +import { MsgBeginRedelegate, MsgCancelUnbondingDelegation, MsgCreateValidator, MsgDelegate, MsgEditValidator, MsgUndelegate, MsgUpdateParams as SMsgUpdateParams } from "cosmjs-types/cosmos/staking/v1beta1/tx"; +import { MsgExec, MsgGrant, MsgRevoke } from "cosmjs-types/cosmos/authz/v1beta1/tx"; +import { MsgMultiSend, MsgSend, MsgSetSendEnabled, MsgUpdateParams } from "cosmjs-types/cosmos/bank/v1beta1/tx"; +import { StakingMsgs, DistributionMsgs, BankMsgs, FeegrantMsgs, GovMsgs } from "../types/msgs"; +export * from "cosmjs-types/cosmos/tx/v1beta1/tx"; +/** + * Module to generate the Messages related to the Authz module of the Blockchain + */ +export declare namespace Authz { + /** MsgGrant message creator + * Grants the provided authorization to the grantee on the granter's account with the provided expiration time. If there is already a grant for the given (granter, grantee, Authorization) triple, then the grant will be overwritten. + * + * @param object Represents the properties available for this MsgGrant message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Grant: (object: MsgGrant) => { + typeUrl: string; + value: MsgGrant; + }; + /** MsgExec message creator + * Attempts to execute the provided messages using authorizations granted to the grantee. Each message should have only one signer corresponding to the granter of the authorization. + * + * @param object Represents the properties available for this MsgExec message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Exec: (object: MsgExec) => { + typeUrl: string; + value: MsgExec; + }; + /** MsgRevoke message creator + * Revokes any authorization corresponding to the provided method name on the granter's account that has been granted to the grantee. + * + * @param object Represents the properties available for this MsgRevoke message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Revoke: (object: MsgRevoke) => { + typeUrl: string; + value: MsgRevoke; + }; +} +/** + * Module to generate the Messages related to the Staking module of the Blockchain + */ +export declare namespace Staking { + /** MsgBeginRedelegate message creator + * Defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator. + * + * @param object Represents the properties available for this MsgBeginRedelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const BeginRedelegate: (object: StakingMsgs.MsgBeginRedelegate) => { + typeUrl: string; + value: MsgBeginRedelegate; + }; + /** MsgCancelUnbondingDelegation message creator + * + * @param object Represents the properties available for this MsgCancelUnbondingDelegation message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CancelUnbondingDelegation: (object: MsgCancelUnbondingDelegation) => { + typeUrl: string; + value: MsgCancelUnbondingDelegation; + }; + /** MsgCreateValidator message creator + * Defines a method for creating a new validator. + * + * @param object Represents the properties available for this MsgCreateValidator message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CreateValidator: (object: StakingMsgs.MsgCreateValidator) => { + typeUrl: string; + value: MsgCreateValidator; + }; + /** MsgDelegate message creator + * Defines a method for performing a delegation of coins from a delegator to a validator. + * + * @param object Represents the properties available for this MsgDelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Delegate: (object: StakingMsgs.MsgDelegate) => { + typeUrl: string; + value: MsgDelegate; + }; + /** MsgEditValidator message creator + * Defines a method for editing an existing validator. + * + * @param object Represents the properties available for this MsgEditValidator message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const EditValidator: (object: StakingMsgs.MsgEditValidator) => { + typeUrl: string; + value: MsgEditValidator; + }; + /** MsgUndelegate message creator + * Defines a method for performing an undelegation from a delegate and a validator. + * + * @param object Represents the properties available for this MsgUndelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Undelegate: (object: StakingMsgs.MsgUndelegate) => { + typeUrl: string; + value: MsgUndelegate; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: StakingMsgs.MsgUpdateParams) => { + typeUrl: string; + value: SMsgUpdateParams; + }; +} +/** + * Module to generate the Messages related to the Governance module of the Blockchain + */ +export declare namespace Governance { + /** MsgDeposit message creator + * Defines a method to add deposit on a specific proposal. + * + * @param object Represents the properties available for this MsgDeposit message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Deposit: (object: MsgDeposit) => { + typeUrl: string; + value: MsgDeposit; + }; + /** MsgSubmitProposal message creator + * Defines a method to create new proposal given a content. + * + * @param object Represents the properties available for this MsgSubmitProposal message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SubmitProposal: (object: GovMsgs.MsgSubmitProposal) => { + typeUrl: string; + value: MsgSubmitProposal; + }; + /** MsgVote message creator + * Defines a method to add a vote on a specific proposal. + * + * @param object Represents the properties available for this MsgVote message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Vote: (object: MsgVote) => { + typeUrl: string; + value: MsgVote; + }; + /** MsgVoteWeighted message creator + * Defines a method to add a weighted vote on a specific proposal. + * + * @param object Represents the properties available for this MsgVoteWeighted message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const VoteWeighted: (object: MsgVoteWeighted) => { + typeUrl: string; + value: MsgVoteWeighted; + }; +} +/** + * Module to generate the Messages related to the Feegrant module of the Blockchain + */ +export declare namespace Feegrant { + /** MsgGrantAllowance message creator + * Grants fee allowance to the grantee on the granter's account with the provided expiration time. + * + * @param object Represents the properties available for this MsgGrantAllowance message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const GrantAllowance: (object: FeegrantMsgs.MsgGrantAllowance) => { + typeUrl: string; + value: MsgGrantAllowance; + }; + /** MsgRevokeAllowance message creator + * Revokes any fee allowance of granter's account that has been granted to the grantee. + * + * @param object Represents the properties available for this MsgRevokeAllowance message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const RevokeAllowance: (object: FeegrantMsgs.MsgRevokeAllowance) => { + typeUrl: string; + value: MsgRevokeAllowance; + }; +} +/** + * Module to generate the Messages related to the Bank module of the Blockchain + */ +export declare namespace Bank { + /** MsgMultiSend message creator + * Defines a method for sending coins from some accounts to other accounts. + * + * @param object Represents the properties available for this MsgMultiSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const MultiSend: (object: BankMsgs.MsgMultiSend) => { + typeUrl: string; + value: MsgMultiSend; + }; + /** MsgSend message creator + * Defines a method for sending coins from one account to another account. + * + * @param object Represents the properties available for this MsgSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const Send: (object: BankMsgs.MsgSend) => { + typeUrl: string; + value: MsgSend; + }; + /** MsgSetSendEnabled message creator + * + * @param object Represents the properties available for this MsgSetSendEnabled message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SetSendEnabled: (object: BankMsgs.MsgSetSendEnabled) => { + typeUrl: string; + value: MsgSetSendEnabled; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: BankMsgs.MsgUpdateParams) => { + typeUrl: string; + value: MsgUpdateParams; + }; +} +/** + * Module to generate the Messages related to the Distribution module of the Blockchain + */ +export declare namespace Distribution { + /** MsgWithdrawDelegatorReward message creator + * Defines a method to withdraw rewards of delegator from a single validator. + * + * @param object Represents the properties available for this MsgWithdrawDelegatorReward message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const WithdrawDelegatorReward: (object: DistributionMsgs.MsgWithdrawDelegatorReward) => { + typeUrl: string; + value: MsgWithdrawDelegatorReward; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: DistributionMsgs.MsgUpdateParams) => { + typeUrl: string; + value: DMsgUpdateParams; + }; + /** MsgWithdrawValidatorCommission message creator + * Defines a method to withdraw the full commission to the validator address. + * + * @param object Represents the properties available for this MsgWithdrawValidatorCommission message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const WithdrawValidatorCommission: (object: DistributionMsgs.MsgWithdrawValidatorCommission) => { + typeUrl: string; + value: MsgWithdrawValidatorCommission; + }; + /** MsgCommunityPoolSpend message creator + * + * @param object Represents the properties available for this MsgCommunityPoolSpend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CommunityPoolSpend: (object: DistributionMsgs.MsgCommunityPoolSpend) => { + typeUrl: string; + value: MsgCommunityPoolSpend; + }; + /** MsgFundCommunityPool message creator + * Defines a method to allow an account to directly fund the community pool. + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const FundCommunityPool: (object: DistributionMsgs.MsgFundCommunityPool) => { + typeUrl: string; + value: MsgFundCommunityPool; + }; + /** MsgSetWithdrawAddress message creator + * Defines a method to change the withdraw address for a delegator (or validator self-delegation). + * + * @param object Represents the properties available for this MsgSetWithdrawAddress message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SetWithdrawAddress: (object: DistributionMsgs.MsgSetWithdrawAddress) => { + typeUrl: string; + value: MsgSetWithdrawAddress; + }; +} +/** + * Module to generate the Messages related to the Vesting module of the Blockchain + */ +export declare namespace Vesting { + /** MsgCreateVestingAccount message creator + * Defines a method that enables creating a vesting account. + * + * @param object Represents the properties available for this MsgCreateVestingAccount message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const CreateVestingAccount: (object: MsgCreateVestingAccount) => { + typeUrl: string; + value: MsgCreateVestingAccount; + }; + const CreatePeriodicVestingAccount: (object: MsgCreatePeriodicVestingAccount) => { + typeUrl: string; + value: MsgCreatePeriodicVestingAccount; + }; + const CreatePermanentLockedAccount: (object: MsgCreatePermanentLockedAccount) => { + typeUrl: string; + value: MsgCreatePermanentLockedAccount; + }; +} diff --git a/dist/module/cosmos/index.js b/dist/module/cosmos/index.js new file mode 100644 index 0000000..cfe46b5 --- /dev/null +++ b/dist/module/cosmos/index.js @@ -0,0 +1,408 @@ +import { MsgDeposit, MsgSubmitProposal, MsgVote, MsgVoteWeighted, } from "cosmjs-types/cosmos/gov/v1beta1/tx"; +import { MsgGrantAllowance, MsgRevokeAllowance, } from "cosmjs-types/cosmos/feegrant/v1beta1/tx"; +// import { +// MsgMultiSend, +// MsgSend, +// MsgSetSendEnabled, +// MsgUpdateParams, +// } from "./bank/v1beta1/tx"; +import { MsgCommunityPoolSpend, +// MsgDepositValidatorRewardsPool, +MsgFundCommunityPool, MsgSetWithdrawAddress, MsgUpdateParams as DMsgUpdateParams, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, } from "cosmjs-types/cosmos/distribution/v1beta1/tx"; +import { MsgCreatePeriodicVestingAccount, MsgCreatePermanentLockedAccount, MsgCreateVestingAccount, } from "cosmjs-types/cosmos/vesting/v1beta1/tx"; +import { MsgBeginRedelegate, MsgCancelUnbondingDelegation, MsgCreateValidator, MsgDelegate, MsgEditValidator, MsgUndelegate, MsgUpdateParams as SMsgUpdateParams, } from "cosmjs-types/cosmos/staking/v1beta1/tx"; +import { MsgExec, MsgGrant, MsgRevoke, } from "cosmjs-types/cosmos/authz/v1beta1/tx"; +import { MsgMultiSend, MsgSend, MsgSetSendEnabled, MsgUpdateParams, } from "cosmjs-types/cosmos/bank/v1beta1/tx"; +const authzBaseUrl = "/cosmos.authz.v1beta1."; +const stakeBaseUrl = "/cosmos.staking.v1beta1."; +const govBaseUrl = "/cosmos.gov.v1beta1."; +const fgBaseUrl = "/cosmos.feegrant.v1beta1."; +const bankBaseUrl = "/cosmos.bank.v1beta1."; +const distBaseUrl = "/cosmos.distribution.v1beta1."; +const vestBaseUrl = "/cosmos.vesting.v1beta1."; +export * from "cosmjs-types/cosmos/tx/v1beta1/tx"; +/** + * Module to generate the Messages related to the Authz module of the Blockchain + */ +export var Authz; +(function (Authz) { + /** MsgGrant message creator + * Grants the provided authorization to the grantee on the granter's account with the provided expiration time. If there is already a grant for the given (granter, grantee, Authorization) triple, then the grant will be overwritten. + * + * @param object Represents the properties available for this MsgGrant message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Authz.Grant = function (object) { + return { + typeUrl: authzBaseUrl + "MsgGrant", + value: MsgGrant.fromPartial(object), + }; + }; + /** MsgExec message creator + * Attempts to execute the provided messages using authorizations granted to the grantee. Each message should have only one signer corresponding to the granter of the authorization. + * + * @param object Represents the properties available for this MsgExec message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Authz.Exec = function (object) { + return { + typeUrl: authzBaseUrl + "MsgExec", + value: MsgExec.fromPartial(object), + }; + }; + /** MsgRevoke message creator + * Revokes any authorization corresponding to the provided method name on the granter's account that has been granted to the grantee. + * + * @param object Represents the properties available for this MsgRevoke message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Authz.Revoke = function (object) { + return { + typeUrl: authzBaseUrl + "MsgRevoke", + value: MsgRevoke.fromPartial(object), + }; + }; +})(Authz || (Authz = {})); +/** + * Module to generate the Messages related to the Staking module of the Blockchain + */ +export var Staking; +(function (Staking) { + /** MsgBeginRedelegate message creator + * Defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator. + * + * @param object Represents the properties available for this MsgBeginRedelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.BeginRedelegate = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgBeginRedelegate", + value: MsgBeginRedelegate.fromPartial(object), + }; + }; + /** MsgCancelUnbondingDelegation message creator + * + * @param object Represents the properties available for this MsgCancelUnbondingDelegation message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.CancelUnbondingDelegation = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgCancelUnbondingDelegation", + value: MsgCancelUnbondingDelegation.fromPartial(object), + }; + }; + /** MsgCreateValidator message creator + * Defines a method for creating a new validator. + * + * @param object Represents the properties available for this MsgCreateValidator message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.CreateValidator = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgCreateValidator", + value: MsgCreateValidator.fromPartial(object), + }; + }; + /** MsgDelegate message creator + * Defines a method for performing a delegation of coins from a delegator to a validator. + * + * @param object Represents the properties available for this MsgDelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.Delegate = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgDelegate", + value: MsgDelegate.fromPartial(object), + }; + }; + /** MsgEditValidator message creator + * Defines a method for editing an existing validator. + * + * @param object Represents the properties available for this MsgEditValidator message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.EditValidator = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgEditValidator", + value: MsgEditValidator.fromPartial(object), + }; + }; + /** MsgUndelegate message creator + * Defines a method for performing an undelegation from a delegate and a validator. + * + * @param object Represents the properties available for this MsgUndelegate message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.Undelegate = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgUndelegate", + value: MsgUndelegate.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Staking.UpdateParams = function (object) { + return { + typeUrl: stakeBaseUrl + "MsgUpdateParams", + value: SMsgUpdateParams.fromPartial(object), + }; + }; +})(Staking || (Staking = {})); +/** + * Module to generate the Messages related to the Governance module of the Blockchain + */ +export var Governance; +(function (Governance) { + /** MsgDeposit message creator + * Defines a method to add deposit on a specific proposal. + * + * @param object Represents the properties available for this MsgDeposit message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Governance.Deposit = function (object) { + return { + typeUrl: govBaseUrl + "MsgDeposit", + value: MsgDeposit.fromPartial(object), + }; + }; + /** MsgSubmitProposal message creator + * Defines a method to create new proposal given a content. + * + * @param object Represents the properties available for this MsgSubmitProposal message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Governance.SubmitProposal = function (object) { + return { + typeUrl: govBaseUrl + "MsgSubmitProposal", + value: MsgSubmitProposal.fromPartial(object), + }; + }; + /** MsgVote message creator + * Defines a method to add a vote on a specific proposal. + * + * @param object Represents the properties available for this MsgVote message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Governance.Vote = function (object) { + return { + typeUrl: govBaseUrl + "MsgVote", + value: MsgVote.fromPartial(object), + }; + }; + /** MsgVoteWeighted message creator + * Defines a method to add a weighted vote on a specific proposal. + * + * @param object Represents the properties available for this MsgVoteWeighted message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Governance.VoteWeighted = function (object) { + return { + typeUrl: govBaseUrl + "MsgVoteWeighted", + value: MsgVoteWeighted.fromPartial(object), + }; + }; +})(Governance || (Governance = {})); +/** + * Module to generate the Messages related to the Feegrant module of the Blockchain + */ +export var Feegrant; +(function (Feegrant) { + /** MsgGrantAllowance message creator + * Grants fee allowance to the grantee on the granter's account with the provided expiration time. + * + * @param object Represents the properties available for this MsgGrantAllowance message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Feegrant.GrantAllowance = function (object) { + return { + typeUrl: fgBaseUrl + "MsgGrantAllowance", + value: MsgGrantAllowance.fromPartial(object), + }; + }; + /** MsgRevokeAllowance message creator + * Revokes any fee allowance of granter's account that has been granted to the grantee. + * + * @param object Represents the properties available for this MsgRevokeAllowance message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Feegrant.RevokeAllowance = function (object) { + return { + typeUrl: fgBaseUrl + "MsgRevokeAllowance", + value: MsgRevokeAllowance.fromPartial(object), + }; + }; +})(Feegrant || (Feegrant = {})); +/** + * Module to generate the Messages related to the Bank module of the Blockchain + */ +export var Bank; +(function (Bank) { + /** MsgMultiSend message creator + * Defines a method for sending coins from some accounts to other accounts. + * + * @param object Represents the properties available for this MsgMultiSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Bank.MultiSend = function (object) { + return { + typeUrl: bankBaseUrl + "MsgMultiSend", + value: MsgMultiSend.fromPartial(object), + }; + }; + /** MsgSend message creator + * Defines a method for sending coins from one account to another account. + * + * @param object Represents the properties available for this MsgSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Bank.Send = function (object) { + return { + typeUrl: bankBaseUrl + "MsgSend", + value: MsgSend.fromPartial(object), + }; + }; + /** MsgSetSendEnabled message creator + * + * @param object Represents the properties available for this MsgSetSendEnabled message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Bank.SetSendEnabled = function (object) { + return { + typeUrl: bankBaseUrl + "MsgSetSendEnabled", + value: MsgSetSendEnabled.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Bank.UpdateParams = function (object) { + return { + typeUrl: bankBaseUrl + "MsgUpdateParams", + value: MsgUpdateParams.fromPartial(object), + }; + }; +})(Bank || (Bank = {})); +/** + * Module to generate the Messages related to the Distribution module of the Blockchain + */ +export var Distribution; +(function (Distribution) { + /** MsgWithdrawDelegatorReward message creator + * Defines a method to withdraw rewards of delegator from a single validator. + * + * @param object Represents the properties available for this MsgWithdrawDelegatorReward message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.WithdrawDelegatorReward = function (object) { + return { + typeUrl: distBaseUrl + "MsgWithdrawDelegatorReward", + value: MsgWithdrawDelegatorReward.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.UpdateParams = function (object) { + return { + typeUrl: distBaseUrl + "MsgUpdateParams", + value: DMsgUpdateParams.fromPartial(object), + }; + }; + /** MsgWithdrawValidatorCommission message creator + * Defines a method to withdraw the full commission to the validator address. + * + * @param object Represents the properties available for this MsgWithdrawValidatorCommission message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.WithdrawValidatorCommission = function (object) { + return { + typeUrl: distBaseUrl + "MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.fromPartial(object), + }; + }; + /** MsgCommunityPoolSpend message creator + * + * @param object Represents the properties available for this MsgCommunityPoolSpend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.CommunityPoolSpend = function (object) { + return { + typeUrl: distBaseUrl + "MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.fromPartial(object), + }; + }; + // /** MsgDepositValidatorRewardsPool message creator + // * + // * @param object Represents the properties available for this MsgDepositValidatorRewardsPool message. + // * @returns A Msg object with the typeUrl and value object for the proper message + // */ + // export const DepositValidatorRewardsPool = function ( + // object: DistributionMsgs.MsgDepositValidatorRewardsPool + // ) { + // return { + // typeUrl: distBaseUrl + "MsgDepositValidatorRewardsPool", + // value: MsgDepositValidatorRewardsPool.fromPartial(object), + // }; + // }; + /** MsgFundCommunityPool message creator + * Defines a method to allow an account to directly fund the community pool. + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.FundCommunityPool = function (object) { + return { + typeUrl: distBaseUrl + "MsgFundCommunityPool", + value: MsgFundCommunityPool.fromPartial(object), + }; + }; + /** MsgSetWithdrawAddress message creator + * Defines a method to change the withdraw address for a delegator (or validator self-delegation). + * + * @param object Represents the properties available for this MsgSetWithdrawAddress message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Distribution.SetWithdrawAddress = function (object) { + return { + typeUrl: distBaseUrl + "MsgSetWithdrawAddress", + value: MsgSetWithdrawAddress.fromPartial(object), + }; + }; +})(Distribution || (Distribution = {})); +/** + * Module to generate the Messages related to the Vesting module of the Blockchain + */ +export var Vesting; +(function (Vesting) { + /** MsgCreateVestingAccount message creator + * Defines a method that enables creating a vesting account. + * + * @param object Represents the properties available for this MsgCreateVestingAccount message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + Vesting.CreateVestingAccount = function (object) { + return { + typeUrl: vestBaseUrl + "MsgCreateVestingAccount", + value: MsgCreateVestingAccount.fromPartial(object), + }; + }; + Vesting.CreatePeriodicVestingAccount = function (object) { + return { + typeUrl: vestBaseUrl + "MsgCreatePeriodicVestingAccount", + value: MsgCreatePeriodicVestingAccount.fromPartial(object), + }; + }; + Vesting.CreatePermanentLockedAccount = function (object) { + return { + typeUrl: vestBaseUrl + "MsgCreatePermanentLockedAccount", + value: MsgCreatePermanentLockedAccount.fromPartial(object), + }; + }; +})(Vesting || (Vesting = {})); diff --git a/dist/module/errors.d.ts b/dist/module/errors.d.ts new file mode 100644 index 0000000..21e428c --- /dev/null +++ b/dist/module/errors.d.ts @@ -0,0 +1,7 @@ +export declare class TxJsError extends Error { + readonly thrower: string; + readonly code: number | null; + constructor(thrower: string, cause: unknown, code?: number | null); +} +export declare function toTxJsError(thrower: string, error: unknown, code?: number | null): TxJsError; +export declare function normalizeWalletError(thrower: string, error: unknown): TxJsError; diff --git a/dist/module/errors.js b/dist/module/errors.js new file mode 100644 index 0000000..60b037b --- /dev/null +++ b/dist/module/errors.js @@ -0,0 +1,43 @@ +export class TxJsError extends Error { + thrower; + code; + constructor(thrower, cause, code = null) { + const message = cause instanceof Error + ? cause.message + : typeof cause === "string" + ? cause + : "Unknown error"; + super(message); + this.name = "TxJsError"; + this.thrower = thrower; + this.code = code; + if (cause instanceof Error && cause.stack) { + this.stack = cause.stack; + } + } +} +export function toTxJsError(thrower, error, code) { + if (error instanceof TxJsError) { + return error; + } + if (typeof error === "object" && + error !== null && + "error" in error) { + const legacy = error; + return new TxJsError(legacy.thrower ?? thrower, legacy.error, legacy.code ?? code ?? null); + } + return new TxJsError(thrower, error, code ?? null); +} +export function normalizeWalletError(thrower, error) { + if (error instanceof TxJsError) { + return error; + } + const wrapped = toTxJsError(thrower, error); + if (wrapped.message === "Extension not installed.") { + return new TxJsError(thrower, wrapped.message, 4000); + } + if (["User rejected the request.", "Request rejected"].includes(wrapped.message)) { + return new TxJsError(thrower, "Request rejected", 4001); + } + return wrapped; +} diff --git a/dist/module/google/api/annotations.d.ts b/dist/module/google/api/annotations.d.ts new file mode 100644 index 0000000..a64daf0 --- /dev/null +++ b/dist/module/google/api/annotations.d.ts @@ -0,0 +1 @@ +export declare const protobufPackage = "google.api"; diff --git a/dist/module/google/api/annotations.js b/dist/module/google/api/annotations.js new file mode 100644 index 0000000..aace478 --- /dev/null +++ b/dist/module/google/api/annotations.js @@ -0,0 +1,2 @@ +/* eslint-disable */ +export const protobufPackage = "google.api"; diff --git a/dist/module/google/api/http.d.ts b/dist/module/google/api/http.d.ts new file mode 100644 index 0000000..cb09360 --- /dev/null +++ b/dist/module/google/api/http.d.ts @@ -0,0 +1,2953 @@ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export declare 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. + */ + fullyDecodeReservedExpansion: 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. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} +export declare const Http: { + encode(message: Http, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Http; + fromJSON(object: any): Http; + toJSON(message: Http): unknown; + create]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & any & { [K_9 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & any & { [K_10 in Exclude]: never; })[] & { [K_11 in Exclude]: never; }) | undefined; + } & { [K_12 in Exclude]: never; })[] & { [K_13 in Exclude]: never; }) | undefined; + } & { [K_14 in Exclude]: never; })[] & { [K_15 in Exclude]: never; }) | undefined; + } & { [K_16 in Exclude]: never; })[] & { [K_17 in Exclude]: never; }) | undefined; + } & { [K_18 in Exclude]: never; })[] & { [K_19 in Exclude]: never; }) | undefined; + } & { [K_20 in Exclude]: never; })[] & { [K_21 in Exclude]: never; }) | undefined; + } & { [K_22 in Exclude]: never; })[] & { [K_23 in Exclude]: never; }) | undefined; + } & { [K_24 in Exclude]: never; })[] & { [K_25 in Exclude]: never; }) | undefined; + } & { [K_26 in Exclude]: never; })[] & { [K_27 in Exclude]: never; }) | undefined; + } & { [K_28 in Exclude]: never; })[] & { [K_29 in Exclude]: never; }) | undefined; + } & { [K_30 in Exclude]: never; })[] & { [K_31 in Exclude]: never; }) | undefined; + fullyDecodeReservedExpansion?: boolean | undefined; + } & { [K_32 in Exclude]: never; }>(base?: I | undefined): Http; + fromPartial]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_34 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_35 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_36 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_37 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_38 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_39 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_40 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_41 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & any & { [K_42 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & any & { [K_43 in Exclude]: never; })[] & { [K_44 in Exclude]: never; }) | undefined; + } & { [K_45 in Exclude]: never; })[] & { [K_46 in Exclude]: never; }) | undefined; + } & { [K_47 in Exclude]: never; })[] & { [K_48 in Exclude]: never; }) | undefined; + } & { [K_49 in Exclude]: never; })[] & { [K_50 in Exclude]: never; }) | undefined; + } & { [K_51 in Exclude]: never; })[] & { [K_52 in Exclude]: never; }) | undefined; + } & { [K_53 in Exclude]: never; })[] & { [K_54 in Exclude]: never; }) | undefined; + } & { [K_55 in Exclude]: never; })[] & { [K_56 in Exclude]: never; }) | undefined; + } & { [K_57 in Exclude]: never; })[] & { [K_58 in Exclude]: never; }) | undefined; + } & { [K_59 in Exclude]: never; })[] & { [K_60 in Exclude]: never; }) | undefined; + } & { [K_61 in Exclude]: never; })[] & { [K_62 in Exclude]: never; }) | undefined; + } & { [K_63 in Exclude]: never; })[] & { [K_64 in Exclude]: never; }) | undefined; + fullyDecodeReservedExpansion?: boolean | undefined; + } & { [K_65 in Exclude]: never; }>(object: I_1): Http; +}; +export declare const HttpRule: { + encode(message: HttpRule, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule; + fromJSON(object: any): HttpRule; + toJSON(message: HttpRule): unknown; + create]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & any & { [K_10 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & any & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + } & { [K_13 in Exclude]: never; })[] & { [K_14 in Exclude]: never; }) | undefined; + } & { [K_15 in Exclude]: never; })[] & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; })[] & { [K_18 in Exclude]: never; }) | undefined; + } & { [K_19 in Exclude]: never; })[] & { [K_20 in Exclude]: never; }) | undefined; + } & { [K_21 in Exclude]: never; })[] & { [K_22 in Exclude]: never; }) | undefined; + } & { [K_23 in Exclude]: never; })[] & { [K_24 in Exclude]: never; }) | undefined; + } & { [K_25 in Exclude]: never; })[] & { [K_26 in Exclude]: never; }) | undefined; + } & { [K_27 in Exclude]: never; })[] & { [K_28 in Exclude]: never; }) | undefined; + } & { [K_29 in Exclude]: never; })[] & { [K_30 in Exclude]: never; }) | undefined; + } & { [K_31 in Exclude]: never; })[] & { [K_32 in Exclude]: never; }) | undefined; + } & { [K_33 in Exclude]: never; }>(base?: I | undefined): HttpRule; + fromPartial]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_35 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_36 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_37 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_38 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_39 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_40 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_41 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_42 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & { + kind?: string | undefined; + path?: string | undefined; + } & { [K_43 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & { + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: ({ + kind?: string | undefined; + path?: string | undefined; + } & any & { [K_44 in Exclude]: never; }) | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + }[] & ({ + selector?: string | undefined; + get?: string | undefined; + put?: string | undefined; + post?: string | undefined; + delete?: string | undefined; + patch?: string | undefined; + custom?: { + kind?: string | undefined; + path?: string | undefined; + } | undefined; + body?: string | undefined; + responseBody?: string | undefined; + additionalBindings?: any[] | undefined; + } & any & { [K_45 in Exclude]: never; })[] & { [K_46 in Exclude]: never; }) | undefined; + } & { [K_47 in Exclude]: never; })[] & { [K_48 in Exclude]: never; }) | undefined; + } & { [K_49 in Exclude]: never; })[] & { [K_50 in Exclude]: never; }) | undefined; + } & { [K_51 in Exclude]: never; })[] & { [K_52 in Exclude]: never; }) | undefined; + } & { [K_53 in Exclude]: never; })[] & { [K_54 in Exclude]: never; }) | undefined; + } & { [K_55 in Exclude]: never; })[] & { [K_56 in Exclude]: never; }) | undefined; + } & { [K_57 in Exclude]: never; })[] & { [K_58 in Exclude]: never; }) | undefined; + } & { [K_59 in Exclude]: never; })[] & { [K_60 in Exclude]: never; }) | undefined; + } & { [K_61 in Exclude]: never; })[] & { [K_62 in Exclude]: never; }) | undefined; + } & { [K_63 in Exclude]: never; })[] & { [K_64 in Exclude]: never; }) | undefined; + } & { [K_65 in Exclude]: never; })[] & { [K_66 in Exclude]: never; }) | undefined; + } & { [K_67 in Exclude]: never; }>(object: I_1): HttpRule; +}; +export declare const CustomHttpPattern: { + encode(message: CustomHttpPattern, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern; + fromJSON(object: any): CustomHttpPattern; + toJSON(message: CustomHttpPattern): unknown; + create]: never; }>(base?: I | undefined): CustomHttpPattern; + fromPartial]: never; }>(object: I_1): CustomHttpPattern; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/google/api/http.js b/dist/module/google/api/http.js new file mode 100644 index 0000000..2392e9e --- /dev/null +++ b/dist/module/google/api/http.js @@ -0,0 +1,319 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export const protobufPackage = "google.api"; +function createBaseHttp() { + return { rules: [], fullyDecodeReservedExpansion: false }; +} +export const Http = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.rules) { + HttpRule.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.fullyDecodeReservedExpansion === true) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag != 10) { + break; + } + message.rules.push(HttpRule.decode(reader, reader.uint32())); + continue; + case 2: + if (tag != 16) { + break; + } + message.fullyDecodeReservedExpansion = reader.bool(); + continue; + } + if ((tag & 7) == 4 || tag == 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e) => HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.rules) { + obj.rules = message.rules.map((e) => e ? HttpRule.toJSON(e) : undefined); + } + else { + obj.rules = []; + } + message.fullyDecodeReservedExpansion !== undefined && + (obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion); + return obj; + }, + create(base) { + return Http.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; +function createBaseHttpRule() { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} +export const HttpRule = { + encode(message, writer = _m0.Writer.create()) { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag != 10) { + break; + } + message.selector = reader.string(); + continue; + case 2: + if (tag != 18) { + break; + } + message.get = reader.string(); + continue; + case 3: + if (tag != 26) { + break; + } + message.put = reader.string(); + continue; + case 4: + if (tag != 34) { + break; + } + message.post = reader.string(); + continue; + case 5: + if (tag != 42) { + break; + } + message.delete = reader.string(); + continue; + case 6: + if (tag != 50) { + break; + } + message.patch = reader.string(); + continue; + case 8: + if (tag != 66) { + break; + } + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + continue; + case 7: + if (tag != 58) { + break; + } + message.body = reader.string(); + continue; + case 12: + if (tag != 98) { + break; + } + message.responseBody = reader.string(); + continue; + case 11: + if (tag != 90) { + break; + } + message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) == 4 || tag == 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + selector: isSet(object.selector) ? String(object.selector) : "", + get: isSet(object.get) ? String(object.get) : undefined, + put: isSet(object.put) ? String(object.put) : undefined, + post: isSet(object.post) ? String(object.post) : undefined, + delete: isSet(object.delete) ? String(object.delete) : undefined, + patch: isSet(object.patch) ? String(object.patch) : undefined, + custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? String(object.body) : "", + responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", + additionalBindings: Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e) => HttpRule.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.selector !== undefined && (obj.selector = message.selector); + message.get !== undefined && (obj.get = message.get); + message.put !== undefined && (obj.put = message.put); + message.post !== undefined && (obj.post = message.post); + message.delete !== undefined && (obj.delete = message.delete); + message.patch !== undefined && (obj.patch = message.patch); + message.custom !== undefined && + (obj.custom = message.custom ? CustomHttpPattern.toJSON(message.custom) : undefined); + message.body !== undefined && (obj.body = message.body); + message.responseBody !== undefined && (obj.responseBody = message.responseBody); + if (message.additionalBindings) { + obj.additionalBindings = message.additionalBindings.map((e) => e ? HttpRule.toJSON(e) : undefined); + } + else { + obj.additionalBindings = []; + } + return obj; + }, + create(base) { + return HttpRule.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = (object.custom !== undefined && object.custom !== null) + ? CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCustomHttpPattern() { + return { kind: "", path: "" }; +} +export const CustomHttpPattern = { + encode(message, writer = _m0.Writer.create()) { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag != 10) { + break; + } + message.kind = reader.string(); + continue; + case 2: + if (tag != 18) { + break; + } + message.path = reader.string(); + continue; + } + if ((tag & 7) == 4 || tag == 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { kind: isSet(object.kind) ? String(object.kind) : "", path: isSet(object.path) ? String(object.path) : "" }; + }, + toJSON(message) { + const obj = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.path !== undefined && (obj.path = message.path); + return obj; + }, + create(base) { + return CustomHttpPattern.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/google/index.d.ts b/dist/module/google/index.d.ts new file mode 100644 index 0000000..498ae62 --- /dev/null +++ b/dist/module/google/index.d.ts @@ -0,0 +1 @@ +export * from "./protobuf/any"; diff --git a/dist/module/google/index.js b/dist/module/google/index.js new file mode 100644 index 0000000..498ae62 --- /dev/null +++ b/dist/module/google/index.js @@ -0,0 +1 @@ +export * from "./protobuf/any"; diff --git a/dist/module/google/protobuf/any.d.ts b/dist/module/google/protobuf/any.d.ts new file mode 100644 index 0000000..e1ca8ec --- /dev/null +++ b/dist/module/google/protobuf/any.d.ts @@ -0,0 +1,150 @@ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "google.protobuf"; +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} +export declare const Any: { + encode(message: Any, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Any; + fromJSON(object: any): Any; + toJSON(message: Any): unknown; + create]: never; }>(base?: I | undefined): Any; + fromPartial]: never; }>(object: I_1): Any; +}; +export declare function bytesFromBase64(b64: string): Uint8Array; +export declare function base64FromBytes(arr: Uint8Array): string; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/google/protobuf/any.js b/dist/module/google/protobuf/any.js new file mode 100644 index 0000000..3891ace --- /dev/null +++ b/dist/module/google/protobuf/any.js @@ -0,0 +1,116 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export const protobufPackage = "google.protobuf"; +function createBaseAny() { + return { typeUrl: "", value: new Uint8Array() }; +} +export const Any = { + encode(message, writer = _m0.Writer.create()) { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag != 10) { + break; + } + message.typeUrl = reader.string(); + continue; + case 2: + if (tag != 18) { + break; + } + message.value = reader.bytes(); + continue; + } + if ((tag & 7) == 4 || tag == 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + create(base) { + return Any.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +export function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +export function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/google/protobuf/duration.d.ts b/dist/module/google/protobuf/duration.d.ts new file mode 100644 index 0000000..f51af0b --- /dev/null +++ b/dist/module/google/protobuf/duration.d.ts @@ -0,0 +1,110 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "google.protobuf"; +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} +export declare const Duration: { + encode(message: Duration, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Duration; + fromJSON(object: any): Duration; + toJSON(message: Duration): unknown; + create]: never; }>(base?: I | undefined): Duration; + fromPartial]: never; }>(object: I_1): Duration; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/google/protobuf/duration.js b/dist/module/google/protobuf/duration.js new file mode 100644 index 0000000..3c9941e --- /dev/null +++ b/dist/module/google/protobuf/duration.js @@ -0,0 +1,94 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export const protobufPackage = "google.protobuf"; +function createBaseDuration() { + return { seconds: 0, nanos: 0 }; +} +export const Duration = { + encode(message, writer = _m0.Writer.create()) { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + seconds: isSet(object.seconds) ? Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.seconds !== undefined && (obj.seconds = Math.round(message.seconds)); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + create(base) { + return Duration.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDuration(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/google/protobuf/timestamp.d.ts b/dist/module/google/protobuf/timestamp.d.ts new file mode 100644 index 0000000..a8a0b79 --- /dev/null +++ b/dist/module/google/protobuf/timestamp.d.ts @@ -0,0 +1,139 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "google.protobuf"; +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} +export declare const Timestamp: { + encode(message: Timestamp, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp; + fromJSON(object: any): Timestamp; + toJSON(message: Timestamp): unknown; + create]: never; }>(base?: I | undefined): Timestamp; + fromPartial]: never; }>(object: I_1): Timestamp; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/google/protobuf/timestamp.js b/dist/module/google/protobuf/timestamp.js new file mode 100644 index 0000000..ef1cb31 --- /dev/null +++ b/dist/module/google/protobuf/timestamp.js @@ -0,0 +1,94 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export const protobufPackage = "google.protobuf"; +function createBaseTimestamp() { + return { seconds: 0, nanos: 0 }; +} +export const Timestamp = { + encode(message, writer = _m0.Writer.create()) { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + seconds: isSet(object.seconds) ? Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.seconds !== undefined && (obj.seconds = Math.round(message.seconds)); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + create(base) { + return Timestamp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/index.d.ts b/dist/module/index.d.ts new file mode 100644 index 0000000..e5f963d --- /dev/null +++ b/dist/module/index.d.ts @@ -0,0 +1,9 @@ +export { Client } from "./client/index"; +export * from "./types"; +export * from "./utils"; +export * from "./coreum"; +export * from "./cosmos"; +export * from "./wasm/v1"; +export * from "./services"; +export { TxJsError } from "./errors"; +export * as Stargate from "@cosmjs/stargate"; diff --git a/dist/module/index.js b/dist/module/index.js new file mode 100644 index 0000000..e5f963d --- /dev/null +++ b/dist/module/index.js @@ -0,0 +1,9 @@ +export { Client } from "./client/index"; +export * from "./types"; +export * from "./utils"; +export * from "./coreum"; +export * from "./cosmos"; +export * from "./wasm/v1"; +export * from "./services"; +export { TxJsError } from "./errors"; +export * as Stargate from "@cosmjs/stargate"; diff --git a/dist/module/services/cosmostation.d.ts b/dist/module/services/cosmostation.d.ts new file mode 100644 index 0000000..b40a1df --- /dev/null +++ b/dist/module/services/cosmostation.d.ts @@ -0,0 +1,4 @@ +import { CoreumNetworkConfig } from "../types/coreum"; +import { OfflineSigner } from "@cosmjs/proto-signing"; +export declare const connectCosmostation: (config: CoreumNetworkConfig) => Promise; +export declare const getCosmosOfflineSigner: (chainId: string) => Promise; diff --git a/dist/module/services/cosmostation.js b/dist/module/services/cosmostation.js new file mode 100644 index 0000000..c14cfbb --- /dev/null +++ b/dist/module/services/cosmostation.js @@ -0,0 +1,38 @@ +import { cosmos } from "@cosmostation/extension-client"; +import { getOfflineSigner } from "@cosmostation/cosmos-client"; +import { TxJsError } from "../errors"; +export const connectCosmostation = async (config) => { + try { + const provider = await cosmos(); + const gasPrice = (config.gas_price || "").replace(config.staking_denom || "", ""); + await provider.addChain({ + chainId: config.chain_id, + chainName: config.chain_name, + addressPrefix: config.chain_bech32_prefix, + baseDenom: config.staking_denom, + displayDenom: "core", + restURL: config.chain_rest_endpoint, + coinType: String(config.coin_type), + decimals: 6, + gasRate: { + average: gasPrice, + low: gasPrice, + tiny: gasPrice, + }, + }); + } + catch (error) { + if (error instanceof Error && error.name === "InstallError") { + throw new TxJsError("connectCosmostation", "Extension not installed.", 4000); + } + throw new TxJsError("connectCosmostation", error); + } +}; +export const getCosmosOfflineSigner = async (chainId) => { + try { + return (await getOfflineSigner(chainId)); + } + catch (error) { + throw new TxJsError("getCosmosOfflineSigner", error); + } +}; diff --git a/dist/module/services/index.d.ts b/dist/module/services/index.d.ts new file mode 100644 index 0000000..ce44237 --- /dev/null +++ b/dist/module/services/index.d.ts @@ -0,0 +1,3 @@ +export * from "./keplr"; +export * from "./cosmostation"; +export * from "./leap"; diff --git a/dist/module/services/index.js b/dist/module/services/index.js new file mode 100644 index 0000000..ce44237 --- /dev/null +++ b/dist/module/services/index.js @@ -0,0 +1,3 @@ +export * from "./keplr"; +export * from "./cosmostation"; +export * from "./leap"; diff --git a/dist/module/services/keplr.d.ts b/dist/module/services/keplr.d.ts new file mode 100644 index 0000000..85b0fc1 --- /dev/null +++ b/dist/module/services/keplr.d.ts @@ -0,0 +1,3 @@ +import { CoreumNetworkConfig } from "../types/coreum"; +export declare const connectKeplr: (config: CoreumNetworkConfig) => Promise; +export declare const getKeplrOfflineSigner: (chainId: string) => Promise; diff --git a/dist/module/services/keplr.js b/dist/module/services/keplr.js new file mode 100644 index 0000000..172ac8e --- /dev/null +++ b/dist/module/services/keplr.js @@ -0,0 +1,36 @@ +import { buildKeplrChainSuggestion } from "../utils/chainConfig"; +import { TxJsError, toTxJsError } from "../errors"; +function getKeplrWindow() { + if (typeof window === "undefined") { + throw new TxJsError("connectKeplr", "Wallet extensions are only available in browser environments"); + } + return window; +} +export const connectKeplr = async (config) => { + try { + const browserWindow = getKeplrWindow(); + if (!browserWindow.getOfflineSignerAuto || !browserWindow.keplr) { + throw new TxJsError("connectKeplr", "Extension not installed.", 4000); + } + if (!browserWindow.keplr.experimentalSuggestChain) { + throw new TxJsError("connectKeplr", "Please use the recent version of Keplr extension"); + } + try { + await browserWindow.keplr.experimentalSuggestChain(buildKeplrChainSuggestion(config)); + } + catch { + throw new TxJsError("connectKeplr", "Failed to suggest the chain"); + } + } + catch (error) { + throw toTxJsError("connectKeplr", error); + } +}; +export const getKeplrOfflineSigner = async (chainId) => { + const browserWindow = getKeplrWindow(); + if (!browserWindow.getOfflineSignerAuto) { + throw new TxJsError("getKeplrOfflineSigner", "Extension not installed.", 4000); + } + await browserWindow.keplr?.enable(chainId); + return browserWindow.getOfflineSignerAuto(chainId); +}; diff --git a/dist/module/services/leap.d.ts b/dist/module/services/leap.d.ts new file mode 100644 index 0000000..99d6b8a --- /dev/null +++ b/dist/module/services/leap.d.ts @@ -0,0 +1,4 @@ +import { CoreumNetworkConfig } from "../types/coreum"; +import { OfflineSigner } from "@cosmjs/proto-signing"; +export declare const connectLeap: (config: CoreumNetworkConfig) => Promise; +export declare const getLeapOfflineSigner: (chainId: string) => Promise; diff --git a/dist/module/services/leap.js b/dist/module/services/leap.js new file mode 100644 index 0000000..9b83aec --- /dev/null +++ b/dist/module/services/leap.js @@ -0,0 +1,39 @@ +import { buildKeplrChainSuggestion } from "../utils/chainConfig"; +import { TxJsError } from "../errors"; +function getLeapWindow() { + if (typeof window === "undefined") { + throw new TxJsError("connectLeap", "Wallet extensions are only available in browser environments"); + } + return window; +} +export const connectLeap = async (config) => { + try { + const browserWindow = getLeapWindow(); + if (!browserWindow.leap) { + throw new TxJsError("connectLeap", "Extension not installed.", 4000); + } + if (browserWindow.leap.experimentalSuggestChain) { + try { + await browserWindow.leap.experimentalSuggestChain(buildKeplrChainSuggestion(config)); + } + catch { + throw new TxJsError("connectLeap", "Failed to suggest the chain"); + } + } + await browserWindow.leap.enable(config.chain_id); + } + catch (error) { + if (error instanceof TxJsError) { + throw error; + } + throw new TxJsError("connectLeap", error); + } +}; +export const getLeapOfflineSigner = async (chainId) => { + const browserWindow = getLeapWindow(); + if (!browserWindow.leap) { + throw new TxJsError("getLeapOfflineSigner", "Extension not installed.", 4000); + } + await browserWindow.leap.enable(chainId); + return browserWindow.leap.getOfflineSignerAuto(chainId); +}; diff --git a/dist/module/tendermint/abci/types.d.ts b/dist/module/tendermint/abci/types.d.ts new file mode 100644 index 0000000..a6f80bb --- /dev/null +++ b/dist/module/tendermint/abci/types.d.ts @@ -0,0 +1,7075 @@ +import _m0 from "protobufjs/minimal"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { ConsensusParams } from "../types/params"; +import { Header } from "../types/types"; +export declare const protobufPackage = "tendermint.abci"; +export declare enum CheckTxType { + NEW = 0, + RECHECK = 1, + UNRECOGNIZED = -1 +} +export declare function checkTxTypeFromJSON(object: any): CheckTxType; +export declare function checkTxTypeToJSON(object: CheckTxType): string; +export declare enum MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1 +} +export declare function misbehaviorTypeFromJSON(object: any): MisbehaviorType; +export declare function misbehaviorTypeToJSON(object: MisbehaviorType): string; +export interface Request { + echo?: RequestEcho | undefined; + flush?: RequestFlush | undefined; + info?: RequestInfo | undefined; + initChain?: RequestInitChain | undefined; + query?: RequestQuery | undefined; + beginBlock?: RequestBeginBlock | undefined; + checkTx?: RequestCheckTx | undefined; + deliverTx?: RequestDeliverTx | undefined; + endBlock?: RequestEndBlock | undefined; + commit?: RequestCommit | undefined; + listSnapshots?: RequestListSnapshots | undefined; + offerSnapshot?: RequestOfferSnapshot | undefined; + loadSnapshotChunk?: RequestLoadSnapshotChunk | undefined; + applySnapshotChunk?: RequestApplySnapshotChunk | undefined; + prepareProposal?: RequestPrepareProposal | undefined; + processProposal?: RequestProcessProposal | undefined; +} +export interface RequestEcho { + message: string; +} +export interface RequestFlush { +} +export interface RequestInfo { + version: string; + blockVersion: number; + p2pVersion: number; + abciVersion: string; +} +export interface RequestInitChain { + time: Date | undefined; + chainId: string; + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: number; +} +export interface RequestQuery { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} +export interface RequestBeginBlock { + hash: Uint8Array; + header: Header | undefined; + lastCommitInfo: CommitInfo | undefined; + byzantineValidators: Misbehavior[]; +} +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} +export interface RequestDeliverTx { + tx: Uint8Array; +} +export interface RequestEndBlock { + height: number; +} +export interface RequestCommit { +} +/** lists available snapshots */ +export interface RequestListSnapshots { +} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot: Snapshot | undefined; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: number; + format: number; + chunk: number; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: number; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo | undefined; + misbehavior: Misbehavior[]; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo | undefined; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time: Date | undefined; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface Response { + exception?: ResponseException | undefined; + echo?: ResponseEcho | undefined; + flush?: ResponseFlush | undefined; + info?: ResponseInfo | undefined; + initChain?: ResponseInitChain | undefined; + query?: ResponseQuery | undefined; + beginBlock?: ResponseBeginBlock | undefined; + checkTx?: ResponseCheckTx | undefined; + deliverTx?: ResponseDeliverTx | undefined; + endBlock?: ResponseEndBlock | undefined; + commit?: ResponseCommit | undefined; + listSnapshots?: ResponseListSnapshots | undefined; + offerSnapshot?: ResponseOfferSnapshot | undefined; + loadSnapshotChunk?: ResponseLoadSnapshotChunk | undefined; + applySnapshotChunk?: ResponseApplySnapshotChunk | undefined; + prepareProposal?: ResponsePrepareProposal | undefined; + processProposal?: ResponseProcessProposal | undefined; +} +/** nondeterministic */ +export interface ResponseException { + error: string; +} +export interface ResponseEcho { + message: string; +} +export interface ResponseFlush { +} +export interface ResponseInfo { + data: string; + version: string; + appVersion: number; + lastBlockHeight: number; + lastBlockAppHash: Uint8Array; +} +export interface ResponseInitChain { + consensusParams: ConsensusParams | undefined; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proofOps: ProofOps | undefined; + height: number; + codespace: string; +} +export interface ResponseBeginBlock { + events: Event[]; +} +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + events: Event[]; + codespace: string; + sender: string; + priority: number; + /** + * mempool_error is set by CometBFT. + * ABCI applictions creating a ResponseCheckTX should not set mempool_error. + */ + mempoolError: string; +} +export interface ResponseDeliverTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: number; + gasUsed: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} +export interface ResponseEndBlock { + validatorUpdates: ValidatorUpdate[]; + consensusParamUpdates: ConsensusParams | undefined; + events: Event[]; +} +export interface ResponseCommit { + /** reserve 1 */ + data: Uint8Array; + retainHeight: number; +} +export interface ResponseListSnapshots { + snapshots: Snapshot[]; +} +export interface ResponseOfferSnapshot { + result: ResponseOfferSnapshot_Result; +} +export declare enum ResponseOfferSnapshot_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Snapshot accepted, apply chunks */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** REJECT - Reject this specific snapshot, try others */ + REJECT = 3, + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + REJECT_FORMAT = 4, + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + REJECT_SENDER = 5, + UNRECOGNIZED = -1 +} +export declare function responseOfferSnapshot_ResultFromJSON(object: any): ResponseOfferSnapshot_Result; +export declare function responseOfferSnapshot_ResultToJSON(object: ResponseOfferSnapshot_Result): string; +export interface ResponseLoadSnapshotChunk { + chunk: Uint8Array; +} +export interface ResponseApplySnapshotChunk { + result: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: string[]; +} +export declare enum ResponseApplySnapshotChunk_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Chunk successfully accepted */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** RETRY - Retry chunk (combine with refetch and reject) */ + RETRY = 3, + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + RETRY_SNAPSHOT = 4, + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + REJECT_SNAPSHOT = 5, + UNRECOGNIZED = -1 +} +export declare function responseApplySnapshotChunk_ResultFromJSON(object: any): ResponseApplySnapshotChunk_Result; +export declare function responseApplySnapshotChunk_ResultToJSON(object: ResponseApplySnapshotChunk_Result): string; +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} +export declare enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1 +} +export declare function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus; +export declare function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string; +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: number; + index: number; + tx: Uint8Array; + result: ResponseDeliverTx | undefined; +} +/** Validator */ +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: number; +} +/** ValidatorUpdate */ +export interface ValidatorUpdate { + pubKey: PublicKey | undefined; + power: number; +} +/** VoteInfo */ +export interface VoteInfo { + validator: Validator | undefined; + signedLastBlock: boolean; +} +export interface ExtendedVoteInfo { + validator: Validator | undefined; + signedLastBlock: boolean; + /** Reserved for future use */ + voteExtension: Uint8Array; +} +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: Validator | undefined; + /** The height when the offense occurred */ + height: number; + /** The corresponding time where the offense occurred */ + time: Date | undefined; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: number; +} +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: number; + /** The application-specific snapshot format */ + format: number; + /** Number of chunks in the snapshot */ + chunks: number; + /** Arbitrary snapshot hash, equal only if identical */ + hash: Uint8Array; + /** Arbitrary application metadata */ + metadata: Uint8Array; +} +export declare const Request: { + encode(message: Request, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Request; + fromJSON(object: any): Request; + toJSON(message: Request): unknown; + create]: never; }) | undefined; + flush?: ({} & {} & { [K_1 in Exclude]: never; }) | undefined; + info?: ({ + version?: string | undefined; + blockVersion?: number | undefined; + p2pVersion?: number | undefined; + abciVersion?: string | undefined; + } & { + version?: string | undefined; + blockVersion?: number | undefined; + p2pVersion?: number | undefined; + abciVersion?: string | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + initChain?: ({ + time?: Date | undefined; + chainId?: string | undefined; + consensusParams?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + validators?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { + time?: Date | undefined; + chainId?: string | undefined; + consensusParams?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + query?: ({ + data?: Uint8Array | undefined; + path?: string | undefined; + height?: number | undefined; + prove?: boolean | undefined; + } & { + data?: Uint8Array | undefined; + path?: string | undefined; + height?: number | undefined; + prove?: boolean | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + beginBlock?: ({ + hash?: Uint8Array | undefined; + header?: { + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } | undefined; + lastCommitInfo?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } | undefined; + byzantineValidators?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + } & { + hash?: Uint8Array | undefined; + header?: ({ + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + version?: ({ + block?: number | undefined; + app?: number | undefined; + } & { + block?: number | undefined; + app?: number | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + lastCommitInfo?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_19 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_20 in Exclude]: never; })[] & { [K_21 in Exclude]: never; }) | undefined; + } & { [K_22 in Exclude]: never; }) | undefined; + byzantineValidators?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_23 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_24 in Exclude]: never; })[] & { [K_25 in Exclude]: never; }) | undefined; + } & { [K_26 in Exclude]: never; }) | undefined; + checkTx?: ({ + tx?: Uint8Array | undefined; + type?: CheckTxType | undefined; + } & { + tx?: Uint8Array | undefined; + type?: CheckTxType | undefined; + } & { [K_27 in Exclude]: never; }) | undefined; + deliverTx?: ({ + tx?: Uint8Array | undefined; + } & { + tx?: Uint8Array | undefined; + } & { [K_28 in Exclude]: never; }) | undefined; + endBlock?: ({ + height?: number | undefined; + } & { + height?: number | undefined; + } & { [K_29 in Exclude]: never; }) | undefined; + commit?: ({} & {} & { [K_30 in Exclude]: never; }) | undefined; + listSnapshots?: ({} & {} & { [K_31 in Exclude]: never; }) | undefined; + offerSnapshot?: ({ + snapshot?: { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } | undefined; + appHash?: Uint8Array | undefined; + } & { + snapshot?: ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { [K_32 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_33 in Exclude]: never; }) | undefined; + loadSnapshotChunk?: ({ + height?: number | undefined; + format?: number | undefined; + chunk?: number | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunk?: number | undefined; + } & { [K_34 in Exclude]: never; }) | undefined; + applySnapshotChunk?: ({ + index?: number | undefined; + chunk?: Uint8Array | undefined; + sender?: string | undefined; + } & { + index?: number | undefined; + chunk?: Uint8Array | undefined; + sender?: string | undefined; + } & { [K_35 in Exclude]: never; }) | undefined; + prepareProposal?: ({ + maxTxBytes?: number | undefined; + txs?: Uint8Array[] | undefined; + localLastCommit?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } | undefined; + misbehavior?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + maxTxBytes?: number | undefined; + txs?: (Uint8Array[] & Uint8Array[] & { [K_36 in Exclude]: never; }) | undefined; + localLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_37 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_38 in Exclude]: never; })[] & { [K_39 in Exclude]: never; }) | undefined; + } & { [K_40 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_41 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_42 in Exclude]: never; })[] & { [K_43 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_44 in Exclude]: never; }) | undefined; + processProposal?: ({ + txs?: Uint8Array[] | undefined; + proposedLastCommit?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } | undefined; + misbehavior?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + txs?: (Uint8Array[] & Uint8Array[] & { [K_45 in Exclude]: never; }) | undefined; + proposedLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_46 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_47 in Exclude]: never; })[] & { [K_48 in Exclude]: never; }) | undefined; + } & { [K_49 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_50 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_51 in Exclude]: never; })[] & { [K_52 in Exclude]: never; }) | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_53 in Exclude]: never; }) | undefined; + } & { [K_54 in Exclude]: never; }>(base?: I | undefined): Request; + fromPartial]: never; }) | undefined; + flush?: ({} & {} & { [K_56 in Exclude]: never; }) | undefined; + info?: ({ + version?: string | undefined; + blockVersion?: number | undefined; + p2pVersion?: number | undefined; + abciVersion?: string | undefined; + } & { + version?: string | undefined; + blockVersion?: number | undefined; + p2pVersion?: number | undefined; + abciVersion?: string | undefined; + } & { [K_57 in Exclude]: never; }) | undefined; + initChain?: ({ + time?: Date | undefined; + chainId?: string | undefined; + consensusParams?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + validators?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { + time?: Date | undefined; + chainId?: string | undefined; + consensusParams?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_58 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_59 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_60 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_61 in Exclude]: never; }) | undefined; + } & { [K_62 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_63 in Exclude]: never; }) | undefined; + } & { [K_64 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_65 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_66 in Exclude]: never; })[] & { [K_67 in Exclude]: never; }) | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { [K_68 in Exclude]: never; }) | undefined; + query?: ({ + data?: Uint8Array | undefined; + path?: string | undefined; + height?: number | undefined; + prove?: boolean | undefined; + } & { + data?: Uint8Array | undefined; + path?: string | undefined; + height?: number | undefined; + prove?: boolean | undefined; + } & { [K_69 in Exclude]: never; }) | undefined; + beginBlock?: ({ + hash?: Uint8Array | undefined; + header?: { + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } | undefined; + lastCommitInfo?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } | undefined; + byzantineValidators?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + } & { + hash?: Uint8Array | undefined; + header?: ({ + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + version?: ({ + block?: number | undefined; + app?: number | undefined; + } & { + block?: number | undefined; + app?: number | undefined; + } & { [K_70 in Exclude]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_71 in Exclude]: never; }) | undefined; + } & { [K_72 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_73 in Exclude]: never; }) | undefined; + lastCommitInfo?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_74 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_75 in Exclude]: never; })[] & { [K_76 in Exclude]: never; }) | undefined; + } & { [K_77 in Exclude]: never; }) | undefined; + byzantineValidators?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_78 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_79 in Exclude]: never; })[] & { [K_80 in Exclude]: never; }) | undefined; + } & { [K_81 in Exclude]: never; }) | undefined; + checkTx?: ({ + tx?: Uint8Array | undefined; + type?: CheckTxType | undefined; + } & { + tx?: Uint8Array | undefined; + type?: CheckTxType | undefined; + } & { [K_82 in Exclude]: never; }) | undefined; + deliverTx?: ({ + tx?: Uint8Array | undefined; + } & { + tx?: Uint8Array | undefined; + } & { [K_83 in Exclude]: never; }) | undefined; + endBlock?: ({ + height?: number | undefined; + } & { + height?: number | undefined; + } & { [K_84 in Exclude]: never; }) | undefined; + commit?: ({} & {} & { [K_85 in Exclude]: never; }) | undefined; + listSnapshots?: ({} & {} & { [K_86 in Exclude]: never; }) | undefined; + offerSnapshot?: ({ + snapshot?: { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } | undefined; + appHash?: Uint8Array | undefined; + } & { + snapshot?: ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { [K_87 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_88 in Exclude]: never; }) | undefined; + loadSnapshotChunk?: ({ + height?: number | undefined; + format?: number | undefined; + chunk?: number | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunk?: number | undefined; + } & { [K_89 in Exclude]: never; }) | undefined; + applySnapshotChunk?: ({ + index?: number | undefined; + chunk?: Uint8Array | undefined; + sender?: string | undefined; + } & { + index?: number | undefined; + chunk?: Uint8Array | undefined; + sender?: string | undefined; + } & { [K_90 in Exclude]: never; }) | undefined; + prepareProposal?: ({ + maxTxBytes?: number | undefined; + txs?: Uint8Array[] | undefined; + localLastCommit?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } | undefined; + misbehavior?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + maxTxBytes?: number | undefined; + txs?: (Uint8Array[] & Uint8Array[] & { [K_91 in Exclude]: never; }) | undefined; + localLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_92 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_93 in Exclude]: never; })[] & { [K_94 in Exclude]: never; }) | undefined; + } & { [K_95 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_96 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_97 in Exclude]: never; })[] & { [K_98 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_99 in Exclude]: never; }) | undefined; + processProposal?: ({ + txs?: Uint8Array[] | undefined; + proposedLastCommit?: { + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } | undefined; + misbehavior?: { + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + txs?: (Uint8Array[] & Uint8Array[] & { [K_100 in Exclude]: never; }) | undefined; + proposedLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_101 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_102 in Exclude]: never; })[] & { [K_103 in Exclude]: never; }) | undefined; + } & { [K_104 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_105 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_106 in Exclude]: never; })[] & { [K_107 in Exclude]: never; }) | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_108 in Exclude]: never; }) | undefined; + } & { [K_109 in Exclude]: never; }>(object: I_1): Request; +}; +export declare const RequestEcho: { + encode(message: RequestEcho, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestEcho; + fromJSON(object: any): RequestEcho; + toJSON(message: RequestEcho): unknown; + create]: never; }>(base?: I | undefined): RequestEcho; + fromPartial]: never; }>(object: I_1): RequestEcho; +}; +export declare const RequestFlush: { + encode(_: RequestFlush, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestFlush; + fromJSON(_: any): RequestFlush; + toJSON(_: RequestFlush): unknown; + create]: never; }>(base?: I | undefined): RequestFlush; + fromPartial]: never; }>(_: I_1): RequestFlush; +}; +export declare const RequestInfo: { + encode(message: RequestInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestInfo; + fromJSON(object: any): RequestInfo; + toJSON(message: RequestInfo): unknown; + create]: never; }>(base?: I | undefined): RequestInfo; + fromPartial]: never; }>(object: I_1): RequestInfo; +}; +export declare const RequestInitChain: { + encode(message: RequestInitChain, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestInitChain; + fromJSON(object: any): RequestInitChain; + toJSON(message: RequestInitChain): unknown; + create]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_8 in Exclude]: never; })[] & { [K_9 in Exclude]: never; }) | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { [K_10 in Exclude]: never; }>(base?: I | undefined): RequestInitChain; + fromPartial]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_14 in Exclude]: never; }) | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_19 in Exclude]: never; })[] & { [K_20 in Exclude]: never; }) | undefined; + appStateBytes?: Uint8Array | undefined; + initialHeight?: number | undefined; + } & { [K_21 in Exclude]: never; }>(object: I_1): RequestInitChain; +}; +export declare const RequestQuery: { + encode(message: RequestQuery, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestQuery; + fromJSON(object: any): RequestQuery; + toJSON(message: RequestQuery): unknown; + create]: never; }>(base?: I | undefined): RequestQuery; + fromPartial]: never; }>(object: I_1): RequestQuery; +}; +export declare const RequestBeginBlock: { + encode(message: RequestBeginBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestBeginBlock; + fromJSON(object: any): RequestBeginBlock; + toJSON(message: RequestBeginBlock): unknown; + create]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + lastCommitInfo?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_5 in Exclude]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + byzantineValidators?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_9 in Exclude]: never; })[] & { [K_10 in Exclude]: never; }) | undefined; + } & { [K_11 in Exclude]: never; }>(base?: I | undefined): RequestBeginBlock; + fromPartial]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + lastCommitInfo?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_16 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_17 in Exclude]: never; })[] & { [K_18 in Exclude]: never; }) | undefined; + } & { [K_19 in Exclude]: never; }) | undefined; + byzantineValidators?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_20 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_21 in Exclude]: never; })[] & { [K_22 in Exclude]: never; }) | undefined; + } & { [K_23 in Exclude]: never; }>(object: I_1): RequestBeginBlock; +}; +export declare const RequestCheckTx: { + encode(message: RequestCheckTx, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestCheckTx; + fromJSON(object: any): RequestCheckTx; + toJSON(message: RequestCheckTx): unknown; + create]: never; }>(base?: I | undefined): RequestCheckTx; + fromPartial]: never; }>(object: I_1): RequestCheckTx; +}; +export declare const RequestDeliverTx: { + encode(message: RequestDeliverTx, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestDeliverTx; + fromJSON(object: any): RequestDeliverTx; + toJSON(message: RequestDeliverTx): unknown; + create]: never; }>(base?: I | undefined): RequestDeliverTx; + fromPartial]: never; }>(object: I_1): RequestDeliverTx; +}; +export declare const RequestEndBlock: { + encode(message: RequestEndBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestEndBlock; + fromJSON(object: any): RequestEndBlock; + toJSON(message: RequestEndBlock): unknown; + create]: never; }>(base?: I | undefined): RequestEndBlock; + fromPartial]: never; }>(object: I_1): RequestEndBlock; +}; +export declare const RequestCommit: { + encode(_: RequestCommit, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestCommit; + fromJSON(_: any): RequestCommit; + toJSON(_: RequestCommit): unknown; + create]: never; }>(base?: I | undefined): RequestCommit; + fromPartial]: never; }>(_: I_1): RequestCommit; +}; +export declare const RequestListSnapshots: { + encode(_: RequestListSnapshots, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestListSnapshots; + fromJSON(_: any): RequestListSnapshots; + toJSON(_: RequestListSnapshots): unknown; + create]: never; }>(base?: I | undefined): RequestListSnapshots; + fromPartial]: never; }>(_: I_1): RequestListSnapshots; +}; +export declare const RequestOfferSnapshot: { + encode(message: RequestOfferSnapshot, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestOfferSnapshot; + fromJSON(object: any): RequestOfferSnapshot; + toJSON(message: RequestOfferSnapshot): unknown; + create]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): RequestOfferSnapshot; + fromPartial]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): RequestOfferSnapshot; +}; +export declare const RequestLoadSnapshotChunk: { + encode(message: RequestLoadSnapshotChunk, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestLoadSnapshotChunk; + fromJSON(object: any): RequestLoadSnapshotChunk; + toJSON(message: RequestLoadSnapshotChunk): unknown; + create]: never; }>(base?: I | undefined): RequestLoadSnapshotChunk; + fromPartial]: never; }>(object: I_1): RequestLoadSnapshotChunk; +}; +export declare const RequestApplySnapshotChunk: { + encode(message: RequestApplySnapshotChunk, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestApplySnapshotChunk; + fromJSON(object: any): RequestApplySnapshotChunk; + toJSON(message: RequestApplySnapshotChunk): unknown; + create]: never; }>(base?: I | undefined): RequestApplySnapshotChunk; + fromPartial]: never; }>(object: I_1): RequestApplySnapshotChunk; +}; +export declare const RequestPrepareProposal: { + encode(message: RequestPrepareProposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestPrepareProposal; + fromJSON(object: any): RequestPrepareProposal; + toJSON(message: RequestPrepareProposal): unknown; + create]: never; }) | undefined; + localLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_6 in Exclude]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_8 in Exclude]: never; }>(base?: I | undefined): RequestPrepareProposal; + fromPartial]: never; }) | undefined; + localLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_15 in Exclude]: never; })[] & { [K_16 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_17 in Exclude]: never; }>(object: I_1): RequestPrepareProposal; +}; +export declare const RequestProcessProposal: { + encode(message: RequestProcessProposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): RequestProcessProposal; + fromJSON(object: any): RequestProcessProposal; + toJSON(message: RequestProcessProposal): unknown; + create]: never; }) | undefined; + proposedLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_6 in Exclude]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_8 in Exclude]: never; }>(base?: I | undefined): RequestProcessProposal; + fromPartial]: never; }) | undefined; + proposedLastCommit?: ({ + round?: number | undefined; + votes?: { + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] | undefined; + } & { + round?: number | undefined; + votes?: ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + }[] & ({ + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + signedLastBlock?: boolean | undefined; + } & { + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + misbehavior?: ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + }[] & ({ + type?: MisbehaviorType | undefined; + validator?: { + address?: Uint8Array | undefined; + power?: number | undefined; + } | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { + type?: MisbehaviorType | undefined; + validator?: ({ + address?: Uint8Array | undefined; + power?: number | undefined; + } & { + address?: Uint8Array | undefined; + power?: number | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_15 in Exclude]: never; })[] & { [K_16 in Exclude]: never; }) | undefined; + hash?: Uint8Array | undefined; + height?: number | undefined; + time?: Date | undefined; + nextValidatorsHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_17 in Exclude]: never; }>(object: I_1): RequestProcessProposal; +}; +export declare const Response: { + encode(message: Response, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Response; + fromJSON(object: any): Response; + toJSON(message: Response): unknown; + create]: never; }) | undefined; + echo?: ({ + message?: string | undefined; + } & { + message?: string | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + flush?: ({} & {} & { [K_2 in Exclude]: never; }) | undefined; + info?: ({ + data?: string | undefined; + version?: string | undefined; + appVersion?: number | undefined; + lastBlockHeight?: number | undefined; + lastBlockAppHash?: Uint8Array | undefined; + } & { + data?: string | undefined; + version?: string | undefined; + appVersion?: number | undefined; + lastBlockHeight?: number | undefined; + lastBlockAppHash?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + initChain?: ({ + consensusParams?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + validators?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + appHash?: Uint8Array | undefined; + } & { + consensusParams?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_7 in Exclude]: never; }) | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_11 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_12 in Exclude]: never; })[] & { [K_13 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + query?: ({ + code?: number | undefined; + log?: string | undefined; + info?: string | undefined; + index?: number | undefined; + key?: Uint8Array | undefined; + value?: Uint8Array | undefined; + proofOps?: { + ops?: { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] | undefined; + } | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { + code?: number | undefined; + log?: string | undefined; + info?: string | undefined; + index?: number | undefined; + key?: Uint8Array | undefined; + value?: Uint8Array | undefined; + proofOps?: ({ + ops?: { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] | undefined; + } & { + ops?: ({ + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] & ({ + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + } & { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + } & { [K_15 in Exclude]: never; })[] & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; }) | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + beginBlock?: ({ + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + } & { + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_19 in Exclude]: never; })[] & { [K_20 in Exclude]: never; }) | undefined; + } & { [K_21 in Exclude]: never; })[] & { [K_22 in Exclude]: never; }) | undefined; + } & { [K_23 in Exclude]: never; }) | undefined; + checkTx?: ({ + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_24 in Exclude]: never; })[] & { [K_25 in Exclude]: never; }) | undefined; + } & { [K_26 in Exclude]: never; })[] & { [K_27 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { [K_28 in Exclude]: never; }) | undefined; + deliverTx?: ({ + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + codespace?: string | undefined; + } & { + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_29 in Exclude]: never; })[] & { [K_30 in Exclude]: never; }) | undefined; + } & { [K_31 in Exclude]: never; })[] & { [K_32 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_33 in Exclude]: never; }) | undefined; + endBlock?: ({ + validatorUpdates?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + consensusParamUpdates?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + } & { + validatorUpdates?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_34 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_35 in Exclude]: never; })[] & { [K_36 in Exclude]: never; }) | undefined; + consensusParamUpdates?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_37 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_38 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_39 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_40 in Exclude]: never; }) | undefined; + } & { [K_41 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_42 in Exclude]: never; }) | undefined; + } & { [K_43 in Exclude]: never; }) | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_44 in Exclude]: never; })[] & { [K_45 in Exclude]: never; }) | undefined; + } & { [K_46 in Exclude]: never; })[] & { [K_47 in Exclude]: never; }) | undefined; + } & { [K_48 in Exclude]: never; }) | undefined; + commit?: ({ + data?: Uint8Array | undefined; + retainHeight?: number | undefined; + } & { + data?: Uint8Array | undefined; + retainHeight?: number | undefined; + } & { [K_49 in Exclude]: never; }) | undefined; + listSnapshots?: ({ + snapshots?: { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + }[] | undefined; + } & { + snapshots?: ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + }[] & ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { [K_50 in Exclude]: never; })[] & { [K_51 in Exclude]: never; }) | undefined; + } & { [K_52 in Exclude]: never; }) | undefined; + offerSnapshot?: ({ + result?: ResponseOfferSnapshot_Result | undefined; + } & { + result?: ResponseOfferSnapshot_Result | undefined; + } & { [K_53 in Exclude]: never; }) | undefined; + loadSnapshotChunk?: ({ + chunk?: Uint8Array | undefined; + } & { + chunk?: Uint8Array | undefined; + } & { [K_54 in Exclude]: never; }) | undefined; + applySnapshotChunk?: ({ + result?: ResponseApplySnapshotChunk_Result | undefined; + refetchChunks?: number[] | undefined; + rejectSenders?: string[] | undefined; + } & { + result?: ResponseApplySnapshotChunk_Result | undefined; + refetchChunks?: (number[] & number[] & { [K_55 in Exclude]: never; }) | undefined; + rejectSenders?: (string[] & string[] & { [K_56 in Exclude]: never; }) | undefined; + } & { [K_57 in Exclude]: never; }) | undefined; + prepareProposal?: ({ + txs?: Uint8Array[] | undefined; + } & { + txs?: (Uint8Array[] & Uint8Array[] & { [K_58 in Exclude]: never; }) | undefined; + } & { [K_59 in Exclude]: never; }) | undefined; + processProposal?: ({ + status?: ResponseProcessProposal_ProposalStatus | undefined; + } & { + status?: ResponseProcessProposal_ProposalStatus | undefined; + } & { [K_60 in Exclude]: never; }) | undefined; + } & { [K_61 in Exclude]: never; }>(base?: I | undefined): Response; + fromPartial]: never; }) | undefined; + echo?: ({ + message?: string | undefined; + } & { + message?: string | undefined; + } & { [K_63 in Exclude]: never; }) | undefined; + flush?: ({} & {} & { [K_64 in Exclude]: never; }) | undefined; + info?: ({ + data?: string | undefined; + version?: string | undefined; + appVersion?: number | undefined; + lastBlockHeight?: number | undefined; + lastBlockAppHash?: Uint8Array | undefined; + } & { + data?: string | undefined; + version?: string | undefined; + appVersion?: number | undefined; + lastBlockHeight?: number | undefined; + lastBlockAppHash?: Uint8Array | undefined; + } & { [K_65 in Exclude]: never; }) | undefined; + initChain?: ({ + consensusParams?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + validators?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + appHash?: Uint8Array | undefined; + } & { + consensusParams?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_66 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_67 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_68 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_69 in Exclude]: never; }) | undefined; + } & { [K_70 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_71 in Exclude]: never; }) | undefined; + } & { [K_72 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_73 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_74 in Exclude]: never; })[] & { [K_75 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_76 in Exclude]: never; }) | undefined; + query?: ({ + code?: number | undefined; + log?: string | undefined; + info?: string | undefined; + index?: number | undefined; + key?: Uint8Array | undefined; + value?: Uint8Array | undefined; + proofOps?: { + ops?: { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] | undefined; + } | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { + code?: number | undefined; + log?: string | undefined; + info?: string | undefined; + index?: number | undefined; + key?: Uint8Array | undefined; + value?: Uint8Array | undefined; + proofOps?: ({ + ops?: { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] | undefined; + } & { + ops?: ({ + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + }[] & ({ + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + } & { + type?: string | undefined; + key?: Uint8Array | undefined; + data?: Uint8Array | undefined; + } & { [K_77 in Exclude]: never; })[] & { [K_78 in Exclude]: never; }) | undefined; + } & { [K_79 in Exclude]: never; }) | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { [K_80 in Exclude]: never; }) | undefined; + beginBlock?: ({ + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + } & { + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_81 in Exclude]: never; })[] & { [K_82 in Exclude]: never; }) | undefined; + } & { [K_83 in Exclude]: never; })[] & { [K_84 in Exclude]: never; }) | undefined; + } & { [K_85 in Exclude]: never; }) | undefined; + checkTx?: ({ + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_86 in Exclude]: never; })[] & { [K_87 in Exclude]: never; }) | undefined; + } & { [K_88 in Exclude]: never; })[] & { [K_89 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { [K_90 in Exclude]: never; }) | undefined; + deliverTx?: ({ + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + codespace?: string | undefined; + } & { + code?: number | undefined; + data?: Uint8Array | undefined; + log?: string | undefined; + info?: string | undefined; + gasWanted?: number | undefined; + gasUsed?: number | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_91 in Exclude]: never; })[] & { [K_92 in Exclude]: never; }) | undefined; + } & { [K_93 in Exclude]: never; })[] & { [K_94 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_95 in Exclude]: never; }) | undefined; + endBlock?: ({ + validatorUpdates?: { + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] | undefined; + consensusParamUpdates?: { + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } | undefined; + events?: { + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] | undefined; + } & { + validatorUpdates?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_96 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_97 in Exclude]: never; })[] & { [K_98 in Exclude]: never; }) | undefined; + consensusParamUpdates?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_99 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_100 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_101 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_102 in Exclude]: never; }) | undefined; + } & { [K_103 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_104 in Exclude]: never; }) | undefined; + } & { [K_105 in Exclude]: never; }) | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_106 in Exclude]: never; })[] & { [K_107 in Exclude]: never; }) | undefined; + } & { [K_108 in Exclude]: never; })[] & { [K_109 in Exclude]: never; }) | undefined; + } & { [K_110 in Exclude]: never; }) | undefined; + commit?: ({ + data?: Uint8Array | undefined; + retainHeight?: number | undefined; + } & { + data?: Uint8Array | undefined; + retainHeight?: number | undefined; + } & { [K_111 in Exclude]: never; }) | undefined; + listSnapshots?: ({ + snapshots?: { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + }[] | undefined; + } & { + snapshots?: ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + }[] & ({ + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { + height?: number | undefined; + format?: number | undefined; + chunks?: number | undefined; + hash?: Uint8Array | undefined; + metadata?: Uint8Array | undefined; + } & { [K_112 in Exclude]: never; })[] & { [K_113 in Exclude]: never; }) | undefined; + } & { [K_114 in Exclude]: never; }) | undefined; + offerSnapshot?: ({ + result?: ResponseOfferSnapshot_Result | undefined; + } & { + result?: ResponseOfferSnapshot_Result | undefined; + } & { [K_115 in Exclude]: never; }) | undefined; + loadSnapshotChunk?: ({ + chunk?: Uint8Array | undefined; + } & { + chunk?: Uint8Array | undefined; + } & { [K_116 in Exclude]: never; }) | undefined; + applySnapshotChunk?: ({ + result?: ResponseApplySnapshotChunk_Result | undefined; + refetchChunks?: number[] | undefined; + rejectSenders?: string[] | undefined; + } & { + result?: ResponseApplySnapshotChunk_Result | undefined; + refetchChunks?: (number[] & number[] & { [K_117 in Exclude]: never; }) | undefined; + rejectSenders?: (string[] & string[] & { [K_118 in Exclude]: never; }) | undefined; + } & { [K_119 in Exclude]: never; }) | undefined; + prepareProposal?: ({ + txs?: Uint8Array[] | undefined; + } & { + txs?: (Uint8Array[] & Uint8Array[] & { [K_120 in Exclude]: never; }) | undefined; + } & { [K_121 in Exclude]: never; }) | undefined; + processProposal?: ({ + status?: ResponseProcessProposal_ProposalStatus | undefined; + } & { + status?: ResponseProcessProposal_ProposalStatus | undefined; + } & { [K_122 in Exclude]: never; }) | undefined; + } & { [K_123 in Exclude]: never; }>(object: I_1): Response; +}; +export declare const ResponseException: { + encode(message: ResponseException, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseException; + fromJSON(object: any): ResponseException; + toJSON(message: ResponseException): unknown; + create]: never; }>(base?: I | undefined): ResponseException; + fromPartial]: never; }>(object: I_1): ResponseException; +}; +export declare const ResponseEcho: { + encode(message: ResponseEcho, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEcho; + fromJSON(object: any): ResponseEcho; + toJSON(message: ResponseEcho): unknown; + create]: never; }>(base?: I | undefined): ResponseEcho; + fromPartial]: never; }>(object: I_1): ResponseEcho; +}; +export declare const ResponseFlush: { + encode(_: ResponseFlush, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseFlush; + fromJSON(_: any): ResponseFlush; + toJSON(_: ResponseFlush): unknown; + create]: never; }>(base?: I | undefined): ResponseFlush; + fromPartial]: never; }>(_: I_1): ResponseFlush; +}; +export declare const ResponseInfo: { + encode(message: ResponseInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInfo; + fromJSON(object: any): ResponseInfo; + toJSON(message: ResponseInfo): unknown; + create]: never; }>(base?: I | undefined): ResponseInfo; + fromPartial]: never; }>(object: I_1): ResponseInfo; +}; +export declare const ResponseInitChain: { + encode(message: ResponseInitChain, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInitChain; + fromJSON(object: any): ResponseInitChain; + toJSON(message: ResponseInitChain): unknown; + create]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_8 in Exclude]: never; })[] & { [K_9 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_10 in Exclude]: never; }>(base?: I | undefined): ResponseInitChain; + fromPartial]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_14 in Exclude]: never; }) | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_16 in Exclude]: never; }) | undefined; + } & { [K_17 in Exclude]: never; }) | undefined; + validators?: ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + }[] & ({ + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + power?: number | undefined; + } & { + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + power?: number | undefined; + } & { [K_19 in Exclude]: never; })[] & { [K_20 in Exclude]: never; }) | undefined; + appHash?: Uint8Array | undefined; + } & { [K_21 in Exclude]: never; }>(object: I_1): ResponseInitChain; +}; +export declare const ResponseQuery: { + encode(message: ResponseQuery, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseQuery; + fromJSON(object: any): ResponseQuery; + toJSON(message: ResponseQuery): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { [K_3 in Exclude]: never; }>(base?: I | undefined): ResponseQuery; + fromPartial]: never; })[] & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + height?: number | undefined; + codespace?: string | undefined; + } & { [K_7 in Exclude]: never; }>(object: I_1): ResponseQuery; +}; +export declare const ResponseBeginBlock: { + encode(message: ResponseBeginBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseBeginBlock; + fromJSON(object: any): ResponseBeginBlock; + toJSON(message: ResponseBeginBlock): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }>(base?: I | undefined): ResponseBeginBlock; + fromPartial]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }>(object: I_1): ResponseBeginBlock; +}; +export declare const ResponseCheckTx: { + encode(message: ResponseCheckTx, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCheckTx; + fromJSON(object: any): ResponseCheckTx; + toJSON(message: ResponseCheckTx): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { [K_4 in Exclude]: never; }>(base?: I | undefined): ResponseCheckTx; + fromPartial]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + sender?: string | undefined; + priority?: number | undefined; + mempoolError?: string | undefined; + } & { [K_9 in Exclude]: never; }>(object: I_1): ResponseCheckTx; +}; +export declare const ResponseDeliverTx: { + encode(message: ResponseDeliverTx, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseDeliverTx; + fromJSON(object: any): ResponseDeliverTx; + toJSON(message: ResponseDeliverTx): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_4 in Exclude]: never; }>(base?: I | undefined): ResponseDeliverTx; + fromPartial]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_9 in Exclude]: never; }>(object: I_1): ResponseDeliverTx; +}; +export declare const ResponseEndBlock: { + encode(message: ResponseEndBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEndBlock; + fromJSON(object: any): ResponseEndBlock; + toJSON(message: ResponseEndBlock): unknown; + create]: never; }) | undefined; + power?: number | undefined; + } & { [K_1 in Exclude]: never; })[] & { [K_2 in Exclude]: never; }) | undefined; + consensusParamUpdates?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_10 in Exclude]: never; })[] & { [K_11 in Exclude]: never; }) | undefined; + } & { [K_12 in Exclude]: never; })[] & { [K_13 in Exclude]: never; }) | undefined; + } & { [K_14 in Exclude]: never; }>(base?: I | undefined): ResponseEndBlock; + fromPartial]: never; }) | undefined; + power?: number | undefined; + } & { [K_16 in Exclude]: never; })[] & { [K_17 in Exclude]: never; }) | undefined; + consensusParamUpdates?: ({ + block?: { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } | undefined; + evidence?: { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } | undefined; + validator?: { + pubKeyTypes?: string[] | undefined; + } | undefined; + version?: { + app?: number | undefined; + } | undefined; + } & { + block?: ({ + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { + maxBytes?: number | undefined; + maxGas?: number | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_19 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_20 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_21 in Exclude]: never; }) | undefined; + } & { [K_22 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_23 in Exclude]: never; }) | undefined; + } & { [K_24 in Exclude]: never; }) | undefined; + events?: ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + }[] & ({ + type?: string | undefined; + attributes?: { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] | undefined; + } & { + type?: string | undefined; + attributes?: ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + }[] & ({ + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { + key?: string | undefined; + value?: string | undefined; + index?: boolean | undefined; + } & { [K_25 in Exclude]: never; })[] & { [K_26 in Exclude]: never; }) | undefined; + } & { [K_27 in Exclude]: never; })[] & { [K_28 in Exclude]: never; }) | undefined; + } & { [K_29 in Exclude]: never; }>(object: I_1): ResponseEndBlock; +}; +export declare const ResponseCommit: { + encode(message: ResponseCommit, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCommit; + fromJSON(object: any): ResponseCommit; + toJSON(message: ResponseCommit): unknown; + create]: never; }>(base?: I | undefined): ResponseCommit; + fromPartial]: never; }>(object: I_1): ResponseCommit; +}; +export declare const ResponseListSnapshots: { + encode(message: ResponseListSnapshots, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseListSnapshots; + fromJSON(object: any): ResponseListSnapshots; + toJSON(message: ResponseListSnapshots): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): ResponseListSnapshots; + fromPartial]: never; })[] & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): ResponseListSnapshots; +}; +export declare const ResponseOfferSnapshot: { + encode(message: ResponseOfferSnapshot, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseOfferSnapshot; + fromJSON(object: any): ResponseOfferSnapshot; + toJSON(message: ResponseOfferSnapshot): unknown; + create]: never; }>(base?: I | undefined): ResponseOfferSnapshot; + fromPartial]: never; }>(object: I_1): ResponseOfferSnapshot; +}; +export declare const ResponseLoadSnapshotChunk: { + encode(message: ResponseLoadSnapshotChunk, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseLoadSnapshotChunk; + fromJSON(object: any): ResponseLoadSnapshotChunk; + toJSON(message: ResponseLoadSnapshotChunk): unknown; + create]: never; }>(base?: I | undefined): ResponseLoadSnapshotChunk; + fromPartial]: never; }>(object: I_1): ResponseLoadSnapshotChunk; +}; +export declare const ResponseApplySnapshotChunk: { + encode(message: ResponseApplySnapshotChunk, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseApplySnapshotChunk; + fromJSON(object: any): ResponseApplySnapshotChunk; + toJSON(message: ResponseApplySnapshotChunk): unknown; + create]: never; }) | undefined; + rejectSenders?: (string[] & string[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): ResponseApplySnapshotChunk; + fromPartial]: never; }) | undefined; + rejectSenders?: (string[] & string[] & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): ResponseApplySnapshotChunk; +}; +export declare const ResponsePrepareProposal: { + encode(message: ResponsePrepareProposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponsePrepareProposal; + fromJSON(object: any): ResponsePrepareProposal; + toJSON(message: ResponsePrepareProposal): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): ResponsePrepareProposal; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): ResponsePrepareProposal; +}; +export declare const ResponseProcessProposal: { + encode(message: ResponseProcessProposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ResponseProcessProposal; + fromJSON(object: any): ResponseProcessProposal; + toJSON(message: ResponseProcessProposal): unknown; + create]: never; }>(base?: I | undefined): ResponseProcessProposal; + fromPartial]: never; }>(object: I_1): ResponseProcessProposal; +}; +export declare const CommitInfo: { + encode(message: CommitInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): CommitInfo; + fromJSON(object: any): CommitInfo; + toJSON(message: CommitInfo): unknown; + create]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_1 in Exclude]: never; })[] & { [K_2 in Exclude]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(base?: I | undefined): CommitInfo; + fromPartial]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_5 in Exclude]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }>(object: I_1): CommitInfo; +}; +export declare const ExtendedCommitInfo: { + encode(message: ExtendedCommitInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ExtendedCommitInfo; + fromJSON(object: any): ExtendedCommitInfo; + toJSON(message: ExtendedCommitInfo): unknown; + create]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; })[] & { [K_2 in Exclude]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(base?: I | undefined): ExtendedCommitInfo; + fromPartial]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; })[] & { [K_6 in Exclude]: never; }) | undefined; + } & { [K_7 in Exclude]: never; }>(object: I_1): ExtendedCommitInfo; +}; +export declare const Event: { + encode(message: Event, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Event; + fromJSON(object: any): Event; + toJSON(message: Event): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): Event; + fromPartial]: never; })[] & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): Event; +}; +export declare const EventAttribute: { + encode(message: EventAttribute, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): EventAttribute; + fromJSON(object: any): EventAttribute; + toJSON(message: EventAttribute): unknown; + create]: never; }>(base?: I | undefined): EventAttribute; + fromPartial]: never; }>(object: I_1): EventAttribute; +}; +export declare const TxResult: { + encode(message: TxResult, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): TxResult; + fromJSON(object: any): TxResult; + toJSON(message: TxResult): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(base?: I | undefined): TxResult; + fromPartial]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + } & { [K_8 in Exclude]: never; })[] & { [K_9 in Exclude]: never; }) | undefined; + codespace?: string | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + } & { [K_11 in Exclude]: never; }>(object: I_1): TxResult; +}; +export declare const Validator: { + encode(message: Validator, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Validator; + fromJSON(object: any): Validator; + toJSON(message: Validator): unknown; + create]: never; }>(base?: I | undefined): Validator; + fromPartial]: never; }>(object: I_1): Validator; +}; +export declare const ValidatorUpdate: { + encode(message: ValidatorUpdate, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorUpdate; + fromJSON(object: any): ValidatorUpdate; + toJSON(message: ValidatorUpdate): unknown; + create]: never; }) | undefined; + power?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): ValidatorUpdate; + fromPartial]: never; }) | undefined; + power?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): ValidatorUpdate; +}; +export declare const VoteInfo: { + encode(message: VoteInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): VoteInfo; + fromJSON(object: any): VoteInfo; + toJSON(message: VoteInfo): unknown; + create]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): VoteInfo; + fromPartial]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): VoteInfo; +}; +export declare const ExtendedVoteInfo: { + encode(message: ExtendedVoteInfo, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ExtendedVoteInfo; + fromJSON(object: any): ExtendedVoteInfo; + toJSON(message: ExtendedVoteInfo): unknown; + create]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): ExtendedVoteInfo; + fromPartial]: never; }) | undefined; + signedLastBlock?: boolean | undefined; + voteExtension?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): ExtendedVoteInfo; +}; +export declare const Misbehavior: { + encode(message: Misbehavior, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Misbehavior; + fromJSON(object: any): Misbehavior; + toJSON(message: Misbehavior): unknown; + create]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): Misbehavior; + fromPartial]: never; }) | undefined; + height?: number | undefined; + time?: Date | undefined; + totalVotingPower?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): Misbehavior; +}; +export declare const Snapshot: { + encode(message: Snapshot, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot; + fromJSON(object: any): Snapshot; + toJSON(message: Snapshot): unknown; + create]: never; }>(base?: I | undefined): Snapshot; + fromPartial]: never; }>(object: I_1): Snapshot; +}; +export interface ABCIApplication { + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + DeliverTx(request: RequestDeliverTx): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + BeginBlock(request: RequestBeginBlock): Promise; + EndBlock(request: RequestEndBlock): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; +} +export declare class ABCIApplicationClientImpl implements ABCIApplication { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + Echo(request: RequestEcho): Promise; + Flush(request: RequestFlush): Promise; + Info(request: RequestInfo): Promise; + DeliverTx(request: RequestDeliverTx): Promise; + CheckTx(request: RequestCheckTx): Promise; + Query(request: RequestQuery): Promise; + Commit(request: RequestCommit): Promise; + InitChain(request: RequestInitChain): Promise; + BeginBlock(request: RequestBeginBlock): Promise; + EndBlock(request: RequestEndBlock): Promise; + ListSnapshots(request: RequestListSnapshots): Promise; + OfferSnapshot(request: RequestOfferSnapshot): Promise; + LoadSnapshotChunk(request: RequestLoadSnapshotChunk): Promise; + ApplySnapshotChunk(request: RequestApplySnapshotChunk): Promise; + PrepareProposal(request: RequestPrepareProposal): Promise; + ProcessProposal(request: RequestProcessProposal): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/tendermint/abci/types.js b/dist/module/tendermint/abci/types.js new file mode 100644 index 0000000..0fd813f --- /dev/null +++ b/dist/module/tendermint/abci/types.js @@ -0,0 +1,4877 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { PublicKey } from "../crypto/keys"; +import { ProofOps } from "../crypto/proof"; +import { ConsensusParams } from "../types/params"; +import { Header } from "../types/types"; +export const protobufPackage = "tendermint.abci"; +export var CheckTxType; +(function (CheckTxType) { + CheckTxType[CheckTxType["NEW"] = 0] = "NEW"; + CheckTxType[CheckTxType["RECHECK"] = 1] = "RECHECK"; + CheckTxType[CheckTxType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(CheckTxType || (CheckTxType = {})); +export function checkTxTypeFromJSON(object) { + switch (object) { + case 0: + case "NEW": + return CheckTxType.NEW; + case 1: + case "RECHECK": + return CheckTxType.RECHECK; + case -1: + case "UNRECOGNIZED": + default: + return CheckTxType.UNRECOGNIZED; + } +} +export function checkTxTypeToJSON(object) { + switch (object) { + case CheckTxType.NEW: + return "NEW"; + case CheckTxType.RECHECK: + return "RECHECK"; + case CheckTxType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var MisbehaviorType; +(function (MisbehaviorType) { + MisbehaviorType[MisbehaviorType["UNKNOWN"] = 0] = "UNKNOWN"; + MisbehaviorType[MisbehaviorType["DUPLICATE_VOTE"] = 1] = "DUPLICATE_VOTE"; + MisbehaviorType[MisbehaviorType["LIGHT_CLIENT_ATTACK"] = 2] = "LIGHT_CLIENT_ATTACK"; + MisbehaviorType[MisbehaviorType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(MisbehaviorType || (MisbehaviorType = {})); +export function misbehaviorTypeFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} +export function misbehaviorTypeToJSON(object) { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var ResponseOfferSnapshot_Result; +(function (ResponseOfferSnapshot_Result) { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["UNKNOWN"] = 0] = "UNKNOWN"; + /** ACCEPT - Snapshot accepted, apply chunks */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["ACCEPT"] = 1] = "ACCEPT"; + /** ABORT - Abort all snapshot restoration */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["ABORT"] = 2] = "ABORT"; + /** REJECT - Reject this specific snapshot, try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT"] = 3] = "REJECT"; + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT_FORMAT"] = 4] = "REJECT_FORMAT"; + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT_SENDER"] = 5] = "REJECT_SENDER"; + ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseOfferSnapshot_Result || (ResponseOfferSnapshot_Result = {})); +export function responseOfferSnapshot_ResultFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseOfferSnapshot_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseOfferSnapshot_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseOfferSnapshot_Result.ABORT; + case 3: + case "REJECT": + return ResponseOfferSnapshot_Result.REJECT; + case 4: + case "REJECT_FORMAT": + return ResponseOfferSnapshot_Result.REJECT_FORMAT; + case 5: + case "REJECT_SENDER": + return ResponseOfferSnapshot_Result.REJECT_SENDER; + case -1: + case "UNRECOGNIZED": + default: + return ResponseOfferSnapshot_Result.UNRECOGNIZED; + } +} +export function responseOfferSnapshot_ResultToJSON(object) { + switch (object) { + case ResponseOfferSnapshot_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseOfferSnapshot_Result.ACCEPT: + return "ACCEPT"; + case ResponseOfferSnapshot_Result.ABORT: + return "ABORT"; + case ResponseOfferSnapshot_Result.REJECT: + return "REJECT"; + case ResponseOfferSnapshot_Result.REJECT_FORMAT: + return "REJECT_FORMAT"; + case ResponseOfferSnapshot_Result.REJECT_SENDER: + return "REJECT_SENDER"; + case ResponseOfferSnapshot_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var ResponseApplySnapshotChunk_Result; +(function (ResponseApplySnapshotChunk_Result) { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["UNKNOWN"] = 0] = "UNKNOWN"; + /** ACCEPT - Chunk successfully accepted */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["ACCEPT"] = 1] = "ACCEPT"; + /** ABORT - Abort all snapshot restoration */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["ABORT"] = 2] = "ABORT"; + /** RETRY - Retry chunk (combine with refetch and reject) */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["RETRY"] = 3] = "RETRY"; + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["RETRY_SNAPSHOT"] = 4] = "RETRY_SNAPSHOT"; + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["REJECT_SNAPSHOT"] = 5] = "REJECT_SNAPSHOT"; + ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseApplySnapshotChunk_Result || (ResponseApplySnapshotChunk_Result = {})); +export function responseApplySnapshotChunk_ResultFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseApplySnapshotChunk_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseApplySnapshotChunk_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseApplySnapshotChunk_Result.ABORT; + case 3: + case "RETRY": + return ResponseApplySnapshotChunk_Result.RETRY; + case 4: + case "RETRY_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT; + case 5: + case "REJECT_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseApplySnapshotChunk_Result.UNRECOGNIZED; + } +} +export function responseApplySnapshotChunk_ResultToJSON(object) { + switch (object) { + case ResponseApplySnapshotChunk_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseApplySnapshotChunk_Result.ACCEPT: + return "ACCEPT"; + case ResponseApplySnapshotChunk_Result.ABORT: + return "ABORT"; + case ResponseApplySnapshotChunk_Result.RETRY: + return "RETRY"; + case ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT: + return "RETRY_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT: + return "REJECT_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export var ResponseProcessProposal_ProposalStatus; +(function (ResponseProcessProposal_ProposalStatus) { + ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["UNKNOWN"] = 0] = "UNKNOWN"; + ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["ACCEPT"] = 1] = "ACCEPT"; + ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["REJECT"] = 2] = "REJECT"; + ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ResponseProcessProposal_ProposalStatus || (ResponseProcessProposal_ProposalStatus = {})); +export function responseProcessProposal_ProposalStatusFromJSON(object) { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} +export function responseProcessProposal_ProposalStatusToJSON(object) { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseRequest() { + return { + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + beginBlock: undefined, + checkTx: undefined, + deliverTx: undefined, + endBlock: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + }; +} +export const Request = { + encode(message, writer = _m0.Writer.create()) { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).ldelim(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim(); + } + if (message.initChain !== undefined) { + RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).ldelim(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + RequestBeginBlock.encode(message.beginBlock, writer.uint32(58).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + RequestDeliverTx.encode(message.deliverTx, writer.uint32(74).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + RequestEndBlock.encode(message.endBlock, writer.uint32(82).fork()).ldelim(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).ldelim(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.echo = RequestEcho.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.flush = RequestFlush.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.info = RequestInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + message.initChain = RequestInitChain.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.query = RequestQuery.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + message.beginBlock = RequestBeginBlock.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + message.deliverTx = RequestDeliverTx.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + message.endBlock = RequestEndBlock.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + message.commit = RequestCommit.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + echo: isSet(object.echo) ? RequestEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) + ? RequestFlush.fromJSON(object.flush) + : undefined, + info: isSet(object.info) ? RequestInfo.fromJSON(object.info) : undefined, + initChain: isSet(object.initChain) + ? RequestInitChain.fromJSON(object.initChain) + : undefined, + query: isSet(object.query) + ? RequestQuery.fromJSON(object.query) + : undefined, + beginBlock: isSet(object.beginBlock) + ? RequestBeginBlock.fromJSON(object.beginBlock) + : undefined, + checkTx: isSet(object.checkTx) + ? RequestCheckTx.fromJSON(object.checkTx) + : undefined, + deliverTx: isSet(object.deliverTx) + ? RequestDeliverTx.fromJSON(object.deliverTx) + : undefined, + endBlock: isSet(object.endBlock) + ? RequestEndBlock.fromJSON(object.endBlock) + : undefined, + commit: isSet(object.commit) + ? RequestCommit.fromJSON(object.commit) + : undefined, + listSnapshots: isSet(object.listSnapshots) + ? RequestListSnapshots.fromJSON(object.listSnapshots) + : undefined, + offerSnapshot: isSet(object.offerSnapshot) + ? RequestOfferSnapshot.fromJSON(object.offerSnapshot) + : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? RequestPrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? RequestProcessProposal.fromJSON(object.processProposal) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.echo !== undefined && + (obj.echo = message.echo ? RequestEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && + (obj.flush = message.flush + ? RequestFlush.toJSON(message.flush) + : undefined); + message.info !== undefined && + (obj.info = message.info ? RequestInfo.toJSON(message.info) : undefined); + message.initChain !== undefined && + (obj.initChain = message.initChain + ? RequestInitChain.toJSON(message.initChain) + : undefined); + message.query !== undefined && + (obj.query = message.query + ? RequestQuery.toJSON(message.query) + : undefined); + message.beginBlock !== undefined && + (obj.beginBlock = message.beginBlock + ? RequestBeginBlock.toJSON(message.beginBlock) + : undefined); + message.checkTx !== undefined && + (obj.checkTx = message.checkTx + ? RequestCheckTx.toJSON(message.checkTx) + : undefined); + message.deliverTx !== undefined && + (obj.deliverTx = message.deliverTx + ? RequestDeliverTx.toJSON(message.deliverTx) + : undefined); + message.endBlock !== undefined && + (obj.endBlock = message.endBlock + ? RequestEndBlock.toJSON(message.endBlock) + : undefined); + message.commit !== undefined && + (obj.commit = message.commit + ? RequestCommit.toJSON(message.commit) + : undefined); + message.listSnapshots !== undefined && + (obj.listSnapshots = message.listSnapshots + ? RequestListSnapshots.toJSON(message.listSnapshots) + : undefined); + message.offerSnapshot !== undefined && + (obj.offerSnapshot = message.offerSnapshot + ? RequestOfferSnapshot.toJSON(message.offerSnapshot) + : undefined); + message.loadSnapshotChunk !== undefined && + (obj.loadSnapshotChunk = message.loadSnapshotChunk + ? RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) + : undefined); + message.applySnapshotChunk !== undefined && + (obj.applySnapshotChunk = message.applySnapshotChunk + ? RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk) + : undefined); + message.prepareProposal !== undefined && + (obj.prepareProposal = message.prepareProposal + ? RequestPrepareProposal.toJSON(message.prepareProposal) + : undefined); + message.processProposal !== undefined && + (obj.processProposal = message.processProposal + ? RequestProcessProposal.toJSON(message.processProposal) + : undefined); + return obj; + }, + create(base) { + return Request.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequest(); + message.echo = + object.echo !== undefined && object.echo !== null + ? RequestEcho.fromPartial(object.echo) + : undefined; + message.flush = + object.flush !== undefined && object.flush !== null + ? RequestFlush.fromPartial(object.flush) + : undefined; + message.info = + object.info !== undefined && object.info !== null + ? RequestInfo.fromPartial(object.info) + : undefined; + message.initChain = + object.initChain !== undefined && object.initChain !== null + ? RequestInitChain.fromPartial(object.initChain) + : undefined; + message.query = + object.query !== undefined && object.query !== null + ? RequestQuery.fromPartial(object.query) + : undefined; + message.beginBlock = + object.beginBlock !== undefined && object.beginBlock !== null + ? RequestBeginBlock.fromPartial(object.beginBlock) + : undefined; + message.checkTx = + object.checkTx !== undefined && object.checkTx !== null + ? RequestCheckTx.fromPartial(object.checkTx) + : undefined; + message.deliverTx = + object.deliverTx !== undefined && object.deliverTx !== null + ? RequestDeliverTx.fromPartial(object.deliverTx) + : undefined; + message.endBlock = + object.endBlock !== undefined && object.endBlock !== null + ? RequestEndBlock.fromPartial(object.endBlock) + : undefined; + message.commit = + object.commit !== undefined && object.commit !== null + ? RequestCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = + object.listSnapshots !== undefined && object.listSnapshots !== null + ? RequestListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = + object.offerSnapshot !== undefined && object.offerSnapshot !== null + ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = + object.loadSnapshotChunk !== undefined && + object.loadSnapshotChunk !== null + ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = + object.applySnapshotChunk !== undefined && + object.applySnapshotChunk !== null + ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = + object.prepareProposal !== undefined && object.prepareProposal !== null + ? RequestPrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = + object.processProposal !== undefined && object.processProposal !== null + ? RequestProcessProposal.fromPartial(object.processProposal) + : undefined; + return message; + }, +}; +function createBaseRequestEcho() { + return { message: "" }; +} +export const RequestEcho = { + encode(message, writer = _m0.Writer.create()) { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { message: isSet(object.message) ? String(object.message) : "" }; + }, + toJSON(message) { + const obj = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + create(base) { + return RequestEcho.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; +function createBaseRequestFlush() { + return {}; +} +export const RequestFlush = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return RequestFlush.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseRequestFlush(); + return message; + }, +}; +function createBaseRequestInfo() { + return { version: "", blockVersion: 0, p2pVersion: 0, abciVersion: "" }; +} +export const RequestInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== 0) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== 0) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.version = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.blockVersion = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.p2pVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.abciVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + version: isSet(object.version) ? String(object.version) : "", + blockVersion: isSet(object.blockVersion) + ? Number(object.blockVersion) + : 0, + p2pVersion: isSet(object.p2pVersion) ? Number(object.p2pVersion) : 0, + abciVersion: isSet(object.abciVersion) ? String(object.abciVersion) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.version !== undefined && (obj.version = message.version); + message.blockVersion !== undefined && + (obj.blockVersion = Math.round(message.blockVersion)); + message.p2pVersion !== undefined && + (obj.p2pVersion = Math.round(message.p2pVersion)); + message.abciVersion !== undefined && + (obj.abciVersion = message.abciVersion); + return obj; + }, + create(base) { + return RequestInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion ?? 0; + message.p2pVersion = object.p2pVersion ?? 0; + message.abciVersion = object.abciVersion ?? ""; + return message; + }, +}; +function createBaseRequestInitChain() { + return { + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(), + initialHeight: 0, + }; +} +export const RequestInitChain = { + encode(message, writer = _m0.Writer.create()) { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v, writer.uint32(34).fork()).ldelim(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== 0) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + message.appStateBytes = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + message.initialHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chainId: isSet(object.chainId) ? String(object.chainId) : "", + consensusParams: isSet(object.consensusParams) + ? ConsensusParams.fromJSON(object.consensusParams) + : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => ValidatorUpdate.fromJSON(e)) + : [], + appStateBytes: isSet(object.appStateBytes) + ? bytesFromBase64(object.appStateBytes) + : new Uint8Array(), + initialHeight: isSet(object.initialHeight) + ? Number(object.initialHeight) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.time !== undefined && (obj.time = message.time.toISOString()); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.consensusParams !== undefined && + (obj.consensusParams = message.consensusParams + ? ConsensusParams.toJSON(message.consensusParams) + : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } + else { + obj.validators = []; + } + message.appStateBytes !== undefined && + (obj.appStateBytes = base64FromBytes(message.appStateBytes !== undefined + ? message.appStateBytes + : new Uint8Array())); + message.initialHeight !== undefined && + (obj.initialHeight = Math.round(message.initialHeight)); + return obj; + }, + create(base) { + return RequestInitChain.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = + object.consensusParams !== undefined && object.consensusParams !== null + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = + object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(); + message.initialHeight = object.initialHeight ?? 0; + return message; + }, +}; +function createBaseRequestQuery() { + return { data: new Uint8Array(), path: "", height: 0, prove: false }; +} +export const RequestQuery = { + encode(message, writer = _m0.Writer.create()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.prove === true) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + path: isSet(object.path) ? String(object.path) : "", + height: isSet(object.height) ? Number(object.height) : 0, + prove: isSet(object.prove) ? Boolean(object.prove) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.path !== undefined && (obj.path = message.path); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.prove !== undefined && (obj.prove = message.prove); + return obj; + }, + create(base) { + return RequestQuery.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; +function createBaseRequestBeginBlock() { + return { + hash: new Uint8Array(), + header: undefined, + lastCommitInfo: undefined, + byzantineValidators: [], + }; +} +export const RequestBeginBlock = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(18).fork()).ldelim(); + } + if (message.lastCommitInfo !== undefined) { + CommitInfo.encode(message.lastCommitInfo, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.byzantineValidators) { + Misbehavior.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.header = Header.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.lastCommitInfo = CommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.byzantineValidators.push(Misbehavior.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + lastCommitInfo: isSet(object.lastCommitInfo) + ? CommitInfo.fromJSON(object.lastCommitInfo) + : undefined, + byzantineValidators: Array.isArray(object?.byzantineValidators) + ? object.byzantineValidators.map((e) => Misbehavior.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.header !== undefined && + (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.lastCommitInfo !== undefined && + (obj.lastCommitInfo = message.lastCommitInfo + ? CommitInfo.toJSON(message.lastCommitInfo) + : undefined); + if (message.byzantineValidators) { + obj.byzantineValidators = message.byzantineValidators.map((e) => e ? Misbehavior.toJSON(e) : undefined); + } + else { + obj.byzantineValidators = []; + } + return obj; + }, + create(base) { + return RequestBeginBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestBeginBlock(); + message.hash = object.hash ?? new Uint8Array(); + message.header = + object.header !== undefined && object.header !== null + ? Header.fromPartial(object.header) + : undefined; + message.lastCommitInfo = + object.lastCommitInfo !== undefined && object.lastCommitInfo !== null + ? CommitInfo.fromPartial(object.lastCommitInfo) + : undefined; + message.byzantineValidators = + object.byzantineValidators?.map((e) => Misbehavior.fromPartial(e)) || []; + return message; + }, +}; +function createBaseRequestCheckTx() { + return { tx: new Uint8Array(), type: 0 }; +} +export const RequestCheckTx = { + encode(message, writer = _m0.Writer.create()) { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.tx = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.type = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.type !== undefined && (obj.type = checkTxTypeToJSON(message.type)); + return obj; + }, + create(base) { + return RequestCheckTx.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(); + message.type = object.type ?? 0; + return message; + }, +}; +function createBaseRequestDeliverTx() { + return { tx: new Uint8Array() }; +} +export const RequestDeliverTx = { + encode(message, writer = _m0.Writer.create()) { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.tx = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + return obj; + }, + create(base) { + return RequestDeliverTx.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestDeliverTx(); + message.tx = object.tx ?? new Uint8Array(); + return message; + }, +}; +function createBaseRequestEndBlock() { + return { height: 0 }; +} +export const RequestEndBlock = { + encode(message, writer = _m0.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { height: isSet(object.height) ? Number(object.height) : 0 }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + return obj; + }, + create(base) { + return RequestEndBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestEndBlock(); + message.height = object.height ?? 0; + return message; + }, +}; +function createBaseRequestCommit() { + return {}; +} +export const RequestCommit = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return RequestCommit.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseRequestCommit(); + return message; + }, +}; +function createBaseRequestListSnapshots() { + return {}; +} +export const RequestListSnapshots = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return RequestListSnapshots.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; +function createBaseRequestOfferSnapshot() { + return { snapshot: undefined, appHash: new Uint8Array() }; +} +export const RequestOfferSnapshot = { + encode(message, writer = _m0.Writer.create()) { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.snapshot = Snapshot.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + snapshot: isSet(object.snapshot) + ? Snapshot.fromJSON(object.snapshot) + : undefined, + appHash: isSet(object.appHash) + ? bytesFromBase64(object.appHash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.snapshot !== undefined && + (obj.snapshot = message.snapshot + ? Snapshot.toJSON(message.snapshot) + : undefined); + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + return obj; + }, + create(base) { + return RequestOfferSnapshot.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = + object.snapshot !== undefined && object.snapshot !== null + ? Snapshot.fromPartial(object.snapshot) + : undefined; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseRequestLoadSnapshotChunk() { + return { height: 0, format: 0, chunk: 0 }; +} +export const RequestLoadSnapshotChunk = { + encode(message, writer = _m0.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunk !== 0) { + writer.uint32(24).uint32(message.chunk); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.chunk = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + height: isSet(object.height) ? Number(object.height) : 0, + format: isSet(object.format) ? Number(object.format) : 0, + chunk: isSet(object.chunk) ? Number(object.chunk) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunk !== undefined && (obj.chunk = Math.round(message.chunk)); + return obj; + }, + create(base) { + return RequestLoadSnapshotChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestLoadSnapshotChunk(); + message.height = object.height ?? 0; + message.format = object.format ?? 0; + message.chunk = object.chunk ?? 0; + return message; + }, +}; +function createBaseRequestApplySnapshotChunk() { + return { index: 0, chunk: new Uint8Array(), sender: "" }; +} +export const RequestApplySnapshotChunk = { + encode(message, writer = _m0.Writer.create()) { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.chunk = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + index: isSet(object.index) ? Number(object.index) : 0, + chunk: isSet(object.chunk) + ? bytesFromBase64(object.chunk) + : new Uint8Array(), + sender: isSet(object.sender) ? String(object.sender) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + create(base) { + return RequestApplySnapshotChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(); + message.sender = object.sender ?? ""; + return message; + }, +}; +function createBaseRequestPrepareProposal() { + return { + maxTxBytes: 0, + txs: [], + localLastCommit: undefined, + misbehavior: [], + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +export const RequestPrepareProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.maxTxBytes !== 0) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v, writer.uint32(34).fork()).ldelim(); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.maxTxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.txs.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.localLastCommit = ExtendedCommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + maxTxBytes: isSet(object.maxTxBytes) ? Number(object.maxTxBytes) : 0, + txs: Array.isArray(object?.txs) + ? object.txs.map((e) => bytesFromBase64(e)) + : [], + localLastCommit: isSet(object.localLastCommit) + ? ExtendedCommitInfo.fromJSON(object.localLastCommit) + : undefined, + misbehavior: Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e) => Misbehavior.fromJSON(e)) + : [], + height: isSet(object.height) ? Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) + ? bytesFromBase64(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.maxTxBytes !== undefined && + (obj.maxTxBytes = Math.round(message.maxTxBytes)); + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + message.localLastCommit !== undefined && + (obj.localLastCommit = message.localLastCommit + ? ExtendedCommitInfo.toJSON(message.localLastCommit) + : undefined); + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map((e) => e ? Misbehavior.toJSON(e) : undefined); + } + else { + obj.misbehavior = []; + } + message.height !== undefined && (obj.height = Math.round(message.height)); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array())); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes(message.proposerAddress !== undefined + ? message.proposerAddress + : new Uint8Array())); + return obj; + }, + create(base) { + return RequestPrepareProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes ?? 0; + message.txs = object.txs?.map((e) => e) || []; + message.localLastCommit = + object.localLastCommit !== undefined && object.localLastCommit !== null + ? ExtendedCommitInfo.fromPartial(object.localLastCommit) + : undefined; + message.misbehavior = + object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, +}; +function createBaseRequestProcessProposal() { + return { + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(), + height: 0, + time: undefined, + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +export const RequestProcessProposal = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.txs) { + writer.uint32(10).bytes(v); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v, writer.uint32(26).fork()).ldelim(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + message.nextValidatorsHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) + ? object.txs.map((e) => bytesFromBase64(e)) + : [], + proposedLastCommit: isSet(object.proposedLastCommit) + ? CommitInfo.fromJSON(object.proposedLastCommit) + : undefined, + misbehavior: Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + height: isSet(object.height) ? Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) + ? bytesFromBase64(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + message.proposedLastCommit !== undefined && + (obj.proposedLastCommit = message.proposedLastCommit + ? CommitInfo.toJSON(message.proposedLastCommit) + : undefined); + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map((e) => e ? Misbehavior.toJSON(e) : undefined); + } + else { + obj.misbehavior = []; + } + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array())); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes(message.proposerAddress !== undefined + ? message.proposerAddress + : new Uint8Array())); + return obj; + }, + create(base) { + return RequestProcessProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = + object.proposedLastCommit !== undefined && + object.proposedLastCommit !== null + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = + object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponse() { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + beginBlock: undefined, + checkTx: undefined, + deliverTx: undefined, + endBlock: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + }; +} +export const Response = { + encode(message, writer = _m0.Writer.create()) { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).ldelim(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).ldelim(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); + } + if (message.initChain !== undefined) { + ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).ldelim(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); + } + if (message.beginBlock !== undefined) { + ResponseBeginBlock.encode(message.beginBlock, writer.uint32(66).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).ldelim(); + } + if (message.deliverTx !== undefined) { + ResponseDeliverTx.encode(message.deliverTx, writer.uint32(82).fork()).ldelim(); + } + if (message.endBlock !== undefined) { + ResponseEndBlock.encode(message.endBlock, writer.uint32(90).fork()).ldelim(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).ldelim(); + } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).ldelim(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.exception = ResponseException.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.echo = ResponseEcho.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.flush = ResponseFlush.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.info = ResponseInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.initChain = ResponseInitChain.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + message.query = ResponseQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + message.beginBlock = ResponseBeginBlock.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + message.deliverTx = ResponseDeliverTx.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + message.endBlock = ResponseEndBlock.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + message.commit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + message.prepareProposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + exception: isSet(object.exception) + ? ResponseException.fromJSON(object.exception) + : undefined, + echo: isSet(object.echo) ? ResponseEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) + ? ResponseFlush.fromJSON(object.flush) + : undefined, + info: isSet(object.info) ? ResponseInfo.fromJSON(object.info) : undefined, + initChain: isSet(object.initChain) + ? ResponseInitChain.fromJSON(object.initChain) + : undefined, + query: isSet(object.query) + ? ResponseQuery.fromJSON(object.query) + : undefined, + beginBlock: isSet(object.beginBlock) + ? ResponseBeginBlock.fromJSON(object.beginBlock) + : undefined, + checkTx: isSet(object.checkTx) + ? ResponseCheckTx.fromJSON(object.checkTx) + : undefined, + deliverTx: isSet(object.deliverTx) + ? ResponseDeliverTx.fromJSON(object.deliverTx) + : undefined, + endBlock: isSet(object.endBlock) + ? ResponseEndBlock.fromJSON(object.endBlock) + : undefined, + commit: isSet(object.commit) + ? ResponseCommit.fromJSON(object.commit) + : undefined, + listSnapshots: isSet(object.listSnapshots) + ? ResponseListSnapshots.fromJSON(object.listSnapshots) + : undefined, + offerSnapshot: isSet(object.offerSnapshot) + ? ResponseOfferSnapshot.fromJSON(object.offerSnapshot) + : undefined, + loadSnapshotChunk: isSet(object.loadSnapshotChunk) + ? ResponseLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) + : undefined, + applySnapshotChunk: isSet(object.applySnapshotChunk) + ? ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) + : undefined, + prepareProposal: isSet(object.prepareProposal) + ? ResponsePrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? ResponseProcessProposal.fromJSON(object.processProposal) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.exception !== undefined && + (obj.exception = message.exception + ? ResponseException.toJSON(message.exception) + : undefined); + message.echo !== undefined && + (obj.echo = message.echo ? ResponseEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && + (obj.flush = message.flush + ? ResponseFlush.toJSON(message.flush) + : undefined); + message.info !== undefined && + (obj.info = message.info ? ResponseInfo.toJSON(message.info) : undefined); + message.initChain !== undefined && + (obj.initChain = message.initChain + ? ResponseInitChain.toJSON(message.initChain) + : undefined); + message.query !== undefined && + (obj.query = message.query + ? ResponseQuery.toJSON(message.query) + : undefined); + message.beginBlock !== undefined && + (obj.beginBlock = message.beginBlock + ? ResponseBeginBlock.toJSON(message.beginBlock) + : undefined); + message.checkTx !== undefined && + (obj.checkTx = message.checkTx + ? ResponseCheckTx.toJSON(message.checkTx) + : undefined); + message.deliverTx !== undefined && + (obj.deliverTx = message.deliverTx + ? ResponseDeliverTx.toJSON(message.deliverTx) + : undefined); + message.endBlock !== undefined && + (obj.endBlock = message.endBlock + ? ResponseEndBlock.toJSON(message.endBlock) + : undefined); + message.commit !== undefined && + (obj.commit = message.commit + ? ResponseCommit.toJSON(message.commit) + : undefined); + message.listSnapshots !== undefined && + (obj.listSnapshots = message.listSnapshots + ? ResponseListSnapshots.toJSON(message.listSnapshots) + : undefined); + message.offerSnapshot !== undefined && + (obj.offerSnapshot = message.offerSnapshot + ? ResponseOfferSnapshot.toJSON(message.offerSnapshot) + : undefined); + message.loadSnapshotChunk !== undefined && + (obj.loadSnapshotChunk = message.loadSnapshotChunk + ? ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) + : undefined); + message.applySnapshotChunk !== undefined && + (obj.applySnapshotChunk = message.applySnapshotChunk + ? ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk) + : undefined); + message.prepareProposal !== undefined && + (obj.prepareProposal = message.prepareProposal + ? ResponsePrepareProposal.toJSON(message.prepareProposal) + : undefined); + message.processProposal !== undefined && + (obj.processProposal = message.processProposal + ? ResponseProcessProposal.toJSON(message.processProposal) + : undefined); + return obj; + }, + create(base) { + return Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponse(); + message.exception = + object.exception !== undefined && object.exception !== null + ? ResponseException.fromPartial(object.exception) + : undefined; + message.echo = + object.echo !== undefined && object.echo !== null + ? ResponseEcho.fromPartial(object.echo) + : undefined; + message.flush = + object.flush !== undefined && object.flush !== null + ? ResponseFlush.fromPartial(object.flush) + : undefined; + message.info = + object.info !== undefined && object.info !== null + ? ResponseInfo.fromPartial(object.info) + : undefined; + message.initChain = + object.initChain !== undefined && object.initChain !== null + ? ResponseInitChain.fromPartial(object.initChain) + : undefined; + message.query = + object.query !== undefined && object.query !== null + ? ResponseQuery.fromPartial(object.query) + : undefined; + message.beginBlock = + object.beginBlock !== undefined && object.beginBlock !== null + ? ResponseBeginBlock.fromPartial(object.beginBlock) + : undefined; + message.checkTx = + object.checkTx !== undefined && object.checkTx !== null + ? ResponseCheckTx.fromPartial(object.checkTx) + : undefined; + message.deliverTx = + object.deliverTx !== undefined && object.deliverTx !== null + ? ResponseDeliverTx.fromPartial(object.deliverTx) + : undefined; + message.endBlock = + object.endBlock !== undefined && object.endBlock !== null + ? ResponseEndBlock.fromPartial(object.endBlock) + : undefined; + message.commit = + object.commit !== undefined && object.commit !== null + ? ResponseCommit.fromPartial(object.commit) + : undefined; + message.listSnapshots = + object.listSnapshots !== undefined && object.listSnapshots !== null + ? ResponseListSnapshots.fromPartial(object.listSnapshots) + : undefined; + message.offerSnapshot = + object.offerSnapshot !== undefined && object.offerSnapshot !== null + ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) + : undefined; + message.loadSnapshotChunk = + object.loadSnapshotChunk !== undefined && + object.loadSnapshotChunk !== null + ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) + : undefined; + message.applySnapshotChunk = + object.applySnapshotChunk !== undefined && + object.applySnapshotChunk !== null + ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) + : undefined; + message.prepareProposal = + object.prepareProposal !== undefined && object.prepareProposal !== null + ? ResponsePrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = + object.processProposal !== undefined && object.processProposal !== null + ? ResponseProcessProposal.fromPartial(object.processProposal) + : undefined; + return message; + }, +}; +function createBaseResponseException() { + return { error: "" }; +} +export const ResponseException = { + encode(message, writer = _m0.Writer.create()) { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { error: isSet(object.error) ? String(object.error) : "" }; + }, + toJSON(message) { + const obj = {}; + message.error !== undefined && (obj.error = message.error); + return obj; + }, + create(base) { + return ResponseException.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; +function createBaseResponseEcho() { + return { message: "" }; +} +export const ResponseEcho = { + encode(message, writer = _m0.Writer.create()) { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { message: isSet(object.message) ? String(object.message) : "" }; + }, + toJSON(message) { + const obj = {}; + message.message !== undefined && (obj.message = message.message); + return obj; + }, + create(base) { + return ResponseEcho.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; +function createBaseResponseFlush() { + return {}; +} +export const ResponseFlush = { + encode(_, writer = _m0.Writer.create()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return ResponseFlush.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseResponseFlush(); + return message; + }, +}; +function createBaseResponseInfo() { + return { + data: "", + version: "", + appVersion: 0, + lastBlockHeight: 0, + lastBlockAppHash: new Uint8Array(), + }; +} +export const ResponseInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== 0) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== 0) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.version = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.appVersion = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.lastBlockHeight = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + message.lastBlockAppHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) ? String(object.data) : "", + version: isSet(object.version) ? String(object.version) : "", + appVersion: isSet(object.appVersion) ? Number(object.appVersion) : 0, + lastBlockHeight: isSet(object.lastBlockHeight) + ? Number(object.lastBlockHeight) + : 0, + lastBlockAppHash: isSet(object.lastBlockAppHash) + ? bytesFromBase64(object.lastBlockAppHash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && (obj.data = message.data); + message.version !== undefined && (obj.version = message.version); + message.appVersion !== undefined && + (obj.appVersion = Math.round(message.appVersion)); + message.lastBlockHeight !== undefined && + (obj.lastBlockHeight = Math.round(message.lastBlockHeight)); + message.lastBlockAppHash !== undefined && + (obj.lastBlockAppHash = base64FromBytes(message.lastBlockAppHash !== undefined + ? message.lastBlockAppHash + : new Uint8Array())); + return obj; + }, + create(base) { + return ResponseInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion ?? 0; + message.lastBlockHeight = object.lastBlockHeight ?? 0; + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseInitChain() { + return { + consensusParams: undefined, + validators: [], + appHash: new Uint8Array(), + }; +} +export const ResponseInitChain = { + encode(message, writer = _m0.Writer.create()) { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v, writer.uint32(18).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + message.appHash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + consensusParams: isSet(object.consensusParams) + ? ConsensusParams.fromJSON(object.consensusParams) + : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e) => ValidatorUpdate.fromJSON(e)) + : [], + appHash: isSet(object.appHash) + ? bytesFromBase64(object.appHash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.consensusParams !== undefined && + (obj.consensusParams = message.consensusParams + ? ConsensusParams.toJSON(message.consensusParams) + : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } + else { + obj.validators = []; + } + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + return obj; + }, + create(base) { + return ResponseInitChain.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseInitChain(); + message.consensusParams = + object.consensusParams !== undefined && object.consensusParams !== null + ? ConsensusParams.fromPartial(object.consensusParams) + : undefined; + message.validators = + object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseQuery() { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(), + value: new Uint8Array(), + proofOps: undefined, + height: 0, + codespace: "", + }; +} +export const ResponseQuery = { + encode(message, writer = _m0.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).ldelim(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.proofOps = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + code: isSet(object.code) ? Number(object.code) : 0, + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + index: isSet(object.index) ? Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(), + proofOps: isSet(object.proofOps) + ? ProofOps.fromJSON(object.proofOps) + : undefined, + height: isSet(object.height) ? Number(object.height) : 0, + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.proofOps !== undefined && + (obj.proofOps = message.proofOps + ? ProofOps.toJSON(message.proofOps) + : undefined); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + create(base) { + return ResponseQuery.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseQuery(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? 0; + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.proofOps = + object.proofOps !== undefined && object.proofOps !== null + ? ProofOps.fromPartial(object.proofOps) + : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; +function createBaseResponseBeginBlock() { + return { events: [] }; +} +export const ResponseBeginBlock = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.events) { + Event.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseBeginBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.events.push(Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + events: Array.isArray(object?.events) + ? object.events.map((e) => Event.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.events) { + obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + create(base) { + return ResponseBeginBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseBeginBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseCheckTx() { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: 0, + gasUsed: 0, + events: [], + codespace: "", + sender: "", + priority: 0, + mempoolError: "", + }; +} +export const ResponseCheckTx = { + encode(message, writer = _m0.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + if (message.sender !== "") { + writer.uint32(74).string(message.sender); + } + if (message.priority !== 0) { + writer.uint32(80).int64(message.priority); + } + if (message.mempoolError !== "") { + writer.uint32(90).string(message.mempoolError); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + message.codespace = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + message.sender = reader.string(); + continue; + case 10: + if (tag !== 80) { + break; + } + message.priority = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + message.mempoolError = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? Number(object.gas_used) : 0, + events: Array.isArray(object?.events) + ? object.events.map((e) => Event.fromJSON(e)) + : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + priority: isSet(object.priority) ? Number(object.priority) : 0, + mempoolError: isSet(object.mempoolError) + ? String(object.mempoolError) + : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && + (obj.gas_wanted = Math.round(message.gasWanted)); + message.gasUsed !== undefined && + (obj.gas_used = Math.round(message.gasUsed)); + if (message.events) { + obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + message.sender !== undefined && (obj.sender = message.sender); + message.priority !== undefined && + (obj.priority = Math.round(message.priority)); + message.mempoolError !== undefined && + (obj.mempoolError = message.mempoolError); + return obj; + }, + create(base) { + return ResponseCheckTx.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + message.sender = object.sender ?? ""; + message.priority = object.priority ?? 0; + message.mempoolError = object.mempoolError ?? ""; + return message; + }, +}; +function createBaseResponseDeliverTx() { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: 0, + gasUsed: 0, + events: [], + codespace: "", + }; +} +export const ResponseDeliverTx = { + encode(message, writer = _m0.Writer.create()) { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== 0) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== 0) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.gasWanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + message.gasUsed = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + code: isSet(object.code) ? Number(object.code) : 0, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + log: isSet(object.log) ? String(object.log) : "", + info: isSet(object.info) ? String(object.info) : "", + gasWanted: isSet(object.gas_wanted) ? Number(object.gas_wanted) : 0, + gasUsed: isSet(object.gas_used) ? Number(object.gas_used) : 0, + events: Array.isArray(object?.events) + ? object.events.map((e) => Event.fromJSON(e)) + : [], + codespace: isSet(object.codespace) ? String(object.codespace) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.code !== undefined && (obj.code = Math.round(message.code)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && + (obj.gas_wanted = Math.round(message.gasWanted)); + message.gasUsed !== undefined && + (obj.gas_used = Math.round(message.gasUsed)); + if (message.events) { + obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + create(base) { + return ResponseDeliverTx.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseDeliverTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted ?? 0; + message.gasUsed = object.gasUsed ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; +function createBaseResponseEndBlock() { + return { validatorUpdates: [], consensusParamUpdates: undefined, events: [] }; +} +export const ResponseEndBlock = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.events) { + Event.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEndBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.events.push(Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + validatorUpdates: Array.isArray(object?.validatorUpdates) + ? object.validatorUpdates.map((e) => ValidatorUpdate.fromJSON(e)) + : [], + consensusParamUpdates: isSet(object.consensusParamUpdates) + ? ConsensusParams.fromJSON(object.consensusParamUpdates) + : undefined, + events: Array.isArray(object?.events) + ? object.events.map((e) => Event.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.validatorUpdates) { + obj.validatorUpdates = message.validatorUpdates.map((e) => e ? ValidatorUpdate.toJSON(e) : undefined); + } + else { + obj.validatorUpdates = []; + } + message.consensusParamUpdates !== undefined && + (obj.consensusParamUpdates = message.consensusParamUpdates + ? ConsensusParams.toJSON(message.consensusParamUpdates) + : undefined); + if (message.events) { + obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); + } + else { + obj.events = []; + } + return obj; + }, + create(base) { + return ResponseEndBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseEndBlock(); + message.validatorUpdates = + object.validatorUpdates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = + object.consensusParamUpdates !== undefined && + object.consensusParamUpdates !== null + ? ConsensusParams.fromPartial(object.consensusParamUpdates) + : undefined; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseCommit() { + return { data: new Uint8Array(), retainHeight: 0 }; +} +export const ResponseCommit = { + encode(message, writer = _m0.Writer.create()) { + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.retainHeight !== 0) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.retainHeight = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + retainHeight: isSet(object.retainHeight) + ? Number(object.retainHeight) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.retainHeight !== undefined && + (obj.retainHeight = Math.round(message.retainHeight)); + return obj; + }, + create(base) { + return ResponseCommit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseCommit(); + message.data = object.data ?? new Uint8Array(); + message.retainHeight = object.retainHeight ?? 0; + return message; + }, +}; +function createBaseResponseListSnapshots() { + return { snapshots: [] }; +} +export const ResponseListSnapshots = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.snapshots) { + Snapshot.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + snapshots: Array.isArray(object?.snapshots) + ? object.snapshots.map((e) => Snapshot.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map((e) => e ? Snapshot.toJSON(e) : undefined); + } + else { + obj.snapshots = []; + } + return obj; + }, + create(base) { + return ResponseListSnapshots.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseListSnapshots(); + message.snapshots = + object.snapshots?.map((e) => Snapshot.fromPartial(e)) || []; + return message; + }, +}; +function createBaseResponseOfferSnapshot() { + return { result: 0 }; +} +export const ResponseOfferSnapshot = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.result = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet(object.result) + ? responseOfferSnapshot_ResultFromJSON(object.result) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && + (obj.result = responseOfferSnapshot_ResultToJSON(message.result)); + return obj; + }, + create(base) { + return ResponseOfferSnapshot.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; +function createBaseResponseLoadSnapshotChunk() { + return { chunk: new Uint8Array() }; +} +export const ResponseLoadSnapshotChunk = { + encode(message, writer = _m0.Writer.create()) { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.chunk = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + chunk: isSet(object.chunk) + ? bytesFromBase64(object.chunk) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + return obj; + }, + create(base) { + return ResponseLoadSnapshotChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(); + return message; + }, +}; +function createBaseResponseApplySnapshotChunk() { + return { result: 0, refetchChunks: [], rejectSenders: [] }; +} +export const ResponseApplySnapshotChunk = { + encode(message, writer = _m0.Writer.create()) { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.ldelim(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.result = reader.int32(); + continue; + case 2: + if (tag === 16) { + message.refetchChunks.push(reader.uint32()); + continue; + } + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + continue; + } + break; + case 3: + if (tag !== 26) { + break; + } + message.rejectSenders.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + result: isSet(object.result) + ? responseApplySnapshotChunk_ResultFromJSON(object.result) + : 0, + refetchChunks: Array.isArray(object?.refetchChunks) + ? object.refetchChunks.map((e) => Number(e)) + : [], + rejectSenders: Array.isArray(object?.rejectSenders) + ? object.rejectSenders.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.result !== undefined && + (obj.result = responseApplySnapshotChunk_ResultToJSON(message.result)); + if (message.refetchChunks) { + obj.refetchChunks = message.refetchChunks.map((e) => Math.round(e)); + } + else { + obj.refetchChunks = []; + } + if (message.rejectSenders) { + obj.rejectSenders = message.rejectSenders.map((e) => e); + } + else { + obj.rejectSenders = []; + } + return obj; + }, + create(base) { + return ResponseApplySnapshotChunk.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map((e) => e) || []; + message.rejectSenders = object.rejectSenders?.map((e) => e) || []; + return message; + }, +}; +function createBaseResponsePrepareProposal() { + return { txs: [] }; +} +export const ResponsePrepareProposal = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.txs) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) + ? object.txs.map((e) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + return obj; + }, + create(base) { + return ResponsePrepareProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; +function createBaseResponseProcessProposal() { + return { status: 0 }; +} +export const ResponseProcessProposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.status = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + status: isSet(object.status) + ? responseProcessProposal_ProposalStatusFromJSON(object.status) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.status !== undefined && + (obj.status = responseProcessProposal_ProposalStatusToJSON(message.status)); + return obj; + }, + create(base) { + return ResponseProcessProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, +}; +function createBaseCommitInfo() { + return { round: 0, votes: [] }; +} +export const CommitInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) + ? object.votes.map((e) => VoteInfo.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => e ? VoteInfo.toJSON(e) : undefined); + } + else { + obj.votes = []; + } + return obj; + }, + create(base) { + return CommitInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; +function createBaseExtendedCommitInfo() { + return { round: 0, votes: [] }; +} +export const ExtendedCommitInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) + ? object.votes.map((e) => ExtendedVoteInfo.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => e ? ExtendedVoteInfo.toJSON(e) : undefined); + } + else { + obj.votes = []; + } + return obj; + }, + create(base) { + return ExtendedCommitInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = + object.votes?.map((e) => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEvent() { + return { type: "", attributes: [] }; +} +export const Event = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? String(object.type) : "", + attributes: Array.isArray(object?.attributes) + ? object.attributes.map((e) => EventAttribute.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => e ? EventAttribute.toJSON(e) : undefined); + } + else { + obj.attributes = []; + } + return obj; + }, + create(base) { + return Event.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEvent(); + message.type = object.type ?? ""; + message.attributes = + object.attributes?.map((e) => EventAttribute.fromPartial(e)) || []; + return message; + }, +}; +function createBaseEventAttribute() { + return { key: "", value: "", index: false }; +} +export const EventAttribute = { + encode(message, writer = _m0.Writer.create()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index === true) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.value = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.index = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "", + index: isSet(object.index) ? Boolean(object.index) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + message.index !== undefined && (obj.index = message.index); + return obj; + }, + create(base) { + return EventAttribute.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, +}; +function createBaseTxResult() { + return { height: 0, index: 0, tx: new Uint8Array(), result: undefined }; +} +export const TxResult = { + encode(message, writer = _m0.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.index !== 0) { + writer.uint32(16).uint32(message.index); + } + if (message.tx.length !== 0) { + writer.uint32(26).bytes(message.tx); + } + if (message.result !== undefined) { + ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.index = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.tx = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.result = ResponseDeliverTx.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + height: isSet(object.height) ? Number(object.height) : 0, + index: isSet(object.index) ? Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(), + result: isSet(object.result) + ? ResponseDeliverTx.fromJSON(object.result) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.result !== undefined && + (obj.result = message.result + ? ResponseDeliverTx.toJSON(message.result) + : undefined); + return obj; + }, + create(base) { + return TxResult.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTxResult(); + message.height = object.height ?? 0; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(); + message.result = + object.result !== undefined && object.result !== null + ? ResponseDeliverTx.fromPartial(object.result) + : undefined; + return message; + }, +}; +function createBaseValidator() { + return { address: new Uint8Array(), power: 0 }; +} +export const Validator = { + encode(message, writer = _m0.Writer.create()) { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.power !== 0) { + writer.uint32(24).int64(message.power); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) + ? bytesFromBase64(object.address) + : new Uint8Array(), + power: isSet(object.power) ? Number(object.power) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.power !== undefined && (obj.power = Math.round(message.power)); + return obj; + }, + create(base) { + return Validator.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.power = object.power ?? 0; + return message; + }, +}; +function createBaseValidatorUpdate() { + return { pubKey: undefined, power: 0 }; +} +export const ValidatorUpdate = { + encode(message, writer = _m0.Writer.create()) { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pubKey: isSet(object.pubKey) + ? PublicKey.fromJSON(object.pubKey) + : undefined, + power: isSet(object.power) ? Number(object.power) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.pubKey !== undefined && + (obj.pubKey = message.pubKey + ? PublicKey.toJSON(message.pubKey) + : undefined); + message.power !== undefined && (obj.power = Math.round(message.power)); + return obj; + }, + create(base) { + return ValidatorUpdate.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidatorUpdate(); + message.pubKey = + object.pubKey !== undefined && object.pubKey !== null + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.power = object.power ?? 0; + return message; + }, +}; +function createBaseVoteInfo() { + return { validator: undefined, signedLastBlock: false }; +} +export const VoteInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.signedLastBlock = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + validator: isSet(object.validator) + ? Validator.fromJSON(object.validator) + : undefined, + signedLastBlock: isSet(object.signedLastBlock) + ? Boolean(object.signedLastBlock) + : false, + }; + }, + toJSON(message) { + const obj = {}; + message.validator !== undefined && + (obj.validator = message.validator + ? Validator.toJSON(message.validator) + : undefined); + message.signedLastBlock !== undefined && + (obj.signedLastBlock = message.signedLastBlock); + return obj; + }, + create(base) { + return VoteInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVoteInfo(); + message.validator = + object.validator !== undefined && object.validator !== null + ? Validator.fromPartial(object.validator) + : undefined; + message.signedLastBlock = object.signedLastBlock ?? false; + return message; + }, +}; +function createBaseExtendedVoteInfo() { + return { + validator: undefined, + signedLastBlock: false, + voteExtension: new Uint8Array(), + }; +} +export const ExtendedVoteInfo = { + encode(message, writer = _m0.Writer.create()) { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.signedLastBlock = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.voteExtension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + validator: isSet(object.validator) + ? Validator.fromJSON(object.validator) + : undefined, + signedLastBlock: isSet(object.signedLastBlock) + ? Boolean(object.signedLastBlock) + : false, + voteExtension: isSet(object.voteExtension) + ? bytesFromBase64(object.voteExtension) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.validator !== undefined && + (obj.validator = message.validator + ? Validator.toJSON(message.validator) + : undefined); + message.signedLastBlock !== undefined && + (obj.signedLastBlock = message.signedLastBlock); + message.voteExtension !== undefined && + (obj.voteExtension = base64FromBytes(message.voteExtension !== undefined + ? message.voteExtension + : new Uint8Array())); + return obj; + }, + create(base) { + return ExtendedVoteInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExtendedVoteInfo(); + message.validator = + object.validator !== undefined && object.validator !== null + ? Validator.fromPartial(object.validator) + : undefined; + message.signedLastBlock = object.signedLastBlock ?? false; + message.voteExtension = object.voteExtension ?? new Uint8Array(); + return message; + }, +}; +function createBaseMisbehavior() { + return { + type: 0, + validator: undefined, + height: 0, + time: undefined, + totalVotingPower: 0, + }; +} +export const Misbehavior = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) + ? Validator.fromJSON(object.validator) + : undefined, + height: isSet(object.height) ? Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + totalVotingPower: isSet(object.totalVotingPower) + ? Number(object.totalVotingPower) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && + (obj.type = misbehaviorTypeToJSON(message.type)); + message.validator !== undefined && + (obj.validator = message.validator + ? Validator.toJSON(message.validator) + : undefined); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.totalVotingPower !== undefined && + (obj.totalVotingPower = Math.round(message.totalVotingPower)); + return obj; + }, + create(base) { + return Misbehavior.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = + object.validator !== undefined && object.validator !== null + ? Validator.fromPartial(object.validator) + : undefined; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; +function createBaseSnapshot() { + return { + height: 0, + format: 0, + chunks: 0, + hash: new Uint8Array(), + metadata: new Uint8Array(), + }; +} +export const Snapshot = { + encode(message, writer = _m0.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata.length !== 0) { + writer.uint32(42).bytes(message.metadata); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + message.metadata = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + height: isSet(object.height) ? Number(object.height) : 0, + format: isSet(object.format) ? Number(object.format) : 0, + chunks: isSet(object.chunks) ? Number(object.chunks) : 0, + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + metadata: isSet(object.metadata) + ? bytesFromBase64(object.metadata) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + message.format !== undefined && (obj.format = Math.round(message.format)); + message.chunks !== undefined && (obj.chunks = Math.round(message.chunks)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.metadata !== undefined && + (obj.metadata = base64FromBytes(message.metadata !== undefined ? message.metadata : new Uint8Array())); + return obj; + }, + create(base) { + return Snapshot.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSnapshot(); + message.height = object.height ?? 0; + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = object.metadata ?? new Uint8Array(); + return message; + }, +}; +export class ABCIApplicationClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || "tendermint.abci.ABCIApplication"; + this.rpc = rpc; + this.Echo = this.Echo.bind(this); + this.Flush = this.Flush.bind(this); + this.Info = this.Info.bind(this); + this.DeliverTx = this.DeliverTx.bind(this); + this.CheckTx = this.CheckTx.bind(this); + this.Query = this.Query.bind(this); + this.Commit = this.Commit.bind(this); + this.InitChain = this.InitChain.bind(this); + this.BeginBlock = this.BeginBlock.bind(this); + this.EndBlock = this.EndBlock.bind(this); + this.ListSnapshots = this.ListSnapshots.bind(this); + this.OfferSnapshot = this.OfferSnapshot.bind(this); + this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); + this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + this.PrepareProposal = this.PrepareProposal.bind(this); + this.ProcessProposal = this.ProcessProposal.bind(this); + } + Echo(request) { + const data = RequestEcho.encode(request).finish(); + const promise = this.rpc.request(this.service, "Echo", data); + return promise.then((data) => ResponseEcho.decode(_m0.Reader.create(data))); + } + Flush(request) { + const data = RequestFlush.encode(request).finish(); + const promise = this.rpc.request(this.service, "Flush", data); + return promise.then((data) => ResponseFlush.decode(_m0.Reader.create(data))); + } + Info(request) { + const data = RequestInfo.encode(request).finish(); + const promise = this.rpc.request(this.service, "Info", data); + return promise.then((data) => ResponseInfo.decode(_m0.Reader.create(data))); + } + DeliverTx(request) { + const data = RequestDeliverTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "DeliverTx", data); + return promise.then((data) => ResponseDeliverTx.decode(_m0.Reader.create(data))); + } + CheckTx(request) { + const data = RequestCheckTx.encode(request).finish(); + const promise = this.rpc.request(this.service, "CheckTx", data); + return promise.then((data) => ResponseCheckTx.decode(_m0.Reader.create(data))); + } + Query(request) { + const data = RequestQuery.encode(request).finish(); + const promise = this.rpc.request(this.service, "Query", data); + return promise.then((data) => ResponseQuery.decode(_m0.Reader.create(data))); + } + Commit(request) { + const data = RequestCommit.encode(request).finish(); + const promise = this.rpc.request(this.service, "Commit", data); + return promise.then((data) => ResponseCommit.decode(_m0.Reader.create(data))); + } + InitChain(request) { + const data = RequestInitChain.encode(request).finish(); + const promise = this.rpc.request(this.service, "InitChain", data); + return promise.then((data) => ResponseInitChain.decode(_m0.Reader.create(data))); + } + BeginBlock(request) { + const data = RequestBeginBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "BeginBlock", data); + return promise.then((data) => ResponseBeginBlock.decode(_m0.Reader.create(data))); + } + EndBlock(request) { + const data = RequestEndBlock.encode(request).finish(); + const promise = this.rpc.request(this.service, "EndBlock", data); + return promise.then((data) => ResponseEndBlock.decode(_m0.Reader.create(data))); + } + ListSnapshots(request) { + const data = RequestListSnapshots.encode(request).finish(); + const promise = this.rpc.request(this.service, "ListSnapshots", data); + return promise.then((data) => ResponseListSnapshots.decode(_m0.Reader.create(data))); + } + OfferSnapshot(request) { + const data = RequestOfferSnapshot.encode(request).finish(); + const promise = this.rpc.request(this.service, "OfferSnapshot", data); + return promise.then((data) => ResponseOfferSnapshot.decode(_m0.Reader.create(data))); + } + LoadSnapshotChunk(request) { + const data = RequestLoadSnapshotChunk.encode(request).finish(); + const promise = this.rpc.request(this.service, "LoadSnapshotChunk", data); + return promise.then((data) => ResponseLoadSnapshotChunk.decode(_m0.Reader.create(data))); + } + ApplySnapshotChunk(request) { + const data = RequestApplySnapshotChunk.encode(request).finish(); + const promise = this.rpc.request(this.service, "ApplySnapshotChunk", data); + return promise.then((data) => ResponseApplySnapshotChunk.decode(_m0.Reader.create(data))); + } + PrepareProposal(request) { + const data = RequestPrepareProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "PrepareProposal", data); + return promise.then((data) => ResponsePrepareProposal.decode(_m0.Reader.create(data))); + } + ProcessProposal(request) { + const data = RequestProcessProposal.encode(request).finish(); + const promise = this.rpc.request(this.service, "ProcessProposal", data); + return promise.then((data) => ResponseProcessProposal.decode(_m0.Reader.create(data))); + } +} +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function toTimestamp(date) { + const seconds = date.getTime() / 1000; + const nanos = (date.getTime() % 1000) * 1000000; + return { seconds, nanos }; +} +function fromTimestamp(t) { + let millis = (t.seconds || 0) * 1000; + millis += (t.nanos || 0) / 1000000; + return new Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof Date) { + return o; + } + else if (typeof o === "string") { + return new Date(o); + } + else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/tendermint/crypto/keys.d.ts b/dist/module/tendermint/crypto/keys.d.ts new file mode 100644 index 0000000..53a5977 --- /dev/null +++ b/dist/module/tendermint/crypto/keys.d.ts @@ -0,0 +1,38 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "tendermint.crypto"; +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; +} +export declare const PublicKey: { + encode(message: PublicKey, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PublicKey; + fromJSON(object: any): PublicKey; + toJSON(message: PublicKey): unknown; + create]: never; }>(base?: I | undefined): PublicKey; + fromPartial]: never; }>(object: I_1): PublicKey; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/tendermint/crypto/keys.js b/dist/module/tendermint/crypto/keys.js new file mode 100644 index 0000000..5997c9c --- /dev/null +++ b/dist/module/tendermint/crypto/keys.js @@ -0,0 +1,110 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +export const protobufPackage = "tendermint.crypto"; +function createBasePublicKey() { + return { ed25519: undefined, secp256k1: undefined }; +} +export const PublicKey = { + encode(message, writer = _m0.Writer.create()) { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.ed25519 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.secp256k1 = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + ed25519: isSet(object.ed25519) ? bytesFromBase64(object.ed25519) : undefined, + secp256k1: isSet(object.secp256k1) ? bytesFromBase64(object.secp256k1) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.ed25519 !== undefined && + (obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined); + message.secp256k1 !== undefined && + (obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined); + return obj; + }, + create(base) { + return PublicKey.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/tendermint/crypto/proof.d.ts b/dist/module/tendermint/crypto/proof.d.ts new file mode 100644 index 0000000..4b04766 --- /dev/null +++ b/dist/module/tendermint/crypto/proof.d.ts @@ -0,0 +1,226 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "tendermint.crypto"; +export interface Proof { + total: number; + index: number; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof: Proof | undefined; +} +export interface DominoOp { + key: string; + input: string; + output: string; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOps { + ops: ProofOp[]; +} +export declare const Proof: { + encode(message: Proof, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Proof; + fromJSON(object: any): Proof; + toJSON(message: Proof): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): Proof; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): Proof; +}; +export declare const ValueOp: { + encode(message: ValueOp, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ValueOp; + fromJSON(object: any): ValueOp; + toJSON(message: ValueOp): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): ValueOp; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): ValueOp; +}; +export declare const DominoOp: { + encode(message: DominoOp, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): DominoOp; + fromJSON(object: any): DominoOp; + toJSON(message: DominoOp): unknown; + create]: never; }>(base?: I | undefined): DominoOp; + fromPartial]: never; }>(object: I_1): DominoOp; +}; +export declare const ProofOp: { + encode(message: ProofOp, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ProofOp; + fromJSON(object: any): ProofOp; + toJSON(message: ProofOp): unknown; + create]: never; }>(base?: I | undefined): ProofOp; + fromPartial]: never; }>(object: I_1): ProofOp; +}; +export declare const ProofOps: { + encode(message: ProofOps, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ProofOps; + fromJSON(object: any): ProofOps; + toJSON(message: ProofOps): unknown; + create]: never; })[] & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): ProofOps; + fromPartial]: never; })[] & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): ProofOps; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/tendermint/crypto/proof.js b/dist/module/tendermint/crypto/proof.js new file mode 100644 index 0000000..3508749 --- /dev/null +++ b/dist/module/tendermint/crypto/proof.js @@ -0,0 +1,415 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export const protobufPackage = "tendermint.crypto"; +function createBaseProof() { + return { total: 0, index: 0, leafHash: new Uint8Array(), aunts: [] }; +} +export const Proof = { + encode(message, writer = _m0.Writer.create()) { + if (message.total !== 0) { + writer.uint32(8).int64(message.total); + } + if (message.index !== 0) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.total = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.index = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.leafHash = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.aunts.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + total: isSet(object.total) ? Number(object.total) : 0, + index: isSet(object.index) ? Number(object.index) : 0, + leafHash: isSet(object.leafHash) ? bytesFromBase64(object.leafHash) : new Uint8Array(), + aunts: Array.isArray(object?.aunts) ? object.aunts.map((e) => bytesFromBase64(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.total !== undefined && (obj.total = Math.round(message.total)); + message.index !== undefined && (obj.index = Math.round(message.index)); + message.leafHash !== undefined && + (obj.leafHash = base64FromBytes(message.leafHash !== undefined ? message.leafHash : new Uint8Array())); + if (message.aunts) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.aunts = []; + } + return obj; + }, + create(base) { + return Proof.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProof(); + message.total = object.total ?? 0; + message.index = object.index ?? 0; + message.leafHash = object.leafHash ?? new Uint8Array(); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; +function createBaseValueOp() { + return { key: new Uint8Array(), proof: undefined }; +} +export const ValueOp = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + create(base) { + return ValueOp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(); + message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; +function createBaseDominoOp() { + return { key: "", input: "", output: "" }; +} +export const DominoOp = { + encode(message, writer = _m0.Writer.create()) { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.input = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.output = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? String(object.key) : "", + input: isSet(object.input) ? String(object.input) : "", + output: isSet(object.output) ? String(object.output) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && (obj.key = message.key); + message.input !== undefined && (obj.input = message.input); + message.output !== undefined && (obj.output = message.output); + return obj; + }, + create(base) { + return DominoOp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseDominoOp(); + message.key = object.key ?? ""; + message.input = object.input ?? ""; + message.output = object.output ?? ""; + return message; + }, +}; +function createBaseProofOp() { + return { type: "", key: new Uint8Array(), data: new Uint8Array() }; +} +export const ProofOp = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = message.type); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + create(base) { + return ProofOp.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, +}; +function createBaseProofOps() { + return { ops: [] }; +} +export const ProofOps = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.ops) { + ProofOp.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { ops: Array.isArray(object?.ops) ? object.ops.map((e) => ProofOp.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.ops) { + obj.ops = message.ops.map((e) => e ? ProofOp.toJSON(e) : undefined); + } + else { + obj.ops = []; + } + return obj; + }, + create(base) { + return ProofOps.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/tendermint/types/params.d.ts b/dist/module/tendermint/types/params.d.ts new file mode 100644 index 0000000..100aff3 --- /dev/null +++ b/dist/module/tendermint/types/params.d.ts @@ -0,0 +1,313 @@ +import _m0 from "protobufjs/minimal"; +import { Duration } from "../../google/protobuf/duration"; +export declare const protobufPackage = "tendermint.types"; +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParams { + block: BlockParams | undefined; + evidence: EvidenceParams | undefined; + validator: ValidatorParams | undefined; + version: VersionParams | undefined; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: number; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: number; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: number; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: Duration | undefined; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: number; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: number; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: number; + blockMaxGas: number; +} +export declare const ConsensusParams: { + encode(message: ConsensusParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams; + fromJSON(object: any): ConsensusParams; + toJSON(message: ConsensusParams): unknown; + create]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }>(base?: I | undefined): ConsensusParams; + fromPartial]: never; }) | undefined; + evidence?: ({ + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: { + seconds?: number | undefined; + nanos?: number | undefined; + } | undefined; + maxBytes?: number | undefined; + } & { + maxAgeNumBlocks?: number | undefined; + maxAgeDuration?: ({ + seconds?: number | undefined; + nanos?: number | undefined; + } & { + seconds?: number | undefined; + nanos?: number | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + validator?: ({ + pubKeyTypes?: string[] | undefined; + } & { + pubKeyTypes?: (string[] & string[] & { [K_10 in Exclude]: never; }) | undefined; + } & { [K_11 in Exclude]: never; }) | undefined; + version?: ({ + app?: number | undefined; + } & { + app?: number | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + } & { [K_13 in Exclude]: never; }>(object: I_1): ConsensusParams; +}; +export declare const BlockParams: { + encode(message: BlockParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams; + fromJSON(object: any): BlockParams; + toJSON(message: BlockParams): unknown; + create]: never; }>(base?: I | undefined): BlockParams; + fromPartial]: never; }>(object: I_1): BlockParams; +}; +export declare const EvidenceParams: { + encode(message: EvidenceParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceParams; + fromJSON(object: any): EvidenceParams; + toJSON(message: EvidenceParams): unknown; + create]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): EvidenceParams; + fromPartial]: never; }) | undefined; + maxBytes?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): EvidenceParams; +}; +export declare const ValidatorParams: { + encode(message: ValidatorParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorParams; + fromJSON(object: any): ValidatorParams; + toJSON(message: ValidatorParams): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): ValidatorParams; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): ValidatorParams; +}; +export declare const VersionParams: { + encode(message: VersionParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): VersionParams; + fromJSON(object: any): VersionParams; + toJSON(message: VersionParams): unknown; + create]: never; }>(base?: I | undefined): VersionParams; + fromPartial]: never; }>(object: I_1): VersionParams; +}; +export declare const HashedParams: { + encode(message: HashedParams, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): HashedParams; + fromJSON(object: any): HashedParams; + toJSON(message: HashedParams): unknown; + create]: never; }>(base?: I | undefined): HashedParams; + fromPartial]: never; }>(object: I_1): HashedParams; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/tendermint/types/params.js b/dist/module/tendermint/types/params.js new file mode 100644 index 0000000..20e348f --- /dev/null +++ b/dist/module/tendermint/types/params.js @@ -0,0 +1,476 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Duration } from "../../google/protobuf/duration"; +export const protobufPackage = "tendermint.types"; +function createBaseConsensusParams() { + return { + block: undefined, + evidence: undefined, + validator: undefined, + version: undefined, + }; +} +export const ConsensusParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.version = VersionParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + block: isSet(object.block) + ? BlockParams.fromJSON(object.block) + : undefined, + evidence: isSet(object.evidence) + ? EvidenceParams.fromJSON(object.evidence) + : undefined, + validator: isSet(object.validator) + ? ValidatorParams.fromJSON(object.validator) + : undefined, + version: isSet(object.version) + ? VersionParams.fromJSON(object.version) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.block !== undefined && + (obj.block = message.block + ? BlockParams.toJSON(message.block) + : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence + ? EvidenceParams.toJSON(message.evidence) + : undefined); + message.validator !== undefined && + (obj.validator = message.validator + ? ValidatorParams.toJSON(message.validator) + : undefined); + message.version !== undefined && + (obj.version = message.version + ? VersionParams.toJSON(message.version) + : undefined); + return obj; + }, + create(base) { + return ConsensusParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseConsensusParams(); + message.block = + object.block !== undefined && object.block !== null + ? BlockParams.fromPartial(object.block) + : undefined; + message.evidence = + object.evidence !== undefined && object.evidence !== null + ? EvidenceParams.fromPartial(object.evidence) + : undefined; + message.validator = + object.validator !== undefined && object.validator !== null + ? ValidatorParams.fromPartial(object.validator) + : undefined; + message.version = + object.version !== undefined && object.version !== null + ? VersionParams.fromPartial(object.version) + : undefined; + return message; + }, +}; +function createBaseBlockParams() { + return { maxBytes: 0, maxGas: 0 }; +} +export const BlockParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.maxBytes !== 0) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== 0) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.maxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.maxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + maxBytes: isSet(object.maxBytes) ? Number(object.maxBytes) : 0, + maxGas: isSet(object.maxGas) ? Number(object.maxGas) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.maxBytes !== undefined && + (obj.maxBytes = Math.round(message.maxBytes)); + message.maxGas !== undefined && (obj.maxGas = Math.round(message.maxGas)); + return obj; + }, + create(base) { + return BlockParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes ?? 0; + message.maxGas = object.maxGas ?? 0; + return message; + }, +}; +function createBaseEvidenceParams() { + return { maxAgeNumBlocks: 0, maxAgeDuration: undefined, maxBytes: 0 }; +} +export const EvidenceParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.maxAgeNumBlocks !== 0) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim(); + } + if (message.maxBytes !== 0) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.maxAgeNumBlocks = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.maxAgeDuration = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.maxBytes = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) + ? Number(object.maxAgeNumBlocks) + : 0, + maxAgeDuration: isSet(object.maxAgeDuration) + ? Duration.fromJSON(object.maxAgeDuration) + : undefined, + maxBytes: isSet(object.maxBytes) ? Number(object.maxBytes) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.maxAgeNumBlocks !== undefined && + (obj.maxAgeNumBlocks = Math.round(message.maxAgeNumBlocks)); + message.maxAgeDuration !== undefined && + (obj.maxAgeDuration = message.maxAgeDuration + ? Duration.toJSON(message.maxAgeDuration) + : undefined); + message.maxBytes !== undefined && + (obj.maxBytes = Math.round(message.maxBytes)); + return obj; + }, + create(base) { + return EvidenceParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks ?? 0; + message.maxAgeDuration = + object.maxAgeDuration !== undefined && object.maxAgeDuration !== null + ? Duration.fromPartial(object.maxAgeDuration) + : undefined; + message.maxBytes = object.maxBytes ?? 0; + return message; + }, +}; +function createBaseValidatorParams() { + return { pubKeyTypes: [] }; +} +export const ValidatorParams = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.pubKeyTypes.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pubKeyTypes: Array.isArray(object?.pubKeyTypes) + ? object.pubKeyTypes.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.pubKeyTypes) { + obj.pubKeyTypes = message.pubKeyTypes.map((e) => e); + } + else { + obj.pubKeyTypes = []; + } + return obj; + }, + create(base) { + return ValidatorParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; + return message; + }, +}; +function createBaseVersionParams() { + return { app: 0 }; +} +export const VersionParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.app !== 0) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { app: isSet(object.app) ? Number(object.app) : 0 }; + }, + toJSON(message) { + const obj = {}; + message.app !== undefined && (obj.app = Math.round(message.app)); + return obj; + }, + create(base) { + return VersionParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVersionParams(); + message.app = object.app ?? 0; + return message; + }, +}; +function createBaseHashedParams() { + return { blockMaxBytes: 0, blockMaxGas: 0 }; +} +export const HashedParams = { + encode(message, writer = _m0.Writer.create()) { + if (message.blockMaxBytes !== 0) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== 0) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.blockMaxBytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.blockMaxGas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blockMaxBytes: isSet(object.blockMaxBytes) + ? Number(object.blockMaxBytes) + : 0, + blockMaxGas: isSet(object.blockMaxGas) ? Number(object.blockMaxGas) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.blockMaxBytes !== undefined && + (obj.blockMaxBytes = Math.round(message.blockMaxBytes)); + message.blockMaxGas !== undefined && + (obj.blockMaxGas = Math.round(message.blockMaxGas)); + return obj; + }, + create(base) { + return HashedParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes ?? 0; + message.blockMaxGas = object.blockMaxGas ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/tendermint/types/types.d.ts b/dist/module/tendermint/types/types.d.ts new file mode 100644 index 0000000..59dfd2f --- /dev/null +++ b/dist/module/tendermint/types/types.d.ts @@ -0,0 +1,1970 @@ +import _m0 from "protobufjs/minimal"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { ValidatorSet } from "./validator"; +export declare const protobufPackage = "tendermint.types"; +/** BlockIdFlag indicates which BlcokID the signature is for */ +export declare enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = 0, + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + BLOCK_ID_FLAG_NIL = 3, + UNRECOGNIZED = -1 +} +export declare function blockIDFlagFromJSON(object: any): BlockIDFlag; +export declare function blockIDFlagToJSON(object: BlockIDFlag): string; +/** SignedMsgType is a type of signed message in the consensus. */ +export declare enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = 0, + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SIGNED_MSG_TYPE_PREVOTE = 1, + SIGNED_MSG_TYPE_PRECOMMIT = 2, + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SIGNED_MSG_TYPE_PROPOSAL = 32, + UNRECOGNIZED = -1 +} +export declare function signedMsgTypeFromJSON(object: any): SignedMsgType; +export declare function signedMsgTypeToJSON(object: SignedMsgType): string; +/** PartsetHeader */ +export interface PartSetHeader { + total: number; + hash: Uint8Array; +} +export interface Part { + index: number; + bytes: Uint8Array; + proof: Proof | undefined; +} +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader | undefined; +} +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus | undefined; + chainId: string; + height: number; + time: Date | undefined; + /** prev block info */ + lastBlockId: BlockID | undefined; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} +/** Data contains the set of transactions included in the block */ +export interface Data { + /** + * Txs that will be applied by state @ block.Height+1. + * NOTE: not all txs here are valid. We're just agreeing on the order first. + * This means that block.AppHash does not include these txs. + */ + txs: Uint8Array[]; +} +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: number; + round: number; + /** zero if vote is nil. */ + blockId: BlockID | undefined; + timestamp: Date | undefined; + validatorAddress: Uint8Array; + validatorIndex: number; + signature: Uint8Array; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: number; + round: number; + blockId: BlockID | undefined; + signatures: CommitSig[]; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date | undefined; + signature: Uint8Array; +} +export interface Proposal { + type: SignedMsgType; + height: number; + round: number; + polRound: number; + blockId: BlockID | undefined; + timestamp: Date | undefined; + signature: Uint8Array; +} +export interface SignedHeader { + header: Header | undefined; + commit: Commit | undefined; +} +export interface LightBlock { + signedHeader: SignedHeader | undefined; + validatorSet: ValidatorSet | undefined; +} +export interface BlockMeta { + blockId: BlockID | undefined; + blockSize: number; + header: Header | undefined; + numTxs: number; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof: Proof | undefined; +} +export declare const PartSetHeader: { + encode(message: PartSetHeader, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PartSetHeader; + fromJSON(object: any): PartSetHeader; + toJSON(message: PartSetHeader): unknown; + create]: never; }>(base?: I | undefined): PartSetHeader; + fromPartial]: never; }>(object: I_1): PartSetHeader; +}; +export declare const Part: { + encode(message: Part, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Part; + fromJSON(object: any): Part; + toJSON(message: Part): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): Part; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): Part; +}; +export declare const BlockID: { + encode(message: BlockID, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): BlockID; + fromJSON(object: any): BlockID; + toJSON(message: BlockID): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): BlockID; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): BlockID; +}; +export declare const Header: { + encode(message: Header, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Header; + fromJSON(object: any): Header; + toJSON(message: Header): unknown; + create]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }>(base?: I | undefined): Header; + fromPartial]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_7 in Exclude]: never; }>(object: I_1): Header; +}; +export declare const Data: { + encode(message: Data, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Data; + fromJSON(object: any): Data; + toJSON(message: Data): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): Data; + fromPartial]: never; }) | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): Data; +}; +export declare const Vote: { + encode(message: Vote, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Vote; + fromJSON(object: any): Vote; + toJSON(message: Vote): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + timestamp?: Date | undefined; + validatorAddress?: Uint8Array | undefined; + validatorIndex?: number | undefined; + signature?: Uint8Array | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): Vote; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + timestamp?: Date | undefined; + validatorAddress?: Uint8Array | undefined; + validatorIndex?: number | undefined; + signature?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): Vote; +}; +export declare const Commit: { + encode(message: Commit, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Commit; + fromJSON(object: any): Commit; + toJSON(message: Commit): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_2 in Exclude]: never; })[] & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }>(base?: I | undefined): Commit; + fromPartial]: never; }) | undefined; + } & { [K_6 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }>(object: I_1): Commit; +}; +export declare const CommitSig: { + encode(message: CommitSig, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): CommitSig; + fromJSON(object: any): CommitSig; + toJSON(message: CommitSig): unknown; + create]: never; }>(base?: I | undefined): CommitSig; + fromPartial]: never; }>(object: I_1): CommitSig; +}; +export declare const Proposal: { + encode(message: Proposal, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal; + fromJSON(object: any): Proposal; + toJSON(message: Proposal): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): Proposal; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): Proposal; +}; +export declare const SignedHeader: { + encode(message: SignedHeader, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): SignedHeader; + fromJSON(object: any): SignedHeader; + toJSON(message: SignedHeader): unknown; + create]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + commit?: ({ + height?: number | undefined; + round?: number | undefined; + blockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + signatures?: { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] | undefined; + } & { + height?: number | undefined; + round?: number | undefined; + blockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_6 in Exclude]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }>(base?: I | undefined): SignedHeader; + fromPartial]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_11 in Exclude]: never; }) | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + commit?: ({ + height?: number | undefined; + round?: number | undefined; + blockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + signatures?: { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] | undefined; + } & { + height?: number | undefined; + round?: number | undefined; + blockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_16 in Exclude]: never; })[] & { [K_17 in Exclude]: never; }) | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + } & { [K_19 in Exclude]: never; }>(object: I_1): SignedHeader; +}; +export declare const LightBlock: { + encode(message: LightBlock, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): LightBlock; + fromJSON(object: any): LightBlock; + toJSON(message: LightBlock): unknown; + create]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + commit?: ({ + height?: number | undefined; + round?: number | undefined; + blockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + signatures?: { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] | undefined; + } & { + height?: number | undefined; + round?: number | undefined; + blockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_6 in Exclude]: never; })[] & { [K_7 in Exclude]: never; }) | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + validatorSet?: ({ + validators?: { + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + }[] | undefined; + proposer?: { + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } | undefined; + totalVotingPower?: number | undefined; + } & { + validators?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + }[] & ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_11 in Exclude]: never; })[] & { [K_12 in Exclude]: never; }) | undefined; + proposer?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_13 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_14 in Exclude]: never; }) | undefined; + totalVotingPower?: number | undefined; + } & { [K_15 in Exclude]: never; }) | undefined; + } & { [K_16 in Exclude]: never; }>(base?: I | undefined): LightBlock; + fromPartial]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_18 in Exclude]: never; }) | undefined; + } & { [K_19 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_20 in Exclude]: never; }) | undefined; + commit?: ({ + height?: number | undefined; + round?: number | undefined; + blockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + signatures?: { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] | undefined; + } & { + height?: number | undefined; + round?: number | undefined; + blockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_21 in Exclude]: never; }) | undefined; + } & { [K_22 in Exclude]: never; }) | undefined; + signatures?: ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + }[] & ({ + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { + blockIdFlag?: BlockIDFlag | undefined; + validatorAddress?: Uint8Array | undefined; + timestamp?: Date | undefined; + signature?: Uint8Array | undefined; + } & { [K_23 in Exclude]: never; })[] & { [K_24 in Exclude]: never; }) | undefined; + } & { [K_25 in Exclude]: never; }) | undefined; + } & { [K_26 in Exclude]: never; }) | undefined; + validatorSet?: ({ + validators?: { + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + }[] | undefined; + proposer?: { + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } | undefined; + totalVotingPower?: number | undefined; + } & { + validators?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + }[] & ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_27 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_28 in Exclude]: never; })[] & { [K_29 in Exclude]: never; }) | undefined; + proposer?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_30 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_31 in Exclude]: never; }) | undefined; + totalVotingPower?: number | undefined; + } & { [K_32 in Exclude]: never; }) | undefined; + } & { [K_33 in Exclude]: never; }>(object: I_1): LightBlock; +}; +export declare const BlockMeta: { + encode(message: BlockMeta, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): BlockMeta; + fromJSON(object: any): BlockMeta; + toJSON(message: BlockMeta): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + blockSize?: number | undefined; + header?: ({ + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + version?: ({ + block?: number | undefined; + app?: number | undefined; + } & { + block?: number | undefined; + app?: number | undefined; + } & { [K_2 in Exclude]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_5 in Exclude]: never; }) | undefined; + numTxs?: number | undefined; + } & { [K_6 in Exclude]: never; }>(base?: I | undefined): BlockMeta; + fromPartial]: never; }) | undefined; + } & { [K_8 in Exclude]: never; }) | undefined; + blockSize?: number | undefined; + header?: ({ + version?: { + block?: number | undefined; + app?: number | undefined; + } | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: { + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { + version?: ({ + block?: number | undefined; + app?: number | undefined; + } & { + block?: number | undefined; + app?: number | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + chainId?: string | undefined; + height?: number | undefined; + time?: Date | undefined; + lastBlockId?: ({ + hash?: Uint8Array | undefined; + partSetHeader?: { + total?: number | undefined; + hash?: Uint8Array | undefined; + } | undefined; + } & { + hash?: Uint8Array | undefined; + partSetHeader?: ({ + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { + total?: number | undefined; + hash?: Uint8Array | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + } & { [K_11 in Exclude]: never; }) | undefined; + lastCommitHash?: Uint8Array | undefined; + dataHash?: Uint8Array | undefined; + validatorsHash?: Uint8Array | undefined; + nextValidatorsHash?: Uint8Array | undefined; + consensusHash?: Uint8Array | undefined; + appHash?: Uint8Array | undefined; + lastResultsHash?: Uint8Array | undefined; + evidenceHash?: Uint8Array | undefined; + proposerAddress?: Uint8Array | undefined; + } & { [K_12 in Exclude]: never; }) | undefined; + numTxs?: number | undefined; + } & { [K_13 in Exclude]: never; }>(object: I_1): BlockMeta; +}; +export declare const TxProof: { + encode(message: TxProof, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): TxProof; + fromJSON(object: any): TxProof; + toJSON(message: TxProof): unknown; + create]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }) | undefined; + } & { [K_2 in Exclude]: never; }>(base?: I | undefined): TxProof; + fromPartial]: never; }) | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + } & { [K_5 in Exclude]: never; }>(object: I_1): TxProof; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/tendermint/types/types.js b/dist/module/tendermint/types/types.js new file mode 100644 index 0000000..98166bb --- /dev/null +++ b/dist/module/tendermint/types/types.js @@ -0,0 +1,1580 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Proof } from "../crypto/proof"; +import { Consensus } from "../version/types"; +import { ValidatorSet } from "./validator"; +export const protobufPackage = "tendermint.types"; +/** BlockIdFlag indicates which BlcokID the signature is for */ +export var BlockIDFlag; +(function (BlockIDFlag) { + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_UNKNOWN"] = 0] = "BLOCK_ID_FLAG_UNKNOWN"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_ABSENT"] = 1] = "BLOCK_ID_FLAG_ABSENT"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_COMMIT"] = 2] = "BLOCK_ID_FLAG_COMMIT"; + BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_NIL"] = 3] = "BLOCK_ID_FLAG_NIL"; + BlockIDFlag[BlockIDFlag["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(BlockIDFlag || (BlockIDFlag = {})); +export function blockIDFlagFromJSON(object) { + switch (object) { + case 0: + case "BLOCK_ID_FLAG_UNKNOWN": + return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; + case 1: + case "BLOCK_ID_FLAG_ABSENT": + return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; + case 2: + case "BLOCK_ID_FLAG_COMMIT": + return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; + case 3: + case "BLOCK_ID_FLAG_NIL": + return BlockIDFlag.BLOCK_ID_FLAG_NIL; + case -1: + case "UNRECOGNIZED": + default: + return BlockIDFlag.UNRECOGNIZED; + } +} +export function blockIDFlagToJSON(object) { + switch (object) { + case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: + return "BLOCK_ID_FLAG_UNKNOWN"; + case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: + return "BLOCK_ID_FLAG_ABSENT"; + case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: + return "BLOCK_ID_FLAG_COMMIT"; + case BlockIDFlag.BLOCK_ID_FLAG_NIL: + return "BLOCK_ID_FLAG_NIL"; + case BlockIDFlag.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** SignedMsgType is a type of signed message in the consensus. */ +export var SignedMsgType; +(function (SignedMsgType) { + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_UNKNOWN"] = 0] = "SIGNED_MSG_TYPE_UNKNOWN"; + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PREVOTE"] = 1] = "SIGNED_MSG_TYPE_PREVOTE"; + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PRECOMMIT"] = 2] = "SIGNED_MSG_TYPE_PRECOMMIT"; + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PROPOSAL"] = 32] = "SIGNED_MSG_TYPE_PROPOSAL"; + SignedMsgType[SignedMsgType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(SignedMsgType || (SignedMsgType = {})); +export function signedMsgTypeFromJSON(object) { + switch (object) { + case 0: + case "SIGNED_MSG_TYPE_UNKNOWN": + return SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; + case 1: + case "SIGNED_MSG_TYPE_PREVOTE": + return SignedMsgType.SIGNED_MSG_TYPE_PREVOTE; + case 2: + case "SIGNED_MSG_TYPE_PRECOMMIT": + return SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT; + case 32: + case "SIGNED_MSG_TYPE_PROPOSAL": + return SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL; + case -1: + case "UNRECOGNIZED": + default: + return SignedMsgType.UNRECOGNIZED; + } +} +export function signedMsgTypeToJSON(object) { + switch (object) { + case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN: + return "SIGNED_MSG_TYPE_UNKNOWN"; + case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE: + return "SIGNED_MSG_TYPE_PREVOTE"; + case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT: + return "SIGNED_MSG_TYPE_PRECOMMIT"; + case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL: + return "SIGNED_MSG_TYPE_PROPOSAL"; + case SignedMsgType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBasePartSetHeader() { + return { total: 0, hash: new Uint8Array() }; +} +export const PartSetHeader = { + encode(message, writer = _m0.Writer.create()) { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.total = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + total: isSet(object.total) ? Number(object.total) : 0, + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.total !== undefined && (obj.total = Math.round(message.total)); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + create(base) { + return PartSetHeader.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, +}; +function createBasePart() { + return { index: 0, bytes: new Uint8Array(), proof: undefined }; +} +export const Part = { + encode(message, writer = _m0.Writer.create()) { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + index: isSet(object.index) ? Number(object.index) : 0, + bytes: isSet(object.bytes) + ? bytesFromBase64(object.bytes) + : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.index !== undefined && (obj.index = Math.round(message.index)); + message.bytes !== undefined && + (obj.bytes = base64FromBytes(message.bytes !== undefined ? message.bytes : new Uint8Array())); + message.proof !== undefined && + (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + create(base) { + return Part.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(); + message.proof = + object.proof !== undefined && object.proof !== null + ? Proof.fromPartial(object.proof) + : undefined; + return message; + }, +}; +function createBaseBlockID() { + return { hash: new Uint8Array(), partSetHeader: undefined }; +} +export const BlockID = { + encode(message, writer = _m0.Writer.create()) { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + partSetHeader: isSet(object.partSetHeader) + ? PartSetHeader.fromJSON(object.partSetHeader) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.partSetHeader !== undefined && + (obj.partSetHeader = message.partSetHeader + ? PartSetHeader.toJSON(message.partSetHeader) + : undefined); + return obj; + }, + create(base) { + return BlockID.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(); + message.partSetHeader = + object.partSetHeader !== undefined && object.partSetHeader !== null + ? PartSetHeader.fromPartial(object.partSetHeader) + : undefined; + return message; + }, +}; +function createBaseHeader() { + return { + version: undefined, + chainId: "", + height: 0, + time: undefined, + lastBlockId: undefined, + lastCommitHash: new Uint8Array(), + dataHash: new Uint8Array(), + validatorsHash: new Uint8Array(), + nextValidatorsHash: new Uint8Array(), + consensusHash: new Uint8Array(), + appHash: new Uint8Array(), + lastResultsHash: new Uint8Array(), + evidenceHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +export const Header = { + encode(message, writer = _m0.Writer.create()) { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.chainId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.lastCommitHash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + message.dataHash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.validatorsHash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + message.nextValidatorsHash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + message.consensusHash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + message.appHash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + message.lastResultsHash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + message.evidenceHash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + message.proposerAddress = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + version: isSet(object.version) + ? Consensus.fromJSON(object.version) + : undefined, + chainId: isSet(object.chainId) ? String(object.chainId) : "", + height: isSet(object.height) ? Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + lastBlockId: isSet(object.lastBlockId) + ? BlockID.fromJSON(object.lastBlockId) + : undefined, + lastCommitHash: isSet(object.lastCommitHash) + ? bytesFromBase64(object.lastCommitHash) + : new Uint8Array(), + dataHash: isSet(object.dataHash) + ? bytesFromBase64(object.dataHash) + : new Uint8Array(), + validatorsHash: isSet(object.validatorsHash) + ? bytesFromBase64(object.validatorsHash) + : new Uint8Array(), + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + consensusHash: isSet(object.consensusHash) + ? bytesFromBase64(object.consensusHash) + : new Uint8Array(), + appHash: isSet(object.appHash) + ? bytesFromBase64(object.appHash) + : new Uint8Array(), + lastResultsHash: isSet(object.lastResultsHash) + ? bytesFromBase64(object.lastResultsHash) + : new Uint8Array(), + evidenceHash: isSet(object.evidenceHash) + ? bytesFromBase64(object.evidenceHash) + : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) + ? bytesFromBase64(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.version !== undefined && + (obj.version = message.version + ? Consensus.toJSON(message.version) + : undefined); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.time !== undefined && (obj.time = message.time.toISOString()); + message.lastBlockId !== undefined && + (obj.lastBlockId = message.lastBlockId + ? BlockID.toJSON(message.lastBlockId) + : undefined); + message.lastCommitHash !== undefined && + (obj.lastCommitHash = base64FromBytes(message.lastCommitHash !== undefined + ? message.lastCommitHash + : new Uint8Array())); + message.dataHash !== undefined && + (obj.dataHash = base64FromBytes(message.dataHash !== undefined ? message.dataHash : new Uint8Array())); + message.validatorsHash !== undefined && + (obj.validatorsHash = base64FromBytes(message.validatorsHash !== undefined + ? message.validatorsHash + : new Uint8Array())); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array())); + message.consensusHash !== undefined && + (obj.consensusHash = base64FromBytes(message.consensusHash !== undefined + ? message.consensusHash + : new Uint8Array())); + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + message.lastResultsHash !== undefined && + (obj.lastResultsHash = base64FromBytes(message.lastResultsHash !== undefined + ? message.lastResultsHash + : new Uint8Array())); + message.evidenceHash !== undefined && + (obj.evidenceHash = base64FromBytes(message.evidenceHash !== undefined + ? message.evidenceHash + : new Uint8Array())); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes(message.proposerAddress !== undefined + ? message.proposerAddress + : new Uint8Array())); + return obj; + }, + create(base) { + return Header.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseHeader(); + message.version = + object.version !== undefined && object.version !== null + ? Consensus.fromPartial(object.version) + : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.lastBlockId = + object.lastBlockId !== undefined && object.lastBlockId !== null + ? BlockID.fromPartial(object.lastBlockId) + : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(); + message.dataHash = object.dataHash ?? new Uint8Array(); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.consensusHash = object.consensusHash ?? new Uint8Array(); + message.appHash = object.appHash ?? new Uint8Array(); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, +}; +function createBaseData() { + return { txs: [] }; +} +export const Data = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.txs) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + txs: Array.isArray(object?.txs) + ? object.txs.map((e) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } + else { + obj.txs = []; + } + return obj; + }, + create(base) { + return Data.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseData(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; +function createBaseVote() { + return { + type: 0, + height: 0, + round: 0, + blockId: undefined, + timestamp: undefined, + validatorAddress: new Uint8Array(), + validatorIndex: 0, + signature: new Uint8Array(), + }; +} +export const Vote = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.round = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + message.validatorAddress = reader.bytes(); + continue; + case 7: + if (tag !== 56) { + break; + } + message.validatorIndex = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? Number(object.height) : 0, + round: isSet(object.round) ? Number(object.round) : 0, + blockId: isSet(object.blockId) + ? BlockID.fromJSON(object.blockId) + : undefined, + timestamp: isSet(object.timestamp) + ? fromJsonTimestamp(object.timestamp) + : undefined, + validatorAddress: isSet(object.validatorAddress) + ? bytesFromBase64(object.validatorAddress) + : new Uint8Array(), + validatorIndex: isSet(object.validatorIndex) + ? Number(object.validatorIndex) + : 0, + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && + (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.blockId !== undefined && + (obj.blockId = message.blockId + ? BlockID.toJSON(message.blockId) + : undefined); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp.toISOString()); + message.validatorAddress !== undefined && + (obj.validatorAddress = base64FromBytes(message.validatorAddress !== undefined + ? message.validatorAddress + : new Uint8Array())); + message.validatorIndex !== undefined && + (obj.validatorIndex = Math.round(message.validatorIndex)); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + create(base) { + return Vote.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseCommit() { + return { height: 0, round: 0, blockId: undefined, signatures: [] }; +} +export const Commit = { + encode(message, writer = _m0.Writer.create()) { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.signatures) { + CommitSig.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + height: isSet(object.height) ? Number(object.height) : 0, + round: isSet(object.round) ? Number(object.round) : 0, + blockId: isSet(object.blockId) + ? BlockID.fromJSON(object.blockId) + : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e) => CommitSig.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.height !== undefined && (obj.height = Math.round(message.height)); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.blockId !== undefined && + (obj.blockId = message.blockId + ? BlockID.toJSON(message.blockId) + : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? CommitSig.toJSON(e) : undefined); + } + else { + obj.signatures = []; + } + return obj; + }, + create(base) { + return Commit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? BlockID.fromPartial(object.blockId) + : undefined; + message.signatures = + object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCommitSig() { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(), + timestamp: undefined, + signature: new Uint8Array(), + }; +} +export const CommitSig = { + encode(message, writer = _m0.Writer.create()) { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.blockIdFlag = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.validatorAddress = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blockIdFlag: isSet(object.blockIdFlag) + ? blockIDFlagFromJSON(object.blockIdFlag) + : 0, + validatorAddress: isSet(object.validatorAddress) + ? bytesFromBase64(object.validatorAddress) + : new Uint8Array(), + timestamp: isSet(object.timestamp) + ? fromJsonTimestamp(object.timestamp) + : undefined, + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.blockIdFlag !== undefined && + (obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag)); + message.validatorAddress !== undefined && + (obj.validatorAddress = base64FromBytes(message.validatorAddress !== undefined + ? message.validatorAddress + : new Uint8Array())); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp.toISOString()); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + create(base) { + return CommitSig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseProposal() { + return { + type: 0, + height: 0, + round: 0, + polRound: 0, + blockId: undefined, + timestamp: undefined, + signature: new Uint8Array(), + }; +} +export const Proposal = { + encode(message, writer = _m0.Writer.create()) { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.type = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.round = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + message.polRound = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? Number(object.height) : 0, + round: isSet(object.round) ? Number(object.round) : 0, + polRound: isSet(object.polRound) ? Number(object.polRound) : 0, + blockId: isSet(object.blockId) + ? BlockID.fromJSON(object.blockId) + : undefined, + timestamp: isSet(object.timestamp) + ? fromJsonTimestamp(object.timestamp) + : undefined, + signature: isSet(object.signature) + ? bytesFromBase64(object.signature) + : new Uint8Array(), + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && + (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = Math.round(message.height)); + message.round !== undefined && (obj.round = Math.round(message.round)); + message.polRound !== undefined && + (obj.polRound = Math.round(message.polRound)); + message.blockId !== undefined && + (obj.blockId = message.blockId + ? BlockID.toJSON(message.blockId) + : undefined); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp.toISOString()); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + return obj; + }, + create(base) { + return Proposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? BlockID.fromPartial(object.blockId) + : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, +}; +function createBaseSignedHeader() { + return { header: undefined, commit: undefined }; +} +export const SignedHeader = { + encode(message, writer = _m0.Writer.create()) { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.commit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + commit: isSet(object.commit) ? Commit.fromJSON(object.commit) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.header !== undefined && + (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.commit !== undefined && + (obj.commit = message.commit ? Commit.toJSON(message.commit) : undefined); + return obj; + }, + create(base) { + return SignedHeader.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSignedHeader(); + message.header = + object.header !== undefined && object.header !== null + ? Header.fromPartial(object.header) + : undefined; + message.commit = + object.commit !== undefined && object.commit !== null + ? Commit.fromPartial(object.commit) + : undefined; + return message; + }, +}; +function createBaseLightBlock() { + return { signedHeader: undefined, validatorSet: undefined }; +} +export const LightBlock = { + encode(message, writer = _m0.Writer.create()) { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + signedHeader: isSet(object.signedHeader) + ? SignedHeader.fromJSON(object.signedHeader) + : undefined, + validatorSet: isSet(object.validatorSet) + ? ValidatorSet.fromJSON(object.validatorSet) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.signedHeader !== undefined && + (obj.signedHeader = message.signedHeader + ? SignedHeader.toJSON(message.signedHeader) + : undefined); + message.validatorSet !== undefined && + (obj.validatorSet = message.validatorSet + ? ValidatorSet.toJSON(message.validatorSet) + : undefined); + return obj; + }, + create(base) { + return LightBlock.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseLightBlock(); + message.signedHeader = + object.signedHeader !== undefined && object.signedHeader !== null + ? SignedHeader.fromPartial(object.signedHeader) + : undefined; + message.validatorSet = + object.validatorSet !== undefined && object.validatorSet !== null + ? ValidatorSet.fromPartial(object.validatorSet) + : undefined; + return message; + }, +}; +function createBaseBlockMeta() { + return { blockId: undefined, blockSize: 0, header: undefined, numTxs: 0 }; +} +export const BlockMeta = { + encode(message, writer = _m0.Writer.create()) { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); + } + if (message.blockSize !== 0) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).ldelim(); + } + if (message.numTxs !== 0) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.blockId = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.blockSize = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + message.header = Header.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.numTxs = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blockId: isSet(object.blockId) + ? BlockID.fromJSON(object.blockId) + : undefined, + blockSize: isSet(object.blockSize) ? Number(object.blockSize) : 0, + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + numTxs: isSet(object.numTxs) ? Number(object.numTxs) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.blockId !== undefined && + (obj.blockId = message.blockId + ? BlockID.toJSON(message.blockId) + : undefined); + message.blockSize !== undefined && + (obj.blockSize = Math.round(message.blockSize)); + message.header !== undefined && + (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.numTxs !== undefined && (obj.numTxs = Math.round(message.numTxs)); + return obj; + }, + create(base) { + return BlockMeta.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseBlockMeta(); + message.blockId = + object.blockId !== undefined && object.blockId !== null + ? BlockID.fromPartial(object.blockId) + : undefined; + message.blockSize = object.blockSize ?? 0; + message.header = + object.header !== undefined && object.header !== null + ? Header.fromPartial(object.header) + : undefined; + message.numTxs = object.numTxs ?? 0; + return message; + }, +}; +function createBaseTxProof() { + return { + rootHash: new Uint8Array(), + data: new Uint8Array(), + proof: undefined, + }; +} +export const TxProof = { + encode(message, writer = _m0.Writer.create()) { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.rootHash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + rootHash: isSet(object.rootHash) + ? bytesFromBase64(object.rootHash) + : new Uint8Array(), + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.rootHash !== undefined && + (obj.rootHash = base64FromBytes(message.rootHash !== undefined ? message.rootHash : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.proof !== undefined && + (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + create(base) { + return TxProof.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + message.proof = + object.proof !== undefined && object.proof !== null + ? Proof.fromPartial(object.proof) + : undefined; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function toTimestamp(date) { + const seconds = date.getTime() / 1000; + const nanos = (date.getTime() % 1000) * 1000000; + return { seconds, nanos }; +} +function fromTimestamp(t) { + let millis = (t.seconds || 0) * 1000; + millis += (t.nanos || 0) / 1000000; + return new Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof Date) { + return o; + } + else if (typeof o === "string") { + return new Date(o); + } + else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/tendermint/types/validator.d.ts b/dist/module/tendermint/types/validator.d.ts new file mode 100644 index 0000000..c634f85 --- /dev/null +++ b/dist/module/tendermint/types/validator.d.ts @@ -0,0 +1,277 @@ +import _m0 from "protobufjs/minimal"; +import { PublicKey } from "../crypto/keys"; +export declare const protobufPackage = "tendermint.types"; +export interface ValidatorSet { + validators: Validator[]; + proposer: Validator | undefined; + totalVotingPower: number; +} +export interface Validator { + address: Uint8Array; + pubKey: PublicKey | undefined; + votingPower: number; + proposerPriority: number; +} +export interface SimpleValidator { + pubKey: PublicKey | undefined; + votingPower: number; +} +export declare const ValidatorSet: { + encode(message: ValidatorSet, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSet; + fromJSON(object: any): ValidatorSet; + toJSON(message: ValidatorSet): unknown; + create]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_1 in Exclude]: never; })[] & { [K_2 in Exclude]: never; }) | undefined; + proposer?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_3 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_4 in Exclude]: never; }) | undefined; + totalVotingPower?: number | undefined; + } & { [K_5 in Exclude]: never; }>(base?: I | undefined): ValidatorSet; + fromPartial]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_7 in Exclude]: never; })[] & { [K_8 in Exclude]: never; }) | undefined; + proposer?: ({ + address?: Uint8Array | undefined; + pubKey?: { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { + address?: Uint8Array | undefined; + pubKey?: ({ + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { + ed25519?: Uint8Array | undefined; + secp256k1?: Uint8Array | undefined; + } & { [K_9 in Exclude]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_10 in Exclude]: never; }) | undefined; + totalVotingPower?: number | undefined; + } & { [K_11 in Exclude]: never; }>(object: I_1): ValidatorSet; +}; +export declare const Validator: { + encode(message: Validator, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Validator; + fromJSON(object: any): Validator; + toJSON(message: Validator): unknown; + create]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): Validator; + fromPartial]: never; }) | undefined; + votingPower?: number | undefined; + proposerPriority?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): Validator; +}; +export declare const SimpleValidator: { + encode(message: SimpleValidator, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): SimpleValidator; + fromJSON(object: any): SimpleValidator; + toJSON(message: SimpleValidator): unknown; + create]: never; }) | undefined; + votingPower?: number | undefined; + } & { [K_1 in Exclude]: never; }>(base?: I | undefined): SimpleValidator; + fromPartial]: never; }) | undefined; + votingPower?: number | undefined; + } & { [K_3 in Exclude]: never; }>(object: I_1): SimpleValidator; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/tendermint/types/validator.js b/dist/module/tendermint/types/validator.js new file mode 100644 index 0000000..0a4866c --- /dev/null +++ b/dist/module/tendermint/types/validator.js @@ -0,0 +1,293 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { PublicKey } from "../crypto/keys"; +export const protobufPackage = "tendermint.types"; +function createBaseValidatorSet() { + return { validators: [], proposer: undefined, totalVotingPower: 0 }; +} +export const ValidatorSet = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.validators) { + Validator.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim(); + } + if (message.totalVotingPower !== 0) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + message.proposer = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.totalVotingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + validators: Array.isArray(object?.validators) ? object.validators.map((e) => Validator.fromJSON(e)) : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + totalVotingPower: isSet(object.totalVotingPower) ? Number(object.totalVotingPower) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => e ? Validator.toJSON(e) : undefined); + } + else { + obj.validators = []; + } + message.proposer !== undefined && + (obj.proposer = message.proposer ? Validator.toJSON(message.proposer) : undefined); + message.totalVotingPower !== undefined && (obj.totalVotingPower = Math.round(message.totalVotingPower)); + return obj; + }, + create(base) { + return ValidatorSet.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.proposer = (object.proposer !== undefined && object.proposer !== null) + ? Validator.fromPartial(object.proposer) + : undefined; + message.totalVotingPower = object.totalVotingPower ?? 0; + return message; + }, +}; +function createBaseValidator() { + return { address: new Uint8Array(), pubKey: undefined, votingPower: 0, proposerPriority: 0 }; +} +export const Validator = { + encode(message, writer = _m0.Writer.create()) { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (message.votingPower !== 0) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== 0) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.address = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.votingPower = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.proposerPriority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(), + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? Number(object.votingPower) : 0, + proposerPriority: isSet(object.proposerPriority) ? Number(object.proposerPriority) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.pubKey !== undefined && (obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined); + message.votingPower !== undefined && (obj.votingPower = Math.round(message.votingPower)); + message.proposerPriority !== undefined && (obj.proposerPriority = Math.round(message.proposerPriority)); + return obj; + }, + create(base) { + return Validator.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + message.proposerPriority = object.proposerPriority ?? 0; + return message; + }, +}; +function createBaseSimpleValidator() { + return { pubKey: undefined, votingPower: 0 }; +} +export const SimpleValidator = { + encode(message, writer = _m0.Writer.create()) { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.votingPower !== 0) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.pubKey = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.votingPower = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pubKey: isSet(object.pubKey) ? PublicKey.fromJSON(object.pubKey) : undefined, + votingPower: isSet(object.votingPower) ? Number(object.votingPower) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.pubKey !== undefined && (obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined); + message.votingPower !== undefined && (obj.votingPower = Math.round(message.votingPower)); + return obj; + }, + create(base) { + return SimpleValidator.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSimpleValidator(); + message.pubKey = (object.pubKey !== undefined && object.pubKey !== null) + ? PublicKey.fromPartial(object.pubKey) + : undefined; + message.votingPower = object.votingPower ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/tendermint/version/types.d.ts b/dist/module/tendermint/version/types.d.ts new file mode 100644 index 0000000..c4d5087 --- /dev/null +++ b/dist/module/tendermint/version/types.d.ts @@ -0,0 +1,71 @@ +import _m0 from "protobufjs/minimal"; +export declare const protobufPackage = "tendermint.version"; +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface App { + protocol: number; + software: string; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface Consensus { + block: number; + app: number; +} +export declare const App: { + encode(message: App, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): App; + fromJSON(object: any): App; + toJSON(message: App): unknown; + create]: never; }>(base?: I | undefined): App; + fromPartial]: never; }>(object: I_1): App; +}; +export declare const Consensus: { + encode(message: Consensus, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): Consensus; + fromJSON(object: any): Consensus; + toJSON(message: Consensus): unknown; + create]: never; }>(base?: I | undefined): Consensus; + fromPartial]: never; }>(object: I_1): Consensus; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/tendermint/version/types.js b/dist/module/tendermint/version/types.js new file mode 100644 index 0000000..08f399b --- /dev/null +++ b/dist/module/tendermint/version/types.js @@ -0,0 +1,153 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export const protobufPackage = "tendermint.version"; +function createBaseApp() { + return { protocol: 0, software: "" }; +} +export const App = { + encode(message, writer = _m0.Writer.create()) { + if (message.protocol !== 0) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.protocol = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + message.software = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + protocol: isSet(object.protocol) ? Number(object.protocol) : 0, + software: isSet(object.software) ? String(object.software) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.protocol !== undefined && (obj.protocol = Math.round(message.protocol)); + message.software !== undefined && (obj.software = message.software); + return obj; + }, + create(base) { + return App.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseApp(); + message.protocol = object.protocol ?? 0; + message.software = object.software ?? ""; + return message; + }, +}; +function createBaseConsensus() { + return { block: 0, app: 0 }; +} +export const Consensus = { + encode(message, writer = _m0.Writer.create()) { + if (message.block !== 0) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + message.block = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { block: isSet(object.block) ? Number(object.block) : 0, app: isSet(object.app) ? Number(object.app) : 0 }; + }, + toJSON(message) { + const obj = {}; + message.block !== undefined && (obj.block = Math.round(message.block)); + message.app !== undefined && (obj.app = Math.round(message.app)); + return obj; + }, + create(base) { + return Consensus.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseConsensus(); + message.block = object.block ?? 0; + message.app = object.app ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/types/core.d.ts b/dist/module/types/core.d.ts new file mode 100644 index 0000000..7174656 --- /dev/null +++ b/dist/module/types/core.d.ts @@ -0,0 +1,31 @@ +import { AuthExtension, MintExtension, QueryClient, StakingExtension, TxExtension } from "@cosmjs/stargate"; +import { setupFTExtension } from "../coreum/extensions/ft"; +import { setupNFTExtension } from "../coreum/extensions/nft"; +import { setupNFTBetaExtension } from "../coreum/extensions/nftbeta"; +import { FeegrantExtension, IbcExtension } from "@cosmjs/stargate/build/modules"; +import { WasmExtension } from "@cosmjs/cosmwasm-stargate"; +import { setupBankExtension, setupGovExtension, setupDistributionExtension } from "../cosmos/extensions"; +import { setupDexExtension } from "../coreum/extensions/dex"; +/** @internal */ +export declare enum CoreumTypeUrl { + NFT = "/coreum.asset.nft.v1.", + FT = "/coreum.asset.ft.v1.", + NFTBeta = "/cosmos.nft.v1beta1.", + DEX = "/coreum.dex.v1." +} +export interface ClientQueryClient extends QueryClient { + ft: ReturnType["ft"]; + nft: ReturnType["nft"]; + nftbeta: ReturnType["nftbeta"]; + bank: ReturnType["bank"]; + gov: ReturnType["gov"]; + distribution: ReturnType["distribution"]; + dex: ReturnType["dex"]; + staking: StakingExtension["staking"]; + auth: AuthExtension["auth"]; + mint: MintExtension["mint"]; + feegrant: FeegrantExtension["feegrant"]; + ibc: IbcExtension["ibc"]; + wasm: WasmExtension["wasm"]; + tx: TxExtension["tx"]; +} diff --git a/dist/module/types/core.js b/dist/module/types/core.js new file mode 100644 index 0000000..dd8bba7 --- /dev/null +++ b/dist/module/types/core.js @@ -0,0 +1,17 @@ +import { protobufPackage as assetNFT } from "../coreum/asset/nft/v1/tx"; +import { protobufPackage as assetFT } from "../coreum/asset/ft/v1/tx"; +import { protobufPackage as nftV1beta } from "../coreum/nft/v1beta1/tx"; +import { protobufPackage as dex } from "../coreum/dex/v1/tx"; +/** @internal */ +export var CoreumTypeUrl; +(function (CoreumTypeUrl) { + CoreumTypeUrl["NFT"] = "/coreum.asset.nft.v1."; + CoreumTypeUrl["FT"] = "/coreum.asset.ft.v1."; + CoreumTypeUrl["NFTBeta"] = "/cosmos.nft.v1beta1."; + CoreumTypeUrl["DEX"] = "/coreum.dex.v1."; +})(CoreumTypeUrl || (CoreumTypeUrl = {})); +// setupMintExtension, +// setupFeegrantExtension, +// setupGovExtension, +// setupIbcExtension, +// setupDistributionExtension, diff --git a/dist/module/types/coreum.d.ts b/dist/module/types/coreum.d.ts new file mode 100644 index 0000000..501e038 --- /dev/null +++ b/dist/module/types/coreum.d.ts @@ -0,0 +1,75 @@ +export declare enum CoreumNetwork { + MAINNET = "mainnet", + TESTNET = "testnet", + DEVNET = "devnet" +} +export declare enum CoreumChainID { + MAINNET = "coreum-mainnet-1", + TESTNET = "coreum-testnet-1", + DEVNET = "coreum-devnet-1" +} +export declare enum CoreumPrefixes { + MAINNET = "core", + TESTNET = "testcore", + DEVNET = "devcore" +} +export declare enum CoreumDenom { + MAINNET = "ucore", + TESTNET = "utestcore", + DEVNET = "udevcore" +} +export type CoreumNetworkKey = keyof typeof COREUM_CONFIG; +export interface CoreumNetworkConfig { + chain_name: string; + chain_id: CoreumChainID; + chain_bech32_prefix: CoreumPrefixes; + chain_rpc_endpoint: string; + chain_rest_endpoint: string; + chain_ws_endpoint: string; + chain_explorer: string; + staking_denom: CoreumDenom; + coin_type: string | number; + site_title: string; + gas_price: string; +} +export declare const COREUM_CONFIG: { + mainnet: { + chain_name: string; + chain_id: CoreumChainID; + chain_bech32_prefix: CoreumPrefixes; + chain_rpc_endpoint: string; + chain_rest_endpoint: string; + chain_ws_endpoint: string; + chain_explorer: string; + staking_denom: CoreumDenom; + coin_type: string; + site_title: string; + gas_price: string; + }; + testnet: { + chain_name: string; + chain_id: CoreumChainID; + chain_bech32_prefix: CoreumPrefixes; + chain_rpc_endpoint: string; + chain_rest_endpoint: string; + chain_ws_endpoint: string; + chain_explorer: string; + staking_denom: CoreumDenom; + coin_type: string; + site_title: string; + gas_price: string; + }; + devnet: { + chain_name: string; + chain_id: CoreumChainID; + chain_bech32_prefix: CoreumPrefixes; + chain_rpc_endpoint: string; + chain_rest_endpoint: string; + chain_ws_endpoint: string; + chain_explorer: string; + staking_denom: CoreumDenom; + coin_type: string; + site_title: string; + gas_price: string; + }; +}; diff --git a/dist/module/types/coreum.js b/dist/module/types/coreum.js new file mode 100644 index 0000000..111fc1d --- /dev/null +++ b/dist/module/types/coreum.js @@ -0,0 +1,65 @@ +export var CoreumNetwork; +(function (CoreumNetwork) { + CoreumNetwork["MAINNET"] = "mainnet"; + CoreumNetwork["TESTNET"] = "testnet"; + CoreumNetwork["DEVNET"] = "devnet"; +})(CoreumNetwork || (CoreumNetwork = {})); +export var CoreumChainID; +(function (CoreumChainID) { + CoreumChainID["MAINNET"] = "coreum-mainnet-1"; + CoreumChainID["TESTNET"] = "coreum-testnet-1"; + CoreumChainID["DEVNET"] = "coreum-devnet-1"; +})(CoreumChainID || (CoreumChainID = {})); +export var CoreumPrefixes; +(function (CoreumPrefixes) { + CoreumPrefixes["MAINNET"] = "core"; + CoreumPrefixes["TESTNET"] = "testcore"; + CoreumPrefixes["DEVNET"] = "devcore"; +})(CoreumPrefixes || (CoreumPrefixes = {})); +export var CoreumDenom; +(function (CoreumDenom) { + CoreumDenom["MAINNET"] = "ucore"; + CoreumDenom["TESTNET"] = "utestcore"; + CoreumDenom["DEVNET"] = "udevcore"; +})(CoreumDenom || (CoreumDenom = {})); +export const COREUM_CONFIG = { + mainnet: { + chain_name: "Coreum", + chain_id: CoreumChainID.MAINNET, + chain_bech32_prefix: CoreumPrefixes.MAINNET, + chain_rpc_endpoint: "https://full-node.mainnet-1.coreum.dev:26657", + chain_rest_endpoint: "https://full-node.mainnet-1.coreum.dev:1317", + chain_ws_endpoint: "wss://full-node.mainnet-1.coreum.dev:26657", + chain_explorer: "https://explorer.mainnet-1.coreum.dev", + staking_denom: CoreumDenom.MAINNET, + coin_type: "990", + site_title: "Coreum Services", + gas_price: `0.0625${CoreumDenom.MAINNET}`, + }, + testnet: { + chain_name: "Coreum Testnet", + chain_id: CoreumChainID.TESTNET, + chain_bech32_prefix: CoreumPrefixes.TESTNET, + chain_rpc_endpoint: "https://full-node.testnet-1.coreum.dev:26657", + chain_rest_endpoint: "https://full-node.testnet-1.coreum.dev:1317", + chain_ws_endpoint: "wss://full-node.testnet-1.coreum.dev:26657", + chain_explorer: "https://explorer.testnet-1.coreum.dev", + staking_denom: CoreumDenom.TESTNET, + coin_type: "990", + site_title: "Coreum Services", + gas_price: `0.0625${CoreumDenom.TESTNET}`, + }, + devnet: { + chain_name: "Coreum Devnet", + chain_id: CoreumChainID.DEVNET, + chain_bech32_prefix: CoreumPrefixes.DEVNET, + chain_rpc_endpoint: "https://full-node.devnet-1.coreum.dev:26657", + chain_rest_endpoint: "https://full-node.devnet-1.coreum.dev:1317", + chain_ws_endpoint: "wss://full-node.devnet-1.coreum.dev:26657", + chain_explorer: "https://explorer.devnet-1.coreum.dev", + staking_denom: CoreumDenom.DEVNET, + coin_type: "990", + site_title: "Coreum Services", + gas_price: `0.0625${CoreumDenom.DEVNET}`, + }, +}; diff --git a/dist/module/types/index.d.ts b/dist/module/types/index.d.ts new file mode 100644 index 0000000..a82d6c7 --- /dev/null +++ b/dist/module/types/index.d.ts @@ -0,0 +1,3 @@ +export * from "./core"; +export * from "./signing"; +export * from "./coreum"; diff --git a/dist/module/types/index.js b/dist/module/types/index.js new file mode 100644 index 0000000..a82d6c7 --- /dev/null +++ b/dist/module/types/index.js @@ -0,0 +1,3 @@ +export * from "./core"; +export * from "./signing"; +export * from "./coreum"; diff --git a/dist/module/types/msgs.d.ts b/dist/module/types/msgs.d.ts new file mode 100644 index 0000000..3cc273c --- /dev/null +++ b/dist/module/types/msgs.d.ts @@ -0,0 +1,680 @@ +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Feature } from "../coreum/asset/ft/v1/token"; +import { ClassFeature } from "../coreum/asset/nft/v1/nft"; +import { Any } from "../google/protobuf/any"; +import { AccessConfig, Params as WasmParams } from "cosmjs-types/cosmwasm/wasm/v1/types"; +import { VoteOption, WeightedVoteOption } from "cosmjs-types/cosmos/gov/v1beta1/gov"; +import { Input, Output, SendEnabled, Params as BankParams } from "cosmjs-types/cosmos/bank/v1beta1/bank"; +import { Params as DistParams } from "cosmjs-types/cosmos/distribution/v1beta1/distribution"; +import { Period } from "cosmjs-types/cosmos/vesting/v1beta1/vesting"; +import { Grant } from "cosmjs-types/cosmos/authz/v1beta1/authz"; +import { CommissionRates, Description, Params as StakingParams } from "cosmjs-types/cosmos/staking/v1beta1/staking"; +export declare namespace FTMsgs { + interface MsgIssue { + issuer: string; + symbol: string; + subunit: string; + precision: number; + initialAmount: string; + description?: string; + features?: Feature[]; + /** + * burn_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * burn_amount. This value will be burnt on top of the send amount. + */ + burnRate?: string; + /** + * send_commission_rate is a number between 0 and 1 which will be multiplied by send amount to determine + * amount sent to the token issuer account. + */ + sendCommissionRate?: string; + uri?: string; + uriHash?: string; + } + interface MsgMint { + sender: string; + coin: Coin; + } + interface MsgBurn { + sender: string; + coin: Coin; + } + interface MsgFreeze { + sender: string; + account: string; + coin: Coin; + } + interface MsgUnfreeze { + sender: string; + account: string; + coin: Coin; + } + interface MsgGloballyFreeze { + sender: string; + denom: string; + } + interface MsgGloballyUnfreeze { + sender: string; + denom: string; + } + interface MsgSetWhitelistedLimit { + sender: string; + account: string; + coin: Coin; + } + interface MsgClawback { + sender: string; + account: string; + coin: Coin; + } +} +export declare namespace NFTMsgs { + /** MsgSend represents a message to send a nft from one account to another account. */ + interface MsgSend { + /** class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 */ + classId: string; + /** id defines the unique identification of nft */ + id: string; + /** sender is the address of the owner of nft */ + sender: string; + /** receiver is the receiver address of nft */ + receiver: string; + } + /** MsgIssueClass defines message for the IssueClass method. */ + interface MsgIssueClass { + issuer: string; + symbol: string; + name: string; + description?: string; + uri: string; + uriHash?: string; + data?: Any; + features?: ClassFeature[]; + royaltyRate?: string; + } + /** MsgMint defines message for the Mint method. */ + interface MsgMint { + sender: string; + classId: string; + id: string; + uri: string; + uriHash: string; + data?: Any; + recipient: string; + } + /** MsgBurn defines message for the Burn method. */ + interface MsgBurn { + sender: string; + classId: string; + id: string; + } + interface MsgFreeze { + sender: string; + classId: string; + id: string; + } + interface MsgUnfreeze { + sender: string; + classId: string; + id: string; + } + interface MsgAddToWhitelist { + sender: string; + classId: string; + id: string; + account: string; + } + interface MsgRemoveFromWhitelist { + sender: string; + classId: string; + id: string; + account: string; + } +} +export declare namespace CWMsgs { + /** MsgStoreCode submit Wasm code to the system */ + interface MsgStoreCode { + /** Sender is the actor that signed the messages */ + sender: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** + * InstantiatePermission access control to apply on contract creation, + * optional + */ + instantiatePermission: AccessConfig | undefined; + } + /** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ + interface MsgInstantiateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + } + /** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ + interface MsgStoreAndInstantiateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig | undefined; + /** + * UnpinCode code on upload, optional. As default the uploaded contract is + * pinned to cache. + */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** + * Funds coins that are transferred from the authority account to the contract + * on instantiation + */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; + } + /** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ + interface MsgUnpinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the WASM codes */ + codeIds: number[]; + } + /** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ + interface MsgPinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the new WASM codes */ + codeIds: number[]; + } + /** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ + interface MsgSudoContract { + /** Authority is the address of the governance account. */ + authority: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; + } + /** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ + interface MsgUpdateParams { + /** Authority is the address of the governance account. */ + authority: string; + /** + * params defines the x/wasm parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: WasmParams | undefined; + } + /** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ + interface MsgUpdateInstantiateConfig { + /** Sender is the that actor that signed the messages */ + sender: string; + /** CodeID references the stored WASM code */ + codeId: number; + /** NewInstantiatePermission is the new access control */ + newInstantiatePermission: AccessConfig | undefined; + } + /** MsgClearAdmin removes any admin stored for a smart contract */ + interface MsgClearAdmin { + /** Sender is the actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + } + /** MsgUpdateAdmin sets a new admin for a smart contract */ + interface MsgUpdateAdmin { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; + } + /** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ + interface MsgMigrateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: number; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; + } + /** MsgExecuteContract submits the given message data to a smart contract */ + interface MsgExecuteContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on execution */ + funds: Coin[]; + } + /** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ + interface MsgInstantiateContract2 { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; + } +} +export declare namespace AuthzMsgs { + /** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ + interface MsgGrant { + granter: string; + grantee: string; + grant?: Grant; + } + /** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ + interface MsgExec { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; + } + /** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ + interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; + } +} +export declare namespace StakingMsgs { + /** MsgCreateValidator defines a SDK message for creating a new validator. */ + interface MsgCreateValidator { + description: Description | undefined; + commission: CommissionRates | undefined; + minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + * + * @deprecated + */ + delegatorAddress: string; + validatorAddress: string; + pubkey: Any | undefined; + value: Coin | undefined; + } + /** MsgEditValidator defines a SDK message for editing an existing validator. */ + interface MsgEditValidator { + description: Description | undefined; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; + } + /** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ + interface MsgDelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; + } + /** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ + interface MsgBeginRedelegate { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin | undefined; + } + /** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ + interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin | undefined; + } + /** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ + interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: Coin | undefined; + /** creation_height is the height which the unbonding took place. */ + creationHeight: number; + } + /** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: StakingParams | undefined; + } +} +export declare namespace GovMsgs { + /** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ + interface MsgSubmitProposal { + /** content is the proposal's content. */ + content: Any | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + } + /** MsgVote defines a message to cast a vote. */ + interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + } + /** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ + interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + } + /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ + interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; + } +} +export declare namespace FeegrantMsgs { + /** + * MsgGrantAllowance adds permission for Grantee to spend up to Allowance + * of fees from the account of Granter. + */ + interface MsgGrantAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + /** allowance can be any of basic, periodic, allowed fee allowance. */ + allowance: Any | undefined; + } + /** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ + interface MsgRevokeAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + } +} +export declare namespace BankMsgs { + /** MsgSend represents a message to send coins from one account to another. */ + interface MsgSend { + fromAddress: string; + toAddress: string; + amount: Coin[]; + } + /** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ + interface MsgMultiSend { + /** + * Inputs, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; + } + /** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: BankParams | undefined; + } + /** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgSetSendEnabled { + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; + } +} +export declare namespace DistributionMsgs { + /** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ + interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: string; + } + /** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ + interface MsgWithdrawDelegatorReward { + delegatorAddress: string; + validatorAddress: string; + } + /** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ + interface MsgWithdrawValidatorCommission { + validatorAddress: string; + } + /** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ + interface MsgFundCommunityPool { + amount: Coin[]; + depositor: string; + } + /** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: DistParams | undefined; + } + /** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ + interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; + } + /** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.48 + */ + interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; + } +} +export declare namespace VestingMsgs { + /** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ + interface MsgCreateVestingAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: number; + delayed: boolean; + } + /** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ + interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; + } + /** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ + interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: number; + vestingPeriods: Period[]; + } +} diff --git a/dist/module/types/msgs.js b/dist/module/types/msgs.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/dist/module/types/msgs.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/module/types/signing.d.ts b/dist/module/types/signing.d.ts new file mode 100644 index 0000000..44af9be --- /dev/null +++ b/dist/module/types/signing.d.ts @@ -0,0 +1,25 @@ +import { MultisigThresholdPubkey, StdFee } from "@cosmjs/amino"; +export interface MultisigAccount { + pubkey: MultisigThresholdPubkey; + address: string; + threshold: number; +} +export declare enum WalletMethods { + OFFLINE = "offline", + COSMOSTATION = "cosmostation", + MNEMONIC = "mnemonic", + LEAP = "leap" +} +export interface FeeCalculation { + fee: StdFee; + gas_wanted: number; +} +export interface FeeOptions { + address?: string; + gasLimit?: number; +} +export declare enum ExtensionWallets { + KEPLR = "keplr", + COSMOSTATION = "cosmostation", + LEAP = "leap" +} diff --git a/dist/module/types/signing.js b/dist/module/types/signing.js new file mode 100644 index 0000000..da18f8e --- /dev/null +++ b/dist/module/types/signing.js @@ -0,0 +1,13 @@ +export var WalletMethods; +(function (WalletMethods) { + WalletMethods["OFFLINE"] = "offline"; + WalletMethods["COSMOSTATION"] = "cosmostation"; + WalletMethods["MNEMONIC"] = "mnemonic"; + WalletMethods["LEAP"] = "leap"; +})(WalletMethods || (WalletMethods = {})); +export var ExtensionWallets; +(function (ExtensionWallets) { + ExtensionWallets["KEPLR"] = "keplr"; + ExtensionWallets["COSMOSTATION"] = "cosmostation"; + ExtensionWallets["LEAP"] = "leap"; +})(ExtensionWallets || (ExtensionWallets = {})); diff --git a/dist/module/utils/calculations.d.ts b/dist/module/utils/calculations.d.ts new file mode 100644 index 0000000..aedbf6d --- /dev/null +++ b/dist/module/utils/calculations.d.ts @@ -0,0 +1,29 @@ +/** + * @param ucore ucore to convert to CORE + * @returns A string representing CORE value of ucore + */ +export declare const ucoreToCORE: (ucore: string) => string; +/** + * @param core CORE to convert to ucore + * @returns A string representing ucore value of CORE + */ +export declare const coreToUCORE: (core: string) => string; +/** + * @param royalty Float to convert to royalty rate format + * @returns a string representing the float passed in royalty rate format + */ +export declare const parseFloatToRoyaltyRate: (royalty: number | string) => string; +/** + * + * @param subunit Amount of the subunit of the token to parse into full unit + * @param precision The precision of the token; number of decimals + * @returns The converted subunit to Unit with the passed precision + */ +export declare const subunitToUnit: (subunit: string, precision: number) => string; +/** + * + * @param unit Amount of the unit of the token to parse into its subunit + * @param precision The precision of the token; number of decimals + * @returns The converted unit to subunit with the passed precision + */ +export declare const unitToSubunit: (unit: string, precision: number) => string; diff --git a/dist/module/utils/calculations.js b/dist/module/utils/calculations.js new file mode 100644 index 0000000..0fbb38d --- /dev/null +++ b/dist/module/utils/calculations.js @@ -0,0 +1,67 @@ +import BigNumber from "bignumber.js"; +function assertValidAmount(value, fieldName) { + const amount = new BigNumber(value); + if (!amount.isFinite() || amount.isNaN()) { + throw new Error(`Invalid ${fieldName}: ${value}`); + } + if (amount.isNegative()) { + throw new Error(`${fieldName} must be non-negative`); + } + return amount; +} +function assertValidPrecision(precision, fieldName) { + if (!Number.isInteger(precision) || precision < 0 || precision > 18) { + throw new Error(`${fieldName} must be an integer between 0 and 18`); + } +} +/** + * @param ucore ucore to convert to CORE + * @returns A string representing CORE value of ucore + */ +export const ucoreToCORE = (ucore) => { + return assertValidAmount(ucore, "ucore").dividedBy(1000000).valueOf(); +}; +/** + * @param core CORE to convert to ucore + * @returns A string representing ucore value of CORE + */ +export const coreToUCORE = (core) => { + return assertValidAmount(core, "core").multipliedBy(1000000).valueOf(); +}; +/** + * @param royalty Float to convert to royalty rate format + * @returns a string representing the float passed in royalty rate format + */ +export const parseFloatToRoyaltyRate = (royalty) => { + const float = new BigNumber(royalty); + if (!float.isFinite() || float.isNaN() || float.isNegative()) { + throw new Error(`Invalid royalty value: ${royalty}`); + } + return float.dividedBy(100).multipliedBy("1000000000000000000").toString(); +}; +/** + * + * @param subunit Amount of the subunit of the token to parse into full unit + * @param precision The precision of the token; number of decimals + * @returns The converted subunit to Unit with the passed precision + */ +export const subunitToUnit = (subunit, precision) => { + assertValidPrecision(precision, "precision"); + const precisionFactor = new BigNumber(10).exponentiatedBy(precision); + return assertValidAmount(subunit, "subunit") + .dividedBy(precisionFactor) + .toString(); +}; +/** + * + * @param unit Amount of the unit of the token to parse into its subunit + * @param precision The precision of the token; number of decimals + * @returns The converted unit to subunit with the passed precision + */ +export const unitToSubunit = (unit, precision) => { + assertValidPrecision(precision, "precision"); + const precisionFactor = new BigNumber(10).exponentiatedBy(precision); + return assertValidAmount(unit, "unit") + .multipliedBy(precisionFactor) + .toString(); +}; diff --git a/dist/module/utils/chainConfig.d.ts b/dist/module/utils/chainConfig.d.ts new file mode 100644 index 0000000..e1d983e --- /dev/null +++ b/dist/module/utils/chainConfig.d.ts @@ -0,0 +1,39 @@ +import { CoreumNetworkConfig } from "../types/coreum"; +export declare function buildKeplrChainSuggestion(config: CoreumNetworkConfig): { + chainId: import("../types/coreum").CoreumChainID; + chainName: string; + rpc: string; + rest: string; + stakeCurrency: { + coinDenom: string; + coinMinimalDenom: import("../types/coreum").CoreumDenom; + coinDecimals: number; + }; + bip44: { + coinType: number; + }; + bech32Config: { + bech32PrefixAccAddr: import("../types/coreum").CoreumPrefixes; + bech32PrefixAccPub: string; + bech32PrefixValAddr: string; + bech32PrefixValPub: string; + bech32PrefixConsAddr: string; + bech32PrefixConsPub: string; + }; + currencies: { + coinDenom: string; + coinMinimalDenom: import("../types/coreum").CoreumDenom; + coinDecimals: number; + }[]; + feeCurrencies: { + coinDenom: string; + coinMinimalDenom: import("../types/coreum").CoreumDenom; + coinDecimals: number; + }[]; + coinType: number; + gasPriceStep: { + low: number; + average: number; + high: number; + }; +}; diff --git a/dist/module/utils/chainConfig.js b/dist/module/utils/chainConfig.js new file mode 100644 index 0000000..5854825 --- /dev/null +++ b/dist/module/utils/chainConfig.js @@ -0,0 +1,46 @@ +export function buildKeplrChainSuggestion(config) { + const stakingDenom = "core"; + const gasPrice = Number((config.gas_price || "").replace(config.staking_denom || "", "")); + return { + chainId: config.chain_id, + chainName: config.chain_name, + rpc: config.chain_rpc_endpoint, + rest: config.chain_rest_endpoint, + stakeCurrency: { + coinDenom: stakingDenom, + coinMinimalDenom: config.staking_denom, + coinDecimals: 6, + }, + bip44: { + coinType: Number(config.coin_type), + }, + bech32Config: { + bech32PrefixAccAddr: config.chain_bech32_prefix, + bech32PrefixAccPub: `${config.chain_bech32_prefix}pub`, + bech32PrefixValAddr: `${config.chain_bech32_prefix}valoper`, + bech32PrefixValPub: `${config.chain_bech32_prefix}valoperpub`, + bech32PrefixConsAddr: `${config.chain_bech32_prefix}valcons`, + bech32PrefixConsPub: `${config.chain_bech32_prefix}valconspub`, + }, + currencies: [ + { + coinDenom: stakingDenom, + coinMinimalDenom: config.staking_denom, + coinDecimals: 6, + }, + ], + feeCurrencies: [ + { + coinDenom: stakingDenom, + coinMinimalDenom: config.staking_denom, + coinDecimals: 6, + }, + ], + coinType: Number(config.coin_type), + gasPriceStep: { + low: gasPrice, + average: gasPrice, + high: gasPrice, + }, + }; +} diff --git a/dist/module/utils/convertStringToAny.d.ts b/dist/module/utils/convertStringToAny.d.ts new file mode 100644 index 0000000..3903ef6 --- /dev/null +++ b/dist/module/utils/convertStringToAny.d.ts @@ -0,0 +1,2 @@ +import { Any } from "google-protobuf/google/protobuf/any_pb"; +export declare const convertStringToAny: (message: string) => Any; diff --git a/dist/module/utils/convertStringToAny.js b/dist/module/utils/convertStringToAny.js new file mode 100644 index 0000000..323ac3e --- /dev/null +++ b/dist/module/utils/convertStringToAny.js @@ -0,0 +1,11 @@ +import { Any } from "google-protobuf/google/protobuf/any_pb"; +import { DataBytes } from "../coreum/asset/nft/v1/types"; +export const convertStringToAny = (message) => { + const formattedValueOfData = btoa(message); + const dataBytesMessage = DataBytes.fromJSON({ Data: formattedValueOfData }); + const dataBytesBinary = DataBytes.encode(dataBytesMessage).finish(); + const formattedAnyDataValue = new Any(); + formattedAnyDataValue.setTypeUrl("/coreum.asset.nft.v1.DataBytes"); + formattedAnyDataValue.setValue(dataBytesBinary); + return formattedAnyDataValue; +}; diff --git a/dist/module/utils/endpoints.d.ts b/dist/module/utils/endpoints.d.ts new file mode 100644 index 0000000..e16042a --- /dev/null +++ b/dist/module/utils/endpoints.d.ts @@ -0,0 +1,8 @@ +export interface EndpointValidationOptions { + /** Allow http:// and ws:// (intended for local development only). */ + allowInsecure?: boolean; + /** Block localhost and private IP ranges (enabled automatically in Node.js). */ + blockPrivateHosts?: boolean; +} +export declare function validateRpcEndpoint(url: string, options?: EndpointValidationOptions): string; +export declare function validateWsEndpoint(url: string, options?: EndpointValidationOptions): string; diff --git a/dist/module/utils/endpoints.js b/dist/module/utils/endpoints.js new file mode 100644 index 0000000..89c857e --- /dev/null +++ b/dist/module/utils/endpoints.js @@ -0,0 +1,65 @@ +const PRIVATE_IPV4_RANGES = [ + /^127\./, + /^10\./, + /^192\.168\./, + /^169\.254\./, + /^172\.(1[6-9]|2\d|3[01])\./, + /^0\./, +]; +function isNodeRuntime() { + return (typeof process !== "undefined" && + typeof process.versions?.node === "string"); +} +function isPrivateOrLocalHost(hostname) { + const normalized = hostname.toLowerCase(); + if (normalized === "localhost" || + normalized.endsWith(".localhost") || + normalized === "::1" || + normalized === "[::1]") { + return true; + } + if (normalized.includes(":")) { + return normalized.startsWith("fc") || normalized.startsWith("fd"); + } + return PRIVATE_IPV4_RANGES.some((pattern) => pattern.test(normalized)); +} +function assertAllowedHost(hostname, options) { + const shouldBlockPrivate = options?.blockPrivateHosts ?? isNodeRuntime(); + if (shouldBlockPrivate && isPrivateOrLocalHost(hostname)) { + throw new Error(`Endpoint host "${hostname}" is not allowed in this environment`); + } +} +export function validateRpcEndpoint(url, options) { + let parsed; + try { + parsed = new URL(url); + } + catch { + throw new Error(`Invalid RPC endpoint URL: ${url}`); + } + const allowedSchemes = options?.allowInsecure + ? ["http:", "https:"] + : ["https:"]; + if (!allowedSchemes.includes(parsed.protocol)) { + throw new Error(`RPC endpoint must use ${allowedSchemes.join(" or ")} (got ${parsed.protocol})`); + } + assertAllowedHost(parsed.hostname, options); + return url; +} +export function validateWsEndpoint(url, options) { + let parsed; + try { + parsed = new URL(url); + } + catch { + throw new Error(`Invalid WebSocket endpoint URL: ${url}`); + } + const allowedSchemes = options?.allowInsecure + ? ["ws:", "wss:"] + : ["wss:"]; + if (!allowedSchemes.includes(parsed.protocol)) { + throw new Error(`WebSocket endpoint must use ${allowedSchemes.join(" or ")} (got ${parsed.protocol})`); + } + assertAllowedHost(parsed.hostname, options); + return url; +} diff --git a/dist/module/utils/event.d.ts b/dist/module/utils/event.d.ts new file mode 100644 index 0000000..e57b889 --- /dev/null +++ b/dist/module/utils/event.d.ts @@ -0,0 +1,9 @@ +interface SubscriptionEvents { + [key: string]: string[]; +} +/** + * @param events Subscription events + * @returns A well-defined object showcasing all the events of a subscription + */ +export declare const parseSubscriptionEvents: (events: SubscriptionEvents) => any; +export {}; diff --git a/dist/module/utils/event.js b/dist/module/utils/event.js new file mode 100644 index 0000000..8a6f4e9 --- /dev/null +++ b/dist/module/utils/event.js @@ -0,0 +1,21 @@ +/** + * @param events Subscription events + * @returns A well-defined object showcasing all the events of a subscription + */ +export const parseSubscriptionEvents = (events) => { + let parsedEvents = {}; + Object.entries(events).map((entry) => { + const [key, value] = entry; + const splitKey = key.split("."); + const last = splitKey.pop(); + const property = splitKey.join("."); + parsedEvents[property] = parsedEvents[property] || {}; + try { + parsedEvents[property][last] = JSON.parse(value[0]); + } + catch (e) { + parsedEvents[property][last] = value[0]; + } + }); + return parsedEvents; +}; diff --git a/dist/module/utils/ft.d.ts b/dist/module/utils/ft.d.ts new file mode 100644 index 0000000..c785fb9 --- /dev/null +++ b/dist/module/utils/ft.d.ts @@ -0,0 +1,11 @@ +import { Feature } from "../coreum/asset/ft/v1/token"; +/** + * @param features An array of Feature. + * @returns An object defining which features are enabled/disabled with boolean + */ +export declare const parseTokenFeatures: (features: Feature[]) => { + minting: boolean; + freezing: boolean; + burning: boolean; + whitelisting: boolean; +}; diff --git a/dist/module/utils/ft.js b/dist/module/utils/ft.js new file mode 100644 index 0000000..3f3b3af --- /dev/null +++ b/dist/module/utils/ft.js @@ -0,0 +1,13 @@ +import { Feature } from "../coreum/asset/ft/v1/token"; +/** + * @param features An array of Feature. + * @returns An object defining which features are enabled/disabled with boolean + */ +export const parseTokenFeatures = (features) => { + return { + minting: features.includes(Feature["minting"]), + freezing: features.includes(Feature["freezing"]), + burning: features.includes(Feature["burning"]), + whitelisting: features.includes(Feature["whitelisting"]), + }; +}; diff --git a/dist/module/utils/index.d.ts b/dist/module/utils/index.d.ts new file mode 100644 index 0000000..3383c8a --- /dev/null +++ b/dist/module/utils/index.d.ts @@ -0,0 +1,7 @@ +export * from "./wallet"; +export * from "./calculations"; +export * from "./nft"; +export * from "./ft"; +export * from "./convertStringToAny"; +export * from "./event"; +export * from "./endpoints"; diff --git a/dist/module/utils/index.js b/dist/module/utils/index.js new file mode 100644 index 0000000..3383c8a --- /dev/null +++ b/dist/module/utils/index.js @@ -0,0 +1,7 @@ +export * from "./wallet"; +export * from "./calculations"; +export * from "./nft"; +export * from "./ft"; +export * from "./convertStringToAny"; +export * from "./event"; +export * from "./endpoints"; diff --git a/dist/module/utils/nft.d.ts b/dist/module/utils/nft.d.ts new file mode 100644 index 0000000..3469b11 --- /dev/null +++ b/dist/module/utils/nft.d.ts @@ -0,0 +1,13 @@ +import { ClassFeature } from "../coreum/asset/nft/v1/nft"; +/** + * + * @param features An array of NFT Class features + * @returns An object defining which features are enabled/disabled with a boolean + */ +export declare function parseClassFeatures(features: ClassFeature[]): { + burning: boolean; + freezing: boolean; + whitelisting: boolean; + disable_sending: boolean; + soulbound: boolean; +}; diff --git a/dist/module/utils/nft.js b/dist/module/utils/nft.js new file mode 100644 index 0000000..9a81ba8 --- /dev/null +++ b/dist/module/utils/nft.js @@ -0,0 +1,15 @@ +import { ClassFeature } from "../coreum/asset/nft/v1/nft"; +/** + * + * @param features An array of NFT Class features + * @returns An object defining which features are enabled/disabled with a boolean + */ +export function parseClassFeatures(features) { + return { + burning: features.includes(ClassFeature["burning"]), + freezing: features.includes(ClassFeature["freezing"]), + whitelisting: features.includes(ClassFeature["whitelisting"]), + disable_sending: features.includes(ClassFeature["disable_sending"]), + soulbound: features.includes(ClassFeature["soulbound"]), + }; +} diff --git a/dist/module/utils/wallet.d.ts b/dist/module/utils/wallet.d.ts new file mode 100644 index 0000000..e6c6dfb --- /dev/null +++ b/dist/module/utils/wallet.d.ts @@ -0,0 +1,20 @@ +import { OfflineDirectSigner } from "@cosmjs/proto-signing"; +import { CoreumPrefixes } from "../types/coreum"; +import { MultisigAccount } from "../types"; +/** + * + * @param address String representing an address on the Coreum blockchain + * @param expectedPrefix Optional bech32 prefix that must match the active network + * @returns A boolean defining if the passed address is a valid address on the Coreum Blockchain + */ +export declare const isValidCoreumAddress: (address: string, expectedPrefix?: CoreumPrefixes | string) => boolean; +export declare const assertValidCoreumAddress: (address: string, expectedPrefix?: CoreumPrefixes | string) => void; +export declare const validateMnemonic: (mnemonic: string) => void; +/** + * + * @param mnemonic Mnemonic words of a Cosmos SDK wallet + * @param prefix The prefix to use - "core" | "testcore" | "devcore" + * @returns A wallet with the default hdPath for the Coreum Blockchain, and with the selected prefix. + */ +export declare const generateWalletFromMnemonic: (mnemonic: string, prefix: CoreumPrefixes) => Promise; +export declare const generateMultisigFromPubkeys: (pubkeys: string[], threshold: number, prefix: string) => MultisigAccount; diff --git a/dist/module/utils/wallet.js b/dist/module/utils/wallet.js new file mode 100644 index 0000000..2ad7052 --- /dev/null +++ b/dist/module/utils/wallet.js @@ -0,0 +1,77 @@ +import { DirectSecp256k1HdWallet, } from "@cosmjs/proto-signing"; +import { stringToPath } from "@cosmjs/crypto"; +import { bech32 } from "bech32"; +import { CoreumPrefixes } from "../types/coreum"; +import { createMultisigThresholdPubkey, pubkeyToAddress } from "@cosmjs/amino"; +import { TxJsError } from "../errors"; +/** + * + * @param address String representing an address on the Coreum blockchain + * @param expectedPrefix Optional bech32 prefix that must match the active network + * @returns A boolean defining if the passed address is a valid address on the Coreum Blockchain + */ +export const isValidCoreumAddress = (address, expectedPrefix) => { + try { + const { prefix = null } = bech32.decode(address); + if (prefix !== CoreumPrefixes.MAINNET && + prefix !== CoreumPrefixes.DEVNET && + prefix !== CoreumPrefixes.TESTNET) { + return false; + } + if (expectedPrefix && prefix !== expectedPrefix) { + return false; + } + return true; + } + catch { + return false; + } +}; +export const assertValidCoreumAddress = (address, expectedPrefix) => { + if (!isValidCoreumAddress(address, expectedPrefix)) { + throw new Error(`Invalid Coreum address: ${address}`); + } +}; +export const validateMnemonic = (mnemonic) => { + const words = mnemonic.trim().split(/\s+/); + if (words.length !== 12 && words.length !== 24) { + throw new Error("Mnemonic must contain 12 or 24 words"); + } + if (words.some((word) => word.length === 0)) { + throw new Error("Mnemonic contains empty words"); + } +}; +/** + * + * @param mnemonic Mnemonic words of a Cosmos SDK wallet + * @param prefix The prefix to use - "core" | "testcore" | "devcore" + * @returns A wallet with the default hdPath for the Coreum Blockchain, and with the selected prefix. + */ +export const generateWalletFromMnemonic = async (mnemonic, prefix) => { + validateMnemonic(mnemonic); + const hdPath = "m/44'/990'/0'/0/0"; + try { + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { + prefix, + hdPaths: [stringToPath(hdPath)], + }); + return wallet; + } + catch (error) { + throw new TxJsError("generateWalletFromMnemonic", error); + } +}; +export const generateMultisigFromPubkeys = (pubkeys, threshold, prefix) => { + const secpPubkeys = pubkeys.map((p) => { + return { + type: "tendermint/PubKeySecp256k1", + value: p, + }; + }); + const multisigPubkey = createMultisigThresholdPubkey(secpPubkeys, threshold); + return { + pubkey: multisigPubkey, + address: pubkeyToAddress(multisigPubkey, prefix), + threshold, + }; +}; diff --git a/dist/module/wasm/v1/authz.d.ts b/dist/module/wasm/v1/authz.d.ts new file mode 100644 index 0000000..15a866c --- /dev/null +++ b/dist/module/wasm/v1/authz.d.ts @@ -0,0 +1,119 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** + * ContractExecutionAuthorization defines authorization for wasm execute. + * Since: wasmd 0.30 + */ +export interface ContractExecutionAuthorization { + /** Grants for contract executions */ + grants: ContractGrant[]; +} +/** + * ContractMigrationAuthorization defines authorization for wasm contract + * migration. Since: wasmd 0.30 + */ +export interface ContractMigrationAuthorization { + /** Grants for contract migrations */ + grants: ContractGrant[]; +} +/** + * ContractGrant a granted permission for a single contract + * Since: wasmd 0.30 + */ +export interface ContractGrant { + /** Contract is the bech32 address of the smart contract */ + contract: string; + /** + * Limit defines execution limits that are enforced and updated when the grant + * is applied. When the limit lapsed the grant is removed. + */ + limit: Any | undefined; + /** + * Filter define more fine-grained control on the message payload passed + * to the contract in the operation. When no filter applies on execution, the + * operation is prohibited. + */ + filter: Any | undefined; +} +/** + * MaxCallsLimit limited number of calls to the contract. No funds transferable. + * Since: wasmd 0.30 + */ +export interface MaxCallsLimit { + /** Remaining number that is decremented on each execution */ + remaining: number; +} +/** + * MaxFundsLimit defines the maximal amounts that can be sent to the contract. + * Since: wasmd 0.30 + */ +export interface MaxFundsLimit { + /** Amounts is the maximal amount of tokens transferable to the contract. */ + amounts: Coin[]; +} +/** + * CombinedLimit defines the maximal amounts that can be sent to a contract and + * the maximal number of calls executable. Both need to remain >0 to be valid. + * Since: wasmd 0.30 + */ +export interface CombinedLimit { + /** Remaining number that is decremented on each execution */ + callsRemaining: number; + /** Amounts is the maximal amount of tokens transferable to the contract. */ + amounts: Coin[]; +} +/** + * AllowAllMessagesFilter is a wildcard to allow any type of contract payload + * message. + * Since: wasmd 0.30 + */ +export interface AllowAllMessagesFilter { +} +/** + * AcceptedMessageKeysFilter accept only the specific contract message keys in + * the json object to be executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessageKeysFilter { + /** Messages is the list of unique keys */ + keys: string[]; +} +/** + * AcceptedMessagesFilter accept only the specific raw contract messages to be + * executed. + * Since: wasmd 0.30 + */ +export interface AcceptedMessagesFilter { + /** Messages is the list of raw contract messages */ + messages: Uint8Array[]; +} +export declare const ContractExecutionAuthorization: MessageFns; +export declare const ContractMigrationAuthorization: MessageFns; +export declare const ContractGrant: MessageFns; +export declare const MaxCallsLimit: MessageFns; +export declare const MaxFundsLimit: MessageFns; +export declare const CombinedLimit: MessageFns; +export declare const AllowAllMessagesFilter: MessageFns; +export declare const AcceptedMessageKeysFilter: MessageFns; +export declare const AcceptedMessagesFilter: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/wasm/v1/authz.js b/dist/module/wasm/v1/authz.js new file mode 100644 index 0000000..55fb656 --- /dev/null +++ b/dist/module/wasm/v1/authz.js @@ -0,0 +1,580 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/authz.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export const protobufPackage = "cosmwasm.wasm.v1"; +function createBaseContractExecutionAuthorization() { + return { grants: [] }; +} +export const ContractExecutionAuthorization = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.grants) { + ContractGrant.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractExecutionAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.grants.push(ContractGrant.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + grants: globalThis.Array.isArray(object?.grants) + ? object.grants.map((e) => ContractGrant.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.grants?.length) { + obj.grants = message.grants.map((e) => ContractGrant.toJSON(e)); + } + return obj; + }, + create(base) { + return ContractExecutionAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractExecutionAuthorization(); + message.grants = + object.grants?.map((e) => ContractGrant.fromPartial(e)) || []; + return message; + }, +}; +function createBaseContractMigrationAuthorization() { + return { grants: [] }; +} +export const ContractMigrationAuthorization = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.grants) { + ContractGrant.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractMigrationAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.grants.push(ContractGrant.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + grants: globalThis.Array.isArray(object?.grants) + ? object.grants.map((e) => ContractGrant.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.grants?.length) { + obj.grants = message.grants.map((e) => ContractGrant.toJSON(e)); + } + return obj; + }, + create(base) { + return ContractMigrationAuthorization.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractMigrationAuthorization(); + message.grants = + object.grants?.map((e) => ContractGrant.fromPartial(e)) || []; + return message; + }, +}; +function createBaseContractGrant() { + return { contract: "", limit: undefined, filter: undefined }; +} +export const ContractGrant = { + encode(message, writer = new BinaryWriter()) { + if (message.contract !== "") { + writer.uint32(10).string(message.contract); + } + if (message.limit !== undefined) { + Any.encode(message.limit, writer.uint32(18).fork()).ldelim(); + } + if (message.filter !== undefined) { + Any.encode(message.filter, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contract = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.limit = Any.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.filter = Any.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + limit: isSet(object.limit) ? Any.fromJSON(object.limit) : undefined, + filter: isSet(object.filter) ? Any.fromJSON(object.filter) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.limit !== undefined) { + obj.limit = Any.toJSON(message.limit); + } + if (message.filter !== undefined) { + obj.filter = Any.toJSON(message.filter); + } + return obj; + }, + create(base) { + return ContractGrant.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractGrant(); + message.contract = object.contract ?? ""; + message.limit = + object.limit !== undefined && object.limit !== null + ? Any.fromPartial(object.limit) + : undefined; + message.filter = + object.filter !== undefined && object.filter !== null + ? Any.fromPartial(object.filter) + : undefined; + return message; + }, +}; +function createBaseMaxCallsLimit() { + return { remaining: 0 }; +} +export const MaxCallsLimit = { + encode(message, writer = new BinaryWriter()) { + if (message.remaining !== 0) { + writer.uint32(8).uint64(message.remaining); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMaxCallsLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.remaining = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + remaining: isSet(object.remaining) + ? globalThis.Number(object.remaining) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.remaining !== 0) { + obj.remaining = Math.round(message.remaining); + } + return obj; + }, + create(base) { + return MaxCallsLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMaxCallsLimit(); + message.remaining = object.remaining ?? 0; + return message; + }, +}; +function createBaseMaxFundsLimit() { + return { amounts: [] }; +} +export const MaxFundsLimit = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.amounts) { + Coin.encode(v, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMaxFundsLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.amounts.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + amounts: globalThis.Array.isArray(object?.amounts) + ? object.amounts.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.amounts?.length) { + obj.amounts = message.amounts.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return MaxFundsLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMaxFundsLimit(); + message.amounts = object.amounts?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCombinedLimit() { + return { callsRemaining: 0, amounts: [] }; +} +export const CombinedLimit = { + encode(message, writer = new BinaryWriter()) { + if (message.callsRemaining !== 0) { + writer.uint32(8).uint64(message.callsRemaining); + } + for (const v of message.amounts) { + Coin.encode(v, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCombinedLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.callsRemaining = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.amounts.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + callsRemaining: isSet(object.callsRemaining) + ? globalThis.Number(object.callsRemaining) + : 0, + amounts: globalThis.Array.isArray(object?.amounts) + ? object.amounts.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.callsRemaining !== 0) { + obj.callsRemaining = Math.round(message.callsRemaining); + } + if (message.amounts?.length) { + obj.amounts = message.amounts.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return CombinedLimit.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCombinedLimit(); + message.callsRemaining = object.callsRemaining ?? 0; + message.amounts = object.amounts?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseAllowAllMessagesFilter() { + return {}; +} +export const AllowAllMessagesFilter = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowAllMessagesFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return AllowAllMessagesFilter.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseAllowAllMessagesFilter(); + return message; + }, +}; +function createBaseAcceptedMessageKeysFilter() { + return { keys: [] }; +} +export const AcceptedMessageKeysFilter = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.keys) { + writer.uint32(10).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcceptedMessageKeysFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.keys.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + keys: globalThis.Array.isArray(object?.keys) + ? object.keys.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.keys?.length) { + obj.keys = message.keys; + } + return obj; + }, + create(base) { + return AcceptedMessageKeysFilter.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAcceptedMessageKeysFilter(); + message.keys = object.keys?.map((e) => e) || []; + return message; + }, +}; +function createBaseAcceptedMessagesFilter() { + return { messages: [] }; +} +export const AcceptedMessagesFilter = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.messages) { + writer.uint32(10).bytes(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcceptedMessagesFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.messages.push(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + messages: globalThis.Array.isArray(object?.messages) + ? object.messages.map((e) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => base64FromBytes(e)); + } + return obj; + }, + create(base) { + return AcceptedMessagesFilter.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAcceptedMessagesFilter(); + message.messages = object.messages?.map((e) => e) || []; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/wasm/v1/extensions/wasm.d.ts b/dist/module/wasm/v1/extensions/wasm.d.ts new file mode 100644 index 0000000..8b79416 --- /dev/null +++ b/dist/module/wasm/v1/extensions/wasm.d.ts @@ -0,0 +1,17 @@ +import { QueryClient } from "@cosmjs/stargate"; +import { QueryAllContractStateRequest, QueryAllContractStateResponse, QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractInfoRequest, QueryContractInfoResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, QueryContractsByCreatorRequest, QueryContractsByCreatorResponse, QueryParamsRequest, QueryParamsResponse, QueryPinnedCodesRequest, QueryPinnedCodesResponse, QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest, QuerySmartContractStateResponse } from "../query"; +export declare function setupWasmExtension(base: QueryClient): { + wasm: { + smartContractState: (request: QuerySmartContractStateRequest) => Promise; + rawContractState: (request: QueryRawContractStateRequest) => Promise; + pinnedCodes: (request: QueryPinnedCodesRequest) => Promise; + contractsByCreator: (request: QueryContractsByCreatorRequest) => Promise; + contractsByCode: (request: QueryContractsByCodeRequest) => Promise; + contractInfo: (request: QueryContractInfoRequest) => Promise; + contractHistory: (request: QueryContractHistoryRequest) => Promise; + allContractState: (request: QueryAllContractStateRequest) => Promise; + params: (request: QueryParamsRequest) => Promise; + code: (request: QueryCodeRequest) => Promise; + codes: (request: QueryCodesRequest) => Promise; + }; +}; diff --git a/dist/module/wasm/v1/extensions/wasm.js b/dist/module/wasm/v1/extensions/wasm.js new file mode 100644 index 0000000..01765a2 --- /dev/null +++ b/dist/module/wasm/v1/extensions/wasm.js @@ -0,0 +1,43 @@ +import { createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryClientImpl, } from "../query"; +export function setupWasmExtension(base) { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + wasm: { + smartContractState: async (request) => { + return await queryService.SmartContractState(request); + }, + rawContractState: async (request) => { + return await queryService.RawContractState(request); + }, + pinnedCodes: async (request) => { + return await queryService.PinnedCodes(request); + }, + contractsByCreator: async (request) => { + return await queryService.ContractsByCreator(request); + }, + contractsByCode: async (request) => { + return await queryService.ContractsByCode(request); + }, + contractInfo: async (request) => { + return await queryService.ContractInfo(request); + }, + contractHistory: async (request) => { + return await queryService.ContractHistory(request); + }, + allContractState: async (request) => { + return await queryService.AllContractState(request); + }, + params: async (request) => { + return await queryService.Params(request); + }, + code: async (request) => { + return await queryService.Code(request); + }, + codes: async (request) => { + return await queryService.Codes(request); + }, + }, + }; +} diff --git a/dist/module/wasm/v1/genesis.d.ts b/dist/module/wasm/v1/genesis.d.ts new file mode 100644 index 0000000..0ea4646 --- /dev/null +++ b/dist/module/wasm/v1/genesis.d.ts @@ -0,0 +1,53 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { CodeInfo, ContractCodeHistoryEntry, ContractInfo, Model, Params } from "./types"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** GenesisState - genesis state of x/wasm */ +export interface GenesisState { + params: Params | undefined; + codes: Code[]; + contracts: Contract[]; + sequences: Sequence[]; +} +/** Code struct encompasses CodeInfo and CodeBytes */ +export interface Code { + codeId: number; + codeInfo: CodeInfo | undefined; + codeBytes: Uint8Array; + /** Pinned to wasmvm cache */ + pinned: boolean; +} +/** Contract struct encompasses ContractAddress, ContractInfo, and ContractState */ +export interface Contract { + contractAddress: string; + contractInfo: ContractInfo | undefined; + contractState: Model[]; + contractCodeHistory: ContractCodeHistoryEntry[]; +} +/** Sequence key and value of an id generation counter */ +export interface Sequence { + idKey: Uint8Array; + value: number; +} +export declare const GenesisState: MessageFns; +export declare const Code: MessageFns; +export declare const Contract: MessageFns; +export declare const Sequence: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/wasm/v1/genesis.js b/dist/module/wasm/v1/genesis.js new file mode 100644 index 0000000..242b4be --- /dev/null +++ b/dist/module/wasm/v1/genesis.js @@ -0,0 +1,452 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/genesis.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { CodeInfo, ContractCodeHistoryEntry, ContractInfo, Model, Params, } from "./types"; +export const protobufPackage = "cosmwasm.wasm.v1"; +function createBaseGenesisState() { + return { params: undefined, codes: [], contracts: [], sequences: [] }; +} +export const GenesisState = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.codes) { + Code.encode(v, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.contracts) { + Contract.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.sequences) { + Sequence.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.codes.push(Code.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contracts.push(Contract.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.sequences.push(Sequence.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + codes: globalThis.Array.isArray(object?.codes) + ? object.codes.map((e) => Code.fromJSON(e)) + : [], + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e) => Contract.fromJSON(e)) + : [], + sequences: globalThis.Array.isArray(object?.sequences) + ? object.sequences.map((e) => Sequence.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.codes?.length) { + obj.codes = message.codes.map((e) => Code.toJSON(e)); + } + if (message.contracts?.length) { + obj.contracts = message.contracts.map((e) => Contract.toJSON(e)); + } + if (message.sequences?.length) { + obj.sequences = message.sequences.map((e) => Sequence.toJSON(e)); + } + return obj; + }, + create(base) { + return GenesisState.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseGenesisState(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + message.codes = object.codes?.map((e) => Code.fromPartial(e)) || []; + message.contracts = + object.contracts?.map((e) => Contract.fromPartial(e)) || []; + message.sequences = + object.sequences?.map((e) => Sequence.fromPartial(e)) || []; + return message; + }, +}; +function createBaseCode() { + return { + codeId: 0, + codeInfo: undefined, + codeBytes: new Uint8Array(0), + pinned: false, + }; +} +export const Code = { + encode(message, writer = new BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.codeInfo !== undefined) { + CodeInfo.encode(message.codeInfo, writer.uint32(18).fork()).ldelim(); + } + if (message.codeBytes.length !== 0) { + writer.uint32(26).bytes(message.codeBytes); + } + if (message.pinned !== false) { + writer.uint32(32).bool(message.pinned); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.codeInfo = CodeInfo.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.codeBytes = reader.bytes(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.pinned = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + codeInfo: isSet(object.codeInfo) + ? CodeInfo.fromJSON(object.codeInfo) + : undefined, + codeBytes: isSet(object.codeBytes) + ? bytesFromBase64(object.codeBytes) + : new Uint8Array(0), + pinned: isSet(object.pinned) ? globalThis.Boolean(object.pinned) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.codeInfo !== undefined) { + obj.codeInfo = CodeInfo.toJSON(message.codeInfo); + } + if (message.codeBytes.length !== 0) { + obj.codeBytes = base64FromBytes(message.codeBytes); + } + if (message.pinned !== false) { + obj.pinned = message.pinned; + } + return obj; + }, + create(base) { + return Code.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCode(); + message.codeId = object.codeId ?? 0; + message.codeInfo = + object.codeInfo !== undefined && object.codeInfo !== null + ? CodeInfo.fromPartial(object.codeInfo) + : undefined; + message.codeBytes = object.codeBytes ?? new Uint8Array(0); + message.pinned = object.pinned ?? false; + return message; + }, +}; +function createBaseContract() { + return { + contractAddress: "", + contractInfo: undefined, + contractState: [], + contractCodeHistory: [], + }; +} +export const Contract = { + encode(message, writer = new BinaryWriter()) { + if (message.contractAddress !== "") { + writer.uint32(10).string(message.contractAddress); + } + if (message.contractInfo !== undefined) { + ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.contractState) { + Model.encode(v, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.contractCodeHistory) { + ContractCodeHistoryEntry.encode(v, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contractAddress = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contractInfo = ContractInfo.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contractState.push(Model.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.contractCodeHistory.push(ContractCodeHistoryEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contractAddress: isSet(object.contractAddress) + ? globalThis.String(object.contractAddress) + : "", + contractInfo: isSet(object.contractInfo) + ? ContractInfo.fromJSON(object.contractInfo) + : undefined, + contractState: globalThis.Array.isArray(object?.contractState) + ? object.contractState.map((e) => Model.fromJSON(e)) + : [], + contractCodeHistory: globalThis.Array.isArray(object?.contractCodeHistory) + ? object.contractCodeHistory.map((e) => ContractCodeHistoryEntry.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.contractAddress !== "") { + obj.contractAddress = message.contractAddress; + } + if (message.contractInfo !== undefined) { + obj.contractInfo = ContractInfo.toJSON(message.contractInfo); + } + if (message.contractState?.length) { + obj.contractState = message.contractState.map((e) => Model.toJSON(e)); + } + if (message.contractCodeHistory?.length) { + obj.contractCodeHistory = message.contractCodeHistory.map((e) => ContractCodeHistoryEntry.toJSON(e)); + } + return obj; + }, + create(base) { + return Contract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContract(); + message.contractAddress = object.contractAddress ?? ""; + message.contractInfo = + object.contractInfo !== undefined && object.contractInfo !== null + ? ContractInfo.fromPartial(object.contractInfo) + : undefined; + message.contractState = + object.contractState?.map((e) => Model.fromPartial(e)) || []; + message.contractCodeHistory = + object.contractCodeHistory?.map((e) => ContractCodeHistoryEntry.fromPartial(e)) || []; + return message; + }, +}; +function createBaseSequence() { + return { idKey: new Uint8Array(0), value: 0 }; +} +export const Sequence = { + encode(message, writer = new BinaryWriter()) { + if (message.idKey.length !== 0) { + writer.uint32(10).bytes(message.idKey); + } + if (message.value !== 0) { + writer.uint32(16).uint64(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSequence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.idKey = reader.bytes(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.value = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + idKey: isSet(object.idKey) + ? bytesFromBase64(object.idKey) + : new Uint8Array(0), + value: isSet(object.value) ? globalThis.Number(object.value) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.idKey.length !== 0) { + obj.idKey = base64FromBytes(message.idKey); + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } + return obj; + }, + create(base) { + return Sequence.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSequence(); + message.idKey = object.idKey ?? new Uint8Array(0); + message.value = object.value ?? 0; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/wasm/v1/ibc.d.ts b/dist/module/wasm/v1/ibc.d.ts new file mode 100644 index 0000000..bc4532b --- /dev/null +++ b/dist/module/wasm/v1/ibc.d.ts @@ -0,0 +1,53 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** MsgIBCSend */ +export interface MsgIBCSend { + /** the channel by which the packet will be sent */ + channel: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeoutHeight: number; + /** + * Timeout timestamp (in nanoseconds) relative to the current block timestamp. + * The timeout is disabled when set to 0. + */ + timeoutTimestamp: number; + /** + * Data is the payload to transfer. We must not make assumption what format or + * content is in here. + */ + data: Uint8Array; +} +/** MsgIBCSendResponse */ +export interface MsgIBCSendResponse { + /** Sequence number of the IBC packet sent */ + sequence: number; +} +/** MsgIBCCloseChannel port and channel need to be owned by the contract */ +export interface MsgIBCCloseChannel { + channel: string; +} +export declare const MsgIBCSend: MessageFns; +export declare const MsgIBCSendResponse: MessageFns; +export declare const MsgIBCCloseChannel: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/wasm/v1/ibc.js b/dist/module/wasm/v1/ibc.js new file mode 100644 index 0000000..70ef63a --- /dev/null +++ b/dist/module/wasm/v1/ibc.js @@ -0,0 +1,261 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/ibc.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +export const protobufPackage = "cosmwasm.wasm.v1"; +function createBaseMsgIBCSend() { + return { + channel: "", + timeoutHeight: 0, + timeoutTimestamp: 0, + data: new Uint8Array(0), + }; +} +export const MsgIBCSend = { + encode(message, writer = new BinaryWriter()) { + if (message.channel !== "") { + writer.uint32(18).string(message.channel); + } + if (message.timeoutHeight !== 0) { + writer.uint32(32).uint64(message.timeoutHeight); + } + if (message.timeoutTimestamp !== 0) { + writer.uint32(40).uint64(message.timeoutTimestamp); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.channel = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + message.timeoutHeight = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.timeoutTimestamp = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + channel: isSet(object.channel) ? globalThis.String(object.channel) : "", + timeoutHeight: isSet(object.timeoutHeight) + ? globalThis.Number(object.timeoutHeight) + : 0, + timeoutTimestamp: isSet(object.timeoutTimestamp) + ? globalThis.Number(object.timeoutTimestamp) + : 0, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.channel !== "") { + obj.channel = message.channel; + } + if (message.timeoutHeight !== 0) { + obj.timeoutHeight = Math.round(message.timeoutHeight); + } + if (message.timeoutTimestamp !== 0) { + obj.timeoutTimestamp = Math.round(message.timeoutTimestamp); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return MsgIBCSend.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIBCSend(); + message.channel = object.channel ?? ""; + message.timeoutHeight = object.timeoutHeight ?? 0; + message.timeoutTimestamp = object.timeoutTimestamp ?? 0; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgIBCSendResponse() { + return { sequence: 0 }; +} +export const MsgIBCSendResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.sequence !== 0) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.sequence = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + create(base) { + return MsgIBCSendResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIBCSendResponse(); + message.sequence = object.sequence ?? 0; + return message; + }, +}; +function createBaseMsgIBCCloseChannel() { + return { channel: "" }; +} +export const MsgIBCCloseChannel = { + encode(message, writer = new BinaryWriter()) { + if (message.channel !== "") { + writer.uint32(18).string(message.channel); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCCloseChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.channel = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + channel: isSet(object.channel) ? globalThis.String(object.channel) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.channel !== "") { + obj.channel = message.channel; + } + return obj; + }, + create(base) { + return MsgIBCCloseChannel.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgIBCCloseChannel(); + message.channel = object.channel ?? ""; + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/wasm/v1/index.d.ts b/dist/module/wasm/v1/index.d.ts new file mode 100644 index 0000000..9e508d2 --- /dev/null +++ b/dist/module/wasm/v1/index.d.ts @@ -0,0 +1,157 @@ +import { MsgStoreCode, MsgInstantiateContract, MsgInstantiateContract2, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin, MsgUpdateInstantiateConfig, MsgUpdateParams, MsgSudoContract, MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract } from "./tx"; +import { MsgIBCSend, MsgIBCCloseChannel } from "./ibc"; +export declare const cosmwasmRegistry: ReadonlyArray<[string, any]>; +/** + * Transaction Module for the IBC Module (wasm) + */ +export declare namespace IBC { + /** MsgIBCSend message creator + * + * @param object Represents the properties available for this MsgIBCSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const IBCSend: (object: MsgIBCSend) => { + typeUrl: string; + value: MsgIBCSend; + }; + /** MsgIBCCloseChannel message creator + * + * @param object Represents the properties available for this MsgIBCCloseChannel message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const IBCCloseChannel: (object: MsgIBCCloseChannel) => { + typeUrl: string; + value: MsgIBCCloseChannel; + }; +} +/** + * Transaction Module for the Smart Contracts Module (wasm) + */ +export declare namespace CosmWasm { + /** MsgStoreAndInstantiateContract message creator + * + * @param object Represents the properties available for this MsgStoreAndInstantiateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const StoreAndInstantiateContract: (object: MsgStoreAndInstantiateContract) => { + typeUrl: string; + value: MsgStoreAndInstantiateContract; + }; + /** MsgUnpinCodes message creator + * + * @param object Represents the properties available for this MsgUnpinCodes message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UnpinCodes: (object: MsgUnpinCodes) => { + typeUrl: string; + value: MsgUnpinCodes; + }; + /** MsgPinCodes message creator + * + * @param object Represents the properties available for this MsgPinCodes message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const PinCodes: (object: MsgPinCodes) => { + typeUrl: string; + value: MsgPinCodes; + }; + /** MsgSudoContract message creator + * + * @param object Represents the properties available for this MsgSudoContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const SudoContract: (object: MsgSudoContract) => { + typeUrl: string; + value: MsgSudoContract; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateParams: (object: MsgUpdateParams) => { + typeUrl: string; + value: MsgUpdateParams; + }; + /** MsgUpdateInstantiateConfig message creator + * + * @param object Represents the properties available for this MsgUpdateInstantiateConfig message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateInstantiateConfig: (object: MsgUpdateInstantiateConfig) => { + typeUrl: string; + value: MsgUpdateInstantiateConfig; + }; + /** + * MsgStoreCode message creator + * Submit Wasm code to the system + * + * @param object Represents the properties available for this MsgStoreCode message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const StoreCode: (object: MsgStoreCode) => { + typeUrl: string; + value: MsgStoreCode; + }; + /** + * MsgInstantiateContract message creator + * Creates a new smart contract instance for the given code id. + * + * @param object Represents the properties available for this MsgInstantiateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const InstantiateContract: (object: MsgInstantiateContract) => { + typeUrl: string; + value: MsgInstantiateContract; + }; + /** MsgInstantiateContract2 message creator + * Creates a new smart contract instance for the given code id with a predictable address + * + * @param object Represents the properties available for this MsgInstantiateContract2 message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const InstantiateContract2: (object: MsgInstantiateContract2) => { + typeUrl: string; + value: MsgInstantiateContract2; + }; + /** MsgClearAdmin message creator + * Removes any admin stored for a smart contract + * + * @param object Represents the properties available for this MsgClearAdmin message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const ClearAdmin: (object: MsgClearAdmin) => { + typeUrl: string; + value: MsgClearAdmin; + }; + /** MsgUpdateAdmin message creator + * Sets a new admin for a smart contract + * + * @param object Represents the properties available for this MsgUpdateAdmin message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const UpdateAdmin: (object: MsgUpdateAdmin) => { + typeUrl: string; + value: MsgUpdateAdmin; + }; + /** MsgExecuteContract message creator + * Submits the given message data to a smart contract + * + * @param object Represents the properties available for this MsgExecuteContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const ExecuteContract: (object: MsgExecuteContract) => { + typeUrl: string; + value: MsgExecuteContract; + }; + /** MsgMigrateContract message creator + * Runs a code upgrade/ downgrade for a smart contract + * + * @param object Represents the properties available for this MsgMigrateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + const MigrateContract: (object: MsgMigrateContract) => { + typeUrl: string; + value: MsgMigrateContract; + }; +} diff --git a/dist/module/wasm/v1/index.js b/dist/module/wasm/v1/index.js new file mode 100644 index 0000000..4f90a52 --- /dev/null +++ b/dist/module/wasm/v1/index.js @@ -0,0 +1,206 @@ +import { MsgStoreCode, MsgInstantiateContract, MsgInstantiateContract2, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin, MsgUpdateInstantiateConfig, MsgUpdateParams, MsgSudoContract, MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract, } from "./tx"; +import { MsgIBCSend, MsgIBCCloseChannel } from "./ibc"; +const baseUrl = "/cosmwasm.wasm.v1."; +export const cosmwasmRegistry = [ + [baseUrl + "MsgStoreAndInstantiateContract", MsgStoreAndInstantiateContract], + [baseUrl + "MsgUpdateParams", MsgUpdateParams], + [baseUrl + "MsgSudoContract", MsgSudoContract], + [baseUrl + "MsgUnpinCodes", MsgUnpinCodes], + [baseUrl + "MsgPinCodes", MsgPinCodes], + [baseUrl + "MsgStoreCode", MsgStoreCode], + [baseUrl + "MsgInstantiateContract", MsgInstantiateContract], + [baseUrl + "MsgInstantiateContract2", MsgInstantiateContract2], + [baseUrl + "MsgExecuteContract", MsgExecuteContract], + [baseUrl + "MsgMigrateContract", MsgMigrateContract], + [baseUrl + "MsgUpdateAdmin", MsgUpdateAdmin], + [baseUrl + "MsgClearAdmin", MsgClearAdmin], + [baseUrl + "MsgUpdateInstantiateConfig", MsgUpdateInstantiateConfig], + [baseUrl + "MsgIBCSend", MsgIBCSend], + [baseUrl + "MsgIBCCloseChannel", MsgIBCCloseChannel], +]; +/** + * Transaction Module for the IBC Module (wasm) + */ +export var IBC; +(function (IBC) { + /** MsgIBCSend message creator + * + * @param object Represents the properties available for this MsgIBCSend message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + IBC.IBCSend = function (object) { + return { + typeUrl: baseUrl + "MsgIBCSend", + value: MsgIBCSend.fromPartial(object), + }; + }; + /** MsgIBCCloseChannel message creator + * + * @param object Represents the properties available for this MsgIBCCloseChannel message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + IBC.IBCCloseChannel = function (object) { + return { + typeUrl: baseUrl + "MsgIBCCloseChannel", + value: MsgIBCCloseChannel.fromPartial(object), + }; + }; +})(IBC || (IBC = {})); +/** + * Transaction Module for the Smart Contracts Module (wasm) + */ +export var CosmWasm; +(function (CosmWasm) { + /** MsgStoreAndInstantiateContract message creator + * + * @param object Represents the properties available for this MsgStoreAndInstantiateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.StoreAndInstantiateContract = function (object) { + return { + typeUrl: baseUrl + "MsgStoreAndInstantiateContract", + value: MsgStoreAndInstantiateContract.fromPartial(object), + }; + }; + /** MsgUnpinCodes message creator + * + * @param object Represents the properties available for this MsgUnpinCodes message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.UnpinCodes = function (object) { + return { + typeUrl: baseUrl + "MsgUnpinCodes", + value: MsgUnpinCodes.fromPartial(object), + }; + }; + /** MsgPinCodes message creator + * + * @param object Represents the properties available for this MsgPinCodes message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.PinCodes = function (object) { + return { + typeUrl: baseUrl + "MsgPinCodes", + value: MsgPinCodes.fromPartial(object), + }; + }; + /** MsgSudoContract message creator + * + * @param object Represents the properties available for this MsgSudoContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.SudoContract = function (object) { + return { + typeUrl: baseUrl + "MsgSudoContract", + value: MsgSudoContract.fromPartial(object), + }; + }; + /** MsgUpdateParams message creator + * + * @param object Represents the properties available for this MsgUpdateParams message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.UpdateParams = function (object) { + return { + typeUrl: baseUrl + "MsgUpdateParams", + value: MsgUpdateParams.fromPartial(object), + }; + }; + /** MsgUpdateInstantiateConfig message creator + * + * @param object Represents the properties available for this MsgUpdateInstantiateConfig message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.UpdateInstantiateConfig = function (object) { + return { + typeUrl: baseUrl + "MsgUpdateInstantiateConfig", + value: MsgUpdateInstantiateConfig.fromPartial(object), + }; + }; + /** + * MsgStoreCode message creator + * Submit Wasm code to the system + * + * @param object Represents the properties available for this MsgStoreCode message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.StoreCode = function (object) { + return { + typeUrl: baseUrl + "MsgStoreCode", + value: MsgStoreCode.fromPartial(object), + }; + }; + /** + * MsgInstantiateContract message creator + * Creates a new smart contract instance for the given code id. + * + * @param object Represents the properties available for this MsgInstantiateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.InstantiateContract = function (object) { + return { + typeUrl: baseUrl + "MsgInstantiateContract", + value: MsgInstantiateContract.fromPartial(object), + }; + }; + /** MsgInstantiateContract2 message creator + * Creates a new smart contract instance for the given code id with a predictable address + * + * @param object Represents the properties available for this MsgInstantiateContract2 message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.InstantiateContract2 = function (object) { + return { + typeUrl: baseUrl + "MsgInstantiateContract2", + value: MsgInstantiateContract2.fromPartial(object), + }; + }; + /** MsgClearAdmin message creator + * Removes any admin stored for a smart contract + * + * @param object Represents the properties available for this MsgClearAdmin message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.ClearAdmin = function (object) { + return { + typeUrl: baseUrl + "MsgClearAdmin", + value: MsgClearAdmin.fromPartial(object), + }; + }; + /** MsgUpdateAdmin message creator + * Sets a new admin for a smart contract + * + * @param object Represents the properties available for this MsgUpdateAdmin message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.UpdateAdmin = function (object) { + return { + typeUrl: baseUrl + "MsgUpdateAdmin", + value: MsgUpdateAdmin.fromPartial(object), + }; + }; + /** MsgExecuteContract message creator + * Submits the given message data to a smart contract + * + * @param object Represents the properties available for this MsgExecuteContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.ExecuteContract = function (object) { + return { + typeUrl: baseUrl + "MsgExecuteContract", + value: MsgExecuteContract.fromPartial(object), + }; + }; + /** MsgMigrateContract message creator + * Runs a code upgrade/ downgrade for a smart contract + * + * @param object Represents the properties available for this MsgMigrateContract message. + * @returns A Msg object with the typeUrl and value object for the proper message + */ + CosmWasm.MigrateContract = function (object) { + return { + typeUrl: baseUrl + "MsgMigrateContract", + value: MsgMigrateContract.fromPartial(object), + }; + }; +})(CosmWasm || (CosmWasm = {})); diff --git a/dist/module/wasm/v1/pagination.d.ts b/dist/module/wasm/v1/pagination.d.ts new file mode 100644 index 0000000..90b423a --- /dev/null +++ b/dist/module/wasm/v1/pagination.d.ts @@ -0,0 +1,128 @@ +import _m0 from "protobufjs/minimal"; +export declare 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. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} +export declare const PageRequest: { + encode(message: PageRequest, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest; + fromJSON(object: any): PageRequest; + toJSON(message: PageRequest): unknown; + create]: never; }>(base?: I | undefined): PageRequest; + fromPartial]: never; }>(object: I_1): PageRequest; +}; +export declare const PageResponse: { + encode(message: PageResponse, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse; + fromJSON(object: any): PageResponse; + toJSON(message: PageResponse): unknown; + create]: never; }>(base?: I | undefined): PageResponse; + fromPartial]: never; }>(object: I_1): PageResponse; +}; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/dist/module/wasm/v1/pagination.js b/dist/module/wasm/v1/pagination.js new file mode 100644 index 0000000..11f4a3f --- /dev/null +++ b/dist/module/wasm/v1/pagination.js @@ -0,0 +1,219 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +export const protobufPackage = "cosmos.base.query.v1beta1"; +function createBasePageRequest() { + return { key: new Uint8Array(), offset: 0, limit: 0, countTotal: false, reverse: false }; +} +export const PageRequest = { + encode(message, writer = _m0.Writer.create()) { + 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.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + message.countTotal = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + offset: isSet(object.offset) ? Number(object.offset) : 0, + limit: isSet(object.limit) ? Number(object.limit) : 0, + countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.offset !== undefined && (obj.offset = Math.round(message.offset)); + message.limit !== undefined && (obj.limit = Math.round(message.limit)); + message.countTotal !== undefined && (obj.countTotal = message.countTotal); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + create(base) { + return PageRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; +function createBasePageResponse() { + return { nextKey: new Uint8Array(), total: 0 }; +} +export const PageResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + message.nextKey = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(), + total: isSet(object.total) ? Number(object.total) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.nextKey !== undefined && + (obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array())); + message.total !== undefined && (obj.total = Math.round(message.total)); + return obj; + }, + create(base) { + return PageResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(); + message.total = object.total ?? 0; + return message; + }, +}; +var tsProtoGlobalThis = (() => { + 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"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function longToNumber(long) { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/wasm/v1/proposal.d.ts b/dist/module/wasm/v1/proposal.d.ts new file mode 100644 index 0000000..da4d9d4 --- /dev/null +++ b/dist/module/wasm/v1/proposal.d.ts @@ -0,0 +1,326 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { AccessConfig } from "./types"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreCodeProposal. To submit WASM code to the system, + * a simple MsgStoreCode can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface StoreCodeProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig | undefined; + /** UnpinCode code on upload, optional */ + unpinCode: boolean; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContractProposal. To instantiate a contract, + * a simple MsgInstantiateContract can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface InstantiateContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit InstantiateContract2Proposal. To instantiate contract 2, + * a simple MsgInstantiateContract2 can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface InstantiateContract2Proposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's enviroment as sender */ + runAs: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encode message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit MigrateContractProposal. To migrate a contract, + * a simple MsgMigrateContract can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface MigrateContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: number; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit SudoContractProposal. To call sudo on a contract, + * a simple MsgSudoContract can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface SudoContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ExecuteContractProposal. To call execute on a contract, + * a simple MsgExecuteContract can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface ExecuteContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as execute */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateAdminProposal. To set an admin for a contract, + * a simple MsgUpdateAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface UpdateAdminProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit ClearAdminProposal. To clear the admin of a contract, + * a simple MsgClearAdmin can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface ClearAdminProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit PinCodesProposal. To pin a set of code ids in the wasmvm + * cache, a simple MsgPinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface PinCodesProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** CodeIDs references the new WASM codes */ + codeIds: number[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm + * cache, a simple MsgUnpinCodes can be invoked from the x/gov module via + * a v1 governance proposal. + * + * @deprecated + */ +export interface UnpinCodesProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** CodeIDs references the WASM codes */ + codeIds: number[]; +} +/** + * AccessConfigUpdate contains the code id and the access config to be + * applied. + */ +export interface AccessConfigUpdate { + /** CodeID is the reference to the stored WASM code to be updated */ + codeId: number; + /** InstantiatePermission to apply to the set of code ids */ + instantiatePermission: AccessConfig | undefined; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit UpdateInstantiateConfigProposal. To update instantiate config + * to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from + * the x/gov module via a v1 governance proposal. + * + * @deprecated + */ +export interface UpdateInstantiateConfigProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** + * AccessConfigUpdate contains the list of code ids and the access config + * to be applied. + */ + accessConfigUpdates: AccessConfigUpdate[]; +} +/** + * Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for + * an explicit StoreAndInstantiateContractProposal. To store and instantiate + * the contract, a simple MsgStoreAndInstantiateContract can be invoked from + * the x/gov module via a v1 governance proposal. + * + * @deprecated + */ +export interface StoreAndInstantiateContractProposal { + /** Title is a short summary */ + title: string; + /** Description is a human readable text */ + description: string; + /** RunAs is the address that is passed to the contract's environment as sender */ + runAs: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig | undefined; + /** UnpinCode code on upload, optional */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +export declare const StoreCodeProposal: MessageFns; +export declare const InstantiateContractProposal: MessageFns; +export declare const InstantiateContract2Proposal: MessageFns; +export declare const MigrateContractProposal: MessageFns; +export declare const SudoContractProposal: MessageFns; +export declare const ExecuteContractProposal: MessageFns; +export declare const UpdateAdminProposal: MessageFns; +export declare const ClearAdminProposal: MessageFns; +export declare const PinCodesProposal: MessageFns; +export declare const UnpinCodesProposal: MessageFns; +export declare const AccessConfigUpdate: MessageFns; +export declare const UpdateInstantiateConfigProposal: MessageFns; +export declare const StoreAndInstantiateContractProposal: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/wasm/v1/proposal.js b/dist/module/wasm/v1/proposal.js new file mode 100644 index 0000000..8992b9b --- /dev/null +++ b/dist/module/wasm/v1/proposal.js @@ -0,0 +1,1803 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/proposal.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { AccessConfig } from "./types"; +export const protobufPackage = "cosmwasm.wasm.v1"; +function createBaseStoreCodeProposal() { + return { + title: "", + description: "", + runAs: "", + wasmByteCode: new Uint8Array(0), + instantiatePermission: undefined, + unpinCode: false, + source: "", + builder: "", + codeHash: new Uint8Array(0), + }; +} +export const StoreCodeProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(34).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(58).fork()).ldelim(); + } + if (message.unpinCode !== false) { + writer.uint32(64).bool(message.unpinCode); + } + if (message.source !== "") { + writer.uint32(74).string(message.source); + } + if (message.builder !== "") { + writer.uint32(82).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(90).bytes(message.codeHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreCodeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.wasmByteCode = reader.bytes(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.unpinCode = reader.bool(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.source = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.builder = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.codeHash = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + wasmByteCode: isSet(object.wasmByteCode) + ? bytesFromBase64(object.wasmByteCode) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + unpinCode: isSet(object.unpinCode) + ? globalThis.Boolean(object.unpinCode) + : false, + source: isSet(object.source) ? globalThis.String(object.source) : "", + builder: isSet(object.builder) ? globalThis.String(object.builder) : "", + codeHash: isSet(object.codeHash) + ? bytesFromBase64(object.codeHash) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.wasmByteCode.length !== 0) { + obj.wasmByteCode = base64FromBytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = AccessConfig.toJSON(message.instantiatePermission); + } + if (message.unpinCode !== false) { + obj.unpinCode = message.unpinCode; + } + if (message.source !== "") { + obj.source = message.source; + } + if (message.builder !== "") { + obj.builder = message.builder; + } + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + return obj; + }, + create(base) { + return StoreCodeProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStoreCodeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + message.unpinCode = object.unpinCode ?? false; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(0); + return message; + }, +}; +function createBaseInstantiateContractProposal() { + return { + title: "", + description: "", + runAs: "", + admin: "", + codeId: 0, + label: "", + msg: new Uint8Array(0), + funds: [], + }; +} +export const InstantiateContractProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.admin !== "") { + writer.uint32(34).string(message.admin); + } + if (message.codeId !== 0) { + writer.uint32(40).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(50).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(58).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(66).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInstantiateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.admin = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.label = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) + ? bytesFromBase64(object.msg) + : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return InstantiateContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInstantiateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseInstantiateContract2Proposal() { + return { + title: "", + description: "", + runAs: "", + admin: "", + codeId: 0, + label: "", + msg: new Uint8Array(0), + funds: [], + salt: new Uint8Array(0), + fixMsg: false, + }; +} +export const InstantiateContract2Proposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.admin !== "") { + writer.uint32(34).string(message.admin); + } + if (message.codeId !== 0) { + writer.uint32(40).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(50).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(58).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(66).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(74).bytes(message.salt); + } + if (message.fixMsg !== false) { + writer.uint32(80).bool(message.fixMsg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInstantiateContract2Proposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.admin = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.label = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.salt = reader.bytes(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + message.fixMsg = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) + ? bytesFromBase64(object.msg) + : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + salt: isSet(object.salt) + ? bytesFromBase64(object.salt) + : new Uint8Array(0), + fixMsg: isSet(object.fixMsg) + ? globalThis.Boolean(object.fixMsg) + : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + if (message.salt.length !== 0) { + obj.salt = base64FromBytes(message.salt); + } + if (message.fixMsg !== false) { + obj.fixMsg = message.fixMsg; + } + return obj; + }, + create(base) { + return InstantiateContract2Proposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseInstantiateContract2Proposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + message.salt = object.salt ?? new Uint8Array(0); + message.fixMsg = object.fixMsg ?? false; + return message; + }, +}; +function createBaseMigrateContractProposal() { + return { + title: "", + description: "", + contract: "", + codeId: 0, + msg: new Uint8Array(0), + }; +} +export const MigrateContractProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.codeId !== 0) { + writer.uint32(40).uint64(message.codeId); + } + if (message.msg.length !== 0) { + writer.uint32(50).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.contract = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return MigrateContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMigrateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + message.codeId = object.codeId ?? 0; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseSudoContractProposal() { + return { title: "", description: "", contract: "", msg: new Uint8Array(0) }; +} +export const SudoContractProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSudoContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contract = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return SudoContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseSudoContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseExecuteContractProposal() { + return { + title: "", + description: "", + runAs: "", + contract: "", + msg: new Uint8Array(0), + funds: [], + }; +} +export const ExecuteContractProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecuteContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.contract = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return ExecuteContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseExecuteContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseUpdateAdminProposal() { + return { title: "", description: "", newAdmin: "", contract: "" }; +} +export const UpdateAdminProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateAdminProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.newAdmin = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.contract = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + newAdmin: isSet(object.newAdmin) + ? globalThis.String(object.newAdmin) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + return obj; + }, + create(base) { + return UpdateAdminProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUpdateAdminProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.newAdmin = object.newAdmin ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBaseClearAdminProposal() { + return { title: "", description: "", contract: "" }; +} +export const ClearAdminProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClearAdminProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contract = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + return obj; + }, + create(base) { + return ClearAdminProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseClearAdminProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBasePinCodesProposal() { + return { title: "", description: "", codeIds: [] }; +} +export const PinCodesProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePinCodesProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + return obj; + }, + create(base) { + return PinCodesProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBasePinCodesProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.codeIds = object.codeIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseUnpinCodesProposal() { + return { title: "", description: "", codeIds: [] }; +} +export const UnpinCodesProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnpinCodesProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag === 24) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + return obj; + }, + create(base) { + return UnpinCodesProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUnpinCodesProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.codeIds = object.codeIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseAccessConfigUpdate() { + return { codeId: 0, instantiatePermission: undefined }; +} +export const AccessConfigUpdate = { + encode(message, writer = new BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessConfigUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + instantiatePermission: isSet(object.instantiatePermission) + ? AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = AccessConfig.toJSON(message.instantiatePermission); + } + return obj; + }, + create(base) { + return AccessConfigUpdate.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAccessConfigUpdate(); + message.codeId = object.codeId ?? 0; + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + return message; + }, +}; +function createBaseUpdateInstantiateConfigProposal() { + return { title: "", description: "", accessConfigUpdates: [] }; +} +export const UpdateInstantiateConfigProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.accessConfigUpdates) { + AccessConfigUpdate.encode(v, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateInstantiateConfigProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.accessConfigUpdates.push(AccessConfigUpdate.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + accessConfigUpdates: globalThis.Array.isArray(object?.accessConfigUpdates) + ? object.accessConfigUpdates.map((e) => AccessConfigUpdate.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.accessConfigUpdates?.length) { + obj.accessConfigUpdates = message.accessConfigUpdates.map((e) => AccessConfigUpdate.toJSON(e)); + } + return obj; + }, + create(base) { + return UpdateInstantiateConfigProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseUpdateInstantiateConfigProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.accessConfigUpdates = + object.accessConfigUpdates?.map((e) => AccessConfigUpdate.fromPartial(e)) || []; + return message; + }, +}; +function createBaseStoreAndInstantiateContractProposal() { + return { + title: "", + description: "", + runAs: "", + wasmByteCode: new Uint8Array(0), + instantiatePermission: undefined, + unpinCode: false, + admin: "", + label: "", + msg: new Uint8Array(0), + funds: [], + source: "", + builder: "", + codeHash: new Uint8Array(0), + }; +} +export const StoreAndInstantiateContractProposal = { + encode(message, writer = new BinaryWriter()) { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.runAs !== "") { + writer.uint32(26).string(message.runAs); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(34).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(42).fork()).ldelim(); + } + if (message.unpinCode !== false) { + writer.uint32(48).bool(message.unpinCode); + } + if (message.admin !== "") { + writer.uint32(58).string(message.admin); + } + if (message.label !== "") { + writer.uint32(66).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(74).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(82).fork()).ldelim(); + } + if (message.source !== "") { + writer.uint32(90).string(message.source); + } + if (message.builder !== "") { + writer.uint32(98).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(106).bytes(message.codeHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreAndInstantiateContractProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.runAs = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.wasmByteCode = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + message.unpinCode = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.admin = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.label = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.source = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.builder = reader.string(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + message.codeHash = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) + ? globalThis.String(object.description) + : "", + runAs: isSet(object.runAs) ? globalThis.String(object.runAs) : "", + wasmByteCode: isSet(object.wasmByteCode) + ? bytesFromBase64(object.wasmByteCode) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + unpinCode: isSet(object.unpinCode) + ? globalThis.Boolean(object.unpinCode) + : false, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) + ? bytesFromBase64(object.msg) + : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + source: isSet(object.source) ? globalThis.String(object.source) : "", + builder: isSet(object.builder) ? globalThis.String(object.builder) : "", + codeHash: isSet(object.codeHash) + ? bytesFromBase64(object.codeHash) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.runAs !== "") { + obj.runAs = message.runAs; + } + if (message.wasmByteCode.length !== 0) { + obj.wasmByteCode = base64FromBytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = AccessConfig.toJSON(message.instantiatePermission); + } + if (message.unpinCode !== false) { + obj.unpinCode = message.unpinCode; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + if (message.source !== "") { + obj.source = message.source; + } + if (message.builder !== "") { + obj.builder = message.builder; + } + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + return obj; + }, + create(base) { + return StoreAndInstantiateContractProposal.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseStoreAndInstantiateContractProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.runAs = object.runAs ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + message.unpinCode = object.unpinCode ?? false; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(0); + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/wasm/v1/query.d.ts b/dist/module/wasm/v1/query.d.ts new file mode 100644 index 0000000..7420ac6 --- /dev/null +++ b/dist/module/wasm/v1/query.d.ts @@ -0,0 +1,277 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { AccessConfig, ContractCodeHistoryEntry, ContractInfo, Model, Params } from "./types"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** + * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoRequest { + /** address is the address of the contract to query */ + address: string; +} +/** + * QueryContractInfoResponse is the response type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoResponse { + /** address is the address of the contract */ + address: string; + contractInfo: ContractInfo | undefined; +} +/** + * QueryContractHistoryRequest is the request type for the Query/ContractHistory + * RPC method + */ +export interface QueryContractHistoryRequest { + /** address is the address of the contract to query */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryContractHistoryResponse is the response type for the + * Query/ContractHistory RPC method + */ +export interface QueryContractHistoryResponse { + entries: ContractCodeHistoryEntry[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** + * QueryContractsByCodeRequest is the request type for the Query/ContractsByCode + * RPC method + */ +export interface QueryContractsByCodeRequest { + /** grpc-gateway_out does not support Go style CodID */ + codeId: number; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryContractsByCodeResponse is the response type for the + * Query/ContractsByCode RPC method + */ +export interface QueryContractsByCodeResponse { + /** contracts are a set of contract addresses */ + contracts: string[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** + * QueryAllContractStateRequest is the request type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateRequest { + /** address is the address of the contract */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryAllContractStateResponse is the response type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateResponse { + models: Model[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** + * QueryRawContractStateRequest is the request type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateRequest { + /** address is the address of the contract */ + address: string; + queryData: Uint8Array; +} +/** + * QueryRawContractStateResponse is the response type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateResponse { + /** Data contains the raw store data */ + data: Uint8Array; +} +/** + * QuerySmartContractStateRequest is the request type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateRequest { + /** address is the address of the contract */ + address: string; + /** QueryData contains the query data passed to the contract */ + queryData: Uint8Array; +} +/** + * QuerySmartContractStateResponse is the response type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateResponse { + /** Data contains the json data returned from the smart contract */ + data: Uint8Array; +} +/** QueryCodeRequest is the request type for the Query/Code RPC method */ +export interface QueryCodeRequest { + /** grpc-gateway_out does not support Go style CodID */ + codeId: number; +} +/** CodeInfoResponse contains code meta data from CodeInfo */ +export interface CodeInfoResponse { + /** id for legacy support */ + codeId: number; + creator: string; + dataHash: Uint8Array; + instantiatePermission: AccessConfig | undefined; +} +/** QueryCodeResponse is the response type for the Query/Code RPC method */ +export interface QueryCodeResponse { + codeInfo: CodeInfoResponse | undefined; + data: Uint8Array; +} +/** QueryCodesRequest is the request type for the Query/Codes RPC method */ +export interface QueryCodesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** QueryCodesResponse is the response type for the Query/Codes RPC method */ +export interface QueryCodesResponse { + codeInfos: CodeInfoResponse[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** + * QueryPinnedCodesRequest is the request type for the Query/PinnedCodes + * RPC method + */ +export interface QueryPinnedCodesRequest { + /** pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryPinnedCodesResponse is the response type for the + * Query/PinnedCodes RPC method + */ +export interface QueryPinnedCodesResponse { + codeIds: number[]; + /** pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params | undefined; +} +/** + * QueryContractsByCreatorRequest is the request type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorRequest { + /** CreatorAddress is the address of contract creator */ + creatorAddress: string; + /** Pagination defines an optional pagination for the request. */ + pagination: PageRequest | undefined; +} +/** + * QueryContractsByCreatorResponse is the response type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorResponse { + /** ContractAddresses result set */ + contractAddresses: string[]; + /** Pagination defines the pagination in the response. */ + pagination: PageResponse | undefined; +} +export declare const QueryContractInfoRequest: MessageFns; +export declare const QueryContractInfoResponse: MessageFns; +export declare const QueryContractHistoryRequest: MessageFns; +export declare const QueryContractHistoryResponse: MessageFns; +export declare const QueryContractsByCodeRequest: MessageFns; +export declare const QueryContractsByCodeResponse: MessageFns; +export declare const QueryAllContractStateRequest: MessageFns; +export declare const QueryAllContractStateResponse: MessageFns; +export declare const QueryRawContractStateRequest: MessageFns; +export declare const QueryRawContractStateResponse: MessageFns; +export declare const QuerySmartContractStateRequest: MessageFns; +export declare const QuerySmartContractStateResponse: MessageFns; +export declare const QueryCodeRequest: MessageFns; +export declare const CodeInfoResponse: MessageFns; +export declare const QueryCodeResponse: MessageFns; +export declare const QueryCodesRequest: MessageFns; +export declare const QueryCodesResponse: MessageFns; +export declare const QueryPinnedCodesRequest: MessageFns; +export declare const QueryPinnedCodesResponse: MessageFns; +export declare const QueryParamsRequest: MessageFns; +export declare const QueryParamsResponse: MessageFns; +export declare const QueryContractsByCreatorRequest: MessageFns; +export declare const QueryContractsByCreatorResponse: MessageFns; +/** Query provides defines the gRPC querier service */ +export interface Query { + /** ContractInfo gets the contract meta data */ + ContractInfo(request: QueryContractInfoRequest): Promise; + /** ContractHistory gets the contract code history */ + ContractHistory(request: QueryContractHistoryRequest): Promise; + /** ContractsByCode lists all smart contracts for a code id */ + ContractsByCode(request: QueryContractsByCodeRequest): Promise; + /** AllContractState gets all raw store data for a single contract */ + AllContractState(request: QueryAllContractStateRequest): Promise; + /** RawContractState gets single key from the raw store data of a contract */ + RawContractState(request: QueryRawContractStateRequest): Promise; + /** SmartContractState get smart query result from the contract */ + SmartContractState(request: QuerySmartContractStateRequest): Promise; + /** Code gets the binary code and metadata for a singe wasm code */ + Code(request: QueryCodeRequest): Promise; + /** Codes gets the metadata for all stored wasm codes */ + Codes(request: QueryCodesRequest): Promise; + /** PinnedCodes gets the pinned code ids */ + PinnedCodes(request: QueryPinnedCodesRequest): Promise; + /** Params gets the module params */ + Params(request: QueryParamsRequest): Promise; + /** ContractsByCreator gets the contracts by creator */ + ContractsByCreator(request: QueryContractsByCreatorRequest): Promise; +} +export declare const QueryServiceName = "cosmwasm.wasm.v1.Query"; +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + ContractInfo(request: QueryContractInfoRequest): Promise; + ContractHistory(request: QueryContractHistoryRequest): Promise; + ContractsByCode(request: QueryContractsByCodeRequest): Promise; + AllContractState(request: QueryAllContractStateRequest): Promise; + RawContractState(request: QueryRawContractStateRequest): Promise; + SmartContractState(request: QuerySmartContractStateRequest): Promise; + Code(request: QueryCodeRequest): Promise; + Codes(request: QueryCodesRequest): Promise; + PinnedCodes(request: QueryPinnedCodesRequest): Promise; + Params(request: QueryParamsRequest): Promise; + ContractsByCreator(request: QueryContractsByCreatorRequest): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/wasm/v1/query.js b/dist/module/wasm/v1/query.js new file mode 100644 index 0000000..94661dc --- /dev/null +++ b/dist/module/wasm/v1/query.js @@ -0,0 +1,1703 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/query.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { PageRequest, PageResponse, } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; +import { AccessConfig, ContractCodeHistoryEntry, ContractInfo, Model, Params, } from "./types"; +export const protobufPackage = "cosmwasm.wasm.v1"; +function createBaseQueryContractInfoRequest() { + return { address: "" }; +} +export const QueryContractInfoRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + create(base) { + return QueryContractInfoRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractInfoRequest(); + message.address = object.address ?? ""; + return message; + }, +}; +function createBaseQueryContractInfoResponse() { + return { address: "", contractInfo: undefined }; +} +export const QueryContractInfoResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.contractInfo !== undefined) { + ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contractInfo = ContractInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + contractInfo: isSet(object.contractInfo) + ? ContractInfo.fromJSON(object.contractInfo) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.contractInfo !== undefined) { + obj.contractInfo = ContractInfo.toJSON(message.contractInfo); + } + return obj; + }, + create(base) { + return QueryContractInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractInfoResponse(); + message.address = object.address ?? ""; + message.contractInfo = + object.contractInfo !== undefined && object.contractInfo !== null + ? ContractInfo.fromPartial(object.contractInfo) + : undefined; + return message; + }, +}; +function createBaseQueryContractHistoryRequest() { + return { address: "", pagination: undefined }; +} +export const QueryContractHistoryRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractHistoryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryContractHistoryRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractHistoryRequest(); + message.address = object.address ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryContractHistoryResponse() { + return { entries: [], pagination: undefined }; +} +export const QueryContractHistoryResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.entries) { + ContractCodeHistoryEntry.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.entries.push(ContractCodeHistoryEntry.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e) => ContractCodeHistoryEntry.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => ContractCodeHistoryEntry.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryContractHistoryResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractHistoryResponse(); + message.entries = + object.entries?.map((e) => ContractCodeHistoryEntry.fromPartial(e)) || + []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryContractsByCodeRequest() { + return { codeId: 0, pagination: undefined }; +} +export const QueryContractsByCodeRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryContractsByCodeRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractsByCodeRequest(); + message.codeId = object.codeId ?? 0; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryContractsByCodeResponse() { + return { contracts: [], pagination: undefined }; +} +export const QueryContractsByCodeResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.contracts) { + writer.uint32(10).string(v); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contracts.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contracts: globalThis.Array.isArray(object?.contracts) + ? object.contracts.map((e) => globalThis.String(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.contracts?.length) { + obj.contracts = message.contracts; + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryContractsByCodeResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractsByCodeResponse(); + message.contracts = object.contracts?.map((e) => e) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAllContractStateRequest() { + return { address: "", pagination: undefined }; +} +export const QueryAllContractStateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryAllContractStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryAllContractStateRequest(); + message.address = object.address ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryAllContractStateResponse() { + return { models: [], pagination: undefined }; +} +export const QueryAllContractStateResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.models) { + Model.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.models.push(Model.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + models: globalThis.Array.isArray(object?.models) + ? object.models.map((e) => Model.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.models?.length) { + obj.models = message.models.map((e) => Model.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryAllContractStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryAllContractStateResponse(); + message.models = object.models?.map((e) => Model.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryRawContractStateRequest() { + return { address: "", queryData: new Uint8Array(0) }; +} +export const QueryRawContractStateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRawContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.queryData = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + queryData: isSet(object.queryData) + ? bytesFromBase64(object.queryData) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.queryData.length !== 0) { + obj.queryData = base64FromBytes(message.queryData); + } + return obj; + }, + create(base) { + return QueryRawContractStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryRawContractStateRequest(); + message.address = object.address ?? ""; + message.queryData = object.queryData ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQueryRawContractStateResponse() { + return { data: new Uint8Array(0) }; +} +export const QueryRawContractStateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRawContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return QueryRawContractStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryRawContractStateResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQuerySmartContractStateRequest() { + return { address: "", queryData: new Uint8Array(0) }; +} +export const QuerySmartContractStateRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySmartContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.queryData = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + queryData: isSet(object.queryData) + ? bytesFromBase64(object.queryData) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.queryData.length !== 0) { + obj.queryData = base64FromBytes(message.queryData); + } + return obj; + }, + create(base) { + return QuerySmartContractStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQuerySmartContractStateRequest(); + message.address = object.address ?? ""; + message.queryData = object.queryData ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQuerySmartContractStateResponse() { + return { data: new Uint8Array(0) }; +} +export const QuerySmartContractStateResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySmartContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return QuerySmartContractStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQuerySmartContractStateResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQueryCodeRequest() { + return { codeId: 0 }; +} +export const QueryCodeRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + return obj; + }, + create(base) { + return QueryCodeRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryCodeRequest(); + message.codeId = object.codeId ?? 0; + return message; + }, +}; +function createBaseCodeInfoResponse() { + return { + codeId: 0, + creator: "", + dataHash: new Uint8Array(0), + instantiatePermission: undefined, + }; +} +export const CodeInfoResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.dataHash.length !== 0) { + writer.uint32(26).bytes(message.dataHash); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.dataHash = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + dataHash: isSet(object.dataHash) + ? bytesFromBase64(object.dataHash) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.dataHash.length !== 0) { + obj.dataHash = base64FromBytes(message.dataHash); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = AccessConfig.toJSON(message.instantiatePermission); + } + return obj; + }, + create(base) { + return CodeInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCodeInfoResponse(); + message.codeId = object.codeId ?? 0; + message.creator = object.creator ?? ""; + message.dataHash = object.dataHash ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + return message; + }, +}; +function createBaseQueryCodeResponse() { + return { codeInfo: undefined, data: new Uint8Array(0) }; +} +export const QueryCodeResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.codeInfo !== undefined) { + CodeInfoResponse.encode(message.codeInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.codeInfo = CodeInfoResponse.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeInfo: isSet(object.codeInfo) + ? CodeInfoResponse.fromJSON(object.codeInfo) + : undefined, + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeInfo !== undefined) { + obj.codeInfo = CodeInfoResponse.toJSON(message.codeInfo); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return QueryCodeResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryCodeResponse(); + message.codeInfo = + object.codeInfo !== undefined && object.codeInfo !== null + ? CodeInfoResponse.fromPartial(object.codeInfo) + : undefined; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseQueryCodesRequest() { + return { pagination: undefined }; +} +export const QueryCodesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryCodesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryCodesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryCodesResponse() { + return { codeInfos: [], pagination: undefined }; +} +export const QueryCodesResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.codeInfos) { + CodeInfoResponse.encode(v, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.codeInfos.push(CodeInfoResponse.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeInfos: globalThis.Array.isArray(object?.codeInfos) + ? object.codeInfos.map((e) => CodeInfoResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeInfos?.length) { + obj.codeInfos = message.codeInfos.map((e) => CodeInfoResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryCodesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryCodesResponse(); + message.codeInfos = + object.codeInfos?.map((e) => CodeInfoResponse.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryPinnedCodesRequest() { + return { pagination: undefined }; +} +export const QueryPinnedCodesRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPinnedCodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryPinnedCodesRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryPinnedCodesRequest(); + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryPinnedCodesResponse() { + return { codeIds: [], pagination: undefined }; +} +export const QueryPinnedCodesResponse = { + encode(message, writer = new BinaryWriter()) { + writer.uint32(10).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPinnedCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryPinnedCodesResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryPinnedCodesResponse(); + message.codeIds = object.codeIds?.map((e) => e) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryParamsRequest() { + return {}; +} +export const QueryParamsRequest = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return QueryParamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; +function createBaseQueryParamsResponse() { + return { params: undefined }; +} +export const QueryParamsResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return QueryParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseQueryContractsByCreatorRequest() { + return { creatorAddress: "", pagination: undefined }; +} +export const QueryContractsByCreatorRequest = { + encode(message, writer = new BinaryWriter()) { + if (message.creatorAddress !== "") { + writer.uint32(10).string(message.creatorAddress); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCreatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.creatorAddress = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + creatorAddress: isSet(object.creatorAddress) + ? globalThis.String(object.creatorAddress) + : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.creatorAddress !== "") { + obj.creatorAddress = message.creatorAddress; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryContractsByCreatorRequest.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractsByCreatorRequest(); + message.creatorAddress = object.creatorAddress ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryContractsByCreatorResponse() { + return { contractAddresses: [], pagination: undefined }; +} +export const QueryContractsByCreatorResponse = { + encode(message, writer = new BinaryWriter()) { + for (const v of message.contractAddresses) { + writer.uint32(10).string(v); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCreatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.contractAddresses.push(reader.string()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + contractAddresses: globalThis.Array.isArray(object?.contractAddresses) + ? object.contractAddresses.map((e) => globalThis.String(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.contractAddresses?.length) { + obj.contractAddresses = message.contractAddresses; + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + create(base) { + return QueryContractsByCreatorResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseQueryContractsByCreatorResponse(); + message.contractAddresses = object.contractAddresses?.map((e) => e) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +export const QueryServiceName = "cosmwasm.wasm.v1.Query"; +export class QueryClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || QueryServiceName; + this.rpc = rpc; + this.ContractInfo = this.ContractInfo.bind(this); + this.ContractHistory = this.ContractHistory.bind(this); + this.ContractsByCode = this.ContractsByCode.bind(this); + this.AllContractState = this.AllContractState.bind(this); + this.RawContractState = this.RawContractState.bind(this); + this.SmartContractState = this.SmartContractState.bind(this); + this.Code = this.Code.bind(this); + this.Codes = this.Codes.bind(this); + this.PinnedCodes = this.PinnedCodes.bind(this); + this.Params = this.Params.bind(this); + this.ContractsByCreator = this.ContractsByCreator.bind(this); + } + ContractInfo(request) { + const data = QueryContractInfoRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ContractInfo", data); + return promise.then((data) => QueryContractInfoResponse.decode(new BinaryReader(data))); + } + ContractHistory(request) { + const data = QueryContractHistoryRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ContractHistory", data); + return promise.then((data) => QueryContractHistoryResponse.decode(new BinaryReader(data))); + } + ContractsByCode(request) { + const data = QueryContractsByCodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ContractsByCode", data); + return promise.then((data) => QueryContractsByCodeResponse.decode(new BinaryReader(data))); + } + AllContractState(request) { + const data = QueryAllContractStateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "AllContractState", data); + return promise.then((data) => QueryAllContractStateResponse.decode(new BinaryReader(data))); + } + RawContractState(request) { + const data = QueryRawContractStateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "RawContractState", data); + return promise.then((data) => QueryRawContractStateResponse.decode(new BinaryReader(data))); + } + SmartContractState(request) { + const data = QuerySmartContractStateRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "SmartContractState", data); + return promise.then((data) => QuerySmartContractStateResponse.decode(new BinaryReader(data))); + } + Code(request) { + const data = QueryCodeRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Code", data); + return promise.then((data) => QueryCodeResponse.decode(new BinaryReader(data))); + } + Codes(request) { + const data = QueryCodesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Codes", data); + return promise.then((data) => QueryCodesResponse.decode(new BinaryReader(data))); + } + PinnedCodes(request) { + const data = QueryPinnedCodesRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "PinnedCodes", data); + return promise.then((data) => QueryPinnedCodesResponse.decode(new BinaryReader(data))); + } + Params(request) { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data))); + } + ContractsByCreator(request) { + const data = QueryContractsByCreatorRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, "ContractsByCreator", data); + return promise.then((data) => QueryContractsByCreatorResponse.decode(new BinaryReader(data))); + } +} +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/wasm/v1/tx.d.ts b/dist/module/wasm/v1/tx.d.ts new file mode 100644 index 0000000..75e8392 --- /dev/null +++ b/dist/module/wasm/v1/tx.d.ts @@ -0,0 +1,416 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { AccessConfig, Params } from "./types"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** MsgStoreCode submit Wasm code to the system */ +export interface MsgStoreCode { + /** Sender is the actor that signed the messages */ + sender: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** + * InstantiatePermission access control to apply on contract creation, + * optional + */ + instantiatePermission: AccessConfig | undefined; +} +/** MsgStoreCodeResponse returns store result data. */ +export interface MsgStoreCodeResponse { + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Checksum is the sha256 hash of the stored code */ + checksum: Uint8Array; +} +/** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ +export interface MsgInstantiateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +/** MsgInstantiateContractResponse return instantiation result data */ +export interface MsgInstantiateContractResponse { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ +export interface MsgInstantiateContract2 { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; +} +/** MsgInstantiateContract2Response return instantiation result data */ +export interface MsgInstantiateContract2Response { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** MsgExecuteContract submits the given message data to a smart contract */ +export interface MsgExecuteContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on execution */ + funds: Coin[]; +} +/** MsgExecuteContractResponse returns execution result data. */ +export interface MsgExecuteContractResponse { + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ +export interface MsgMigrateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: number; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +/** MsgMigrateContractResponse returns contract migration result data. */ +export interface MsgMigrateContractResponse { + /** + * Data contains same raw bytes returned as data from the wasm contract. + * (May be empty) + */ + data: Uint8Array; +} +/** MsgUpdateAdmin sets a new admin for a smart contract */ +export interface MsgUpdateAdmin { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** MsgUpdateAdminResponse returns empty data */ +export interface MsgUpdateAdminResponse { +} +/** MsgClearAdmin removes any admin stored for a smart contract */ +export interface MsgClearAdmin { + /** Sender is the actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; +} +/** MsgClearAdminResponse returns empty data */ +export interface MsgClearAdminResponse { +} +/** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ +export interface MsgUpdateInstantiateConfig { + /** Sender is the that actor that signed the messages */ + sender: string; + /** CodeID references the stored WASM code */ + codeId: number; + /** NewInstantiatePermission is the new access control */ + newInstantiatePermission: AccessConfig | undefined; +} +/** MsgUpdateInstantiateConfigResponse returns empty data */ +export interface MsgUpdateInstantiateConfigResponse { +} +/** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ +export interface MsgUpdateParams { + /** Authority is the address of the governance account. */ + authority: string; + /** + * params defines the x/wasm parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params | undefined; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsResponse { +} +/** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ +export interface MsgSudoContract { + /** Authority is the address of the governance account. */ + authority: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; +} +/** + * MsgSudoContractResponse defines the response structure for executing a + * MsgSudoContract message. + * + * Since: 0.40 + */ +export interface MsgSudoContractResponse { + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +/** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ +export interface MsgPinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the new WASM codes */ + codeIds: number[]; +} +/** + * MsgPinCodesResponse defines the response structure for executing a + * MsgPinCodes message. + * + * Since: 0.40 + */ +export interface MsgPinCodesResponse { +} +/** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ +export interface MsgUnpinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the WASM codes */ + codeIds: number[]; +} +/** + * MsgUnpinCodesResponse defines the response structure for executing a + * MsgUnpinCodes message. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesResponse { +} +/** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission: AccessConfig | undefined; + /** + * UnpinCode code on upload, optional. As default the uploaded contract is + * pinned to cache. + */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** + * Funds coins that are transferred from the authority account to the contract + * on instantiation + */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +/** + * MsgStoreAndInstantiateContractResponse defines the response structure + * for executing a MsgStoreAndInstantiateContract message. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractResponse { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export declare const MsgStoreCode: MessageFns; +export declare const MsgStoreCodeResponse: MessageFns; +export declare const MsgInstantiateContract: MessageFns; +export declare const MsgInstantiateContractResponse: MessageFns; +export declare const MsgInstantiateContract2: MessageFns; +export declare const MsgInstantiateContract2Response: MessageFns; +export declare const MsgExecuteContract: MessageFns; +export declare const MsgExecuteContractResponse: MessageFns; +export declare const MsgMigrateContract: MessageFns; +export declare const MsgMigrateContractResponse: MessageFns; +export declare const MsgUpdateAdmin: MessageFns; +export declare const MsgUpdateAdminResponse: MessageFns; +export declare const MsgClearAdmin: MessageFns; +export declare const MsgClearAdminResponse: MessageFns; +export declare const MsgUpdateInstantiateConfig: MessageFns; +export declare const MsgUpdateInstantiateConfigResponse: MessageFns; +export declare const MsgUpdateParams: MessageFns; +export declare const MsgUpdateParamsResponse: MessageFns; +export declare const MsgSudoContract: MessageFns; +export declare const MsgSudoContractResponse: MessageFns; +export declare const MsgPinCodes: MessageFns; +export declare const MsgPinCodesResponse: MessageFns; +export declare const MsgUnpinCodes: MessageFns; +export declare const MsgUnpinCodesResponse: MessageFns; +export declare const MsgStoreAndInstantiateContract: MessageFns; +export declare const MsgStoreAndInstantiateContractResponse: MessageFns; +/** Msg defines the wasm Msg service. */ +export interface Msg { + /** StoreCode to submit Wasm code to the system */ + StoreCode(request: MsgStoreCode): Promise; + /** + * InstantiateContract creates a new smart contract instance for the given + * code id. + */ + InstantiateContract(request: MsgInstantiateContract): Promise; + /** + * InstantiateContract2 creates a new smart contract instance for the given + * code id with a predictable address + */ + InstantiateContract2(request: MsgInstantiateContract2): Promise; + /** Execute submits the given message data to a smart contract */ + ExecuteContract(request: MsgExecuteContract): Promise; + /** Migrate runs a code upgrade/ downgrade for a smart contract */ + MigrateContract(request: MsgMigrateContract): Promise; + /** UpdateAdmin sets a new admin for a smart contract */ + UpdateAdmin(request: MsgUpdateAdmin): Promise; + /** ClearAdmin removes any admin stored for a smart contract */ + ClearAdmin(request: MsgClearAdmin): Promise; + /** UpdateInstantiateConfig updates instantiate config for a smart contract */ + UpdateInstantiateConfig(request: MsgUpdateInstantiateConfig): Promise; + /** + * UpdateParams defines a governance operation for updating the x/wasm + * module parameters. The authority is defined in the keeper. + * + * Since: 0.40 + */ + UpdateParams(request: MsgUpdateParams): Promise; + /** + * SudoContract defines a governance operation for calling sudo + * on a contract. The authority is defined in the keeper. + * + * Since: 0.40 + */ + SudoContract(request: MsgSudoContract): Promise; + /** + * PinCodes defines a governance operation for pinning a set of + * code ids in the wasmvm cache. The authority is defined in the keeper. + * + * Since: 0.40 + */ + PinCodes(request: MsgPinCodes): Promise; + /** + * UnpinCodes defines a governance operation for unpinning a set of + * code ids in the wasmvm cache. The authority is defined in the keeper. + * + * Since: 0.40 + */ + UnpinCodes(request: MsgUnpinCodes): Promise; + /** + * StoreAndInstantiateContract defines a governance operation for storing + * and instantiating the contract. The authority is defined in the keeper. + * + * Since: 0.40 + */ + StoreAndInstantiateContract(request: MsgStoreAndInstantiateContract): Promise; +} +export declare const MsgServiceName = "cosmwasm.wasm.v1.Msg"; +export declare class MsgClientImpl implements Msg { + private readonly rpc; + private readonly service; + constructor(rpc: Rpc, opts?: { + service?: string; + }); + StoreCode(request: MsgStoreCode): Promise; + InstantiateContract(request: MsgInstantiateContract): Promise; + InstantiateContract2(request: MsgInstantiateContract2): Promise; + ExecuteContract(request: MsgExecuteContract): Promise; + MigrateContract(request: MsgMigrateContract): Promise; + UpdateAdmin(request: MsgUpdateAdmin): Promise; + ClearAdmin(request: MsgClearAdmin): Promise; + UpdateInstantiateConfig(request: MsgUpdateInstantiateConfig): Promise; + UpdateParams(request: MsgUpdateParams): Promise; + SudoContract(request: MsgSudoContract): Promise; + PinCodes(request: MsgPinCodes): Promise; + UnpinCodes(request: MsgUnpinCodes): Promise; + StoreAndInstantiateContract(request: MsgStoreAndInstantiateContract): Promise; +} +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/wasm/v1/tx.js b/dist/module/wasm/v1/tx.js new file mode 100644 index 0000000..704fec6 --- /dev/null +++ b/dist/module/wasm/v1/tx.js @@ -0,0 +1,2209 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/tx.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { AccessConfig, Params } from "./types"; +export const protobufPackage = "cosmwasm.wasm.v1"; +function createBaseMsgStoreCode() { + return { + sender: "", + wasmByteCode: new Uint8Array(0), + instantiatePermission: undefined, + }; +} +export const MsgStoreCode = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.wasmByteCode = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + wasmByteCode: isSet(object.wasmByteCode) + ? bytesFromBase64(object.wasmByteCode) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.wasmByteCode.length !== 0) { + obj.wasmByteCode = base64FromBytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = AccessConfig.toJSON(message.instantiatePermission); + } + return obj; + }, + create(base) { + return MsgStoreCode.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgStoreCode(); + message.sender = object.sender ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + return message; + }, +}; +function createBaseMsgStoreCodeResponse() { + return { codeId: 0, checksum: new Uint8Array(0) }; +} +export const MsgStoreCodeResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.checksum = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + checksum: isSet(object.checksum) + ? bytesFromBase64(object.checksum) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.checksum.length !== 0) { + obj.checksum = base64FromBytes(message.checksum); + } + return obj; + }, + create(base) { + return MsgStoreCodeResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgStoreCodeResponse(); + message.codeId = object.codeId ?? 0; + message.checksum = object.checksum ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgInstantiateContract() { + return { + sender: "", + admin: "", + codeId: 0, + label: "", + msg: new Uint8Array(0), + funds: [], + }; +} +export const MsgInstantiateContract = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== 0) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.admin = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.label = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return MsgInstantiateContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgInstantiateContract(); + message.sender = object.sender ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgInstantiateContractResponse() { + return { address: "", data: new Uint8Array(0) }; +} +export const MsgInstantiateContractResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return MsgInstantiateContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgInstantiateContractResponse(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgInstantiateContract2() { + return { + sender: "", + admin: "", + codeId: 0, + label: "", + msg: new Uint8Array(0), + funds: [], + salt: new Uint8Array(0), + fixMsg: false, + }; +} +export const MsgInstantiateContract2 = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== 0) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(50).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(58).bytes(message.salt); + } + if (message.fixMsg !== false) { + writer.uint32(64).bool(message.fixMsg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract2(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.admin = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.label = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.salt = reader.bytes(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + message.fixMsg = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + salt: isSet(object.salt) + ? bytesFromBase64(object.salt) + : new Uint8Array(0), + fixMsg: isSet(object.fixMsg) ? globalThis.Boolean(object.fixMsg) : false, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + if (message.salt.length !== 0) { + obj.salt = base64FromBytes(message.salt); + } + if (message.fixMsg !== false) { + obj.fixMsg = message.fixMsg; + } + return obj; + }, + create(base) { + return MsgInstantiateContract2.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgInstantiateContract2(); + message.sender = object.sender ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId ?? 0; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + message.salt = object.salt ?? new Uint8Array(0); + message.fixMsg = object.fixMsg ?? false; + return message; + }, +}; +function createBaseMsgInstantiateContract2Response() { + return { address: "", data: new Uint8Array(0) }; +} +export const MsgInstantiateContract2Response = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return MsgInstantiateContract2Response.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgInstantiateContract2Response(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgExecuteContract() { + return { sender: "", contract: "", msg: new Uint8Array(0), funds: [] }; +} +export const MsgExecuteContract = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecuteContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contract = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + return obj; + }, + create(base) { + return MsgExecuteContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgExecuteContract(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgExecuteContractResponse() { + return { data: new Uint8Array(0) }; +} +export const MsgExecuteContractResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecuteContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return MsgExecuteContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgExecuteContractResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgMigrateContract() { + return { sender: "", contract: "", codeId: 0, msg: new Uint8Array(0) }; +} +export const MsgMigrateContract = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.codeId !== 0) { + writer.uint32(24).uint64(message.codeId); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contract = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return MsgMigrateContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgMigrateContract(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + message.codeId = object.codeId ?? 0; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgMigrateContractResponse() { + return { data: new Uint8Array(0) }; +} +export const MsgMigrateContractResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return MsgMigrateContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgMigrateContractResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgUpdateAdmin() { + return { sender: "", newAdmin: "", contract: "" }; +} +export const MsgUpdateAdmin = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newAdmin !== "") { + writer.uint32(18).string(message.newAdmin); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.newAdmin = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contract = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + newAdmin: isSet(object.newAdmin) + ? globalThis.String(object.newAdmin) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.newAdmin !== "") { + obj.newAdmin = message.newAdmin; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + return obj; + }, + create(base) { + return MsgUpdateAdmin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateAdmin(); + message.sender = object.sender ?? ""; + message.newAdmin = object.newAdmin ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBaseMsgUpdateAdminResponse() { + return {}; +} +export const MsgUpdateAdminResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return MsgUpdateAdminResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgUpdateAdminResponse(); + return message; + }, +}; +function createBaseMsgClearAdmin() { + return { sender: "", contract: "" }; +} +export const MsgClearAdmin = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.contract = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + return obj; + }, + create(base) { + return MsgClearAdmin.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgClearAdmin(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + return message; + }, +}; +function createBaseMsgClearAdminResponse() { + return {}; +} +export const MsgClearAdminResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return MsgClearAdminResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgClearAdminResponse(); + return message; + }, +}; +function createBaseMsgUpdateInstantiateConfig() { + return { sender: "", codeId: 0, newInstantiatePermission: undefined }; +} +export const MsgUpdateInstantiateConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.codeId !== 0) { + writer.uint32(16).uint64(message.codeId); + } + if (message.newInstantiatePermission !== undefined) { + AccessConfig.encode(message.newInstantiatePermission, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateInstantiateConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.sender = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.newInstantiatePermission = AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + newInstantiatePermission: isSet(object.newInstantiatePermission) + ? AccessConfig.fromJSON(object.newInstantiatePermission) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.newInstantiatePermission !== undefined) { + obj.newInstantiatePermission = AccessConfig.toJSON(message.newInstantiatePermission); + } + return obj; + }, + create(base) { + return MsgUpdateInstantiateConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateInstantiateConfig(); + message.sender = object.sender ?? ""; + message.codeId = object.codeId ?? 0; + message.newInstantiatePermission = + object.newInstantiatePermission !== undefined && + object.newInstantiatePermission !== null + ? AccessConfig.fromPartial(object.newInstantiatePermission) + : undefined; + return message; + }, +}; +function createBaseMsgUpdateInstantiateConfigResponse() { + return {}; +} +export const MsgUpdateInstantiateConfigResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateInstantiateConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return MsgUpdateInstantiateConfigResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgUpdateInstantiateConfigResponse(); + return message; + }, +}; +function createBaseMsgUpdateParams() { + return { authority: "", params: undefined }; +} +export const MsgUpdateParams = { + encode(message, writer = new BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.params = Params.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + create(base) { + return MsgUpdateParams.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, +}; +function createBaseMsgUpdateParamsResponse() { + return {}; +} +export const MsgUpdateParamsResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return MsgUpdateParamsResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, +}; +function createBaseMsgSudoContract() { + return { authority: "", contract: "", msg: new Uint8Array(0) }; +} +export const MsgSudoContract = { + encode(message, writer = new BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSudoContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.contract = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + contract: isSet(object.contract) + ? globalThis.String(object.contract) + : "", + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.contract !== "") { + obj.contract = message.contract; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return MsgSudoContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSudoContract(); + message.authority = object.authority ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgSudoContractResponse() { + return { data: new Uint8Array(0) }; +} +export const MsgSudoContractResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSudoContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return MsgSudoContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgSudoContractResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgPinCodes() { + return { authority: "", codeIds: [] }; +} +export const MsgPinCodes = { + encode(message, writer = new BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + writer.uint32(18).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPinCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag === 16) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + return obj; + }, + create(base) { + return MsgPinCodes.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgPinCodes(); + message.authority = object.authority ?? ""; + message.codeIds = object.codeIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseMsgPinCodesResponse() { + return {}; +} +export const MsgPinCodesResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPinCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return MsgPinCodesResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgPinCodesResponse(); + return message; + }, +}; +function createBaseMsgUnpinCodes() { + return { authority: "", codeIds: [] }; +} +export const MsgUnpinCodes = { + encode(message, writer = new BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + writer.uint32(18).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpinCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 2: { + if (tag === 16) { + message.codeIds.push(longToNumber(reader.uint64())); + continue; + } + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(longToNumber(reader.uint64())); + } + continue; + } + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + codeIds: globalThis.Array.isArray(object?.codeIds) + ? object.codeIds.map((e) => globalThis.Number(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.codeIds?.length) { + obj.codeIds = message.codeIds.map((e) => Math.round(e)); + } + return obj; + }, + create(base) { + return MsgUnpinCodes.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgUnpinCodes(); + message.authority = object.authority ?? ""; + message.codeIds = object.codeIds?.map((e) => e) || []; + return message; + }, +}; +function createBaseMsgUnpinCodesResponse() { + return {}; +} +export const MsgUnpinCodesResponse = { + encode(_, writer = new BinaryWriter()) { + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpinCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(_) { + return {}; + }, + toJSON(_) { + const obj = {}; + return obj; + }, + create(base) { + return MsgUnpinCodesResponse.fromPartial(base ?? {}); + }, + fromPartial(_) { + const message = createBaseMsgUnpinCodesResponse(); + return message; + }, +}; +function createBaseMsgStoreAndInstantiateContract() { + return { + authority: "", + wasmByteCode: new Uint8Array(0), + instantiatePermission: undefined, + unpinCode: false, + admin: "", + label: "", + msg: new Uint8Array(0), + funds: [], + source: "", + builder: "", + codeHash: new Uint8Array(0), + }; +} +export const MsgStoreAndInstantiateContract = { + encode(message, writer = new BinaryWriter()) { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(26).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(34).fork()).ldelim(); + } + if (message.unpinCode !== false) { + writer.uint32(40).bool(message.unpinCode); + } + if (message.admin !== "") { + writer.uint32(50).string(message.admin); + } + if (message.label !== "") { + writer.uint32(58).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(66).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v, writer.uint32(74).fork()).ldelim(); + } + if (message.source !== "") { + writer.uint32(82).string(message.source); + } + if (message.builder !== "") { + writer.uint32(90).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(98).bytes(message.codeHash); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndInstantiateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.authority = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.wasmByteCode = reader.bytes(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + message.unpinCode = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.admin = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.label = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + message.msg = reader.bytes(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + message.funds.push(Coin.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + message.source = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + message.builder = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + message.codeHash = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + authority: isSet(object.authority) + ? globalThis.String(object.authority) + : "", + wasmByteCode: isSet(object.wasmByteCode) + ? bytesFromBase64(object.wasmByteCode) + : new Uint8Array(0), + instantiatePermission: isSet(object.instantiatePermission) + ? AccessConfig.fromJSON(object.instantiatePermission) + : undefined, + unpinCode: isSet(object.unpinCode) + ? globalThis.Boolean(object.unpinCode) + : false, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + label: isSet(object.label) ? globalThis.String(object.label) : "", + msg: isSet(object.msg) + ? bytesFromBase64(object.msg) + : new Uint8Array(0), + funds: globalThis.Array.isArray(object?.funds) + ? object.funds.map((e) => Coin.fromJSON(e)) + : [], + source: isSet(object.source) ? globalThis.String(object.source) : "", + builder: isSet(object.builder) ? globalThis.String(object.builder) : "", + codeHash: isSet(object.codeHash) + ? bytesFromBase64(object.codeHash) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.authority !== "") { + obj.authority = message.authority; + } + if (message.wasmByteCode.length !== 0) { + obj.wasmByteCode = base64FromBytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + obj.instantiatePermission = AccessConfig.toJSON(message.instantiatePermission); + } + if (message.unpinCode !== false) { + obj.unpinCode = message.unpinCode; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + if (message.funds?.length) { + obj.funds = message.funds.map((e) => Coin.toJSON(e)); + } + if (message.source !== "") { + obj.source = message.source; + } + if (message.builder !== "") { + obj.builder = message.builder; + } + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + return obj; + }, + create(base) { + return MsgStoreAndInstantiateContract.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgStoreAndInstantiateContract(); + message.authority = object.authority ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(0); + message.instantiatePermission = + object.instantiatePermission !== undefined && + object.instantiatePermission !== null + ? AccessConfig.fromPartial(object.instantiatePermission) + : undefined; + message.unpinCode = object.unpinCode ?? false; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(0); + message.funds = object.funds?.map((e) => Coin.fromPartial(e)) || []; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(0); + return message; + }, +}; +function createBaseMsgStoreAndInstantiateContractResponse() { + return { address: "", data: new Uint8Array(0) }; +} +export const MsgStoreAndInstantiateContractResponse = { + encode(message, writer = new BinaryWriter()) { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndInstantiateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.address = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.data = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + data: isSet(object.data) + ? bytesFromBase64(object.data) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + create(base) { + return MsgStoreAndInstantiateContractResponse.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseMsgStoreAndInstantiateContractResponse(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; +export const MsgServiceName = "cosmwasm.wasm.v1.Msg"; +export class MsgClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || MsgServiceName; + this.rpc = rpc; + this.StoreCode = this.StoreCode.bind(this); + this.InstantiateContract = this.InstantiateContract.bind(this); + this.InstantiateContract2 = this.InstantiateContract2.bind(this); + this.ExecuteContract = this.ExecuteContract.bind(this); + this.MigrateContract = this.MigrateContract.bind(this); + this.UpdateAdmin = this.UpdateAdmin.bind(this); + this.ClearAdmin = this.ClearAdmin.bind(this); + this.UpdateInstantiateConfig = this.UpdateInstantiateConfig.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + this.SudoContract = this.SudoContract.bind(this); + this.PinCodes = this.PinCodes.bind(this); + this.UnpinCodes = this.UnpinCodes.bind(this); + this.StoreAndInstantiateContract = + this.StoreAndInstantiateContract.bind(this); + } + StoreCode(request) { + const data = MsgStoreCode.encode(request).finish(); + const promise = this.rpc.request(this.service, "StoreCode", data); + return promise.then((data) => MsgStoreCodeResponse.decode(new BinaryReader(data))); + } + InstantiateContract(request) { + const data = MsgInstantiateContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "InstantiateContract", data); + return promise.then((data) => MsgInstantiateContractResponse.decode(new BinaryReader(data))); + } + InstantiateContract2(request) { + const data = MsgInstantiateContract2.encode(request).finish(); + const promise = this.rpc.request(this.service, "InstantiateContract2", data); + return promise.then((data) => MsgInstantiateContract2Response.decode(new BinaryReader(data))); + } + ExecuteContract(request) { + const data = MsgExecuteContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "ExecuteContract", data); + return promise.then((data) => MsgExecuteContractResponse.decode(new BinaryReader(data))); + } + MigrateContract(request) { + const data = MsgMigrateContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "MigrateContract", data); + return promise.then((data) => MsgMigrateContractResponse.decode(new BinaryReader(data))); + } + UpdateAdmin(request) { + const data = MsgUpdateAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateAdmin", data); + return promise.then((data) => MsgUpdateAdminResponse.decode(new BinaryReader(data))); + } + ClearAdmin(request) { + const data = MsgClearAdmin.encode(request).finish(); + const promise = this.rpc.request(this.service, "ClearAdmin", data); + return promise.then((data) => MsgClearAdminResponse.decode(new BinaryReader(data))); + } + UpdateInstantiateConfig(request) { + const data = MsgUpdateInstantiateConfig.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateInstantiateConfig", data); + return promise.then((data) => MsgUpdateInstantiateConfigResponse.decode(new BinaryReader(data))); + } + UpdateParams(request) { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request(this.service, "UpdateParams", data); + return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); + } + SudoContract(request) { + const data = MsgSudoContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "SudoContract", data); + return promise.then((data) => MsgSudoContractResponse.decode(new BinaryReader(data))); + } + PinCodes(request) { + const data = MsgPinCodes.encode(request).finish(); + const promise = this.rpc.request(this.service, "PinCodes", data); + return promise.then((data) => MsgPinCodesResponse.decode(new BinaryReader(data))); + } + UnpinCodes(request) { + const data = MsgUnpinCodes.encode(request).finish(); + const promise = this.rpc.request(this.service, "UnpinCodes", data); + return promise.then((data) => MsgUnpinCodesResponse.decode(new BinaryReader(data))); + } + StoreAndInstantiateContract(request) { + const data = MsgStoreAndInstantiateContract.encode(request).finish(); + const promise = this.rpc.request(this.service, "StoreAndInstantiateContract", data); + return promise.then((data) => MsgStoreAndInstantiateContractResponse.decode(new BinaryReader(data))); + } +} +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/dist/module/wasm/v1/types.d.ts b/dist/module/wasm/v1/types.d.ts new file mode 100644 index 0000000..c018f1d --- /dev/null +++ b/dist/module/wasm/v1/types.d.ts @@ -0,0 +1,139 @@ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export declare const protobufPackage = "cosmwasm.wasm.v1"; +/** AccessType permission types */ +export declare enum AccessType { + /** ACCESS_TYPE_UNSPECIFIED - AccessTypeUnspecified placeholder for empty value */ + ACCESS_TYPE_UNSPECIFIED = 0, + /** ACCESS_TYPE_NOBODY - AccessTypeNobody forbidden */ + ACCESS_TYPE_NOBODY = 1, + /** + * ACCESS_TYPE_ONLY_ADDRESS - AccessTypeOnlyAddress restricted to a single address + * Deprecated: use AccessTypeAnyOfAddresses instead + */ + ACCESS_TYPE_ONLY_ADDRESS = 2, + /** ACCESS_TYPE_EVERYBODY - AccessTypeEverybody unrestricted */ + ACCESS_TYPE_EVERYBODY = 3, + /** ACCESS_TYPE_ANY_OF_ADDRESSES - AccessTypeAnyOfAddresses allow any of the addresses */ + ACCESS_TYPE_ANY_OF_ADDRESSES = 4, + UNRECOGNIZED = -1 +} +export declare function accessTypeFromJSON(object: any): AccessType; +export declare function accessTypeToJSON(object: AccessType): string; +/** ContractCodeHistoryOperationType actions that caused a code change */ +export declare enum ContractCodeHistoryOperationType { + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED - ContractCodeHistoryOperationTypeUnspecified placeholder for empty value */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED = 0, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT - ContractCodeHistoryOperationTypeInit on chain contract instantiation */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT = 1, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE - ContractCodeHistoryOperationTypeMigrate code migration */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE = 2, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS - ContractCodeHistoryOperationTypeGenesis based on genesis data */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS = 3, + UNRECOGNIZED = -1 +} +export declare function contractCodeHistoryOperationTypeFromJSON(object: any): ContractCodeHistoryOperationType; +export declare function contractCodeHistoryOperationTypeToJSON(object: ContractCodeHistoryOperationType): string; +/** AccessTypeParam */ +export interface AccessTypeParam { + value: AccessType; +} +/** AccessConfig access control type. */ +export interface AccessConfig { + permission: AccessType; + /** + * Address + * Deprecated: replaced by addresses + */ + address: string; + addresses: string[]; +} +/** Params defines the set of wasm parameters. */ +export interface Params { + codeUploadAccess: AccessConfig | undefined; + instantiateDefaultPermission: AccessType; +} +/** CodeInfo is data for the uploaded contract WASM code */ +export interface CodeInfo { + /** CodeHash is the unique identifier created by wasmvm */ + codeHash: Uint8Array; + /** Creator address who initially stored the code */ + creator: string; + /** InstantiateConfig access control to apply on contract creation, optional */ + instantiateConfig: AccessConfig | undefined; +} +/** ContractInfo stores a WASM contract instance */ +export interface ContractInfo { + /** CodeID is the reference to the stored Wasm code */ + codeId: number; + /** Creator address who initially instantiated the contract */ + creator: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Created Tx position when the contract was instantiated. */ + created: AbsoluteTxPosition | undefined; + ibcPortId: string; + /** + * Extension is an extension point to store custom metadata within the + * persistence model. + */ + extension: Any | undefined; +} +/** ContractCodeHistoryEntry metadata to a contract. */ +export interface ContractCodeHistoryEntry { + operation: ContractCodeHistoryOperationType; + /** CodeID is the reference to the stored WASM code */ + codeId: number; + /** Updated Tx position when the operation was executed. */ + updated: AbsoluteTxPosition | undefined; + msg: Uint8Array; +} +/** + * AbsoluteTxPosition is a unique transaction position that allows for global + * ordering of transactions. + */ +export interface AbsoluteTxPosition { + /** BlockHeight is the block the contract was created at */ + blockHeight: number; + /** + * TxIndex is a monotonic counter within the block (actual transaction index, + * or gas consumed) + */ + txIndex: number; +} +/** Model is a struct that holds a KV pair */ +export interface Model { + /** hex-encode key to read it better (this is often ascii) */ + key: Uint8Array; + /** base64-encode raw value */ + value: Uint8Array; +} +export declare const AccessTypeParam: MessageFns; +export declare const AccessConfig: MessageFns; +export declare const Params: MessageFns; +export declare const CodeInfo: MessageFns; +export declare const ContractInfo: MessageFns; +export declare const ContractCodeHistoryEntry: MessageFns; +export declare const AbsoluteTxPosition: MessageFns; +export declare const Model: MessageFns; +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} +export {}; diff --git a/dist/module/wasm/v1/types.js b/dist/module/wasm/v1/types.js new file mode 100644 index 0000000..c0eec12 --- /dev/null +++ b/dist/module/wasm/v1/types.js @@ -0,0 +1,877 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.7.0 +// protoc v3.21.12 +// source: wasmd/proto/cosmwasm/wasm/v1/types.proto +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "cosmjs-types/binary"; +import { Any } from "cosmjs-types/google/protobuf/any"; +export const protobufPackage = "cosmwasm.wasm.v1"; +/** AccessType permission types */ +export var AccessType; +(function (AccessType) { + /** ACCESS_TYPE_UNSPECIFIED - AccessTypeUnspecified placeholder for empty value */ + AccessType[AccessType["ACCESS_TYPE_UNSPECIFIED"] = 0] = "ACCESS_TYPE_UNSPECIFIED"; + /** ACCESS_TYPE_NOBODY - AccessTypeNobody forbidden */ + AccessType[AccessType["ACCESS_TYPE_NOBODY"] = 1] = "ACCESS_TYPE_NOBODY"; + /** + * ACCESS_TYPE_ONLY_ADDRESS - AccessTypeOnlyAddress restricted to a single address + * Deprecated: use AccessTypeAnyOfAddresses instead + */ + AccessType[AccessType["ACCESS_TYPE_ONLY_ADDRESS"] = 2] = "ACCESS_TYPE_ONLY_ADDRESS"; + /** ACCESS_TYPE_EVERYBODY - AccessTypeEverybody unrestricted */ + AccessType[AccessType["ACCESS_TYPE_EVERYBODY"] = 3] = "ACCESS_TYPE_EVERYBODY"; + /** ACCESS_TYPE_ANY_OF_ADDRESSES - AccessTypeAnyOfAddresses allow any of the addresses */ + AccessType[AccessType["ACCESS_TYPE_ANY_OF_ADDRESSES"] = 4] = "ACCESS_TYPE_ANY_OF_ADDRESSES"; + AccessType[AccessType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(AccessType || (AccessType = {})); +export function accessTypeFromJSON(object) { + switch (object) { + case 0: + case "ACCESS_TYPE_UNSPECIFIED": + return AccessType.ACCESS_TYPE_UNSPECIFIED; + case 1: + case "ACCESS_TYPE_NOBODY": + return AccessType.ACCESS_TYPE_NOBODY; + case 2: + case "ACCESS_TYPE_ONLY_ADDRESS": + return AccessType.ACCESS_TYPE_ONLY_ADDRESS; + case 3: + case "ACCESS_TYPE_EVERYBODY": + return AccessType.ACCESS_TYPE_EVERYBODY; + case 4: + case "ACCESS_TYPE_ANY_OF_ADDRESSES": + return AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES; + case -1: + case "UNRECOGNIZED": + default: + return AccessType.UNRECOGNIZED; + } +} +export function accessTypeToJSON(object) { + switch (object) { + case AccessType.ACCESS_TYPE_UNSPECIFIED: + return "ACCESS_TYPE_UNSPECIFIED"; + case AccessType.ACCESS_TYPE_NOBODY: + return "ACCESS_TYPE_NOBODY"; + case AccessType.ACCESS_TYPE_ONLY_ADDRESS: + return "ACCESS_TYPE_ONLY_ADDRESS"; + case AccessType.ACCESS_TYPE_EVERYBODY: + return "ACCESS_TYPE_EVERYBODY"; + case AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES: + return "ACCESS_TYPE_ANY_OF_ADDRESSES"; + case AccessType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ContractCodeHistoryOperationType actions that caused a code change */ +export var ContractCodeHistoryOperationType; +(function (ContractCodeHistoryOperationType) { + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED - ContractCodeHistoryOperationTypeUnspecified placeholder for empty value */ + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED"] = 0] = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED"; + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT - ContractCodeHistoryOperationTypeInit on chain contract instantiation */ + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT"] = 1] = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT"; + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE - ContractCodeHistoryOperationTypeMigrate code migration */ + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE"] = 2] = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE"; + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS - ContractCodeHistoryOperationTypeGenesis based on genesis data */ + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS"] = 3] = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS"; + ContractCodeHistoryOperationType[ContractCodeHistoryOperationType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ContractCodeHistoryOperationType || (ContractCodeHistoryOperationType = {})); +export function contractCodeHistoryOperationTypeFromJSON(object) { + switch (object) { + case 0: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED; + case 1: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT; + case 2: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE; + case 3: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS; + case -1: + case "UNRECOGNIZED": + default: + return ContractCodeHistoryOperationType.UNRECOGNIZED; + } +} +export function contractCodeHistoryOperationTypeToJSON(object) { + switch (object) { + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS"; + case ContractCodeHistoryOperationType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseAccessTypeParam() { + return { value: 0 }; +} +export const AccessTypeParam = { + encode(message, writer = new BinaryWriter()) { + if (message.value !== 0) { + writer.uint32(8).int32(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessTypeParam(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.value = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + value: isSet(object.value) ? accessTypeFromJSON(object.value) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.value !== 0) { + obj.value = accessTypeToJSON(message.value); + } + return obj; + }, + create(base) { + return AccessTypeParam.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAccessTypeParam(); + message.value = object.value ?? 0; + return message; + }, +}; +function createBaseAccessConfig() { + return { permission: 0, address: "", addresses: [] }; +} +export const AccessConfig = { + encode(message, writer = new BinaryWriter()) { + if (message.permission !== 0) { + writer.uint32(8).int32(message.permission); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + for (const v of message.addresses) { + writer.uint32(26).string(v); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.permission = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.address = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.addresses.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + permission: isSet(object.permission) + ? accessTypeFromJSON(object.permission) + : 0, + address: isSet(object.address) ? globalThis.String(object.address) : "", + addresses: globalThis.Array.isArray(object?.addresses) + ? object.addresses.map((e) => globalThis.String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.permission !== 0) { + obj.permission = accessTypeToJSON(message.permission); + } + if (message.address !== "") { + obj.address = message.address; + } + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + create(base) { + return AccessConfig.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAccessConfig(); + message.permission = object.permission ?? 0; + message.address = object.address ?? ""; + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; +function createBaseParams() { + return { codeUploadAccess: undefined, instantiateDefaultPermission: 0 }; +} +export const Params = { + encode(message, writer = new BinaryWriter()) { + if (message.codeUploadAccess !== undefined) { + AccessConfig.encode(message.codeUploadAccess, writer.uint32(10).fork()).ldelim(); + } + if (message.instantiateDefaultPermission !== 0) { + writer.uint32(16).int32(message.instantiateDefaultPermission); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.codeUploadAccess = AccessConfig.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.instantiateDefaultPermission = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeUploadAccess: isSet(object.codeUploadAccess) + ? AccessConfig.fromJSON(object.codeUploadAccess) + : undefined, + instantiateDefaultPermission: isSet(object.instantiateDefaultPermission) + ? accessTypeFromJSON(object.instantiateDefaultPermission) + : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeUploadAccess !== undefined) { + obj.codeUploadAccess = AccessConfig.toJSON(message.codeUploadAccess); + } + if (message.instantiateDefaultPermission !== 0) { + obj.instantiateDefaultPermission = accessTypeToJSON(message.instantiateDefaultPermission); + } + return obj; + }, + create(base) { + return Params.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseParams(); + message.codeUploadAccess = + object.codeUploadAccess !== undefined && object.codeUploadAccess !== null + ? AccessConfig.fromPartial(object.codeUploadAccess) + : undefined; + message.instantiateDefaultPermission = + object.instantiateDefaultPermission ?? 0; + return message; + }, +}; +function createBaseCodeInfo() { + return { + codeHash: new Uint8Array(0), + creator: "", + instantiateConfig: undefined, + }; +} +export const CodeInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.codeHash.length !== 0) { + writer.uint32(10).bytes(message.codeHash); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.instantiateConfig !== undefined) { + AccessConfig.encode(message.instantiateConfig, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.codeHash = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creator = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.instantiateConfig = AccessConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeHash: isSet(object.codeHash) + ? bytesFromBase64(object.codeHash) + : new Uint8Array(0), + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + instantiateConfig: isSet(object.instantiateConfig) + ? AccessConfig.fromJSON(object.instantiateConfig) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.instantiateConfig !== undefined) { + obj.instantiateConfig = AccessConfig.toJSON(message.instantiateConfig); + } + return obj; + }, + create(base) { + return CodeInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseCodeInfo(); + message.codeHash = object.codeHash ?? new Uint8Array(0); + message.creator = object.creator ?? ""; + message.instantiateConfig = + object.instantiateConfig !== undefined && + object.instantiateConfig !== null + ? AccessConfig.fromPartial(object.instantiateConfig) + : undefined; + return message; + }, +}; +function createBaseContractInfo() { + return { + codeId: 0, + creator: "", + admin: "", + label: "", + created: undefined, + ibcPortId: "", + extension: undefined, + }; +} +export const ContractInfo = { + encode(message, writer = new BinaryWriter()) { + if (message.codeId !== 0) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.created !== undefined) { + AbsoluteTxPosition.encode(message.created, writer.uint32(42).fork()).ldelim(); + } + if (message.ibcPortId !== "") { + writer.uint32(50).string(message.ibcPortId); + } + if (message.extension !== undefined) { + Any.encode(message.extension, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.creator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.admin = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.label = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + message.created = AbsoluteTxPosition.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + message.ibcPortId = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + message.extension = Any.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + creator: isSet(object.creator) ? globalThis.String(object.creator) : "", + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + label: isSet(object.label) ? globalThis.String(object.label) : "", + created: isSet(object.created) + ? AbsoluteTxPosition.fromJSON(object.created) + : undefined, + ibcPortId: isSet(object.ibcPortId) + ? globalThis.String(object.ibcPortId) + : "", + extension: isSet(object.extension) + ? Any.fromJSON(object.extension) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.creator !== "") { + obj.creator = message.creator; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.label !== "") { + obj.label = message.label; + } + if (message.created !== undefined) { + obj.created = AbsoluteTxPosition.toJSON(message.created); + } + if (message.ibcPortId !== "") { + obj.ibcPortId = message.ibcPortId; + } + if (message.extension !== undefined) { + obj.extension = Any.toJSON(message.extension); + } + return obj; + }, + create(base) { + return ContractInfo.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractInfo(); + message.codeId = object.codeId ?? 0; + message.creator = object.creator ?? ""; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.created = + object.created !== undefined && object.created !== null + ? AbsoluteTxPosition.fromPartial(object.created) + : undefined; + message.ibcPortId = object.ibcPortId ?? ""; + message.extension = + object.extension !== undefined && object.extension !== null + ? Any.fromPartial(object.extension) + : undefined; + return message; + }, +}; +function createBaseContractCodeHistoryEntry() { + return { + operation: 0, + codeId: 0, + updated: undefined, + msg: new Uint8Array(0), + }; +} +export const ContractCodeHistoryEntry = { + encode(message, writer = new BinaryWriter()) { + if (message.operation !== 0) { + writer.uint32(8).int32(message.operation); + } + if (message.codeId !== 0) { + writer.uint32(16).uint64(message.codeId); + } + if (message.updated !== undefined) { + AbsoluteTxPosition.encode(message.updated, writer.uint32(26).fork()).ldelim(); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractCodeHistoryEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.operation = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.codeId = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + message.updated = AbsoluteTxPosition.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + message.msg = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + operation: isSet(object.operation) + ? contractCodeHistoryOperationTypeFromJSON(object.operation) + : 0, + codeId: isSet(object.codeId) ? globalThis.Number(object.codeId) : 0, + updated: isSet(object.updated) + ? AbsoluteTxPosition.fromJSON(object.updated) + : undefined, + msg: isSet(object.msg) ? bytesFromBase64(object.msg) : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.operation !== 0) { + obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation); + } + if (message.codeId !== 0) { + obj.codeId = Math.round(message.codeId); + } + if (message.updated !== undefined) { + obj.updated = AbsoluteTxPosition.toJSON(message.updated); + } + if (message.msg.length !== 0) { + obj.msg = base64FromBytes(message.msg); + } + return obj; + }, + create(base) { + return ContractCodeHistoryEntry.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseContractCodeHistoryEntry(); + message.operation = object.operation ?? 0; + message.codeId = object.codeId ?? 0; + message.updated = + object.updated !== undefined && object.updated !== null + ? AbsoluteTxPosition.fromPartial(object.updated) + : undefined; + message.msg = object.msg ?? new Uint8Array(0); + return message; + }, +}; +function createBaseAbsoluteTxPosition() { + return { blockHeight: 0, txIndex: 0 }; +} +export const AbsoluteTxPosition = { + encode(message, writer = new BinaryWriter()) { + if (message.blockHeight !== 0) { + writer.uint32(8).uint64(message.blockHeight); + } + if (message.txIndex !== 0) { + writer.uint32(16).uint64(message.txIndex); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAbsoluteTxPosition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + message.blockHeight = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + message.txIndex = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + blockHeight: isSet(object.blockHeight) + ? globalThis.Number(object.blockHeight) + : 0, + txIndex: isSet(object.txIndex) ? globalThis.Number(object.txIndex) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.blockHeight !== 0) { + obj.blockHeight = Math.round(message.blockHeight); + } + if (message.txIndex !== 0) { + obj.txIndex = Math.round(message.txIndex); + } + return obj; + }, + create(base) { + return AbsoluteTxPosition.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseAbsoluteTxPosition(); + message.blockHeight = object.blockHeight ?? 0; + message.txIndex = object.txIndex ?? 0; + return message; + }, +}; +function createBaseModel() { + return { key: new Uint8Array(0), value: new Uint8Array(0) }; +} +export const Model = { + encode(message, writer = new BinaryWriter()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + message.key = reader.bytes(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) + ? bytesFromBase64(object.value) + : new Uint8Array(0), + }; + }, + toJSON(message) { + const obj = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + create(base) { + return Model.fromPartial(base ?? {}); + }, + fromPartial(object) { + const message = createBaseModel(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +function longToNumber(int64) { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} +function isSet(value) { + return value !== null && value !== undefined; +}