From ecbbc05e63594f1afcad9280f9fe05b3c955dbed Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 27 Jan 2021 14:52:18 +0000 Subject: [PATCH] proto-signing: Update ts-proto-generated codec --- .../src/codec/cosmos/bank/v1beta1/bank.ts | 150 +- .../src/codec/cosmos/bank/v1beta1/tx.ts | 135 +- .../src/codec/cosmos/base/v1beta1/coin.ts | 75 +- .../crypto/multisig/v1beta1/multisig.ts | 61 +- .../src/codec/cosmos/crypto/secp256k1/keys.ts | 59 +- .../cosmos/tx/signing/v1beta1/signing.ts | 223 +- .../src/codec/cosmos/tx/v1beta1/tx.ts | 340 +-- .../src/codec/cosmos_proto/cosmos.ts | 1 - .../proto-signing/src/codec/gogoproto/gogo.ts | 1 - .../src/codec/google/protobuf/any.ts | 223 +- .../src/codec/google/protobuf/descriptor.ts | 1936 +++++++++-------- .../src/codec/tendermint/crypto/keys.ts | 39 +- .../types/codec/cosmos/bank/v1beta1/bank.d.ts | 77 +- .../types/codec/cosmos/bank/v1beta1/tx.d.ts | 91 +- .../types/codec/cosmos/base/v1beta1/coin.d.ts | 33 +- .../crypto/multisig/v1beta1/multisig.d.ts | 23 +- .../codec/cosmos/crypto/secp256k1/keys.d.ts | 23 +- .../cosmos/tx/signing/v1beta1/signing.d.ts | 155 +- .../types/codec/cosmos/tx/v1beta1/tx.d.ts | 226 +- .../types/codec/google/protobuf/any.d.ts | 191 +- .../codec/google/protobuf/descriptor.d.ts | 1122 +++++----- .../types/codec/tendermint/crypto/keys.d.ts | 11 +- 22 files changed, 2544 insertions(+), 2651 deletions(-) diff --git a/packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts b/packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts index afff626e..b87747fb 100644 --- a/packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts +++ b/packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts @@ -1,124 +1,82 @@ /* eslint-disable */ import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; -/** - * Params defines the parameters for the bank module. - */ +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** Params defines the parameters for the bank module. */ export interface Params { sendEnabled: SendEnabled[]; defaultSendEnabled: boolean; } /** - * SendEnabled maps coin denom to a send_enabled status (whether a denom is - * sendable). + * SendEnabled maps coin denom to a send_enabled status (whether a denom is + * sendable). */ export interface SendEnabled { denom: string; enabled: boolean; } -/** - * Input models transaction input. - */ +/** Input models transaction input. */ export interface Input { address: string; coins: Coin[]; } -/** - * Output models transaction outputs. - */ +/** Output models transaction outputs. */ export interface Output { address: string; coins: Coin[]; } /** - * Supply represents a struct that passively keeps track of the total supply - * amounts in the network. + * Supply represents a struct that passively keeps track of the total supply + * amounts in the network. */ export interface Supply { total: Coin[]; } /** - * DenomUnit represents a struct that describes a given - * denomination unit of the basic token. + * DenomUnit represents a struct that describes a given + * denomination unit of the basic token. */ export interface DenomUnit { - /** - * denom represents the string name of the given denom unit (e.g uatom). - */ + /** denom represents the string name of the given denom unit (e.g uatom). */ denom: string; /** - * exponent represents power of 10 exponent that one must - * raise the base_denom to in order to equal the given DenomUnit's denom - * 1 denom = 1^exponent base_denom - * (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with - * exponent = 6, thus: 1 atom = 10^6 uatom). + * exponent represents power of 10 exponent that one must + * raise the base_denom to in order to equal the given DenomUnit's denom + * 1 denom = 1^exponent base_denom + * (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + * exponent = 6, thus: 1 atom = 10^6 uatom). */ exponent: number; - /** - * aliases is a list of string aliases for the given denom - */ + /** aliases is a list of string aliases for the given denom */ aliases: string[]; } /** - * Metadata represents a struct that describes - * a basic token. + * Metadata represents a struct that describes + * a basic token. */ export interface Metadata { description: string; - /** - * denom_units represents the list of DenomUnit's for a given coin - */ + /** denom_units represents the list of DenomUnit's for a given coin */ denomUnits: DenomUnit[]; - /** - * base represents the base denom (should be the DenomUnit with exponent = 0). - */ + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ base: string; /** - * display indicates the suggested denom that should be - * displayed in clients. + * display indicates the suggested denom that should be + * displayed in clients. */ display: string; } -const baseParams: object = { - defaultSendEnabled: false, -}; - -const baseSendEnabled: object = { - denom: "", - enabled: false, -}; - -const baseInput: object = { - address: "", -}; - -const baseOutput: object = { - address: "", -}; - -const baseSupply: object = {}; - -const baseDenomUnit: object = { - denom: "", - exponent: 0, - aliases: "", -}; - -const baseMetadata: object = { - description: "", - base: "", - display: "", -}; - -export const protobufPackage = "cosmos.bank.v1beta1"; +const baseParams: object = { defaultSendEnabled: false }; export const Params = { encode(message: Params, writer: Writer = Writer.create()): Writer { @@ -128,7 +86,8 @@ export const Params = { writer.uint32(16).bool(message.defaultSendEnabled); return writer; }, - decode(input: Uint8Array | Reader, length?: number): Params { + + decode(input: Reader | Uint8Array, length?: number): Params { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseParams } as Params; @@ -149,6 +108,7 @@ export const Params = { } return message; }, + fromJSON(object: any): Params { const message = { ...baseParams } as Params; message.sendEnabled = []; @@ -164,6 +124,7 @@ export const Params = { } return message; }, + fromPartial(object: DeepPartial): Params { const message = { ...baseParams } as Params; message.sendEnabled = []; @@ -179,6 +140,7 @@ export const Params = { } return message; }, + toJSON(message: Params): unknown { const obj: any = {}; if (message.sendEnabled) { @@ -191,13 +153,16 @@ export const Params = { }, }; +const baseSendEnabled: object = { denom: "", enabled: false }; + export const SendEnabled = { encode(message: SendEnabled, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.denom); writer.uint32(16).bool(message.enabled); return writer; }, - decode(input: Uint8Array | Reader, length?: number): SendEnabled { + + decode(input: Reader | Uint8Array, length?: number): SendEnabled { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSendEnabled } as SendEnabled; @@ -217,6 +182,7 @@ export const SendEnabled = { } return message; }, + fromJSON(object: any): SendEnabled { const message = { ...baseSendEnabled } as SendEnabled; if (object.denom !== undefined && object.denom !== null) { @@ -231,6 +197,7 @@ export const SendEnabled = { } return message; }, + fromPartial(object: DeepPartial): SendEnabled { const message = { ...baseSendEnabled } as SendEnabled; if (object.denom !== undefined && object.denom !== null) { @@ -245,6 +212,7 @@ export const SendEnabled = { } return message; }, + toJSON(message: SendEnabled): unknown { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); @@ -253,6 +221,8 @@ export const SendEnabled = { }, }; +const baseInput: object = { address: "" }; + export const Input = { encode(message: Input, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.address); @@ -261,7 +231,8 @@ export const Input = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): Input { + + decode(input: Reader | Uint8Array, length?: number): Input { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseInput } as Input; @@ -282,6 +253,7 @@ export const Input = { } return message; }, + fromJSON(object: any): Input { const message = { ...baseInput } as Input; message.coins = []; @@ -297,6 +269,7 @@ export const Input = { } return message; }, + fromPartial(object: DeepPartial): Input { const message = { ...baseInput } as Input; message.coins = []; @@ -312,6 +285,7 @@ export const Input = { } return message; }, + toJSON(message: Input): unknown { const obj: any = {}; message.address !== undefined && (obj.address = message.address); @@ -324,6 +298,8 @@ export const Input = { }, }; +const baseOutput: object = { address: "" }; + export const Output = { encode(message: Output, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.address); @@ -332,7 +308,8 @@ export const Output = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): Output { + + decode(input: Reader | Uint8Array, length?: number): Output { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseOutput } as Output; @@ -353,6 +330,7 @@ export const Output = { } return message; }, + fromJSON(object: any): Output { const message = { ...baseOutput } as Output; message.coins = []; @@ -368,6 +346,7 @@ export const Output = { } return message; }, + fromPartial(object: DeepPartial): Output { const message = { ...baseOutput } as Output; message.coins = []; @@ -383,6 +362,7 @@ export const Output = { } return message; }, + toJSON(message: Output): unknown { const obj: any = {}; message.address !== undefined && (obj.address = message.address); @@ -395,6 +375,8 @@ export const Output = { }, }; +const baseSupply: object = {}; + export const Supply = { encode(message: Supply, writer: Writer = Writer.create()): Writer { for (const v of message.total) { @@ -402,7 +384,8 @@ export const Supply = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): Supply { + + decode(input: Reader | Uint8Array, length?: number): Supply { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSupply } as Supply; @@ -420,6 +403,7 @@ export const Supply = { } return message; }, + fromJSON(object: any): Supply { const message = { ...baseSupply } as Supply; message.total = []; @@ -430,6 +414,7 @@ export const Supply = { } return message; }, + fromPartial(object: DeepPartial): Supply { const message = { ...baseSupply } as Supply; message.total = []; @@ -440,6 +425,7 @@ export const Supply = { } return message; }, + toJSON(message: Supply): unknown { const obj: any = {}; if (message.total) { @@ -451,6 +437,8 @@ export const Supply = { }, }; +const baseDenomUnit: object = { denom: "", exponent: 0, aliases: "" }; + export const DenomUnit = { encode(message: DenomUnit, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.denom); @@ -460,7 +448,8 @@ export const DenomUnit = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): DenomUnit { + + decode(input: Reader | Uint8Array, length?: number): DenomUnit { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseDenomUnit } as DenomUnit; @@ -484,6 +473,7 @@ export const DenomUnit = { } return message; }, + fromJSON(object: any): DenomUnit { const message = { ...baseDenomUnit } as DenomUnit; message.aliases = []; @@ -504,6 +494,7 @@ export const DenomUnit = { } return message; }, + fromPartial(object: DeepPartial): DenomUnit { const message = { ...baseDenomUnit } as DenomUnit; message.aliases = []; @@ -524,6 +515,7 @@ export const DenomUnit = { } return message; }, + toJSON(message: DenomUnit): unknown { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); @@ -537,6 +529,8 @@ export const DenomUnit = { }, }; +const baseMetadata: object = { description: "", base: "", display: "" }; + export const Metadata = { encode(message: Metadata, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.description); @@ -547,7 +541,8 @@ export const Metadata = { writer.uint32(34).string(message.display); return writer; }, - decode(input: Uint8Array | Reader, length?: number): Metadata { + + decode(input: Reader | Uint8Array, length?: number): Metadata { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMetadata } as Metadata; @@ -574,6 +569,7 @@ export const Metadata = { } return message; }, + fromJSON(object: any): Metadata { const message = { ...baseMetadata } as Metadata; message.denomUnits = []; @@ -599,6 +595,7 @@ export const Metadata = { } return message; }, + fromPartial(object: DeepPartial): Metadata { const message = { ...baseMetadata } as Metadata; message.denomUnits = []; @@ -624,6 +621,7 @@ export const Metadata = { } return message; }, + toJSON(message: Metadata): unknown { const obj: any = {}; message.description !== undefined && (obj.description = message.description); @@ -638,7 +636,7 @@ export const Metadata = { }, }; -type Builtin = Date | Function | Uint8Array | string | number | undefined; +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts b/packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts index 6a967bfb..0e15aa40 100644 --- a/packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts +++ b/packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts @@ -1,86 +1,31 @@ /* eslint-disable */ +import { Reader, Writer } from "protobufjs/minimal"; import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { Input, Output } from "../../../cosmos/bank/v1beta1/bank"; -import { Reader, Writer } from "protobufjs/minimal"; +import * as Long from "long"; -/** - * MsgSend represents a message to send coins from one account to another. - */ +export const protobufPackage = "cosmos.bank.v1beta1"; + +/** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { fromAddress: string; toAddress: string; amount: Coin[]; } -/** - * MsgSendResponse defines the Msg/Send response type. - */ +/** MsgSendResponse defines the Msg/Send response type. */ export interface MsgSendResponse {} -/** - * MsgMultiSend represents an arbitrary multi-in, multi-out send message. - */ +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ export interface MsgMultiSend { inputs: Input[]; outputs: Output[]; } -/** - * MsgMultiSendResponse defines the Msg/MultiSend response type. - */ +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ export interface MsgMultiSendResponse {} -const baseMsgSend: object = { - fromAddress: "", - toAddress: "", -}; - -const baseMsgSendResponse: object = {}; - -const baseMsgMultiSend: object = {}; - -const baseMsgMultiSendResponse: object = {}; - -/** - * Msg defines the bank Msg service. - */ -export interface Msg { - /** - * Send defines a method for sending coins from one account to another account. - */ - Send(request: MsgSend): Promise; - - /** - * MultiSend defines a method for sending coins from some accounts to other accounts. - */ - MultiSend(request: MsgMultiSend): Promise; -} - -export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - } - - Send(request: MsgSend): Promise { - const data = MsgSend.encode(request).finish(); - const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data); - return promise.then((data) => MsgSendResponse.decode(new Reader(data))); - } - - MultiSend(request: MsgMultiSend): Promise { - const data = MsgMultiSend.encode(request).finish(); - const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "MultiSend", data); - return promise.then((data) => MsgMultiSendResponse.decode(new Reader(data))); - } -} - -interface Rpc { - request(service: string, method: string, data: Uint8Array): Promise; -} - -export const protobufPackage = "cosmos.bank.v1beta1"; +const baseMsgSend: object = { fromAddress: "", toAddress: "" }; export const MsgSend = { encode(message: MsgSend, writer: Writer = Writer.create()): Writer { @@ -91,7 +36,8 @@ export const MsgSend = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): MsgSend { + + decode(input: Reader | Uint8Array, length?: number): MsgSend { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMsgSend } as MsgSend; @@ -115,6 +61,7 @@ export const MsgSend = { } return message; }, + fromJSON(object: any): MsgSend { const message = { ...baseMsgSend } as MsgSend; message.amount = []; @@ -135,6 +82,7 @@ export const MsgSend = { } return message; }, + fromPartial(object: DeepPartial): MsgSend { const message = { ...baseMsgSend } as MsgSend; message.amount = []; @@ -155,6 +103,7 @@ export const MsgSend = { } return message; }, + toJSON(message: MsgSend): unknown { const obj: any = {}; message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); @@ -168,11 +117,14 @@ export const MsgSend = { }, }; +const baseMsgSendResponse: object = {}; + export const MsgSendResponse = { encode(_: MsgSendResponse, writer: Writer = Writer.create()): Writer { return writer; }, - decode(input: Uint8Array | Reader, length?: number): MsgSendResponse { + + decode(input: Reader | Uint8Array, length?: number): MsgSendResponse { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMsgSendResponse } as MsgSendResponse; @@ -186,20 +138,25 @@ export const MsgSendResponse = { } return message; }, + fromJSON(_: any): MsgSendResponse { const message = { ...baseMsgSendResponse } as MsgSendResponse; return message; }, + fromPartial(_: DeepPartial): MsgSendResponse { const message = { ...baseMsgSendResponse } as MsgSendResponse; return message; }, + toJSON(_: MsgSendResponse): unknown { const obj: any = {}; return obj; }, }; +const baseMsgMultiSend: object = {}; + export const MsgMultiSend = { encode(message: MsgMultiSend, writer: Writer = Writer.create()): Writer { for (const v of message.inputs) { @@ -210,7 +167,8 @@ export const MsgMultiSend = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): MsgMultiSend { + + decode(input: Reader | Uint8Array, length?: number): MsgMultiSend { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMsgMultiSend } as MsgMultiSend; @@ -232,6 +190,7 @@ export const MsgMultiSend = { } return message; }, + fromJSON(object: any): MsgMultiSend { const message = { ...baseMsgMultiSend } as MsgMultiSend; message.inputs = []; @@ -248,6 +207,7 @@ export const MsgMultiSend = { } return message; }, + fromPartial(object: DeepPartial): MsgMultiSend { const message = { ...baseMsgMultiSend } as MsgMultiSend; message.inputs = []; @@ -264,6 +224,7 @@ export const MsgMultiSend = { } return message; }, + toJSON(message: MsgMultiSend): unknown { const obj: any = {}; if (message.inputs) { @@ -280,11 +241,14 @@ export const MsgMultiSend = { }, }; +const baseMsgMultiSendResponse: object = {}; + export const MsgMultiSendResponse = { encode(_: MsgMultiSendResponse, writer: Writer = Writer.create()): Writer { return writer; }, - decode(input: Uint8Array | Reader, length?: number): MsgMultiSendResponse { + + decode(input: Reader | Uint8Array, length?: number): MsgMultiSendResponse { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; @@ -298,21 +262,54 @@ export const MsgMultiSendResponse = { } return message; }, + fromJSON(_: any): MsgMultiSendResponse { const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; return message; }, + fromPartial(_: DeepPartial): MsgMultiSendResponse { const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; return message; }, + toJSON(_: MsgMultiSendResponse): unknown { const obj: any = {}; return obj; }, }; -type Builtin = Date | Function | Uint8Array | string | number | undefined; +/** Msg defines the bank Msg service. */ +export interface Msg { + /** Send defines a method for sending coins from one account to another account. */ + Send(request: MsgSend): Promise; + /** MultiSend defines a method for sending coins from some accounts to other accounts. */ + MultiSend(request: MsgMultiSend): Promise; +} + +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + } + Send(request: MsgSend): Promise { + const data = MsgSend.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "methodDesc.name", data); + return promise.then((data) => MsgSendResponse.decode(new Reader(data))); + } + + MultiSend(request: MsgMultiSend): Promise { + const data = MsgMultiSend.encode(request).finish(); + const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "methodDesc.name", data); + return promise.then((data) => MsgMultiSendResponse.decode(new Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts b/packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts index 34f4bad5..b6a459fe 100644 --- a/packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts +++ b/packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts @@ -1,11 +1,14 @@ /* eslint-disable */ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; + +export const protobufPackage = "cosmos.base.v1beta1"; /** - * Coin defines a token with a denomination and an amount. + * 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. + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. */ export interface Coin { denom: string; @@ -13,49 +16,27 @@ export interface Coin { } /** - * DecCoin defines a token with a denomination and a decimal amount. + * 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. + * 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. - */ +/** IntProto defines a Protobuf wrapper around an Int object. */ export interface IntProto { int: string; } -/** - * DecProto defines a Protobuf wrapper around a Dec object. - */ +/** DecProto defines a Protobuf wrapper around a Dec object. */ export interface DecProto { dec: string; } -const baseCoin: object = { - denom: "", - amount: "", -}; - -const baseDecCoin: object = { - denom: "", - amount: "", -}; - -const baseIntProto: object = { - int: "", -}; - -const baseDecProto: object = { - dec: "", -}; - -export const protobufPackage = "cosmos.base.v1beta1"; +const baseCoin: object = { denom: "", amount: "" }; export const Coin = { encode(message: Coin, writer: Writer = Writer.create()): Writer { @@ -63,7 +44,8 @@ export const Coin = { writer.uint32(18).string(message.amount); return writer; }, - decode(input: Uint8Array | Reader, length?: number): Coin { + + decode(input: Reader | Uint8Array, length?: number): Coin { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseCoin } as Coin; @@ -83,6 +65,7 @@ export const Coin = { } return message; }, + fromJSON(object: any): Coin { const message = { ...baseCoin } as Coin; if (object.denom !== undefined && object.denom !== null) { @@ -97,6 +80,7 @@ export const Coin = { } return message; }, + fromPartial(object: DeepPartial): Coin { const message = { ...baseCoin } as Coin; if (object.denom !== undefined && object.denom !== null) { @@ -111,6 +95,7 @@ export const Coin = { } return message; }, + toJSON(message: Coin): unknown { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); @@ -119,13 +104,16 @@ export const Coin = { }, }; +const baseDecCoin: object = { denom: "", amount: "" }; + export const DecCoin = { encode(message: DecCoin, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.denom); writer.uint32(18).string(message.amount); return writer; }, - decode(input: Uint8Array | Reader, length?: number): DecCoin { + + decode(input: Reader | Uint8Array, length?: number): DecCoin { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseDecCoin } as DecCoin; @@ -145,6 +133,7 @@ export const DecCoin = { } return message; }, + fromJSON(object: any): DecCoin { const message = { ...baseDecCoin } as DecCoin; if (object.denom !== undefined && object.denom !== null) { @@ -159,6 +148,7 @@ export const DecCoin = { } return message; }, + fromPartial(object: DeepPartial): DecCoin { const message = { ...baseDecCoin } as DecCoin; if (object.denom !== undefined && object.denom !== null) { @@ -173,6 +163,7 @@ export const DecCoin = { } return message; }, + toJSON(message: DecCoin): unknown { const obj: any = {}; message.denom !== undefined && (obj.denom = message.denom); @@ -181,12 +172,15 @@ export const DecCoin = { }, }; +const baseIntProto: object = { int: "" }; + export const IntProto = { encode(message: IntProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.int); return writer; }, - decode(input: Uint8Array | Reader, length?: number): IntProto { + + decode(input: Reader | Uint8Array, length?: number): IntProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseIntProto } as IntProto; @@ -203,6 +197,7 @@ export const IntProto = { } return message; }, + fromJSON(object: any): IntProto { const message = { ...baseIntProto } as IntProto; if (object.int !== undefined && object.int !== null) { @@ -212,6 +207,7 @@ export const IntProto = { } return message; }, + fromPartial(object: DeepPartial): IntProto { const message = { ...baseIntProto } as IntProto; if (object.int !== undefined && object.int !== null) { @@ -221,6 +217,7 @@ export const IntProto = { } return message; }, + toJSON(message: IntProto): unknown { const obj: any = {}; message.int !== undefined && (obj.int = message.int); @@ -228,12 +225,15 @@ export const IntProto = { }, }; +const baseDecProto: object = { dec: "" }; + export const DecProto = { encode(message: DecProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.dec); return writer; }, - decode(input: Uint8Array | Reader, length?: number): DecProto { + + decode(input: Reader | Uint8Array, length?: number): DecProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseDecProto } as DecProto; @@ -250,6 +250,7 @@ export const DecProto = { } return message; }, + fromJSON(object: any): DecProto { const message = { ...baseDecProto } as DecProto; if (object.dec !== undefined && object.dec !== null) { @@ -259,6 +260,7 @@ export const DecProto = { } return message; }, + fromPartial(object: DeepPartial): DecProto { const message = { ...baseDecProto } as DecProto; if (object.dec !== undefined && object.dec !== null) { @@ -268,6 +270,7 @@ export const DecProto = { } return message; }, + toJSON(message: DecProto): unknown { const obj: any = {}; message.dec !== undefined && (obj.dec = message.dec); @@ -275,7 +278,7 @@ export const DecProto = { }, }; -type Builtin = Date | Function | Uint8Array | string | number | undefined; +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts b/packages/proto-signing/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts index 6caa5ba6..5b8dd393 100644 --- a/packages/proto-signing/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/packages/proto-signing/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -1,20 +1,23 @@ /* eslint-disable */ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; + +export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; /** - * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. - * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers - * signed and with which modes. + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. */ export interface MultiSignature { signatures: Uint8Array[]; } /** - * CompactBitArray is an implementation of a space efficient bit array. - * This is used to ensure that the encoded data takes up a minimal amount of - * space after proto encoding. - * This is not thread safe, and is not intended for concurrent usage. + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. */ export interface CompactBitArray { extraBitsStored: number; @@ -23,12 +26,6 @@ export interface CompactBitArray { const baseMultiSignature: object = {}; -const baseCompactBitArray: object = { - extraBitsStored: 0, -}; - -export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; - export const MultiSignature = { encode(message: MultiSignature, writer: Writer = Writer.create()): Writer { for (const v of message.signatures) { @@ -36,7 +33,8 @@ export const MultiSignature = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): MultiSignature { + + decode(input: Reader | Uint8Array, length?: number): MultiSignature { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMultiSignature } as MultiSignature; @@ -54,6 +52,7 @@ export const MultiSignature = { } return message; }, + fromJSON(object: any): MultiSignature { const message = { ...baseMultiSignature } as MultiSignature; message.signatures = []; @@ -64,6 +63,7 @@ export const MultiSignature = { } return message; }, + fromPartial(object: DeepPartial): MultiSignature { const message = { ...baseMultiSignature } as MultiSignature; message.signatures = []; @@ -74,6 +74,7 @@ export const MultiSignature = { } return message; }, + toJSON(message: MultiSignature): unknown { const obj: any = {}; if (message.signatures) { @@ -85,13 +86,16 @@ export const MultiSignature = { }, }; +const baseCompactBitArray: object = { extraBitsStored: 0 }; + export const CompactBitArray = { encode(message: CompactBitArray, writer: Writer = Writer.create()): Writer { writer.uint32(8).uint32(message.extraBitsStored); writer.uint32(18).bytes(message.elems); return writer; }, - decode(input: Uint8Array | Reader, length?: number): CompactBitArray { + + decode(input: Reader | Uint8Array, length?: number): CompactBitArray { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseCompactBitArray } as CompactBitArray; @@ -111,6 +115,7 @@ export const CompactBitArray = { } return message; }, + fromJSON(object: any): CompactBitArray { const message = { ...baseCompactBitArray } as CompactBitArray; if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) { @@ -123,6 +128,7 @@ export const CompactBitArray = { } return message; }, + fromPartial(object: DeepPartial): CompactBitArray { const message = { ...baseCompactBitArray } as CompactBitArray; if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) { @@ -137,6 +143,7 @@ export const CompactBitArray = { } return message; }, + toJSON(message: CompactBitArray): unknown { const obj: any = {}; message.extraBitsStored !== undefined && (obj.extraBitsStored = message.extraBitsStored); @@ -146,15 +153,18 @@ export const CompactBitArray = { }, }; -interface WindowBase64 { - atob(b64: string): string; - btoa(bin: string): string; -} - -const windowBase64 = (globalThis as unknown) as WindowBase64; -const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary")); -const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64")); +declare var self: any | undefined; +declare var window: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw new Error("Unable to locate global object"); +})(); +const atob: (b64: string) => string = + globalThis.atob || ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); function bytesFromBase64(b64: string): Uint8Array { const bin = atob(b64); const arr = new Uint8Array(bin.length); @@ -164,6 +174,8 @@ function bytesFromBase64(b64: string): Uint8Array { return arr; } +const btoa: (bin: string) => string = + globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); function base64FromBytes(arr: Uint8Array): string { const bin: string[] = []; for (let i = 0; i < arr.byteLength; ++i) { @@ -171,7 +183,8 @@ function base64FromBytes(arr: Uint8Array): string { } return btoa(bin.join("")); } -type Builtin = Date | Function | Uint8Array | string | number | undefined; + +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts b/packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts index eb131770..6ae71a98 100644 --- a/packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts +++ b/packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts @@ -1,36 +1,34 @@ /* eslint-disable */ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; + +export const protobufPackage = "cosmos.crypto.secp256k1"; /** - * PubKey defines a secp256k1 public key - * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte - * if the y-coordinate is the lexicographically largest of the two associated with - * the x-coordinate. Otherwise the first byte is a 0x03. - * This prefix is followed with the x-coordinate. + * PubKey defines a secp256k1 public key + * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte + * if the y-coordinate is the lexicographically largest of the two associated with + * the x-coordinate. Otherwise the first byte is a 0x03. + * This prefix is followed with the x-coordinate. */ export interface PubKey { key: Uint8Array; } -/** - * PrivKey defines a secp256k1 private key. - */ +/** PrivKey defines a secp256k1 private key. */ export interface PrivKey { key: Uint8Array; } const basePubKey: object = {}; -const basePrivKey: object = {}; - -export const protobufPackage = "cosmos.crypto.secp256k1"; - export const PubKey = { encode(message: PubKey, writer: Writer = Writer.create()): Writer { writer.uint32(10).bytes(message.key); return writer; }, - decode(input: Uint8Array | Reader, length?: number): PubKey { + + decode(input: Reader | Uint8Array, length?: number): PubKey { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...basePubKey } as PubKey; @@ -47,6 +45,7 @@ export const PubKey = { } return message; }, + fromJSON(object: any): PubKey { const message = { ...basePubKey } as PubKey; if (object.key !== undefined && object.key !== null) { @@ -54,6 +53,7 @@ export const PubKey = { } return message; }, + fromPartial(object: DeepPartial): PubKey { const message = { ...basePubKey } as PubKey; if (object.key !== undefined && object.key !== null) { @@ -63,6 +63,7 @@ export const PubKey = { } return message; }, + toJSON(message: PubKey): unknown { const obj: any = {}; message.key !== undefined && @@ -71,12 +72,15 @@ export const PubKey = { }, }; +const basePrivKey: object = {}; + export const PrivKey = { encode(message: PrivKey, writer: Writer = Writer.create()): Writer { writer.uint32(10).bytes(message.key); return writer; }, - decode(input: Uint8Array | Reader, length?: number): PrivKey { + + decode(input: Reader | Uint8Array, length?: number): PrivKey { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...basePrivKey } as PrivKey; @@ -93,6 +97,7 @@ export const PrivKey = { } return message; }, + fromJSON(object: any): PrivKey { const message = { ...basePrivKey } as PrivKey; if (object.key !== undefined && object.key !== null) { @@ -100,6 +105,7 @@ export const PrivKey = { } return message; }, + fromPartial(object: DeepPartial): PrivKey { const message = { ...basePrivKey } as PrivKey; if (object.key !== undefined && object.key !== null) { @@ -109,6 +115,7 @@ export const PrivKey = { } return message; }, + toJSON(message: PrivKey): unknown { const obj: any = {}; message.key !== undefined && @@ -117,15 +124,18 @@ export const PrivKey = { }, }; -interface WindowBase64 { - atob(b64: string): string; - btoa(bin: string): string; -} - -const windowBase64 = (globalThis as unknown) as WindowBase64; -const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary")); -const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64")); +declare var self: any | undefined; +declare var window: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw new Error("Unable to locate global object"); +})(); +const atob: (b64: string) => string = + globalThis.atob || ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); function bytesFromBase64(b64: string): Uint8Array { const bin = atob(b64); const arr = new Uint8Array(bin.length); @@ -135,6 +145,8 @@ function bytesFromBase64(b64: string): Uint8Array { return arr; } +const btoa: (bin: string) => string = + globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); function base64FromBytes(arr: Uint8Array): string { const bin: string[] = []; for (let i = 0; i < arr.byteLength; ++i) { @@ -142,7 +154,8 @@ function base64FromBytes(arr: Uint8Array): string { } return btoa(bin.join("")); } -type Builtin = Date | Function | Uint8Array | string | number | undefined; + +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/cosmos/tx/signing/v1beta1/signing.ts b/packages/proto-signing/src/codec/cosmos/tx/signing/v1beta1/signing.ts index c1c3552c..ae42feb6 100644 --- a/packages/proto-signing/src/codec/cosmos/tx/signing/v1beta1/signing.ts +++ b/packages/proto-signing/src/codec/cosmos/tx/signing/v1beta1/signing.ts @@ -4,112 +4,29 @@ import * as Long from "long"; import { CompactBitArray } from "../../../../cosmos/crypto/multisig/v1beta1/multisig"; import { Writer, Reader } from "protobufjs/minimal"; -/** - * SignatureDescriptors wraps multiple SignatureDescriptor's. - */ -export interface SignatureDescriptors { - /** - * signatures are the signature descriptors - */ - signatures: SignatureDescriptor[]; -} - -/** - * SignatureDescriptor is a convenience type which represents the full data for - * a signature including the public key of the signer, signing modes and the - * signature itself. It is primarily used for coordinating signatures between - * clients. - */ -export interface SignatureDescriptor { - /** - * public_key is the public key of the signer - */ - publicKey?: Any; - data?: SignatureDescriptor_Data; - /** - * sequence is the sequence of the account, which describes the - * number of committed transactions signed by a given address. It is used to prevent - * replay attacks. - */ - sequence: Long; -} - -/** - * Data represents signature data - */ -export interface SignatureDescriptor_Data { - /** - * single represents a single signer - */ - single?: SignatureDescriptor_Data_Single | undefined; - /** - * multi represents a multisig signer - */ - multi?: SignatureDescriptor_Data_Multi | undefined; -} - -/** - * Single is the signature data for a single signer - */ -export interface SignatureDescriptor_Data_Single { - /** - * mode is the signing mode of the single signer - */ - mode: SignMode; - /** - * signature is the raw signature bytes - */ - signature: Uint8Array; -} - -/** - * Multi is the signature data for a multisig public key - */ -export interface SignatureDescriptor_Data_Multi { - /** - * bitarray specifies which keys within the multisig are signing - */ - bitarray?: CompactBitArray; - /** - * signatures is the signatures of the multi-signature - */ - signatures: SignatureDescriptor_Data[]; -} - -const baseSignatureDescriptors: object = {}; - -const baseSignatureDescriptor: object = { - sequence: Long.UZERO, -}; - -const baseSignatureDescriptor_Data: object = {}; - -const baseSignatureDescriptor_Data_Single: object = { - mode: 0, -}; - -const baseSignatureDescriptor_Data_Multi: object = {}; - export const protobufPackage = "cosmos.tx.signing.v1beta1"; -/** SignMode represents a signing mode with its own security guarantees. - */ +/** SignMode represents a signing mode with its own security guarantees. */ export enum SignMode { - /** SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - rejected + /** + * SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be + * rejected */ SIGN_MODE_UNSPECIFIED = 0, - /** SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - verified with raw bytes from Tx + /** + * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + * verified with raw bytes from Tx */ SIGN_MODE_DIRECT = 1, - /** SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some - human-readable textual representation on top of the binary representation - from SIGN_MODE_DIRECT + /** + * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some + * human-readable textual representation on top of the binary representation + * from SIGN_MODE_DIRECT */ SIGN_MODE_TEXTUAL = 2, - /** SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - Amino JSON and will be removed in the future + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future */ SIGN_MODE_LEGACY_AMINO_JSON = 127, UNRECOGNIZED = -1, @@ -151,6 +68,56 @@ export function signModeToJSON(object: SignMode): string { } } +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey?: Any; + data?: SignatureDescriptor_Data; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to prevent + * replay attacks. + */ + sequence: Long; +} + +/** Data represents signature data */ +export interface SignatureDescriptor_Data { + /** single represents a single signer */ + single?: SignatureDescriptor_Data_Single | undefined; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_Multi | undefined; +} + +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_Single { + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** signature is the raw signature bytes */ + signature: Uint8Array; +} + +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_Multi { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArray; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} + +const baseSignatureDescriptors: object = {}; + export const SignatureDescriptors = { encode(message: SignatureDescriptors, writer: Writer = Writer.create()): Writer { for (const v of message.signatures) { @@ -158,7 +125,8 @@ export const SignatureDescriptors = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): SignatureDescriptors { + + decode(input: Reader | Uint8Array, length?: number): SignatureDescriptors { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSignatureDescriptors } as SignatureDescriptors; @@ -176,6 +144,7 @@ export const SignatureDescriptors = { } return message; }, + fromJSON(object: any): SignatureDescriptors { const message = { ...baseSignatureDescriptors } as SignatureDescriptors; message.signatures = []; @@ -186,6 +155,7 @@ export const SignatureDescriptors = { } return message; }, + fromPartial(object: DeepPartial): SignatureDescriptors { const message = { ...baseSignatureDescriptors } as SignatureDescriptors; message.signatures = []; @@ -196,6 +166,7 @@ export const SignatureDescriptors = { } return message; }, + toJSON(message: SignatureDescriptors): unknown { const obj: any = {}; if (message.signatures) { @@ -207,6 +178,8 @@ export const SignatureDescriptors = { }, }; +const baseSignatureDescriptor: object = { sequence: Long.UZERO }; + export const SignatureDescriptor = { encode(message: SignatureDescriptor, writer: Writer = Writer.create()): Writer { if (message.publicKey !== undefined && message.publicKey !== undefined) { @@ -218,7 +191,8 @@ export const SignatureDescriptor = { writer.uint32(24).uint64(message.sequence); return writer; }, - decode(input: Uint8Array | Reader, length?: number): SignatureDescriptor { + + decode(input: Reader | Uint8Array, length?: number): SignatureDescriptor { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSignatureDescriptor } as SignatureDescriptor; @@ -241,6 +215,7 @@ export const SignatureDescriptor = { } return message; }, + fromJSON(object: any): SignatureDescriptor { const message = { ...baseSignatureDescriptor } as SignatureDescriptor; if (object.publicKey !== undefined && object.publicKey !== null) { @@ -260,6 +235,7 @@ export const SignatureDescriptor = { } return message; }, + fromPartial(object: DeepPartial): SignatureDescriptor { const message = { ...baseSignatureDescriptor } as SignatureDescriptor; if (object.publicKey !== undefined && object.publicKey !== null) { @@ -279,6 +255,7 @@ export const SignatureDescriptor = { } return message; }, + toJSON(message: SignatureDescriptor): unknown { const obj: any = {}; message.publicKey !== undefined && @@ -290,6 +267,8 @@ export const SignatureDescriptor = { }, }; +const baseSignatureDescriptor_Data: object = {}; + export const SignatureDescriptor_Data = { encode(message: SignatureDescriptor_Data, writer: Writer = Writer.create()): Writer { if (message.single !== undefined) { @@ -300,7 +279,8 @@ export const SignatureDescriptor_Data = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): SignatureDescriptor_Data { + + decode(input: Reader | Uint8Array, length?: number): SignatureDescriptor_Data { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; @@ -320,6 +300,7 @@ export const SignatureDescriptor_Data = { } return message; }, + fromJSON(object: any): SignatureDescriptor_Data { const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; if (object.single !== undefined && object.single !== null) { @@ -334,6 +315,7 @@ export const SignatureDescriptor_Data = { } return message; }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data { const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; if (object.single !== undefined && object.single !== null) { @@ -348,6 +330,7 @@ export const SignatureDescriptor_Data = { } return message; }, + toJSON(message: SignatureDescriptor_Data): unknown { const obj: any = {}; message.single !== undefined && @@ -358,13 +341,16 @@ export const SignatureDescriptor_Data = { }, }; +const baseSignatureDescriptor_Data_Single: object = { mode: 0 }; + export const SignatureDescriptor_Data_Single = { encode(message: SignatureDescriptor_Data_Single, writer: Writer = Writer.create()): Writer { writer.uint32(8).int32(message.mode); writer.uint32(18).bytes(message.signature); return writer; }, - decode(input: Uint8Array | Reader, length?: number): SignatureDescriptor_Data_Single { + + decode(input: Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; @@ -384,6 +370,7 @@ export const SignatureDescriptor_Data_Single = { } return message; }, + fromJSON(object: any): SignatureDescriptor_Data_Single { const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; if (object.mode !== undefined && object.mode !== null) { @@ -396,6 +383,7 @@ export const SignatureDescriptor_Data_Single = { } return message; }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Single { const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; if (object.mode !== undefined && object.mode !== null) { @@ -410,6 +398,7 @@ export const SignatureDescriptor_Data_Single = { } return message; }, + toJSON(message: SignatureDescriptor_Data_Single): unknown { const obj: any = {}; message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); @@ -421,6 +410,8 @@ export const SignatureDescriptor_Data_Single = { }, }; +const baseSignatureDescriptor_Data_Multi: object = {}; + export const SignatureDescriptor_Data_Multi = { encode(message: SignatureDescriptor_Data_Multi, writer: Writer = Writer.create()): Writer { if (message.bitarray !== undefined && message.bitarray !== undefined) { @@ -431,7 +422,8 @@ export const SignatureDescriptor_Data_Multi = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): SignatureDescriptor_Data_Multi { + + decode(input: Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; @@ -452,6 +444,7 @@ export const SignatureDescriptor_Data_Multi = { } return message; }, + fromJSON(object: any): SignatureDescriptor_Data_Multi { const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; message.signatures = []; @@ -467,6 +460,7 @@ export const SignatureDescriptor_Data_Multi = { } return message; }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Multi { const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; message.signatures = []; @@ -482,6 +476,7 @@ export const SignatureDescriptor_Data_Multi = { } return message; }, + toJSON(message: SignatureDescriptor_Data_Multi): unknown { const obj: any = {}; message.bitarray !== undefined && @@ -495,15 +490,18 @@ export const SignatureDescriptor_Data_Multi = { }, }; -interface WindowBase64 { - atob(b64: string): string; - btoa(bin: string): string; -} - -const windowBase64 = (globalThis as unknown) as WindowBase64; -const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary")); -const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64")); +declare var self: any | undefined; +declare var window: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw new Error("Unable to locate global object"); +})(); +const atob: (b64: string) => string = + globalThis.atob || ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); function bytesFromBase64(b64: string): Uint8Array { const bin = atob(b64); const arr = new Uint8Array(bin.length); @@ -513,6 +511,8 @@ function bytesFromBase64(b64: string): Uint8Array { return arr; } +const btoa: (bin: string) => string = + globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); function base64FromBytes(arr: Uint8Array): string { const bin: string[] = []; for (let i = 0; i < arr.byteLength; ++i) { @@ -520,7 +520,8 @@ function base64FromBytes(arr: Uint8Array): string { } return btoa(bin.join("")); } -type Builtin = Date | Function | Uint8Array | string | number | undefined; + +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts b/packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts index cd82e4d3..7ac915b2 100644 --- a/packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts +++ b/packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts @@ -6,267 +6,209 @@ import { CompactBitArray } from "../../../cosmos/crypto/multisig/v1beta1/multisi import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { Writer, Reader } from "protobufjs/minimal"; -/** - * Tx is the standard type used for broadcasting transactions. - */ +export const protobufPackage = "cosmos.tx.v1beta1"; + +/** Tx is the standard type used for broadcasting transactions. */ export interface Tx { - /** - * body is the processable content of the transaction - */ + /** body is the processable content of the transaction */ body?: TxBody; /** - * auth_info is the authorization related content of the transaction, - * specifically signers, signer modes and fee + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee */ authInfo?: AuthInfo; /** - * signatures is a list of signatures that matches the length and order of - * AuthInfo's signer_infos to allow connecting signature meta information like - * public key and signing mode by position. + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. */ signatures: Uint8Array[]; } /** - * TxRaw is a variant of Tx that pins the signer's exact binary representation - * of body and auth_info. This is used for signing, broadcasting and - * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and - * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used - * as the transaction ID. + * TxRaw is a variant of Tx that pins the signer's exact binary representation + * of body and auth_info. This is used for signing, broadcasting and + * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and + * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used + * as the transaction ID. */ export interface TxRaw { /** - * body_bytes is a protobuf serialization of a TxBody that matches the - * representation in SignDoc. + * body_bytes is a protobuf serialization of a TxBody that matches the + * representation in SignDoc. */ bodyBytes: Uint8Array; /** - * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - * representation in SignDoc. + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. */ authInfoBytes: Uint8Array; /** - * signatures is a list of signatures that matches the length and order of - * AuthInfo's signer_infos to allow connecting signature meta information like - * public key and signing mode by position. + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. */ signatures: Uint8Array[]; } -/** - * SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. - */ +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ export interface SignDoc { /** - * body_bytes is protobuf serialization of a TxBody that matches the - * representation in TxRaw. + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. */ bodyBytes: Uint8Array; /** - * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - * representation in TxRaw. + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. */ authInfoBytes: Uint8Array; /** - * chain_id is the unique identifier of the chain this transaction targets. - * It prevents signed transactions from being used on another chain by an - * attacker + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker */ chainId: string; - /** - * account_number is the account number of the account in state - */ + /** account_number is the account number of the account in state */ accountNumber: Long; } -/** - * TxBody is the body of a transaction that all signers sign over. - */ +/** TxBody is the body of a transaction that all signers sign over. */ export interface TxBody { /** - * messages is a list of messages to be executed. The required signers of - * those messages define the number and order of elements in AuthInfo's - * signer_infos and Tx's signatures. Each required signer address is added to - * the list only the first time it occurs. - * By convention, the first required signer (usually from the first message) - * is referred to as the primary signer and pays the fee for the whole - * transaction. + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. */ messages: Any[]; - /** - * memo is any arbitrary memo to be added to the transaction - */ + /** memo is any arbitrary memo to be added to the transaction */ memo: string; /** - * timeout is the block height after which this transaction will not - * be processed by the chain + * timeout is the block height after which this transaction will not + * be processed by the chain */ timeoutHeight: Long; /** - * extension_options are arbitrary options that can be added by chains - * when the default options are not sufficient. If any of these are present - * and can't be handled, the transaction will be rejected + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected */ extensionOptions: Any[]; /** - * extension_options are arbitrary options that can be added by chains - * when the default options are not sufficient. If any of these are present - * and can't be handled, they will be ignored + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored */ nonCriticalExtensionOptions: Any[]; } /** - * AuthInfo describes the fee and signer modes that are used to sign a - * transaction. + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. */ export interface AuthInfo { /** - * signer_infos defines the signing modes for the required signers. The number - * and order of elements must match the required signers from TxBody's - * messages. The first element is the primary signer and the one which pays - * the fee. + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. */ signerInfos: SignerInfo[]; /** - * Fee is the fee and gas limit for the transaction. The first signer is the - * primary signer and the one which pays the fee. The fee can be calculated - * based on the cost of evaluating the body and doing signature verification - * of the signers. This can be estimated via simulation. + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. */ fee?: Fee; } /** - * SignerInfo describes the public key and signing mode of a single top-level - * signer. + * SignerInfo describes the public key and signing mode of a single top-level + * signer. */ export interface SignerInfo { /** - * public_key is the public key of the signer. It is optional for accounts - * that already exist in state. If unset, the verifier can use the required \ - * signer address for this position and lookup the public key. + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. */ publicKey?: Any; /** - * mode_info describes the signing mode of the signer and is a nested - * structure to support nested multisig pubkey's + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's */ modeInfo?: ModeInfo; /** - * sequence is the sequence of the account, which describes the - * number of committed transactions signed by a given address. It is used to - * prevent replay attacks. + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to + * prevent replay attacks. */ sequence: Long; } -/** - * ModeInfo describes the signing mode of a single or nested multisig signer. - */ +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ export interface ModeInfo { - /** - * single represents a single signer - */ + /** single represents a single signer */ single?: ModeInfo_Single | undefined; - /** - * multi represents a nested multisig signer - */ + /** multi represents a nested multisig signer */ multi?: ModeInfo_Multi | undefined; } /** - * Single is the mode info for a single signer. It is structured as a message - * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the - * future + * Single is the mode info for a single signer. It is structured as a message + * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + * future */ export interface ModeInfo_Single { - /** - * mode is the signing mode of the single signer - */ + /** mode is the signing mode of the single signer */ mode: SignMode; } -/** - * Multi is the mode info for a multisig public key - */ +/** Multi is the mode info for a multisig public key */ export interface ModeInfo_Multi { - /** - * bitarray specifies which keys within the multisig are signing - */ + /** bitarray specifies which keys within the multisig are signing */ bitarray?: CompactBitArray; /** - * mode_infos is the corresponding modes of the signers of the multisig - * which could include nested multisig public keys + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys */ modeInfos: ModeInfo[]; } /** - * Fee includes the amount of coins paid in fees and the maximum - * gas to be used by the transaction. The ratio yields an effective "gasprice", - * which must be above some miminum to be accepted into the mempool. + * Fee includes the amount of coins paid in fees and the maximum + * gas to be used by the transaction. The ratio yields an effective "gasprice", + * which must be above some miminum to be accepted into the mempool. */ export interface Fee { - /** - * amount is the amount of coins to be paid as a fee - */ + /** amount is the amount of coins to be paid as a fee */ amount: Coin[]; /** - * gas_limit is the maximum gas that can be used in transaction processing - * before an out of gas error occurs + * gas_limit is the maximum gas that can be used in transaction processing + * before an out of gas error occurs */ gasLimit: Long; /** - * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - * the payer must be a tx signer (and thus have signed this field in AuthInfo). - * setting this field does *not* change the ordering of required signers for the transaction. + * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + * the payer must be a tx signer (and thus have signed this field in AuthInfo). + * setting this field does *not* change the ordering of required signers for the transaction. */ payer: string; /** - * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - * not support fee grants, this will fail + * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + * not support fee grants, this will fail */ granter: string; } const baseTx: object = {}; -const baseTxRaw: object = {}; - -const baseSignDoc: object = { - chainId: "", - accountNumber: Long.UZERO, -}; - -const baseTxBody: object = { - memo: "", - timeoutHeight: Long.UZERO, -}; - -const baseAuthInfo: object = {}; - -const baseSignerInfo: object = { - sequence: Long.UZERO, -}; - -const baseModeInfo: object = {}; - -const baseModeInfo_Single: object = { - mode: 0, -}; - -const baseModeInfo_Multi: object = {}; - -const baseFee: object = { - gasLimit: Long.UZERO, - payer: "", - granter: "", -}; - -export const protobufPackage = "cosmos.tx.v1beta1"; - export const Tx = { encode(message: Tx, writer: Writer = Writer.create()): Writer { if (message.body !== undefined && message.body !== undefined) { @@ -280,7 +222,8 @@ export const Tx = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): Tx { + + decode(input: Reader | Uint8Array, length?: number): Tx { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseTx } as Tx; @@ -304,6 +247,7 @@ export const Tx = { } return message; }, + fromJSON(object: any): Tx { const message = { ...baseTx } as Tx; message.signatures = []; @@ -324,6 +268,7 @@ export const Tx = { } return message; }, + fromPartial(object: DeepPartial): Tx { const message = { ...baseTx } as Tx; message.signatures = []; @@ -344,6 +289,7 @@ export const Tx = { } return message; }, + toJSON(message: Tx): unknown { const obj: any = {}; message.body !== undefined && (obj.body = message.body ? TxBody.toJSON(message.body) : undefined); @@ -358,6 +304,8 @@ export const Tx = { }, }; +const baseTxRaw: object = {}; + export const TxRaw = { encode(message: TxRaw, writer: Writer = Writer.create()): Writer { writer.uint32(10).bytes(message.bodyBytes); @@ -367,7 +315,8 @@ export const TxRaw = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): TxRaw { + + decode(input: Reader | Uint8Array, length?: number): TxRaw { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseTxRaw } as TxRaw; @@ -391,6 +340,7 @@ export const TxRaw = { } return message; }, + fromJSON(object: any): TxRaw { const message = { ...baseTxRaw } as TxRaw; message.signatures = []; @@ -407,6 +357,7 @@ export const TxRaw = { } return message; }, + fromPartial(object: DeepPartial): TxRaw { const message = { ...baseTxRaw } as TxRaw; message.signatures = []; @@ -427,6 +378,7 @@ export const TxRaw = { } return message; }, + toJSON(message: TxRaw): unknown { const obj: any = {}; message.bodyBytes !== undefined && @@ -446,6 +398,8 @@ export const TxRaw = { }, }; +const baseSignDoc: object = { chainId: "", accountNumber: Long.UZERO }; + export const SignDoc = { encode(message: SignDoc, writer: Writer = Writer.create()): Writer { writer.uint32(10).bytes(message.bodyBytes); @@ -454,7 +408,8 @@ export const SignDoc = { writer.uint32(32).uint64(message.accountNumber); return writer; }, - decode(input: Uint8Array | Reader, length?: number): SignDoc { + + decode(input: Reader | Uint8Array, length?: number): SignDoc { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSignDoc } as SignDoc; @@ -480,6 +435,7 @@ export const SignDoc = { } return message; }, + fromJSON(object: any): SignDoc { const message = { ...baseSignDoc } as SignDoc; if (object.bodyBytes !== undefined && object.bodyBytes !== null) { @@ -500,6 +456,7 @@ export const SignDoc = { } return message; }, + fromPartial(object: DeepPartial): SignDoc { const message = { ...baseSignDoc } as SignDoc; if (object.bodyBytes !== undefined && object.bodyBytes !== null) { @@ -524,6 +481,7 @@ export const SignDoc = { } return message; }, + toJSON(message: SignDoc): unknown { const obj: any = {}; message.bodyBytes !== undefined && @@ -541,6 +499,8 @@ export const SignDoc = { }, }; +const baseTxBody: object = { memo: "", timeoutHeight: Long.UZERO }; + export const TxBody = { encode(message: TxBody, writer: Writer = Writer.create()): Writer { for (const v of message.messages) { @@ -556,7 +516,8 @@ export const TxBody = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): TxBody { + + decode(input: Reader | Uint8Array, length?: number): TxBody { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseTxBody } as TxBody; @@ -588,6 +549,7 @@ export const TxBody = { } return message; }, + fromJSON(object: any): TxBody { const message = { ...baseTxBody } as TxBody; message.messages = []; @@ -620,6 +582,7 @@ export const TxBody = { } return message; }, + fromPartial(object: DeepPartial): TxBody { const message = { ...baseTxBody } as TxBody; message.messages = []; @@ -652,6 +615,7 @@ export const TxBody = { } return message; }, + toJSON(message: TxBody): unknown { const obj: any = {}; if (message.messages) { @@ -678,6 +642,8 @@ export const TxBody = { }, }; +const baseAuthInfo: object = {}; + export const AuthInfo = { encode(message: AuthInfo, writer: Writer = Writer.create()): Writer { for (const v of message.signerInfos) { @@ -688,7 +654,8 @@ export const AuthInfo = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): AuthInfo { + + decode(input: Reader | Uint8Array, length?: number): AuthInfo { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseAuthInfo } as AuthInfo; @@ -709,6 +676,7 @@ export const AuthInfo = { } return message; }, + fromJSON(object: any): AuthInfo { const message = { ...baseAuthInfo } as AuthInfo; message.signerInfos = []; @@ -724,6 +692,7 @@ export const AuthInfo = { } return message; }, + fromPartial(object: DeepPartial): AuthInfo { const message = { ...baseAuthInfo } as AuthInfo; message.signerInfos = []; @@ -739,6 +708,7 @@ export const AuthInfo = { } return message; }, + toJSON(message: AuthInfo): unknown { const obj: any = {}; if (message.signerInfos) { @@ -751,6 +721,8 @@ export const AuthInfo = { }, }; +const baseSignerInfo: object = { sequence: Long.UZERO }; + export const SignerInfo = { encode(message: SignerInfo, writer: Writer = Writer.create()): Writer { if (message.publicKey !== undefined && message.publicKey !== undefined) { @@ -762,7 +734,8 @@ export const SignerInfo = { writer.uint32(24).uint64(message.sequence); return writer; }, - decode(input: Uint8Array | Reader, length?: number): SignerInfo { + + decode(input: Reader | Uint8Array, length?: number): SignerInfo { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSignerInfo } as SignerInfo; @@ -785,6 +758,7 @@ export const SignerInfo = { } return message; }, + fromJSON(object: any): SignerInfo { const message = { ...baseSignerInfo } as SignerInfo; if (object.publicKey !== undefined && object.publicKey !== null) { @@ -804,6 +778,7 @@ export const SignerInfo = { } return message; }, + fromPartial(object: DeepPartial): SignerInfo { const message = { ...baseSignerInfo } as SignerInfo; if (object.publicKey !== undefined && object.publicKey !== null) { @@ -823,6 +798,7 @@ export const SignerInfo = { } return message; }, + toJSON(message: SignerInfo): unknown { const obj: any = {}; message.publicKey !== undefined && @@ -834,6 +810,8 @@ export const SignerInfo = { }, }; +const baseModeInfo: object = {}; + export const ModeInfo = { encode(message: ModeInfo, writer: Writer = Writer.create()): Writer { if (message.single !== undefined) { @@ -844,7 +822,8 @@ export const ModeInfo = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): ModeInfo { + + decode(input: Reader | Uint8Array, length?: number): ModeInfo { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseModeInfo } as ModeInfo; @@ -864,6 +843,7 @@ export const ModeInfo = { } return message; }, + fromJSON(object: any): ModeInfo { const message = { ...baseModeInfo } as ModeInfo; if (object.single !== undefined && object.single !== null) { @@ -878,6 +858,7 @@ export const ModeInfo = { } return message; }, + fromPartial(object: DeepPartial): ModeInfo { const message = { ...baseModeInfo } as ModeInfo; if (object.single !== undefined && object.single !== null) { @@ -892,6 +873,7 @@ export const ModeInfo = { } return message; }, + toJSON(message: ModeInfo): unknown { const obj: any = {}; message.single !== undefined && @@ -902,12 +884,15 @@ export const ModeInfo = { }, }; +const baseModeInfo_Single: object = { mode: 0 }; + export const ModeInfo_Single = { encode(message: ModeInfo_Single, writer: Writer = Writer.create()): Writer { writer.uint32(8).int32(message.mode); return writer; }, - decode(input: Uint8Array | Reader, length?: number): ModeInfo_Single { + + decode(input: Reader | Uint8Array, length?: number): ModeInfo_Single { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseModeInfo_Single } as ModeInfo_Single; @@ -924,6 +909,7 @@ export const ModeInfo_Single = { } return message; }, + fromJSON(object: any): ModeInfo_Single { const message = { ...baseModeInfo_Single } as ModeInfo_Single; if (object.mode !== undefined && object.mode !== null) { @@ -933,6 +919,7 @@ export const ModeInfo_Single = { } return message; }, + fromPartial(object: DeepPartial): ModeInfo_Single { const message = { ...baseModeInfo_Single } as ModeInfo_Single; if (object.mode !== undefined && object.mode !== null) { @@ -942,6 +929,7 @@ export const ModeInfo_Single = { } return message; }, + toJSON(message: ModeInfo_Single): unknown { const obj: any = {}; message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); @@ -949,6 +937,8 @@ export const ModeInfo_Single = { }, }; +const baseModeInfo_Multi: object = {}; + export const ModeInfo_Multi = { encode(message: ModeInfo_Multi, writer: Writer = Writer.create()): Writer { if (message.bitarray !== undefined && message.bitarray !== undefined) { @@ -959,7 +949,8 @@ export const ModeInfo_Multi = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): ModeInfo_Multi { + + decode(input: Reader | Uint8Array, length?: number): ModeInfo_Multi { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; @@ -980,6 +971,7 @@ export const ModeInfo_Multi = { } return message; }, + fromJSON(object: any): ModeInfo_Multi { const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; message.modeInfos = []; @@ -995,6 +987,7 @@ export const ModeInfo_Multi = { } return message; }, + fromPartial(object: DeepPartial): ModeInfo_Multi { const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; message.modeInfos = []; @@ -1010,6 +1003,7 @@ export const ModeInfo_Multi = { } return message; }, + toJSON(message: ModeInfo_Multi): unknown { const obj: any = {}; message.bitarray !== undefined && @@ -1023,6 +1017,8 @@ export const ModeInfo_Multi = { }, }; +const baseFee: object = { gasLimit: Long.UZERO, payer: "", granter: "" }; + export const Fee = { encode(message: Fee, writer: Writer = Writer.create()): Writer { for (const v of message.amount) { @@ -1033,7 +1029,8 @@ export const Fee = { writer.uint32(34).string(message.granter); return writer; }, - decode(input: Uint8Array | Reader, length?: number): Fee { + + decode(input: Reader | Uint8Array, length?: number): Fee { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseFee } as Fee; @@ -1060,6 +1057,7 @@ export const Fee = { } return message; }, + fromJSON(object: any): Fee { const message = { ...baseFee } as Fee; message.amount = []; @@ -1085,6 +1083,7 @@ export const Fee = { } return message; }, + fromPartial(object: DeepPartial): Fee { const message = { ...baseFee } as Fee; message.amount = []; @@ -1110,6 +1109,7 @@ export const Fee = { } return message; }, + toJSON(message: Fee): unknown { const obj: any = {}; if (message.amount) { @@ -1124,15 +1124,18 @@ export const Fee = { }, }; -interface WindowBase64 { - atob(b64: string): string; - btoa(bin: string): string; -} - -const windowBase64 = (globalThis as unknown) as WindowBase64; -const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary")); -const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64")); +declare var self: any | undefined; +declare var window: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw new Error("Unable to locate global object"); +})(); +const atob: (b64: string) => string = + globalThis.atob || ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); function bytesFromBase64(b64: string): Uint8Array { const bin = atob(b64); const arr = new Uint8Array(bin.length); @@ -1142,6 +1145,8 @@ function bytesFromBase64(b64: string): Uint8Array { return arr; } +const btoa: (bin: string) => string = + globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); function base64FromBytes(arr: Uint8Array): string { const bin: string[] = []; for (let i = 0; i < arr.byteLength; ++i) { @@ -1149,7 +1154,8 @@ function base64FromBytes(arr: Uint8Array): string { } return btoa(bin.join("")); } -type Builtin = Date | Function | Uint8Array | string | number | undefined; + +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/cosmos_proto/cosmos.ts b/packages/proto-signing/src/codec/cosmos_proto/cosmos.ts index 1ef6995b..9ec67a12 100644 --- a/packages/proto-signing/src/codec/cosmos_proto/cosmos.ts +++ b/packages/proto-signing/src/codec/cosmos_proto/cosmos.ts @@ -1,3 +1,2 @@ /* eslint-disable */ - export const protobufPackage = "cosmos_proto"; diff --git a/packages/proto-signing/src/codec/gogoproto/gogo.ts b/packages/proto-signing/src/codec/gogoproto/gogo.ts index ecf800e0..3f41a047 100644 --- a/packages/proto-signing/src/codec/gogoproto/gogo.ts +++ b/packages/proto-signing/src/codec/gogoproto/gogo.ts @@ -1,3 +1,2 @@ /* eslint-disable */ - export const protobufPackage = "gogoproto"; diff --git a/packages/proto-signing/src/codec/google/protobuf/any.ts b/packages/proto-signing/src/codec/google/protobuf/any.ts index 8b24c81b..21674e20 100644 --- a/packages/proto-signing/src/codec/google/protobuf/any.ts +++ b/packages/proto-signing/src/codec/google/protobuf/any.ts @@ -1,131 +1,126 @@ /* eslint-disable */ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; + +export const protobufPackage = "google.protobuf"; /** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. + * `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. + * 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++. + * 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 foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&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". + * 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); + * } * - * 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: + * Example 3: Pack and unpack a message in Python. * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; + * 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 { + * ... * } * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } + * 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". * - * 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" - * } + * 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). + * 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: + * 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.) + * * 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. + * 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. - */ + /** Must be a valid serialized protocol buffer of the above specified type. */ value: Uint8Array; } -const baseAny: object = { - typeUrl: "", -}; - -export const protobufPackage = "google.protobuf"; +const baseAny: object = { typeUrl: "" }; export const Any = { encode(message: Any, writer: Writer = Writer.create()): Writer { @@ -133,7 +128,8 @@ export const Any = { writer.uint32(18).bytes(message.value); return writer; }, - decode(input: Uint8Array | Reader, length?: number): Any { + + decode(input: Reader | Uint8Array, length?: number): Any { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseAny } as Any; @@ -153,6 +149,7 @@ export const Any = { } return message; }, + fromJSON(object: any): Any { const message = { ...baseAny } as Any; if (object.typeUrl !== undefined && object.typeUrl !== null) { @@ -165,6 +162,7 @@ export const Any = { } return message; }, + fromPartial(object: DeepPartial): Any { const message = { ...baseAny } as Any; if (object.typeUrl !== undefined && object.typeUrl !== null) { @@ -179,6 +177,7 @@ export const Any = { } return message; }, + toJSON(message: Any): unknown { const obj: any = {}; message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); @@ -188,15 +187,18 @@ export const Any = { }, }; -interface WindowBase64 { - atob(b64: string): string; - btoa(bin: string): string; -} - -const windowBase64 = (globalThis as unknown) as WindowBase64; -const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary")); -const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64")); +declare var self: any | undefined; +declare var window: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw new Error("Unable to locate global object"); +})(); +const atob: (b64: string) => string = + globalThis.atob || ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); function bytesFromBase64(b64: string): Uint8Array { const bin = atob(b64); const arr = new Uint8Array(bin.length); @@ -206,6 +208,8 @@ function bytesFromBase64(b64: string): Uint8Array { return arr; } +const btoa: (bin: string) => string = + globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); function base64FromBytes(arr: Uint8Array): string { const bin: string[] = []; for (let i = 0; i < arr.byteLength; ++i) { @@ -213,7 +217,8 @@ function base64FromBytes(arr: Uint8Array): string { } return btoa(bin.join("")); } -type Builtin = Date | Function | Uint8Array | string | number | undefined; + +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/google/protobuf/descriptor.ts b/packages/proto-signing/src/codec/google/protobuf/descriptor.ts index 0ff4add2..3b16ece1 100644 --- a/packages/proto-signing/src/codec/google/protobuf/descriptor.ts +++ b/packages/proto-signing/src/codec/google/protobuf/descriptor.ts @@ -2,64 +2,52 @@ import * as Long from "long"; import { Writer, Reader } from "protobufjs/minimal"; +export const protobufPackage = "google.protobuf"; + /** - * The protocol compiler can output a FileDescriptorSet containing the .proto - * files it parses. + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. */ export interface FileDescriptorSet { file: FileDescriptorProto[]; } -/** - * Describes a complete .proto file. - */ +/** Describes a complete .proto file. */ export interface FileDescriptorProto { - /** - * file name, relative to root of source tree - */ + /** file name, relative to root of source tree */ name: string; - /** - * e.g. "foo", "foo.bar", etc. - */ + /** e.g. "foo", "foo.bar", etc. */ package: string; - /** - * Names of files imported by this file. - */ + /** Names of files imported by this file. */ dependency: string[]; - /** - * Indexes of the public imported files in the dependency list above. - */ + /** 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. + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. */ weakDependency: number[]; - /** - * All top-level definitions in this file. - */ + /** All top-level definitions in this file. */ messageType: DescriptorProto[]; enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; options?: FileOptions; /** - * This field contains optional information about the original source code. - * You may safely remove this entire field without harming runtime - * functionality of the descriptors -- the information is needed only by - * development tools. + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. */ sourceCodeInfo?: SourceCodeInfo; /** - * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". */ syntax: string; } -/** - * Describes a message type. - */ +/** Describes a message type. */ export interface DescriptorProto { name: string; field: FieldDescriptorProto[]; @@ -71,956 +59,147 @@ export interface DescriptorProto { options?: MessageOptions; reservedRange: DescriptorProto_ReservedRange[]; /** - * Reserved field names, which may not be used by fields in the same message. - * A given name may only be reserved once. + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. */ reservedName: string[]; } export interface DescriptorProto_ExtensionRange { - /** - * Inclusive. - */ + /** Inclusive. */ start: number; - /** - * Exclusive. - */ + /** Exclusive. */ end: number; options?: ExtensionRangeOptions; } /** - * 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. + * 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. - */ + /** Inclusive. */ start: number; - /** - * Exclusive. - */ + /** Exclusive. */ end: number; } export interface ExtensionRangeOptions { - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -/** - * Describes a field within a message. - */ +/** Describes a field within a message. */ export interface FieldDescriptorProto { name: string; number: number; label: FieldDescriptorProto_Label; /** - * If type_name is set, this need not be set. If both this and type_name - * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. */ type: FieldDescriptorProto_Type; /** - * For message and enum types, this is the name of the type. If the name - * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - * rules are used to find the type (i.e. first the nested types within this - * message are searched, then within the parent, on up to the root - * namespace). + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). */ typeName: string; /** - * For extensions, this is the name of the type being extended. It is - * resolved in the same manner as type_name. + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. */ extendee: string; /** - * For numeric types, contains the original text representation of the value. - * For booleans, "true" or "false". - * For strings, contains the default text contents (not escaped in any way). - * For bytes, contains the C escaped value. All bytes >= 128 are escaped. - * TODO(kenton): Base-64 encode? + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? */ defaultValue: string; /** - * If set, gives the index of a oneof in the containing type's oneof_decl - * list. This field is a member of that oneof. + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. */ oneofIndex: number; /** - * JSON name of this field. The value is set by protocol compiler. If the - * user has set a "json_name" option on this field, that option's value - * will be used. Otherwise, it's deduced from the field's name by converting - * it to camelCase. + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. */ jsonName: string; options?: FieldOptions; /** - * If true, this is a proto3 "optional". When a proto3 field is optional, it - * tracks presence regardless of field type. + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must be belong to a oneof to + * signal to old proto3 clients that presence is tracked for this field. This + * oneof is known as a "synthetic" oneof, and this field must be its sole + * member (each proto3 optional field gets its own synthetic oneof). Synthetic + * oneofs exist in the descriptor only, and do not generate any API. Synthetic + * oneofs must be ordered after all "real" oneofs. * - * For message fields, proto3_optional doesn't create any semantic change, - * since non-repeated message fields always track presence. However it still - * indicates the semantic detail of whether the user wrote "optional" or not. - * This can be useful for round-tripping the .proto file. For consistency we - * give message fields a synthetic oneof also, even though it is not required - * to track presence. This is especially important because the parser can't - * tell if a field is a message or an enum, so it must always create a - * synthetic oneof. + * 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`. + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. */ proto3Optional: boolean; } -/** - * Describes a oneof. - */ -export interface OneofDescriptorProto { - name: string; - options?: OneofOptions; -} - -/** - * Describes an enum type. - */ -export interface EnumDescriptorProto { - name: string; - value: EnumValueDescriptorProto[]; - options?: EnumOptions; - /** - * Range of reserved numeric values. Reserved numeric values may not be used - * by enum values in the same enum declaration. Reserved ranges may not - * overlap. - */ - reservedRange: EnumDescriptorProto_EnumReservedRange[]; - /** - * Reserved enum value names, which may not be reused. A given name may only - * be reserved once. - */ - reservedName: string[]; -} - -/** - * Range of reserved numeric values. Reserved values may not be used by - * entries in the same enum. Reserved ranges may not overlap. - * - * Note that this is distinct from DescriptorProto.ReservedRange in that it - * is inclusive such that it can appropriately represent the entire int32 - * domain. - */ -export interface EnumDescriptorProto_EnumReservedRange { - /** - * Inclusive. - */ - start: number; - /** - * Inclusive. - */ - end: number; -} - -/** - * Describes a value within an enum. - */ -export interface EnumValueDescriptorProto { - name: string; - number: number; - options?: EnumValueOptions; -} - -/** - * Describes a service. - */ -export interface ServiceDescriptorProto { - name: string; - method: MethodDescriptorProto[]; - options?: ServiceOptions; -} - -/** - * Describes a method of a service. - */ -export interface MethodDescriptorProto { - name: string; - /** - * Input and output type names. These are resolved in the same way as - * FieldDescriptorProto.type_name, but must refer to a message type. - */ - inputType: string; - outputType: string; - options?: MethodOptions; - /** - * Identifies if client streams multiple client messages - */ - clientStreaming: boolean; - /** - * Identifies if server streams multiple server messages - */ - serverStreaming: boolean; -} - -export interface FileOptions { - /** - * Sets the Java package where classes generated from this .proto will be - * placed. By default, the proto package is used, but this is often - * inappropriate because proto packages do not normally start with backwards - * domain names. - */ - javaPackage: string; - /** - * If set, all the classes from the .proto file are wrapped in a single - * outer class with the given name. This applies to both Proto1 - * (equivalent to the old "--one_java_file" option) and Proto2 (where - * a .proto always translates to a single class, but you may want to - * explicitly choose the class name). - */ - javaOuterClassname: string; - /** - * If set true, then the Java code generator will generate a separate .java - * file for each top-level message, enum, and service defined in the .proto - * file. Thus, these types will *not* be nested inside the outer class - * named by java_outer_classname. However, the outer class will still be - * generated to contain the file's getDescriptor() method as well as any - * top-level extensions defined in the file. - */ - javaMultipleFiles: boolean; - /** - * This option does nothing. - */ - javaGenerateEqualsAndHash: boolean; - /** - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. - */ - javaStringCheckUtf8: boolean; - optimizeFor: FileOptions_OptimizeMode; - /** - * Sets the Go package where structs generated from this .proto will be - * placed. If omitted, the Go package will be derived from the following: - * - The basename of the package import path, if provided. - * - Otherwise, the package statement in the .proto file, if present. - * - Otherwise, the basename of the .proto file, without extension. - */ - goPackage: string; - /** - * Should generic services be generated in each language? "Generic" services - * are not specific to any particular RPC system. They are generated by the - * main code generators in each language (without additional plugins). - * Generic services were the only kind of service generation supported by - * early versions of google.protobuf. - * - * Generic services are now considered deprecated in favor of using plugins - * that generate code specific to your particular RPC system. Therefore, - * these default to false. Old code which depends on generic services should - * explicitly set them to true. - */ - ccGenericServices: boolean; - javaGenericServices: boolean; - pyGenericServices: boolean; - phpGenericServices: boolean; - /** - * Is this file deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for everything in the file, or it will be completely ignored; in the very - * least, this is a formalization for deprecating files. - */ - deprecated: boolean; - /** - * Enables the use of arenas for the proto messages in this file. This applies - * only to generated classes for C++. - */ - ccEnableArenas: boolean; - /** - * Sets the objective c class prefix which is prepended to all objective c - * generated classes from this .proto. There is no default. - */ - objcClassPrefix: string; - /** - * Namespace for generated classes; defaults to the package. - */ - csharpNamespace: string; - /** - * By default Swift generators will take the proto package and CamelCase it - * replacing '.' with underscore and use that to prefix the types/symbols - * defined. When this options is provided, they will use this value instead - * to prefix the types/symbols defined. - */ - swiftPrefix: string; - /** - * Sets the php class prefix which is prepended to all php generated classes - * from this .proto. Default is empty. - */ - phpClassPrefix: string; - /** - * Use this option to change the namespace of php generated classes. Default - * is empty. When this option is empty, the package name will be used for - * determining the namespace. - */ - phpNamespace: string; - /** - * Use this option to change the namespace of php generated metadata classes. - * Default is empty. When this option is empty, the proto file name will be - * used for determining the namespace. - */ - phpMetadataNamespace: string; - /** - * Use this option to change the package of ruby generated classes. Default - * is empty. When this option is not set, the package name will be used for - * determining the ruby package. - */ - rubyPackage: string; - /** - * The parser stores options it doesn't recognize here. - * See the documentation for the "Options" section above. - */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface MessageOptions { - /** - * Set true to use the old proto1 MessageSet wire format for extensions. - * This is provided for backwards-compatibility with the MessageSet wire - * format. You should not use this for any other reason: It's less - * efficient, has fewer features, and is more complicated. - * - * The message must be defined exactly as follows: - * message Foo { - * option message_set_wire_format = true; - * extensions 4 to max; - * } - * Note that the message cannot have any defined fields; MessageSets only - * have extensions. - * - * All extensions of your type must be singular messages; e.g. they cannot - * be int32s, enums, or repeated messages. - * - * Because this is an option, the above two restrictions are not enforced by - * the protocol compiler. - */ - messageSetWireFormat: boolean; - /** - * Disables the generation of the standard "descriptor()" accessor, which can - * conflict with a field of the same name. This is meant to make migration - * from proto1 easier; new code should avoid fields named "descriptor". - */ - noStandardDescriptorAccessor: boolean; - /** - * Is this message deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the message, or it will be completely ignored; in the very least, - * this is a formalization for deprecating messages. - */ - deprecated: boolean; - /** - * Whether the message is an automatically generated map entry type for the - * maps field. - * - * For maps fields: - * map map_field = 1; - * The parsed descriptor looks like: - * message MapFieldEntry { - * option map_entry = true; - * optional KeyType key = 1; - * optional ValueType value = 2; - * } - * repeated MapFieldEntry map_field = 1; - * - * Implementations may choose not to generate the map_entry=true message, but - * use a native map in the target language to hold the keys and values. - * The reflection APIs in such implementations still need to work as - * if the field is a repeated message field. - * - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. - */ - mapEntry: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface FieldOptions { - /** - * The ctype option instructs the C++ code generator to use a different - * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! - */ - ctype: FieldOptions_CType; - /** - * The packed option can be enabled for repeated primitive fields to enable - * a more efficient representation on the wire. Rather than repeatedly - * writing the tag and type for each element, the entire array is encoded as - * a single length-delimited blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. - */ - packed: boolean; - /** - * The jstype option determines the JavaScript type used for values of the - * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - * is represented as JavaScript string, which avoids loss of precision that - * can happen when a large value is converted to a floating point JavaScript. - * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - * use the JavaScript "number" type. The behavior of the default option - * JS_NORMAL is implementation dependent. - * - * This option is an enum to permit additional types to be added, e.g. - * goog.math.Integer. - */ - jstype: FieldOptions_JSType; - /** - * Should this field be parsed lazily? Lazy applies only to message-type - * fields. It means that when the outer message is initially parsed, the - * inner message's contents will not be parsed but instead stored in encoded - * form. The inner message will actually be parsed when it is first accessed. - * - * This is only a hint. Implementations are free to choose whether to use - * eager or lazy parsing regardless of the value of this option. However, - * setting this option true suggests that the protocol author believes that - * using lazy parsing on this field is worth the additional bookkeeping - * overhead typically needed to implement it. - * - * This option does not affect the public interface of any generated code; - * all method signatures remain the same. Furthermore, thread-safety of the - * interface is not affected by this option; const methods remain safe to - * call from multiple threads concurrently, while non-const methods continue - * to require exclusive access. - * - * - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - */ - lazy: boolean; - /** - * Is this field deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for accessors, or it will be completely ignored; in the very least, this - * is a formalization for deprecating fields. - */ - deprecated: boolean; - /** - * For Google-internal migration only. Do not use. - */ - weak: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface OneofOptions { - /** - * 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; - /** - * Is this enum deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum, or it will be completely ignored; in the very least, this - * is a formalization for deprecating enums. - */ - deprecated: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface EnumValueOptions { - /** - * Is this enum value deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum value, or it will be completely ignored; in the very least, - * this is a formalization for deprecating enum values. - */ - deprecated: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface ServiceOptions { - /** - * Is this service deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the service, or it will be completely ignored; in the very least, - * this is a formalization for deprecating services. - */ - deprecated: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ - uninterpretedOption: UninterpretedOption[]; -} - -export interface MethodOptions { - /** - * Is this method deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the method, or it will be completely ignored; in the very least, - * this is a formalization for deprecating methods. - */ - deprecated: boolean; - idempotencyLevel: MethodOptions_IdempotencyLevel; - /** - * The parser stores options it doesn't recognize here. See above. - */ - uninterpretedOption: UninterpretedOption[]; -} - -/** - * A message representing a option the parser does not recognize. This only - * appears in options protos created by the compiler::Parser class. - * DescriptorPool resolves these when building Descriptor objects. Therefore, - * options protos in descriptor objects (e.g. returned by Descriptor::options(), - * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions - * in them. - */ -export interface UninterpretedOption { - name: UninterpretedOption_NamePart[]; - /** - * The value of the uninterpreted option, in whatever type the tokenizer - * identified it as during parsing. Exactly one of these should be set. - */ - identifierValue: string; - positiveIntValue: Long; - negativeIntValue: Long; - doubleValue: number; - stringValue: Uint8Array; - aggregateValue: string; -} - -/** - * The name of the uninterpreted option. Each string represents a segment in - * a dot-separated name. is_extension is true iff a segment represents an - * extension (denoted with parentheses in options specs in .proto files). - * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - * "foo.(bar.baz).qux". - */ -export interface UninterpretedOption_NamePart { - namePart: string; - isExtension: boolean; -} - -/** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. - */ -export interface SourceCodeInfo { - /** - * A Location identifies a piece of source code in a .proto file which - * corresponds to a particular definition. This information is intended - * to be useful to IDEs, code indexers, documentation generators, and similar - * tools. - * - * For example, say we have a file like: - * message Foo { - * optional string foo = 1; - * } - * Let's look at just the field definition: - * optional string foo = 1; - * ^ ^^ ^^ ^ ^^^ - * a bc de f ghi - * We have the following locations: - * span path represents - * [a,i) [ 4, 0, 2, 0 ] The whole field definition. - * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - * - * Notes: - * - A location may refer to a repeated field itself (i.e. not to any - * particular index within it). This is used whenever a set of elements are - * logically enclosed in a single code segment. For example, an entire - * extend block (possibly containing multiple extension definitions) will - * have an outer location whose path refers to the "extensions" repeated - * field without an index. - * - Multiple locations may have the same path. This happens when a single - * logical declaration is spread out across multiple places. The most - * obvious example is the "extend" block again -- there may be multiple - * extend blocks in the same scope, each of which will have the same path. - * - A location's span is not always a subset of its parent's span. For - * example, the "extendee" of an extension declaration appears at the - * beginning of the "extend" block and is shared by all extensions within - * the block. - * - Just because a location's span is a subset of some other location's span - * does not mean that it is a descendant. For example, a "group" defines - * both a type and a field in a single declaration. Thus, the locations - * corresponding to the type and field and their components will overlap. - * - Code which tries to interpret locations should probably be designed to - * ignore those that it doesn't understand, as more types of locations could - * be recorded in the future. - */ - location: SourceCodeInfo_Location[]; -} - -export interface SourceCodeInfo_Location { - /** - * Identifies which part of the FileDescriptorProto was defined at this - * location. - * - * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - */ - path: number[]; - /** - * Always has exactly three or four elements: start line, start column, - * end line (optional, otherwise assumed same as start line), end column. - * These are packed into a single field for efficiency. Note that line - * and column numbers are zero-based -- typically you will want to add - * 1 to each before displaying to a user. - */ - span: number[]; - /** - * If this SourceCodeInfo represents a complete declaration, these are any - * comments appearing before and after the declaration which appear to be - * attached to the declaration. - * - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * - * Examples: - * - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; - * - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. - * - * // Detached comment for corge paragraph 2. - * - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. * / - * /* Block comment attached to - * * grault. * / - * optional int32 grault = 6; - * - * // ignored detached comments. - */ - leadingComments: string; - trailingComments: string; - 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; - /** - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - */ - begin: number; - /** - * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past - * the last relevant byte (so the length of the text = end - begin). - */ - end: number; -} - -const baseFileDescriptorSet: object = {}; - -const baseFileDescriptorProto: object = { - name: "", - package: "", - dependency: "", - publicDependency: 0, - weakDependency: 0, - syntax: "", -}; - -const baseDescriptorProto: object = { - name: "", - reservedName: "", -}; - -const baseDescriptorProto_ExtensionRange: object = { - start: 0, - end: 0, -}; - -const baseDescriptorProto_ReservedRange: object = { - start: 0, - end: 0, -}; - -const baseExtensionRangeOptions: object = {}; - -const baseFieldDescriptorProto: object = { - name: "", - number: 0, - label: 1, - type: 1, - typeName: "", - extendee: "", - defaultValue: "", - oneofIndex: 0, - jsonName: "", - proto3Optional: false, -}; - -const baseOneofDescriptorProto: object = { - name: "", -}; - -const baseEnumDescriptorProto: object = { - name: "", - reservedName: "", -}; - -const baseEnumDescriptorProto_EnumReservedRange: object = { - start: 0, - end: 0, -}; - -const baseEnumValueDescriptorProto: object = { - name: "", - number: 0, -}; - -const baseServiceDescriptorProto: object = { - name: "", -}; - -const baseMethodDescriptorProto: object = { - name: "", - inputType: "", - outputType: "", - clientStreaming: false, - serverStreaming: false, -}; - -const baseFileOptions: object = { - javaPackage: "", - javaOuterClassname: "", - javaMultipleFiles: false, - javaGenerateEqualsAndHash: false, - javaStringCheckUtf8: false, - optimizeFor: 1, - goPackage: "", - ccGenericServices: false, - javaGenericServices: false, - pyGenericServices: false, - phpGenericServices: false, - deprecated: false, - ccEnableArenas: false, - objcClassPrefix: "", - csharpNamespace: "", - swiftPrefix: "", - phpClassPrefix: "", - phpNamespace: "", - phpMetadataNamespace: "", - rubyPackage: "", -}; - -const baseMessageOptions: object = { - messageSetWireFormat: false, - noStandardDescriptorAccessor: false, - deprecated: false, - mapEntry: false, -}; - -const baseFieldOptions: object = { - ctype: 0, - packed: false, - jstype: 0, - lazy: false, - deprecated: false, - weak: false, -}; - -const baseOneofOptions: object = {}; - -const baseEnumOptions: object = { - allowAlias: false, - deprecated: false, -}; - -const baseEnumValueOptions: object = { - deprecated: false, -}; - -const baseServiceOptions: object = { - deprecated: false, -}; - -const baseMethodOptions: object = { - deprecated: false, - idempotencyLevel: 0, -}; - -const baseUninterpretedOption: object = { - identifierValue: "", - positiveIntValue: Long.UZERO, - negativeIntValue: Long.ZERO, - doubleValue: 0, - aggregateValue: "", -}; - -const baseUninterpretedOption_NamePart: object = { - namePart: "", - isExtension: false, -}; - -const baseSourceCodeInfo: object = {}; - -const baseSourceCodeInfo_Location: object = { - path: 0, - span: 0, - leadingComments: "", - trailingComments: "", - leadingDetachedComments: "", -}; - -const baseGeneratedCodeInfo: object = {}; - -const baseGeneratedCodeInfo_Annotation: object = { - path: 0, - sourceFile: "", - begin: 0, - end: 0, -}; - -export const protobufPackage = "google.protobuf"; - export enum FieldDescriptorProto_Type { - /** TYPE_DOUBLE - 0 is reserved for errors. - Order is weird for historical reasons. + /** + * 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 - 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 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. */ TYPE_INT32 = 5, TYPE_FIXED64 = 6, TYPE_FIXED32 = 7, TYPE_BOOL = 8, TYPE_STRING = 9, - /** TYPE_GROUP - Tag-delimited aggregate. - Group type is deprecated and not supported in proto3. However, Proto3 - implementations should still be able to parse the group wire format and - treat group fields as unknown fields. + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. */ TYPE_GROUP = 10, - /** TYPE_MESSAGE - Length-delimited aggregate. - */ + /** TYPE_MESSAGE - Length-delimited aggregate. */ TYPE_MESSAGE = 11, - /** TYPE_BYTES - New in version 2. - */ + /** 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 - Uses ZigZag encoding. */ TYPE_SINT32 = 17, - /** TYPE_SINT64 - Uses ZigZag encoding. - */ + /** TYPE_SINT64 - Uses ZigZag encoding. */ TYPE_SINT64 = 18, UNRECOGNIZED = -1, } @@ -1132,8 +311,7 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ } export enum FieldDescriptorProto_Label { - /** LABEL_OPTIONAL - 0 is reserved for errors - */ + /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, LABEL_REQUIRED = 2, LABEL_REPEATED = 3, @@ -1171,17 +349,203 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La } } -/** Generated classes can be optimized for speed or code size. +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options?: OneofOptions; +} + +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name: string; + value: EnumValueDescriptorProto[]; + options?: EnumOptions; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; +} + +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. */ +export interface EnumDescriptorProto_EnumReservedRange { + /** Inclusive. */ + start: number; + /** Inclusive. */ + end: number; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options?: EnumValueOptions; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions; +} + +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name: string; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType: string; + outputType: string; + options?: MethodOptions; + /** Identifies if client streams multiple client messages */ + clientStreaming: boolean; + /** Identifies if server streams multiple server messages */ + serverStreaming: boolean; +} + +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage: string; + /** + * If set, all the classes from the .proto file are wrapped in a single + * outer class with the given name. This applies to both Proto1 + * (equivalent to the old "--one_java_file" option) and Proto2 (where + * a .proto always translates to a single class, but you may want to + * explicitly choose the class name). + */ + javaOuterClassname: string; + /** + * If set true, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the outer class + * named by java_outer_classname. However, the outer class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + javaMultipleFiles: boolean; + /** + * This option does nothing. + * + * @deprecated + */ + javaGenerateEqualsAndHash: boolean; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + javaStringCheckUtf8: boolean; + optimizeFor: FileOptions_OptimizeMode; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage: string; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices: boolean; + javaGenericServices: boolean; + pyGenericServices: boolean; + phpGenericServices: boolean; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated: boolean; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix: string; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace: string; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix: string; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix: string; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace: string; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace: string; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage: string; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} + +/** Generated classes can be optimized for speed or code size. */ export enum FileOptions_OptimizeMode { - /** SPEED - Generate complete code for parsing, serialization, - */ + /** SPEED - Generate complete code for parsing, serialization, */ SPEED = 1, - /** CODE_SIZE - etc. - */ + /** CODE_SIZE - etc. */ CODE_SIZE = 2, - /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. - */ + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ LITE_RUNTIME = 3, UNRECOGNIZED = -1, } @@ -1217,9 +581,145 @@ export function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode) } } -export enum FieldOptions_CType { - /** STRING - Default mode. +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. */ + messageSetWireFormat: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface FieldOptions { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + */ + ctype: FieldOptions_CType; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + */ + packed: boolean; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype: FieldOptions_JSType; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + */ + lazy: boolean; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated: boolean; + /** For Google-internal migration only. Do not use. */ + weak: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ STRING = 0, CORD = 1, STRING_PIECE = 2, @@ -1258,14 +758,11 @@ export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { } export enum FieldOptions_JSType { - /** JS_NORMAL - Use the default type. - */ + /** JS_NORMAL - Use the default type. */ JS_NORMAL = 0, - /** JS_STRING - Use JavaScript strings. - */ + /** JS_STRING - Use JavaScript strings. */ JS_STRING = 1, - /** JS_NUMBER - Use JavaScript numbers. - */ + /** JS_NUMBER - Use JavaScript numbers. */ JS_NUMBER = 2, UNRECOGNIZED = -1, } @@ -1301,17 +798,75 @@ export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { } } -/** 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 interface OneofOptions { + /** 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; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumValueOptions { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface MethodOptions { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated: boolean; + idempotencyLevel: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. */ export enum MethodOptions_IdempotencyLevel { IDEMPOTENCY_UNKNOWN = 0, - /** NO_SIDE_EFFECTS - implies idempotent - */ + /** NO_SIDE_EFFECTS - implies idempotent */ NO_SIDE_EFFECTS = 1, - /** IDEMPOTENT - idempotent, but may have side effects - */ + /** IDEMPOTENT - idempotent, but may have side effects */ IDEMPOTENT = 2, UNRECOGNIZED = -1, } @@ -1347,6 +902,218 @@ export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_Idemp } } +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue: string; + positiveIntValue: Long; + negativeIntValue: Long; + doubleValue: number; + stringValue: Uint8Array; + aggregateValue: string; +} + +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} + +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfo { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_Location[]; +} + +export interface SourceCodeInfo_Location { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. * / + * /* Block comment attached to + * * grault. * / + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments: string; + trailingComments: string; + 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; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin: number; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; +} + +const baseFileDescriptorSet: object = {}; + export const FileDescriptorSet = { encode(message: FileDescriptorSet, writer: Writer = Writer.create()): Writer { for (const v of message.file) { @@ -1354,7 +1121,8 @@ export const FileDescriptorSet = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): FileDescriptorSet { + + decode(input: Reader | Uint8Array, length?: number): FileDescriptorSet { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseFileDescriptorSet } as FileDescriptorSet; @@ -1372,6 +1140,7 @@ export const FileDescriptorSet = { } return message; }, + fromJSON(object: any): FileDescriptorSet { const message = { ...baseFileDescriptorSet } as FileDescriptorSet; message.file = []; @@ -1382,6 +1151,7 @@ export const FileDescriptorSet = { } return message; }, + fromPartial(object: DeepPartial): FileDescriptorSet { const message = { ...baseFileDescriptorSet } as FileDescriptorSet; message.file = []; @@ -1392,6 +1162,7 @@ export const FileDescriptorSet = { } return message; }, + toJSON(message: FileDescriptorSet): unknown { const obj: any = {}; if (message.file) { @@ -1403,6 +1174,15 @@ export const FileDescriptorSet = { }, }; +const baseFileDescriptorProto: object = { + name: "", + package: "", + dependency: "", + publicDependency: 0, + weakDependency: 0, + syntax: "", +}; + export const FileDescriptorProto = { encode(message: FileDescriptorProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.name); @@ -1441,7 +1221,8 @@ export const FileDescriptorProto = { writer.uint32(98).string(message.syntax); return writer; }, - decode(input: Uint8Array | Reader, length?: number): FileDescriptorProto { + + decode(input: Reader | Uint8Array, length?: number): FileDescriptorProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseFileDescriptorProto } as FileDescriptorProto; @@ -1512,6 +1293,7 @@ export const FileDescriptorProto = { } return message; }, + fromJSON(object: any): FileDescriptorProto { const message = { ...baseFileDescriptorProto } as FileDescriptorProto; message.dependency = []; @@ -1583,6 +1365,7 @@ export const FileDescriptorProto = { } return message; }, + fromPartial(object: DeepPartial): FileDescriptorProto { const message = { ...baseFileDescriptorProto } as FileDescriptorProto; message.dependency = []; @@ -1654,6 +1437,7 @@ export const FileDescriptorProto = { } return message; }, + toJSON(message: FileDescriptorProto): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); @@ -1704,6 +1488,8 @@ export const FileDescriptorProto = { }, }; +const baseDescriptorProto: object = { name: "", reservedName: "" }; + export const DescriptorProto = { encode(message: DescriptorProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.name); @@ -1736,7 +1522,8 @@ export const DescriptorProto = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): DescriptorProto { + + decode(input: Reader | Uint8Array, length?: number): DescriptorProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseDescriptorProto } as DescriptorProto; @@ -1788,6 +1575,7 @@ export const DescriptorProto = { } return message; }, + fromJSON(object: any): DescriptorProto { const message = { ...baseDescriptorProto } as DescriptorProto; message.field = []; @@ -1850,6 +1638,7 @@ export const DescriptorProto = { } return message; }, + fromPartial(object: DeepPartial): DescriptorProto { const message = { ...baseDescriptorProto } as DescriptorProto; message.field = []; @@ -1912,6 +1701,7 @@ export const DescriptorProto = { } return message; }, + toJSON(message: DescriptorProto): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); @@ -1965,6 +1755,8 @@ export const DescriptorProto = { }, }; +const baseDescriptorProto_ExtensionRange: object = { start: 0, end: 0 }; + export const DescriptorProto_ExtensionRange = { encode(message: DescriptorProto_ExtensionRange, writer: Writer = Writer.create()): Writer { writer.uint32(8).int32(message.start); @@ -1974,7 +1766,8 @@ export const DescriptorProto_ExtensionRange = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): DescriptorProto_ExtensionRange { + + decode(input: Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseDescriptorProto_ExtensionRange } as DescriptorProto_ExtensionRange; @@ -1997,6 +1790,7 @@ export const DescriptorProto_ExtensionRange = { } return message; }, + fromJSON(object: any): DescriptorProto_ExtensionRange { const message = { ...baseDescriptorProto_ExtensionRange } as DescriptorProto_ExtensionRange; if (object.start !== undefined && object.start !== null) { @@ -2016,6 +1810,7 @@ export const DescriptorProto_ExtensionRange = { } return message; }, + fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { const message = { ...baseDescriptorProto_ExtensionRange } as DescriptorProto_ExtensionRange; if (object.start !== undefined && object.start !== null) { @@ -2035,6 +1830,7 @@ export const DescriptorProto_ExtensionRange = { } return message; }, + toJSON(message: DescriptorProto_ExtensionRange): unknown { const obj: any = {}; message.start !== undefined && (obj.start = message.start); @@ -2045,13 +1841,16 @@ export const DescriptorProto_ExtensionRange = { }, }; +const baseDescriptorProto_ReservedRange: object = { start: 0, end: 0 }; + export const DescriptorProto_ReservedRange = { encode(message: DescriptorProto_ReservedRange, writer: Writer = Writer.create()): Writer { writer.uint32(8).int32(message.start); writer.uint32(16).int32(message.end); return writer; }, - decode(input: Uint8Array | Reader, length?: number): DescriptorProto_ReservedRange { + + decode(input: Reader | Uint8Array, length?: number): DescriptorProto_ReservedRange { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseDescriptorProto_ReservedRange } as DescriptorProto_ReservedRange; @@ -2071,6 +1870,7 @@ export const DescriptorProto_ReservedRange = { } return message; }, + fromJSON(object: any): DescriptorProto_ReservedRange { const message = { ...baseDescriptorProto_ReservedRange } as DescriptorProto_ReservedRange; if (object.start !== undefined && object.start !== null) { @@ -2085,6 +1885,7 @@ export const DescriptorProto_ReservedRange = { } return message; }, + fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { const message = { ...baseDescriptorProto_ReservedRange } as DescriptorProto_ReservedRange; if (object.start !== undefined && object.start !== null) { @@ -2099,6 +1900,7 @@ export const DescriptorProto_ReservedRange = { } return message; }, + toJSON(message: DescriptorProto_ReservedRange): unknown { const obj: any = {}; message.start !== undefined && (obj.start = message.start); @@ -2107,6 +1909,8 @@ export const DescriptorProto_ReservedRange = { }, }; +const baseExtensionRangeOptions: object = {}; + export const ExtensionRangeOptions = { encode(message: ExtensionRangeOptions, writer: Writer = Writer.create()): Writer { for (const v of message.uninterpretedOption) { @@ -2114,7 +1918,8 @@ export const ExtensionRangeOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): ExtensionRangeOptions { + + decode(input: Reader | Uint8Array, length?: number): ExtensionRangeOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; @@ -2132,6 +1937,7 @@ export const ExtensionRangeOptions = { } return message; }, + fromJSON(object: any): ExtensionRangeOptions { const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; message.uninterpretedOption = []; @@ -2142,6 +1948,7 @@ export const ExtensionRangeOptions = { } return message; }, + fromPartial(object: DeepPartial): ExtensionRangeOptions { const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; message.uninterpretedOption = []; @@ -2152,6 +1959,7 @@ export const ExtensionRangeOptions = { } return message; }, + toJSON(message: ExtensionRangeOptions): unknown { const obj: any = {}; if (message.uninterpretedOption) { @@ -2165,6 +1973,19 @@ export const ExtensionRangeOptions = { }, }; +const baseFieldDescriptorProto: object = { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + proto3Optional: false, +}; + export const FieldDescriptorProto = { encode(message: FieldDescriptorProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.name); @@ -2182,7 +2003,8 @@ export const FieldDescriptorProto = { writer.uint32(136).bool(message.proto3Optional); return writer; }, - decode(input: Uint8Array | Reader, length?: number): FieldDescriptorProto { + + decode(input: Reader | Uint8Array, length?: number): FieldDescriptorProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; @@ -2229,6 +2051,7 @@ export const FieldDescriptorProto = { } return message; }, + fromJSON(object: any): FieldDescriptorProto { const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2288,6 +2111,7 @@ export const FieldDescriptorProto = { } return message; }, + fromPartial(object: DeepPartial): FieldDescriptorProto { const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2347,6 +2171,7 @@ export const FieldDescriptorProto = { } return message; }, + toJSON(message: FieldDescriptorProto): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); @@ -2365,6 +2190,8 @@ export const FieldDescriptorProto = { }, }; +const baseOneofDescriptorProto: object = { name: "" }; + export const OneofDescriptorProto = { encode(message: OneofDescriptorProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.name); @@ -2373,7 +2200,8 @@ export const OneofDescriptorProto = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): OneofDescriptorProto { + + decode(input: Reader | Uint8Array, length?: number): OneofDescriptorProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; @@ -2393,6 +2221,7 @@ export const OneofDescriptorProto = { } return message; }, + fromJSON(object: any): OneofDescriptorProto { const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2407,6 +2236,7 @@ export const OneofDescriptorProto = { } return message; }, + fromPartial(object: DeepPartial): OneofDescriptorProto { const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2421,6 +2251,7 @@ export const OneofDescriptorProto = { } return message; }, + toJSON(message: OneofDescriptorProto): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); @@ -2430,6 +2261,8 @@ export const OneofDescriptorProto = { }, }; +const baseEnumDescriptorProto: object = { name: "", reservedName: "" }; + export const EnumDescriptorProto = { encode(message: EnumDescriptorProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.name); @@ -2447,7 +2280,8 @@ export const EnumDescriptorProto = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): EnumDescriptorProto { + + decode(input: Reader | Uint8Array, length?: number): EnumDescriptorProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; @@ -2479,6 +2313,7 @@ export const EnumDescriptorProto = { } return message; }, + fromJSON(object: any): EnumDescriptorProto { const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; message.value = []; @@ -2511,6 +2346,7 @@ export const EnumDescriptorProto = { } return message; }, + fromPartial(object: DeepPartial): EnumDescriptorProto { const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; message.value = []; @@ -2543,6 +2379,7 @@ export const EnumDescriptorProto = { } return message; }, + toJSON(message: EnumDescriptorProto): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); @@ -2569,13 +2406,16 @@ export const EnumDescriptorProto = { }, }; +const baseEnumDescriptorProto_EnumReservedRange: object = { start: 0, end: 0 }; + export const EnumDescriptorProto_EnumReservedRange = { encode(message: EnumDescriptorProto_EnumReservedRange, writer: Writer = Writer.create()): Writer { writer.uint32(8).int32(message.start); writer.uint32(16).int32(message.end); return writer; }, - decode(input: Uint8Array | Reader, length?: number): EnumDescriptorProto_EnumReservedRange { + + decode(input: Reader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseEnumDescriptorProto_EnumReservedRange } as EnumDescriptorProto_EnumReservedRange; @@ -2595,6 +2435,7 @@ export const EnumDescriptorProto_EnumReservedRange = { } return message; }, + fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { const message = { ...baseEnumDescriptorProto_EnumReservedRange } as EnumDescriptorProto_EnumReservedRange; if (object.start !== undefined && object.start !== null) { @@ -2609,6 +2450,7 @@ export const EnumDescriptorProto_EnumReservedRange = { } return message; }, + fromPartial( object: DeepPartial, ): EnumDescriptorProto_EnumReservedRange { @@ -2625,6 +2467,7 @@ export const EnumDescriptorProto_EnumReservedRange = { } return message; }, + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { const obj: any = {}; message.start !== undefined && (obj.start = message.start); @@ -2633,6 +2476,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, }; +const baseEnumValueDescriptorProto: object = { name: "", number: 0 }; + export const EnumValueDescriptorProto = { encode(message: EnumValueDescriptorProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.name); @@ -2642,7 +2487,8 @@ export const EnumValueDescriptorProto = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): EnumValueDescriptorProto { + + decode(input: Reader | Uint8Array, length?: number): EnumValueDescriptorProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseEnumValueDescriptorProto } as EnumValueDescriptorProto; @@ -2665,6 +2511,7 @@ export const EnumValueDescriptorProto = { } return message; }, + fromJSON(object: any): EnumValueDescriptorProto { const message = { ...baseEnumValueDescriptorProto } as EnumValueDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2684,6 +2531,7 @@ export const EnumValueDescriptorProto = { } return message; }, + fromPartial(object: DeepPartial): EnumValueDescriptorProto { const message = { ...baseEnumValueDescriptorProto } as EnumValueDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2703,6 +2551,7 @@ export const EnumValueDescriptorProto = { } return message; }, + toJSON(message: EnumValueDescriptorProto): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); @@ -2713,6 +2562,8 @@ export const EnumValueDescriptorProto = { }, }; +const baseServiceDescriptorProto: object = { name: "" }; + export const ServiceDescriptorProto = { encode(message: ServiceDescriptorProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.name); @@ -2724,7 +2575,8 @@ export const ServiceDescriptorProto = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): ServiceDescriptorProto { + + decode(input: Reader | Uint8Array, length?: number): ServiceDescriptorProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; @@ -2748,6 +2600,7 @@ export const ServiceDescriptorProto = { } return message; }, + fromJSON(object: any): ServiceDescriptorProto { const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; message.method = []; @@ -2768,6 +2621,7 @@ export const ServiceDescriptorProto = { } return message; }, + fromPartial(object: DeepPartial): ServiceDescriptorProto { const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; message.method = []; @@ -2788,6 +2642,7 @@ export const ServiceDescriptorProto = { } return message; }, + toJSON(message: ServiceDescriptorProto): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); @@ -2802,6 +2657,14 @@ export const ServiceDescriptorProto = { }, }; +const baseMethodDescriptorProto: object = { + name: "", + inputType: "", + outputType: "", + clientStreaming: false, + serverStreaming: false, +}; + export const MethodDescriptorProto = { encode(message: MethodDescriptorProto, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.name); @@ -2814,7 +2677,8 @@ export const MethodDescriptorProto = { writer.uint32(48).bool(message.serverStreaming); return writer; }, - decode(input: Uint8Array | Reader, length?: number): MethodDescriptorProto { + + decode(input: Reader | Uint8Array, length?: number): MethodDescriptorProto { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; @@ -2846,6 +2710,7 @@ export const MethodDescriptorProto = { } return message; }, + fromJSON(object: any): MethodDescriptorProto { const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2880,6 +2745,7 @@ export const MethodDescriptorProto = { } return message; }, + fromPartial(object: DeepPartial): MethodDescriptorProto { const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2914,6 +2780,7 @@ export const MethodDescriptorProto = { } return message; }, + toJSON(message: MethodDescriptorProto): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); @@ -2927,6 +2794,29 @@ export const MethodDescriptorProto = { }, }; +const baseFileOptions: object = { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + phpGenericServices: false, + deprecated: false, + ccEnableArenas: false, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", +}; + export const FileOptions = { encode(message: FileOptions, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.javaPackage); @@ -2954,7 +2844,8 @@ export const FileOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): FileOptions { + + decode(input: Reader | Uint8Array, length?: number): FileOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseFileOptions } as FileOptions; @@ -3032,6 +2923,7 @@ export const FileOptions = { } return message; }, + fromJSON(object: any): FileOptions { const message = { ...baseFileOptions } as FileOptions; message.uninterpretedOption = []; @@ -3142,6 +3034,7 @@ export const FileOptions = { } return message; }, + fromPartial(object: DeepPartial): FileOptions { const message = { ...baseFileOptions } as FileOptions; message.uninterpretedOption = []; @@ -3252,6 +3145,7 @@ export const FileOptions = { } return message; }, + toJSON(message: FileOptions): unknown { const obj: any = {}; message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); @@ -3287,6 +3181,13 @@ export const FileOptions = { }, }; +const baseMessageOptions: object = { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, +}; + export const MessageOptions = { encode(message: MessageOptions, writer: Writer = Writer.create()): Writer { writer.uint32(8).bool(message.messageSetWireFormat); @@ -3298,7 +3199,8 @@ export const MessageOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): MessageOptions { + + decode(input: Reader | Uint8Array, length?: number): MessageOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMessageOptions } as MessageOptions; @@ -3328,6 +3230,7 @@ export const MessageOptions = { } return message; }, + fromJSON(object: any): MessageOptions { const message = { ...baseMessageOptions } as MessageOptions; message.uninterpretedOption = []; @@ -3358,6 +3261,7 @@ export const MessageOptions = { } return message; }, + fromPartial(object: DeepPartial): MessageOptions { const message = { ...baseMessageOptions } as MessageOptions; message.uninterpretedOption = []; @@ -3388,6 +3292,7 @@ export const MessageOptions = { } return message; }, + toJSON(message: MessageOptions): unknown { const obj: any = {}; message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); @@ -3406,6 +3311,15 @@ export const MessageOptions = { }, }; +const baseFieldOptions: object = { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + deprecated: false, + weak: false, +}; + export const FieldOptions = { encode(message: FieldOptions, writer: Writer = Writer.create()): Writer { writer.uint32(8).int32(message.ctype); @@ -3419,7 +3333,8 @@ export const FieldOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): FieldOptions { + + decode(input: Reader | Uint8Array, length?: number): FieldOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseFieldOptions } as FieldOptions; @@ -3455,6 +3370,7 @@ export const FieldOptions = { } return message; }, + fromJSON(object: any): FieldOptions { const message = { ...baseFieldOptions } as FieldOptions; message.uninterpretedOption = []; @@ -3495,6 +3411,7 @@ export const FieldOptions = { } return message; }, + fromPartial(object: DeepPartial): FieldOptions { const message = { ...baseFieldOptions } as FieldOptions; message.uninterpretedOption = []; @@ -3535,6 +3452,7 @@ export const FieldOptions = { } return message; }, + toJSON(message: FieldOptions): unknown { const obj: any = {}; message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); @@ -3554,6 +3472,8 @@ export const FieldOptions = { }, }; +const baseOneofOptions: object = {}; + export const OneofOptions = { encode(message: OneofOptions, writer: Writer = Writer.create()): Writer { for (const v of message.uninterpretedOption) { @@ -3561,7 +3481,8 @@ export const OneofOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): OneofOptions { + + decode(input: Reader | Uint8Array, length?: number): OneofOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseOneofOptions } as OneofOptions; @@ -3579,6 +3500,7 @@ export const OneofOptions = { } return message; }, + fromJSON(object: any): OneofOptions { const message = { ...baseOneofOptions } as OneofOptions; message.uninterpretedOption = []; @@ -3589,6 +3511,7 @@ export const OneofOptions = { } return message; }, + fromPartial(object: DeepPartial): OneofOptions { const message = { ...baseOneofOptions } as OneofOptions; message.uninterpretedOption = []; @@ -3599,6 +3522,7 @@ export const OneofOptions = { } return message; }, + toJSON(message: OneofOptions): unknown { const obj: any = {}; if (message.uninterpretedOption) { @@ -3612,6 +3536,8 @@ export const OneofOptions = { }, }; +const baseEnumOptions: object = { allowAlias: false, deprecated: false }; + export const EnumOptions = { encode(message: EnumOptions, writer: Writer = Writer.create()): Writer { writer.uint32(16).bool(message.allowAlias); @@ -3621,7 +3547,8 @@ export const EnumOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): EnumOptions { + + decode(input: Reader | Uint8Array, length?: number): EnumOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseEnumOptions } as EnumOptions; @@ -3645,6 +3572,7 @@ export const EnumOptions = { } return message; }, + fromJSON(object: any): EnumOptions { const message = { ...baseEnumOptions } as EnumOptions; message.uninterpretedOption = []; @@ -3665,6 +3593,7 @@ export const EnumOptions = { } return message; }, + fromPartial(object: DeepPartial): EnumOptions { const message = { ...baseEnumOptions } as EnumOptions; message.uninterpretedOption = []; @@ -3685,6 +3614,7 @@ export const EnumOptions = { } return message; }, + toJSON(message: EnumOptions): unknown { const obj: any = {}; message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); @@ -3700,6 +3630,8 @@ export const EnumOptions = { }, }; +const baseEnumValueOptions: object = { deprecated: false }; + export const EnumValueOptions = { encode(message: EnumValueOptions, writer: Writer = Writer.create()): Writer { writer.uint32(8).bool(message.deprecated); @@ -3708,7 +3640,8 @@ export const EnumValueOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): EnumValueOptions { + + decode(input: Reader | Uint8Array, length?: number): EnumValueOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseEnumValueOptions } as EnumValueOptions; @@ -3729,6 +3662,7 @@ export const EnumValueOptions = { } return message; }, + fromJSON(object: any): EnumValueOptions { const message = { ...baseEnumValueOptions } as EnumValueOptions; message.uninterpretedOption = []; @@ -3744,6 +3678,7 @@ export const EnumValueOptions = { } return message; }, + fromPartial(object: DeepPartial): EnumValueOptions { const message = { ...baseEnumValueOptions } as EnumValueOptions; message.uninterpretedOption = []; @@ -3759,6 +3694,7 @@ export const EnumValueOptions = { } return message; }, + toJSON(message: EnumValueOptions): unknown { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -3773,6 +3709,8 @@ export const EnumValueOptions = { }, }; +const baseServiceOptions: object = { deprecated: false }; + export const ServiceOptions = { encode(message: ServiceOptions, writer: Writer = Writer.create()): Writer { writer.uint32(264).bool(message.deprecated); @@ -3781,7 +3719,8 @@ export const ServiceOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): ServiceOptions { + + decode(input: Reader | Uint8Array, length?: number): ServiceOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseServiceOptions } as ServiceOptions; @@ -3802,6 +3741,7 @@ export const ServiceOptions = { } return message; }, + fromJSON(object: any): ServiceOptions { const message = { ...baseServiceOptions } as ServiceOptions; message.uninterpretedOption = []; @@ -3817,6 +3757,7 @@ export const ServiceOptions = { } return message; }, + fromPartial(object: DeepPartial): ServiceOptions { const message = { ...baseServiceOptions } as ServiceOptions; message.uninterpretedOption = []; @@ -3832,6 +3773,7 @@ export const ServiceOptions = { } return message; }, + toJSON(message: ServiceOptions): unknown { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -3846,6 +3788,8 @@ export const ServiceOptions = { }, }; +const baseMethodOptions: object = { deprecated: false, idempotencyLevel: 0 }; + export const MethodOptions = { encode(message: MethodOptions, writer: Writer = Writer.create()): Writer { writer.uint32(264).bool(message.deprecated); @@ -3855,7 +3799,8 @@ export const MethodOptions = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): MethodOptions { + + decode(input: Reader | Uint8Array, length?: number): MethodOptions { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMethodOptions } as MethodOptions; @@ -3879,6 +3824,7 @@ export const MethodOptions = { } return message; }, + fromJSON(object: any): MethodOptions { const message = { ...baseMethodOptions } as MethodOptions; message.uninterpretedOption = []; @@ -3899,6 +3845,7 @@ export const MethodOptions = { } return message; }, + fromPartial(object: DeepPartial): MethodOptions { const message = { ...baseMethodOptions } as MethodOptions; message.uninterpretedOption = []; @@ -3919,6 +3866,7 @@ export const MethodOptions = { } return message; }, + toJSON(message: MethodOptions): unknown { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -3935,6 +3883,14 @@ export const MethodOptions = { }, }; +const baseUninterpretedOption: object = { + identifierValue: "", + positiveIntValue: Long.UZERO, + negativeIntValue: Long.ZERO, + doubleValue: 0, + aggregateValue: "", +}; + export const UninterpretedOption = { encode(message: UninterpretedOption, writer: Writer = Writer.create()): Writer { for (const v of message.name) { @@ -3948,7 +3904,8 @@ export const UninterpretedOption = { writer.uint32(66).string(message.aggregateValue); return writer; }, - decode(input: Uint8Array | Reader, length?: number): UninterpretedOption { + + decode(input: Reader | Uint8Array, length?: number): UninterpretedOption { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseUninterpretedOption } as UninterpretedOption; @@ -3984,6 +3941,7 @@ export const UninterpretedOption = { } return message; }, + fromJSON(object: any): UninterpretedOption { const message = { ...baseUninterpretedOption } as UninterpretedOption; message.name = []; @@ -4022,6 +3980,7 @@ export const UninterpretedOption = { } return message; }, + fromPartial(object: DeepPartial): UninterpretedOption { const message = { ...baseUninterpretedOption } as UninterpretedOption; message.name = []; @@ -4062,6 +4021,7 @@ export const UninterpretedOption = { } return message; }, + toJSON(message: UninterpretedOption): unknown { const obj: any = {}; if (message.name) { @@ -4084,13 +4044,16 @@ export const UninterpretedOption = { }, }; +const baseUninterpretedOption_NamePart: object = { namePart: "", isExtension: false }; + export const UninterpretedOption_NamePart = { encode(message: UninterpretedOption_NamePart, writer: Writer = Writer.create()): Writer { writer.uint32(10).string(message.namePart); writer.uint32(16).bool(message.isExtension); return writer; }, - decode(input: Uint8Array | Reader, length?: number): UninterpretedOption_NamePart { + + decode(input: Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseUninterpretedOption_NamePart } as UninterpretedOption_NamePart; @@ -4110,6 +4073,7 @@ export const UninterpretedOption_NamePart = { } return message; }, + fromJSON(object: any): UninterpretedOption_NamePart { const message = { ...baseUninterpretedOption_NamePart } as UninterpretedOption_NamePart; if (object.namePart !== undefined && object.namePart !== null) { @@ -4124,6 +4088,7 @@ export const UninterpretedOption_NamePart = { } return message; }, + fromPartial(object: DeepPartial): UninterpretedOption_NamePart { const message = { ...baseUninterpretedOption_NamePart } as UninterpretedOption_NamePart; if (object.namePart !== undefined && object.namePart !== null) { @@ -4138,6 +4103,7 @@ export const UninterpretedOption_NamePart = { } return message; }, + toJSON(message: UninterpretedOption_NamePart): unknown { const obj: any = {}; message.namePart !== undefined && (obj.namePart = message.namePart); @@ -4146,6 +4112,8 @@ export const UninterpretedOption_NamePart = { }, }; +const baseSourceCodeInfo: object = {}; + export const SourceCodeInfo = { encode(message: SourceCodeInfo, writer: Writer = Writer.create()): Writer { for (const v of message.location) { @@ -4153,7 +4121,8 @@ export const SourceCodeInfo = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): SourceCodeInfo { + + decode(input: Reader | Uint8Array, length?: number): SourceCodeInfo { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSourceCodeInfo } as SourceCodeInfo; @@ -4171,6 +4140,7 @@ export const SourceCodeInfo = { } return message; }, + fromJSON(object: any): SourceCodeInfo { const message = { ...baseSourceCodeInfo } as SourceCodeInfo; message.location = []; @@ -4181,6 +4151,7 @@ export const SourceCodeInfo = { } return message; }, + fromPartial(object: DeepPartial): SourceCodeInfo { const message = { ...baseSourceCodeInfo } as SourceCodeInfo; message.location = []; @@ -4191,6 +4162,7 @@ export const SourceCodeInfo = { } return message; }, + toJSON(message: SourceCodeInfo): unknown { const obj: any = {}; if (message.location) { @@ -4202,6 +4174,14 @@ export const SourceCodeInfo = { }, }; +const baseSourceCodeInfo_Location: object = { + path: 0, + span: 0, + leadingComments: "", + trailingComments: "", + leadingDetachedComments: "", +}; + export const SourceCodeInfo_Location = { encode(message: SourceCodeInfo_Location, writer: Writer = Writer.create()): Writer { writer.uint32(10).fork(); @@ -4221,7 +4201,8 @@ export const SourceCodeInfo_Location = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): SourceCodeInfo_Location { + + decode(input: Reader | Uint8Array, length?: number): SourceCodeInfo_Location { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseSourceCodeInfo_Location } as SourceCodeInfo_Location; @@ -4267,6 +4248,7 @@ export const SourceCodeInfo_Location = { } return message; }, + fromJSON(object: any): SourceCodeInfo_Location { const message = { ...baseSourceCodeInfo_Location } as SourceCodeInfo_Location; message.path = []; @@ -4299,6 +4281,7 @@ export const SourceCodeInfo_Location = { } return message; }, + fromPartial(object: DeepPartial): SourceCodeInfo_Location { const message = { ...baseSourceCodeInfo_Location } as SourceCodeInfo_Location; message.path = []; @@ -4331,6 +4314,7 @@ export const SourceCodeInfo_Location = { } return message; }, + toJSON(message: SourceCodeInfo_Location): unknown { const obj: any = {}; if (message.path) { @@ -4354,6 +4338,8 @@ export const SourceCodeInfo_Location = { }, }; +const baseGeneratedCodeInfo: object = {}; + export const GeneratedCodeInfo = { encode(message: GeneratedCodeInfo, writer: Writer = Writer.create()): Writer { for (const v of message.annotation) { @@ -4361,7 +4347,8 @@ export const GeneratedCodeInfo = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): GeneratedCodeInfo { + + decode(input: Reader | Uint8Array, length?: number): GeneratedCodeInfo { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; @@ -4379,6 +4366,7 @@ export const GeneratedCodeInfo = { } return message; }, + fromJSON(object: any): GeneratedCodeInfo { const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; message.annotation = []; @@ -4389,6 +4377,7 @@ export const GeneratedCodeInfo = { } return message; }, + fromPartial(object: DeepPartial): GeneratedCodeInfo { const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; message.annotation = []; @@ -4399,6 +4388,7 @@ export const GeneratedCodeInfo = { } return message; }, + toJSON(message: GeneratedCodeInfo): unknown { const obj: any = {}; if (message.annotation) { @@ -4412,6 +4402,8 @@ export const GeneratedCodeInfo = { }, }; +const baseGeneratedCodeInfo_Annotation: object = { path: 0, sourceFile: "", begin: 0, end: 0 }; + export const GeneratedCodeInfo_Annotation = { encode(message: GeneratedCodeInfo_Annotation, writer: Writer = Writer.create()): Writer { writer.uint32(10).fork(); @@ -4424,7 +4416,8 @@ export const GeneratedCodeInfo_Annotation = { writer.uint32(32).int32(message.end); return writer; }, - decode(input: Uint8Array | Reader, length?: number): GeneratedCodeInfo_Annotation { + + decode(input: Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseGeneratedCodeInfo_Annotation } as GeneratedCodeInfo_Annotation; @@ -4458,6 +4451,7 @@ export const GeneratedCodeInfo_Annotation = { } return message; }, + fromJSON(object: any): GeneratedCodeInfo_Annotation { const message = { ...baseGeneratedCodeInfo_Annotation } as GeneratedCodeInfo_Annotation; message.path = []; @@ -4483,6 +4477,7 @@ export const GeneratedCodeInfo_Annotation = { } return message; }, + fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { const message = { ...baseGeneratedCodeInfo_Annotation } as GeneratedCodeInfo_Annotation; message.path = []; @@ -4508,6 +4503,7 @@ export const GeneratedCodeInfo_Annotation = { } return message; }, + toJSON(message: GeneratedCodeInfo_Annotation): unknown { const obj: any = {}; if (message.path) { @@ -4522,15 +4518,18 @@ export const GeneratedCodeInfo_Annotation = { }, }; -interface WindowBase64 { - atob(b64: string): string; - btoa(bin: string): string; -} - -const windowBase64 = (globalThis as unknown) as WindowBase64; -const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary")); -const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64")); +declare var self: any | undefined; +declare var window: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw new Error("Unable to locate global object"); +})(); +const atob: (b64: string) => string = + globalThis.atob || ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); function bytesFromBase64(b64: string): Uint8Array { const bin = atob(b64); const arr = new Uint8Array(bin.length); @@ -4540,6 +4539,8 @@ function bytesFromBase64(b64: string): Uint8Array { return arr; } +const btoa: (bin: string) => string = + globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); function base64FromBytes(arr: Uint8Array): string { const bin: string[] = []; for (let i = 0; i < arr.byteLength; ++i) { @@ -4547,7 +4548,8 @@ function base64FromBytes(arr: Uint8Array): string { } return btoa(bin.join("")); } -type Builtin = Date | Function | Uint8Array | string | number | undefined; + +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/src/codec/tendermint/crypto/keys.ts b/packages/proto-signing/src/codec/tendermint/crypto/keys.ts index b2a42252..db6739e0 100644 --- a/packages/proto-signing/src/codec/tendermint/crypto/keys.ts +++ b/packages/proto-signing/src/codec/tendermint/crypto/keys.ts @@ -1,9 +1,10 @@ /* eslint-disable */ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; -/** - * PublicKey defines the keys available for use with Tendermint Validators - */ +export const protobufPackage = "tendermint.crypto"; + +/** PublicKey defines the keys available for use with Tendermint Validators */ export interface PublicKey { ed25519: Uint8Array | undefined; secp256k1: Uint8Array | undefined; @@ -11,8 +12,6 @@ export interface PublicKey { const basePublicKey: object = {}; -export const protobufPackage = "tendermint.crypto"; - export const PublicKey = { encode(message: PublicKey, writer: Writer = Writer.create()): Writer { if (message.ed25519 !== undefined) { @@ -23,7 +22,8 @@ export const PublicKey = { } return writer; }, - decode(input: Uint8Array | Reader, length?: number): PublicKey { + + decode(input: Reader | Uint8Array, length?: number): PublicKey { const reader = input instanceof Uint8Array ? new Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; const message = { ...basePublicKey } as PublicKey; @@ -43,6 +43,7 @@ export const PublicKey = { } return message; }, + fromJSON(object: any): PublicKey { const message = { ...basePublicKey } as PublicKey; if (object.ed25519 !== undefined && object.ed25519 !== null) { @@ -53,6 +54,7 @@ export const PublicKey = { } return message; }, + fromPartial(object: DeepPartial): PublicKey { const message = { ...basePublicKey } as PublicKey; if (object.ed25519 !== undefined && object.ed25519 !== null) { @@ -67,6 +69,7 @@ export const PublicKey = { } return message; }, + toJSON(message: PublicKey): unknown { const obj: any = {}; message.ed25519 !== undefined && @@ -77,15 +80,18 @@ export const PublicKey = { }, }; -interface WindowBase64 { - atob(b64: string): string; - btoa(bin: string): string; -} - -const windowBase64 = (globalThis as unknown) as WindowBase64; -const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary")); -const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64")); +declare var self: any | undefined; +declare var window: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") return globalThis; + if (typeof self !== "undefined") return self; + if (typeof window !== "undefined") return window; + if (typeof global !== "undefined") return global; + throw new Error("Unable to locate global object"); +})(); +const atob: (b64: string) => string = + globalThis.atob || ((b64) => globalThis.Buffer.from(b64, "base64").toString("binary")); function bytesFromBase64(b64: string): Uint8Array { const bin = atob(b64); const arr = new Uint8Array(bin.length); @@ -95,6 +101,8 @@ function bytesFromBase64(b64: string): Uint8Array { return arr; } +const btoa: (bin: string) => string = + globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64")); function base64FromBytes(arr: Uint8Array): string { const bin: string[] = []; for (let i = 0; i < arr.byteLength; ++i) { @@ -102,7 +110,8 @@ function base64FromBytes(arr: Uint8Array): string { } return btoa(bin.join("")); } -type Builtin = Date | Function | Uint8Array | string | number | undefined; + +type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/cosmos/bank/v1beta1/bank.d.ts b/packages/proto-signing/types/codec/cosmos/bank/v1beta1/bank.d.ts index 03ef38bd..5facfc64 100644 --- a/packages/proto-signing/types/codec/cosmos/bank/v1beta1/bank.d.ts +++ b/packages/proto-signing/types/codec/cosmos/bank/v1beta1/bank.d.ts @@ -1,134 +1,121 @@ import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { Writer, Reader } from "protobufjs/minimal"; -/** - * Params defines the parameters for the bank module. - */ +import * as Long from "long"; +export declare const protobufPackage = "cosmos.bank.v1beta1"; +/** Params defines the parameters for the bank module. */ export interface Params { sendEnabled: SendEnabled[]; defaultSendEnabled: boolean; } /** - * SendEnabled maps coin denom to a send_enabled status (whether a denom is - * sendable). + * SendEnabled maps coin denom to a send_enabled status (whether a denom is + * sendable). */ export interface SendEnabled { denom: string; enabled: boolean; } -/** - * Input models transaction input. - */ +/** Input models transaction input. */ export interface Input { address: string; coins: Coin[]; } -/** - * Output models transaction outputs. - */ +/** Output models transaction outputs. */ export interface Output { address: string; coins: Coin[]; } /** - * Supply represents a struct that passively keeps track of the total supply - * amounts in the network. + * Supply represents a struct that passively keeps track of the total supply + * amounts in the network. */ export interface Supply { total: Coin[]; } /** - * DenomUnit represents a struct that describes a given - * denomination unit of the basic token. + * DenomUnit represents a struct that describes a given + * denomination unit of the basic token. */ export interface DenomUnit { - /** - * denom represents the string name of the given denom unit (e.g uatom). - */ + /** denom represents the string name of the given denom unit (e.g uatom). */ denom: string; /** - * exponent represents power of 10 exponent that one must - * raise the base_denom to in order to equal the given DenomUnit's denom - * 1 denom = 1^exponent base_denom - * (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with - * exponent = 6, thus: 1 atom = 10^6 uatom). + * exponent represents power of 10 exponent that one must + * raise the base_denom to in order to equal the given DenomUnit's denom + * 1 denom = 1^exponent base_denom + * (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + * exponent = 6, thus: 1 atom = 10^6 uatom). */ exponent: number; - /** - * aliases is a list of string aliases for the given denom - */ + /** aliases is a list of string aliases for the given denom */ aliases: string[]; } /** - * Metadata represents a struct that describes - * a basic token. + * Metadata represents a struct that describes + * a basic token. */ export interface Metadata { description: string; - /** - * denom_units represents the list of DenomUnit's for a given coin - */ + /** denom_units represents the list of DenomUnit's for a given coin */ denomUnits: DenomUnit[]; - /** - * base represents the base denom (should be the DenomUnit with exponent = 0). - */ + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ base: string; /** - * display indicates the suggested denom that should be - * displayed in clients. + * display indicates the suggested denom that should be + * displayed in clients. */ display: string; } -export declare const protobufPackage = "cosmos.bank.v1beta1"; export declare const Params: { encode(message: Params, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Params; + decode(input: Reader | Uint8Array, length?: number | undefined): Params; fromJSON(object: any): Params; fromPartial(object: DeepPartial): Params; toJSON(message: Params): unknown; }; export declare const SendEnabled: { encode(message: SendEnabled, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SendEnabled; + decode(input: Reader | Uint8Array, length?: number | undefined): SendEnabled; fromJSON(object: any): SendEnabled; fromPartial(object: DeepPartial): SendEnabled; toJSON(message: SendEnabled): unknown; }; export declare const Input: { encode(message: Input, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Input; + decode(input: Reader | Uint8Array, length?: number | undefined): Input; fromJSON(object: any): Input; fromPartial(object: DeepPartial): Input; toJSON(message: Input): unknown; }; export declare const Output: { encode(message: Output, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Output; + decode(input: Reader | Uint8Array, length?: number | undefined): Output; fromJSON(object: any): Output; fromPartial(object: DeepPartial): Output; toJSON(message: Output): unknown; }; export declare const Supply: { encode(message: Supply, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Supply; + decode(input: Reader | Uint8Array, length?: number | undefined): Supply; fromJSON(object: any): Supply; fromPartial(object: DeepPartial): Supply; toJSON(message: Supply): unknown; }; export declare const DenomUnit: { encode(message: DenomUnit, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): DenomUnit; + decode(input: Reader | Uint8Array, length?: number | undefined): DenomUnit; fromJSON(object: any): DenomUnit; fromPartial(object: DeepPartial): DenomUnit; toJSON(message: DenomUnit): unknown; }; export declare const Metadata: { encode(message: Metadata, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Metadata; + decode(input: Reader | Uint8Array, length?: number | undefined): Metadata; fromJSON(object: any): Metadata; fromPartial(object: DeepPartial): Metadata; toJSON(message: Metadata): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/cosmos/bank/v1beta1/tx.d.ts b/packages/proto-signing/types/codec/cosmos/bank/v1beta1/tx.d.ts index 21343c48..32e7c9cb 100644 --- a/packages/proto-signing/types/codec/cosmos/bank/v1beta1/tx.d.ts +++ b/packages/proto-signing/types/codec/cosmos/bank/v1beta1/tx.d.ts @@ -1,40 +1,56 @@ +import { Reader, Writer } from "protobufjs/minimal"; import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { Input, Output } from "../../../cosmos/bank/v1beta1/bank"; -import { Reader, Writer } from "protobufjs/minimal"; -/** - * MsgSend represents a message to send coins from one account to another. - */ +import * as Long from "long"; +export declare const protobufPackage = "cosmos.bank.v1beta1"; +/** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { fromAddress: string; toAddress: string; amount: Coin[]; } -/** - * MsgSendResponse defines the Msg/Send response type. - */ +/** MsgSendResponse defines the Msg/Send response type. */ export interface MsgSendResponse {} -/** - * MsgMultiSend represents an arbitrary multi-in, multi-out send message. - */ +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ export interface MsgMultiSend { inputs: Input[]; outputs: Output[]; } -/** - * MsgMultiSendResponse defines the Msg/MultiSend response type. - */ +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ export interface MsgMultiSendResponse {} -/** - * Msg defines the bank Msg service. - */ +export declare const MsgSend: { + encode(message: MsgSend, writer?: Writer): Writer; + decode(input: Reader | Uint8Array, length?: number | undefined): MsgSend; + fromJSON(object: any): MsgSend; + fromPartial(object: DeepPartial): MsgSend; + toJSON(message: MsgSend): unknown; +}; +export declare const MsgSendResponse: { + encode(_: MsgSendResponse, writer?: Writer): Writer; + decode(input: Reader | Uint8Array, length?: number | undefined): MsgSendResponse; + fromJSON(_: any): MsgSendResponse; + fromPartial(_: DeepPartial): MsgSendResponse; + toJSON(_: MsgSendResponse): unknown; +}; +export declare const MsgMultiSend: { + encode(message: MsgMultiSend, writer?: Writer): Writer; + decode(input: Reader | Uint8Array, length?: number | undefined): MsgMultiSend; + fromJSON(object: any): MsgMultiSend; + fromPartial(object: DeepPartial): MsgMultiSend; + toJSON(message: MsgMultiSend): unknown; +}; +export declare const MsgMultiSendResponse: { + encode(_: MsgMultiSendResponse, writer?: Writer): Writer; + decode(input: Reader | Uint8Array, length?: number | undefined): MsgMultiSendResponse; + fromJSON(_: any): MsgMultiSendResponse; + fromPartial(_: DeepPartial): MsgMultiSendResponse; + toJSON(_: MsgMultiSendResponse): unknown; +}; +/** Msg defines the bank Msg service. */ export interface Msg { - /** - * Send defines a method for sending coins from one account to another account. - */ + /** Send defines a method for sending coins from one account to another account. */ Send(request: MsgSend): Promise; - /** - * MultiSend defines a method for sending coins from some accounts to other accounts. - */ + /** MultiSend defines a method for sending coins from some accounts to other accounts. */ MultiSend(request: MsgMultiSend): Promise; } export declare class MsgClientImpl implements Msg { @@ -46,36 +62,7 @@ export declare class MsgClientImpl implements Msg { interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } -export declare const protobufPackage = "cosmos.bank.v1beta1"; -export declare const MsgSend: { - encode(message: MsgSend, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): MsgSend; - fromJSON(object: any): MsgSend; - fromPartial(object: DeepPartial): MsgSend; - toJSON(message: MsgSend): unknown; -}; -export declare const MsgSendResponse: { - encode(_: MsgSendResponse, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): MsgSendResponse; - fromJSON(_: any): MsgSendResponse; - fromPartial(_: DeepPartial): MsgSendResponse; - toJSON(_: MsgSendResponse): unknown; -}; -export declare const MsgMultiSend: { - encode(message: MsgMultiSend, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): MsgMultiSend; - fromJSON(object: any): MsgMultiSend; - fromPartial(object: DeepPartial): MsgMultiSend; - toJSON(message: MsgMultiSend): unknown; -}; -export declare const MsgMultiSendResponse: { - encode(_: MsgMultiSendResponse, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): MsgMultiSendResponse; - fromJSON(_: any): MsgMultiSendResponse; - fromPartial(_: DeepPartial): MsgMultiSendResponse; - toJSON(_: MsgMultiSendResponse): unknown; -}; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/cosmos/base/v1beta1/coin.d.ts b/packages/proto-signing/types/codec/cosmos/base/v1beta1/coin.d.ts index 9336a029..5496ce28 100644 --- a/packages/proto-signing/types/codec/cosmos/base/v1beta1/coin.d.ts +++ b/packages/proto-signing/types/codec/cosmos/base/v1beta1/coin.d.ts @@ -1,66 +1,63 @@ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; +export declare const protobufPackage = "cosmos.base.v1beta1"; /** - * Coin defines a token with a denomination and an amount. + * 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. + * 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. + * 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. + * 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. - */ +/** IntProto defines a Protobuf wrapper around an Int object. */ export interface IntProto { int: string; } -/** - * DecProto defines a Protobuf wrapper around a Dec object. - */ +/** DecProto defines a Protobuf wrapper around a Dec object. */ export interface DecProto { dec: string; } -export declare const protobufPackage = "cosmos.base.v1beta1"; export declare const Coin: { encode(message: Coin, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Coin; + decode(input: Reader | Uint8Array, length?: number | undefined): Coin; fromJSON(object: any): Coin; fromPartial(object: DeepPartial): Coin; toJSON(message: Coin): unknown; }; export declare const DecCoin: { encode(message: DecCoin, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): DecCoin; + decode(input: Reader | Uint8Array, length?: number | undefined): DecCoin; fromJSON(object: any): DecCoin; fromPartial(object: DeepPartial): DecCoin; toJSON(message: DecCoin): unknown; }; export declare const IntProto: { encode(message: IntProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): IntProto; + decode(input: Reader | Uint8Array, length?: number | undefined): IntProto; fromJSON(object: any): IntProto; fromPartial(object: DeepPartial): IntProto; toJSON(message: IntProto): unknown; }; export declare const DecProto: { encode(message: DecProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): DecProto; + decode(input: Reader | Uint8Array, length?: number | undefined): DecProto; fromJSON(object: any): DecProto; fromPartial(object: DeepPartial): DecProto; toJSON(message: DecProto): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/cosmos/crypto/multisig/v1beta1/multisig.d.ts b/packages/proto-signing/types/codec/cosmos/crypto/multisig/v1beta1/multisig.d.ts index 780eed76..90489d75 100644 --- a/packages/proto-signing/types/codec/cosmos/crypto/multisig/v1beta1/multisig.d.ts +++ b/packages/proto-signing/types/codec/cosmos/crypto/multisig/v1beta1/multisig.d.ts @@ -1,38 +1,39 @@ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; +export declare const protobufPackage = "cosmos.crypto.multisig.v1beta1"; /** - * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. - * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers - * signed and with which modes. + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. */ export interface MultiSignature { signatures: Uint8Array[]; } /** - * CompactBitArray is an implementation of a space efficient bit array. - * This is used to ensure that the encoded data takes up a minimal amount of - * space after proto encoding. - * This is not thread safe, and is not intended for concurrent usage. + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. */ export interface CompactBitArray { extraBitsStored: number; elems: Uint8Array; } -export declare const protobufPackage = "cosmos.crypto.multisig.v1beta1"; export declare const MultiSignature: { encode(message: MultiSignature, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): MultiSignature; + decode(input: Reader | Uint8Array, length?: number | undefined): MultiSignature; fromJSON(object: any): MultiSignature; fromPartial(object: DeepPartial): MultiSignature; toJSON(message: MultiSignature): unknown; }; export declare const CompactBitArray: { encode(message: CompactBitArray, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): CompactBitArray; + decode(input: Reader | Uint8Array, length?: number | undefined): CompactBitArray; fromJSON(object: any): CompactBitArray; fromPartial(object: DeepPartial): CompactBitArray; toJSON(message: CompactBitArray): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/cosmos/crypto/secp256k1/keys.d.ts b/packages/proto-signing/types/codec/cosmos/crypto/secp256k1/keys.d.ts index e8e5a400..7a314db1 100644 --- a/packages/proto-signing/types/codec/cosmos/crypto/secp256k1/keys.d.ts +++ b/packages/proto-signing/types/codec/cosmos/crypto/secp256k1/keys.d.ts @@ -1,36 +1,35 @@ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; +export declare const protobufPackage = "cosmos.crypto.secp256k1"; /** - * PubKey defines a secp256k1 public key - * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte - * if the y-coordinate is the lexicographically largest of the two associated with - * the x-coordinate. Otherwise the first byte is a 0x03. - * This prefix is followed with the x-coordinate. + * PubKey defines a secp256k1 public key + * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte + * if the y-coordinate is the lexicographically largest of the two associated with + * the x-coordinate. Otherwise the first byte is a 0x03. + * This prefix is followed with the x-coordinate. */ export interface PubKey { key: Uint8Array; } -/** - * PrivKey defines a secp256k1 private key. - */ +/** PrivKey defines a secp256k1 private key. */ export interface PrivKey { key: Uint8Array; } -export declare const protobufPackage = "cosmos.crypto.secp256k1"; export declare const PubKey: { encode(message: PubKey, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): PubKey; + decode(input: Reader | Uint8Array, length?: number | undefined): PubKey; fromJSON(object: any): PubKey; fromPartial(object: DeepPartial): PubKey; toJSON(message: PubKey): unknown; }; export declare const PrivKey: { encode(message: PrivKey, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): PrivKey; + decode(input: Reader | Uint8Array, length?: number | undefined): PrivKey; fromJSON(object: any): PrivKey; fromPartial(object: DeepPartial): PrivKey; toJSON(message: PrivKey): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/cosmos/tx/signing/v1beta1/signing.d.ts b/packages/proto-signing/types/codec/cosmos/tx/signing/v1beta1/signing.d.ts index 05dfe7a3..3ab416ca 100644 --- a/packages/proto-signing/types/codec/cosmos/tx/signing/v1beta1/signing.d.ts +++ b/packages/proto-signing/types/codec/cosmos/tx/signing/v1beta1/signing.d.ts @@ -2,134 +2,113 @@ import { Any } from "../../../../google/protobuf/any"; import * as Long from "long"; import { CompactBitArray } from "../../../../cosmos/crypto/multisig/v1beta1/multisig"; import { Writer, Reader } from "protobufjs/minimal"; -/** - * SignatureDescriptors wraps multiple SignatureDescriptor's. - */ -export interface SignatureDescriptors { - /** - * signatures are the signature descriptors - */ - signatures: SignatureDescriptor[]; -} -/** - * SignatureDescriptor is a convenience type which represents the full data for - * a signature including the public key of the signer, signing modes and the - * signature itself. It is primarily used for coordinating signatures between - * clients. - */ -export interface SignatureDescriptor { - /** - * public_key is the public key of the signer - */ - publicKey?: Any; - data?: SignatureDescriptor_Data; - /** - * sequence is the sequence of the account, which describes the - * number of committed transactions signed by a given address. It is used to prevent - * replay attacks. - */ - sequence: Long; -} -/** - * Data represents signature data - */ -export interface SignatureDescriptor_Data { - /** - * single represents a single signer - */ - single?: SignatureDescriptor_Data_Single | undefined; - /** - * multi represents a multisig signer - */ - multi?: SignatureDescriptor_Data_Multi | undefined; -} -/** - * Single is the signature data for a single signer - */ -export interface SignatureDescriptor_Data_Single { - /** - * mode is the signing mode of the single signer - */ - mode: SignMode; - /** - * signature is the raw signature bytes - */ - signature: Uint8Array; -} -/** - * Multi is the signature data for a multisig public key - */ -export interface SignatureDescriptor_Data_Multi { - /** - * bitarray specifies which keys within the multisig are signing - */ - bitarray?: CompactBitArray; - /** - * signatures is the signatures of the multi-signature - */ - signatures: SignatureDescriptor_Data[]; -} export declare const protobufPackage = "cosmos.tx.signing.v1beta1"; -/** SignMode represents a signing mode with its own security guarantees. - */ +/** SignMode represents a signing mode with its own security guarantees. */ export declare enum SignMode { - /** SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - rejected - */ + /** + * SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be + * rejected + */ SIGN_MODE_UNSPECIFIED = 0, - /** SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - verified with raw bytes from Tx - */ + /** + * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + * verified with raw bytes from Tx + */ SIGN_MODE_DIRECT = 1, - /** SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some - human-readable textual representation on top of the binary representation - from SIGN_MODE_DIRECT - */ + /** + * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some + * human-readable textual representation on top of the binary representation + * from SIGN_MODE_DIRECT + */ SIGN_MODE_TEXTUAL = 2, - /** SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - Amino JSON and will be removed in the future - */ + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future + */ SIGN_MODE_LEGACY_AMINO_JSON = 127, UNRECOGNIZED = -1, } export declare function signModeFromJSON(object: any): SignMode; export declare function signModeToJSON(object: SignMode): string; +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey?: Any; + data?: SignatureDescriptor_Data; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to prevent + * replay attacks. + */ + sequence: Long; +} +/** Data represents signature data */ +export interface SignatureDescriptor_Data { + /** single represents a single signer */ + single?: SignatureDescriptor_Data_Single | undefined; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_Multi | undefined; +} +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_Single { + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** signature is the raw signature bytes */ + signature: Uint8Array; +} +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_Multi { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArray; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} export declare const SignatureDescriptors: { encode(message: SignatureDescriptors, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptors; + decode(input: Reader | Uint8Array, length?: number | undefined): SignatureDescriptors; fromJSON(object: any): SignatureDescriptors; fromPartial(object: DeepPartial): SignatureDescriptors; toJSON(message: SignatureDescriptors): unknown; }; export declare const SignatureDescriptor: { encode(message: SignatureDescriptor, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptor; + decode(input: Reader | Uint8Array, length?: number | undefined): SignatureDescriptor; fromJSON(object: any): SignatureDescriptor; fromPartial(object: DeepPartial): SignatureDescriptor; toJSON(message: SignatureDescriptor): unknown; }; export declare const SignatureDescriptor_Data: { encode(message: SignatureDescriptor_Data, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptor_Data; + decode(input: Reader | Uint8Array, length?: number | undefined): SignatureDescriptor_Data; fromJSON(object: any): SignatureDescriptor_Data; fromPartial(object: DeepPartial): SignatureDescriptor_Data; toJSON(message: SignatureDescriptor_Data): unknown; }; export declare const SignatureDescriptor_Data_Single: { encode(message: SignatureDescriptor_Data_Single, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptor_Data_Single; + decode(input: Reader | Uint8Array, length?: number | undefined): SignatureDescriptor_Data_Single; fromJSON(object: any): SignatureDescriptor_Data_Single; fromPartial(object: DeepPartial): SignatureDescriptor_Data_Single; toJSON(message: SignatureDescriptor_Data_Single): unknown; }; export declare const SignatureDescriptor_Data_Multi: { encode(message: SignatureDescriptor_Data_Multi, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptor_Data_Multi; + decode(input: Reader | Uint8Array, length?: number | undefined): SignatureDescriptor_Data_Multi; fromJSON(object: any): SignatureDescriptor_Data_Multi; fromPartial(object: DeepPartial): SignatureDescriptor_Data_Multi; toJSON(message: SignatureDescriptor_Data_Multi): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/cosmos/tx/v1beta1/tx.d.ts b/packages/proto-signing/types/codec/cosmos/tx/v1beta1/tx.d.ts index 9a65bd17..7a8057e0 100644 --- a/packages/proto-signing/types/codec/cosmos/tx/v1beta1/tx.d.ts +++ b/packages/proto-signing/types/codec/cosmos/tx/v1beta1/tx.d.ts @@ -4,293 +4,267 @@ import { SignMode } from "../../../cosmos/tx/signing/v1beta1/signing"; import { CompactBitArray } from "../../../cosmos/crypto/multisig/v1beta1/multisig"; import { Coin } from "../../../cosmos/base/v1beta1/coin"; import { Writer, Reader } from "protobufjs/minimal"; -/** - * Tx is the standard type used for broadcasting transactions. - */ +export declare const protobufPackage = "cosmos.tx.v1beta1"; +/** Tx is the standard type used for broadcasting transactions. */ export interface Tx { - /** - * body is the processable content of the transaction - */ + /** body is the processable content of the transaction */ body?: TxBody; /** - * auth_info is the authorization related content of the transaction, - * specifically signers, signer modes and fee + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee */ authInfo?: AuthInfo; /** - * signatures is a list of signatures that matches the length and order of - * AuthInfo's signer_infos to allow connecting signature meta information like - * public key and signing mode by position. + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. */ signatures: Uint8Array[]; } /** - * TxRaw is a variant of Tx that pins the signer's exact binary representation - * of body and auth_info. This is used for signing, broadcasting and - * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and - * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used - * as the transaction ID. + * TxRaw is a variant of Tx that pins the signer's exact binary representation + * of body and auth_info. This is used for signing, broadcasting and + * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and + * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used + * as the transaction ID. */ export interface TxRaw { /** - * body_bytes is a protobuf serialization of a TxBody that matches the - * representation in SignDoc. + * body_bytes is a protobuf serialization of a TxBody that matches the + * representation in SignDoc. */ bodyBytes: Uint8Array; /** - * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - * representation in SignDoc. + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. */ authInfoBytes: Uint8Array; /** - * signatures is a list of signatures that matches the length and order of - * AuthInfo's signer_infos to allow connecting signature meta information like - * public key and signing mode by position. + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. */ signatures: Uint8Array[]; } -/** - * SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. - */ +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ export interface SignDoc { /** - * body_bytes is protobuf serialization of a TxBody that matches the - * representation in TxRaw. + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. */ bodyBytes: Uint8Array; /** - * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - * representation in TxRaw. + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. */ authInfoBytes: Uint8Array; /** - * chain_id is the unique identifier of the chain this transaction targets. - * It prevents signed transactions from being used on another chain by an - * attacker + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker */ chainId: string; - /** - * account_number is the account number of the account in state - */ + /** account_number is the account number of the account in state */ accountNumber: Long; } -/** - * TxBody is the body of a transaction that all signers sign over. - */ +/** TxBody is the body of a transaction that all signers sign over. */ export interface TxBody { /** - * messages is a list of messages to be executed. The required signers of - * those messages define the number and order of elements in AuthInfo's - * signer_infos and Tx's signatures. Each required signer address is added to - * the list only the first time it occurs. - * By convention, the first required signer (usually from the first message) - * is referred to as the primary signer and pays the fee for the whole - * transaction. + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. */ messages: Any[]; - /** - * memo is any arbitrary memo to be added to the transaction - */ + /** memo is any arbitrary memo to be added to the transaction */ memo: string; /** - * timeout is the block height after which this transaction will not - * be processed by the chain + * timeout is the block height after which this transaction will not + * be processed by the chain */ timeoutHeight: Long; /** - * extension_options are arbitrary options that can be added by chains - * when the default options are not sufficient. If any of these are present - * and can't be handled, the transaction will be rejected + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected */ extensionOptions: Any[]; /** - * extension_options are arbitrary options that can be added by chains - * when the default options are not sufficient. If any of these are present - * and can't be handled, they will be ignored + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored */ nonCriticalExtensionOptions: Any[]; } /** - * AuthInfo describes the fee and signer modes that are used to sign a - * transaction. + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. */ export interface AuthInfo { /** - * signer_infos defines the signing modes for the required signers. The number - * and order of elements must match the required signers from TxBody's - * messages. The first element is the primary signer and the one which pays - * the fee. + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. */ signerInfos: SignerInfo[]; /** - * Fee is the fee and gas limit for the transaction. The first signer is the - * primary signer and the one which pays the fee. The fee can be calculated - * based on the cost of evaluating the body and doing signature verification - * of the signers. This can be estimated via simulation. + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. */ fee?: Fee; } /** - * SignerInfo describes the public key and signing mode of a single top-level - * signer. + * SignerInfo describes the public key and signing mode of a single top-level + * signer. */ export interface SignerInfo { /** - * public_key is the public key of the signer. It is optional for accounts - * that already exist in state. If unset, the verifier can use the required \ - * signer address for this position and lookup the public key. + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. */ publicKey?: Any; /** - * mode_info describes the signing mode of the signer and is a nested - * structure to support nested multisig pubkey's + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's */ modeInfo?: ModeInfo; /** - * sequence is the sequence of the account, which describes the - * number of committed transactions signed by a given address. It is used to - * prevent replay attacks. + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to + * prevent replay attacks. */ sequence: Long; } -/** - * ModeInfo describes the signing mode of a single or nested multisig signer. - */ +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ export interface ModeInfo { - /** - * single represents a single signer - */ + /** single represents a single signer */ single?: ModeInfo_Single | undefined; - /** - * multi represents a nested multisig signer - */ + /** multi represents a nested multisig signer */ multi?: ModeInfo_Multi | undefined; } /** - * Single is the mode info for a single signer. It is structured as a message - * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the - * future + * Single is the mode info for a single signer. It is structured as a message + * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + * future */ export interface ModeInfo_Single { - /** - * mode is the signing mode of the single signer - */ + /** mode is the signing mode of the single signer */ mode: SignMode; } -/** - * Multi is the mode info for a multisig public key - */ +/** Multi is the mode info for a multisig public key */ export interface ModeInfo_Multi { - /** - * bitarray specifies which keys within the multisig are signing - */ + /** bitarray specifies which keys within the multisig are signing */ bitarray?: CompactBitArray; /** - * mode_infos is the corresponding modes of the signers of the multisig - * which could include nested multisig public keys + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys */ modeInfos: ModeInfo[]; } /** - * Fee includes the amount of coins paid in fees and the maximum - * gas to be used by the transaction. The ratio yields an effective "gasprice", - * which must be above some miminum to be accepted into the mempool. + * Fee includes the amount of coins paid in fees and the maximum + * gas to be used by the transaction. The ratio yields an effective "gasprice", + * which must be above some miminum to be accepted into the mempool. */ export interface Fee { - /** - * amount is the amount of coins to be paid as a fee - */ + /** amount is the amount of coins to be paid as a fee */ amount: Coin[]; /** - * gas_limit is the maximum gas that can be used in transaction processing - * before an out of gas error occurs + * gas_limit is the maximum gas that can be used in transaction processing + * before an out of gas error occurs */ gasLimit: Long; /** - * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - * the payer must be a tx signer (and thus have signed this field in AuthInfo). - * setting this field does *not* change the ordering of required signers for the transaction. + * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + * the payer must be a tx signer (and thus have signed this field in AuthInfo). + * setting this field does *not* change the ordering of required signers for the transaction. */ payer: string; /** - * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - * not support fee grants, this will fail + * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + * not support fee grants, this will fail */ granter: string; } -export declare const protobufPackage = "cosmos.tx.v1beta1"; export declare const Tx: { encode(message: Tx, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Tx; + decode(input: Reader | Uint8Array, length?: number | undefined): Tx; fromJSON(object: any): Tx; fromPartial(object: DeepPartial): Tx; toJSON(message: Tx): unknown; }; export declare const TxRaw: { encode(message: TxRaw, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): TxRaw; + decode(input: Reader | Uint8Array, length?: number | undefined): TxRaw; fromJSON(object: any): TxRaw; fromPartial(object: DeepPartial): TxRaw; toJSON(message: TxRaw): unknown; }; export declare const SignDoc: { encode(message: SignDoc, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SignDoc; + decode(input: Reader | Uint8Array, length?: number | undefined): SignDoc; fromJSON(object: any): SignDoc; fromPartial(object: DeepPartial): SignDoc; toJSON(message: SignDoc): unknown; }; export declare const TxBody: { encode(message: TxBody, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): TxBody; + decode(input: Reader | Uint8Array, length?: number | undefined): TxBody; fromJSON(object: any): TxBody; fromPartial(object: DeepPartial): TxBody; toJSON(message: TxBody): unknown; }; export declare const AuthInfo: { encode(message: AuthInfo, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): AuthInfo; + decode(input: Reader | Uint8Array, length?: number | undefined): AuthInfo; fromJSON(object: any): AuthInfo; fromPartial(object: DeepPartial): AuthInfo; toJSON(message: AuthInfo): unknown; }; export declare const SignerInfo: { encode(message: SignerInfo, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SignerInfo; + decode(input: Reader | Uint8Array, length?: number | undefined): SignerInfo; fromJSON(object: any): SignerInfo; fromPartial(object: DeepPartial): SignerInfo; toJSON(message: SignerInfo): unknown; }; export declare const ModeInfo: { encode(message: ModeInfo, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): ModeInfo; + decode(input: Reader | Uint8Array, length?: number | undefined): ModeInfo; fromJSON(object: any): ModeInfo; fromPartial(object: DeepPartial): ModeInfo; toJSON(message: ModeInfo): unknown; }; export declare const ModeInfo_Single: { encode(message: ModeInfo_Single, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): ModeInfo_Single; + decode(input: Reader | Uint8Array, length?: number | undefined): ModeInfo_Single; fromJSON(object: any): ModeInfo_Single; fromPartial(object: DeepPartial): ModeInfo_Single; toJSON(message: ModeInfo_Single): unknown; }; export declare const ModeInfo_Multi: { encode(message: ModeInfo_Multi, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): ModeInfo_Multi; + decode(input: Reader | Uint8Array, length?: number | undefined): ModeInfo_Multi; fromJSON(object: any): ModeInfo_Multi; fromPartial(object: DeepPartial): ModeInfo_Multi; toJSON(message: ModeInfo_Multi): unknown; }; export declare const Fee: { encode(message: Fee, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Fee; + decode(input: Reader | Uint8Array, length?: number | undefined): Fee; fromJSON(object: any): Fee; fromPartial(object: DeepPartial): Fee; toJSON(message: Fee): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/google/protobuf/any.d.ts b/packages/proto-signing/types/codec/google/protobuf/any.d.ts index 75353dac..ca2efa98 100644 --- a/packages/proto-signing/types/codec/google/protobuf/any.d.ts +++ b/packages/proto-signing/types/codec/google/protobuf/any.d.ts @@ -1,132 +1,129 @@ import { Writer, Reader } from "protobufjs/minimal"; +import * as Long from "long"; +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. + * `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. + * 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++. + * 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 foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&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". + * 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); + * } * - * 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: + * Example 3: Pack and unpack a message in Python. * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; + * 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 { + * ... * } * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } + * 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". * - * 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" - * } + * 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). + * 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: + * 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.) + * * 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. + * 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. - */ + /** Must be a valid serialized protocol buffer of the above specified type. */ value: Uint8Array; } -export declare const protobufPackage = "google.protobuf"; export declare const Any: { encode(message: Any, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): Any; + decode(input: Reader | Uint8Array, length?: number | undefined): Any; fromJSON(object: any): Any; fromPartial(object: DeepPartial): Any; toJSON(message: Any): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/google/protobuf/descriptor.d.ts b/packages/proto-signing/types/codec/google/protobuf/descriptor.d.ts index 8f16042e..0f92cf5e 100644 --- a/packages/proto-signing/types/codec/google/protobuf/descriptor.d.ts +++ b/packages/proto-signing/types/codec/google/protobuf/descriptor.d.ts @@ -1,61 +1,48 @@ import * as Long from "long"; import { Writer, Reader } from "protobufjs/minimal"; +export declare const protobufPackage = "google.protobuf"; /** - * The protocol compiler can output a FileDescriptorSet containing the .proto - * files it parses. + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. */ export interface FileDescriptorSet { file: FileDescriptorProto[]; } -/** - * Describes a complete .proto file. - */ +/** Describes a complete .proto file. */ export interface FileDescriptorProto { - /** - * file name, relative to root of source tree - */ + /** file name, relative to root of source tree */ name: string; - /** - * e.g. "foo", "foo.bar", etc. - */ + /** e.g. "foo", "foo.bar", etc. */ package: string; - /** - * Names of files imported by this file. - */ + /** Names of files imported by this file. */ dependency: string[]; - /** - * Indexes of the public imported files in the dependency list above. - */ + /** 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. + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. */ weakDependency: number[]; - /** - * All top-level definitions in this file. - */ + /** All top-level definitions in this file. */ messageType: DescriptorProto[]; enumType: EnumDescriptorProto[]; service: ServiceDescriptorProto[]; extension: FieldDescriptorProto[]; options?: FileOptions; /** - * This field contains optional information about the original source code. - * You may safely remove this entire field without harming runtime - * functionality of the descriptors -- the information is needed only by - * development tools. + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. */ sourceCodeInfo?: SourceCodeInfo; /** - * The syntax of the proto file. - * The supported values are "proto2" and "proto3". + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". */ syntax: string; } -/** - * Describes a message type. - */ +/** Describes a message type. */ export interface DescriptorProto { name: string; field: FieldDescriptorProto[]; @@ -67,533 +54,588 @@ export interface DescriptorProto { options?: MessageOptions; reservedRange: DescriptorProto_ReservedRange[]; /** - * Reserved field names, which may not be used by fields in the same message. - * A given name may only be reserved once. + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. */ reservedName: string[]; } export interface DescriptorProto_ExtensionRange { - /** - * Inclusive. - */ + /** Inclusive. */ start: number; - /** - * Exclusive. - */ + /** Exclusive. */ end: number; options?: ExtensionRangeOptions; } /** - * 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. + * 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. - */ + /** Inclusive. */ start: number; - /** - * Exclusive. - */ + /** Exclusive. */ end: number; } export interface ExtensionRangeOptions { - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } -/** - * Describes a field within a message. - */ +/** Describes a field within a message. */ export interface FieldDescriptorProto { name: string; number: number; label: FieldDescriptorProto_Label; /** - * If type_name is set, this need not be set. If both this and type_name - * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. */ type: FieldDescriptorProto_Type; /** - * For message and enum types, this is the name of the type. If the name - * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - * rules are used to find the type (i.e. first the nested types within this - * message are searched, then within the parent, on up to the root - * namespace). + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). */ typeName: string; /** - * For extensions, this is the name of the type being extended. It is - * resolved in the same manner as type_name. + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. */ extendee: string; /** - * For numeric types, contains the original text representation of the value. - * For booleans, "true" or "false". - * For strings, contains the default text contents (not escaped in any way). - * For bytes, contains the C escaped value. All bytes >= 128 are escaped. - * TODO(kenton): Base-64 encode? + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? */ defaultValue: string; /** - * If set, gives the index of a oneof in the containing type's oneof_decl - * list. This field is a member of that oneof. + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. */ oneofIndex: number; /** - * JSON name of this field. The value is set by protocol compiler. If the - * user has set a "json_name" option on this field, that option's value - * will be used. Otherwise, it's deduced from the field's name by converting - * it to camelCase. + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. */ jsonName: string; options?: FieldOptions; /** - * If true, this is a proto3 "optional". When a proto3 field is optional, it - * tracks presence regardless of field type. + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must be belong to a oneof to + * signal to old proto3 clients that presence is tracked for this field. This + * oneof is known as a "synthetic" oneof, and this field must be its sole + * member (each proto3 optional field gets its own synthetic oneof). Synthetic + * oneofs exist in the descriptor only, and do not generate any API. Synthetic + * oneofs must be ordered after all "real" oneofs. * - * For message fields, proto3_optional doesn't create any semantic change, - * since non-repeated message fields always track presence. However it still - * indicates the semantic detail of whether the user wrote "optional" or not. - * This can be useful for round-tripping the .proto file. For consistency we - * give message fields a synthetic oneof also, even though it is not required - * to track presence. This is especially important because the parser can't - * tell if a field is a message or an enum, so it must always create a - * synthetic oneof. + * 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`. + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. */ proto3Optional: boolean; } -/** - * Describes a oneof. - */ +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 in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} +export 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_REQUIRED = 2, + LABEL_REPEATED = 3, + 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; options?: OneofOptions; } -/** - * Describes an enum type. - */ +/** Describes an enum type. */ export interface EnumDescriptorProto { name: string; value: EnumValueDescriptorProto[]; options?: EnumOptions; /** - * Range of reserved numeric values. Reserved numeric values may not be used - * by enum values in the same enum declaration. Reserved ranges may not - * overlap. + * 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. + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. */ reservedName: string[]; } /** - * Range of reserved numeric values. Reserved values may not be used by - * entries in the same enum. Reserved ranges may not overlap. + * 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. + * 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. - */ + /** Inclusive. */ start: number; - /** - * Inclusive. - */ + /** Inclusive. */ end: number; } -/** - * Describes a value within an enum. - */ +/** Describes a value within an enum. */ export interface EnumValueDescriptorProto { name: string; number: number; options?: EnumValueOptions; } -/** - * Describes a service. - */ +/** Describes a service. */ export interface ServiceDescriptorProto { name: string; method: MethodDescriptorProto[]; options?: ServiceOptions; } -/** - * Describes a method of a service. - */ +/** Describes a method of a service. */ export interface MethodDescriptorProto { name: string; /** - * Input and output type names. These are resolved in the same way as - * FieldDescriptorProto.type_name, but must refer to a message type. + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. */ inputType: string; outputType: string; options?: MethodOptions; - /** - * Identifies if client streams multiple client messages - */ + /** Identifies if client streams multiple client messages */ clientStreaming: boolean; - /** - * Identifies if server streams multiple server messages - */ + /** Identifies if server streams multiple server messages */ serverStreaming: boolean; } export interface FileOptions { /** - * Sets the Java package where classes generated from this .proto will be - * placed. By default, the proto package is used, but this is often - * inappropriate because proto packages do not normally start with backwards - * domain names. + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. */ javaPackage: string; /** - * If set, all the classes from the .proto file are wrapped in a single - * outer class with the given name. This applies to both Proto1 - * (equivalent to the old "--one_java_file" option) and Proto2 (where - * a .proto always translates to a single class, but you may want to - * explicitly choose the class name). + * If set, all the classes from the .proto file are wrapped in a single + * outer class with the given name. This applies to both Proto1 + * (equivalent to the old "--one_java_file" option) and Proto2 (where + * a .proto always translates to a single class, but you may want to + * explicitly choose the class name). */ javaOuterClassname: string; /** - * If set true, then the Java code generator will generate a separate .java - * file for each top-level message, enum, and service defined in the .proto - * file. Thus, these types will *not* be nested inside the outer class - * named by java_outer_classname. However, the outer class will still be - * generated to contain the file's getDescriptor() method as well as any - * top-level extensions defined in the file. + * If set true, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the outer class + * named by java_outer_classname. However, the outer class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. */ javaMultipleFiles: boolean; /** - * This option does nothing. + * This option does nothing. + * + * @deprecated */ javaGenerateEqualsAndHash: boolean; /** - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. */ javaStringCheckUtf8: boolean; optimizeFor: FileOptions_OptimizeMode; /** - * Sets the Go package where structs generated from this .proto will be - * placed. If omitted, the Go package will be derived from the following: - * - The basename of the package import path, if provided. - * - Otherwise, the package statement in the .proto file, if present. - * - Otherwise, the basename of the .proto file, without extension. + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. */ goPackage: string; /** - * Should generic services be generated in each language? "Generic" services - * are not specific to any particular RPC system. They are generated by the - * main code generators in each language (without additional plugins). - * Generic services were the only kind of service generation supported by - * early versions of google.protobuf. + * 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. + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. */ ccGenericServices: boolean; javaGenericServices: boolean; pyGenericServices: boolean; phpGenericServices: boolean; /** - * Is this file deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for everything in the file, or it will be completely ignored; in the very - * least, this is a formalization for deprecating files. + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. */ deprecated: boolean; /** - * Enables the use of arenas for the proto messages in this file. This applies - * only to generated classes for C++. + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. */ ccEnableArenas: boolean; /** - * Sets the objective c class prefix which is prepended to all objective c - * generated classes from this .proto. There is no default. + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. */ objcClassPrefix: string; - /** - * Namespace for generated classes; defaults to the package. - */ + /** Namespace for generated classes; defaults to the package. */ csharpNamespace: string; /** - * By default Swift generators will take the proto package and CamelCase it - * replacing '.' with underscore and use that to prefix the types/symbols - * defined. When this options is provided, they will use this value instead - * to prefix the types/symbols defined. + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. */ swiftPrefix: string; /** - * Sets the php class prefix which is prepended to all php generated classes - * from this .proto. Default is empty. + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. */ phpClassPrefix: string; /** - * Use this option to change the namespace of php generated classes. Default - * is empty. When this option is empty, the package name will be used for - * determining the namespace. + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. */ phpNamespace: string; /** - * Use this option to change the namespace of php generated metadata classes. - * Default is empty. When this option is empty, the proto file name will be - * used for determining the namespace. + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. */ phpMetadataNamespace: string; /** - * Use this option to change the package of ruby generated classes. Default - * is empty. When this option is not set, the package name will be used for - * determining the ruby package. + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. */ rubyPackage: string; /** - * The parser stores options it doesn't recognize here. - * See the documentation for the "Options" section above. + * 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. + * 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. + * 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. + * 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. + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. */ messageSetWireFormat: boolean; /** - * Disables the generation of the standard "descriptor()" accessor, which can - * conflict with a field of the same name. This is meant to make migration - * from proto1 easier; new code should avoid fields named "descriptor". + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". */ noStandardDescriptorAccessor: boolean; /** - * Is this message deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the message, or it will be completely ignored; in the very least, - * this is a formalization for deprecating messages. + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. */ deprecated: boolean; /** - * Whether the message is an automatically generated map entry type for the - * maps field. + * 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; + * 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. + * 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. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. */ mapEntry: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface FieldOptions { /** - * The ctype option instructs the C++ code generator to use a different - * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! */ ctype: FieldOptions_CType; /** - * The packed option can be enabled for repeated primitive fields to enable - * a more efficient representation on the wire. Rather than repeatedly - * writing the tag and type for each element, the entire array is encoded as - * a single length-delimited blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. */ packed: boolean; /** - * The jstype option determines the JavaScript type used for values of the - * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - * is represented as JavaScript string, which avoids loss of precision that - * can happen when a large value is converted to a floating point JavaScript. - * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - * use the JavaScript "number" type. The behavior of the default option - * JS_NORMAL is implementation dependent. + * 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. + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. */ jstype: FieldOptions_JSType; /** - * Should this field be parsed lazily? Lazy applies only to message-type - * fields. It means that when the outer message is initially parsed, the - * inner message's contents will not be parsed but instead stored in encoded - * form. The inner message will actually be parsed when it is first accessed. + * 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 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. + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. * * - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. */ lazy: boolean; /** - * Is this field deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for accessors, or it will be completely ignored; in the very least, this - * is a formalization for deprecating fields. + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. */ deprecated: boolean; - /** - * For Google-internal migration only. Do not use. - */ + /** For Google-internal migration only. Do not use. */ weak: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export declare enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + 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; export interface OneofOptions { - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** 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. + * Set this option to true to allow mapping different tag names to the same + * value. */ allowAlias: boolean; /** - * Is this enum deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum, or it will be completely ignored; in the very least, this - * is a formalization for deprecating enums. + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. */ deprecated: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** 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. + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. */ deprecated: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { /** - * Is this service deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the service, or it will be completely ignored; in the very least, - * this is a formalization for deprecating services. + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. */ deprecated: boolean; - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** 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. + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. */ deprecated: boolean; idempotencyLevel: MethodOptions_IdempotencyLevel; - /** - * The parser stores options it doesn't recognize here. See above. - */ + /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } /** - * 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. + * 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. + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. */ identifierValue: string; positiveIntValue: Long; @@ -603,368 +645,254 @@ export interface UninterpretedOption { aggregateValue: string; } /** - * The name of the uninterpreted option. Each string represents a segment in - * a dot-separated name. is_extension is true iff a segment represents an - * extension (denoted with parentheses in options specs in .proto files). - * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - * "foo.(bar.baz).qux". + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". */ export interface UninterpretedOption_NamePart { namePart: string; isExtension: boolean; } /** - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. + * 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. + * 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). + * 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. + * 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. + * Identifies which part of the FileDescriptorProto was defined at this + * location. * - * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; * - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). + * 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. + * 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. + * 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. + * 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. + * 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. + * 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: + * Examples: * - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; + * 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. + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. * - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; * - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. * - * // Detached comment for corge paragraph 2. + * // 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; + * 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. + * // ignored detached comments. */ leadingComments: string; trailingComments: string; 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. + * 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. + * 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. + * 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. - */ + /** Identifies the filesystem path to the original source .proto. */ sourceFile: string; /** - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. */ begin: number; /** - * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past - * the last relevant byte (so the length of the text = end - begin). + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). */ end: number; } -export declare const protobufPackage = "google.protobuf"; -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 in proto3. However, Proto3 - implementations should still be able to parse the group wire format and - treat group fields as unknown fields. - */ - TYPE_GROUP = 10, - /** TYPE_MESSAGE - Length-delimited aggregate. - */ - TYPE_MESSAGE = 11, - /** TYPE_BYTES - New in version 2. - */ - TYPE_BYTES = 12, - TYPE_UINT32 = 13, - TYPE_ENUM = 14, - TYPE_SFIXED32 = 15, - TYPE_SFIXED64 = 16, - /** TYPE_SINT32 - Uses ZigZag encoding. - */ - TYPE_SINT32 = 17, - /** TYPE_SINT64 - Uses ZigZag encoding. - */ - TYPE_SINT64 = 18, - UNRECOGNIZED = -1, -} -export 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_REQUIRED = 2, - LABEL_REPEATED = 3, - UNRECOGNIZED = -1, -} -export declare function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label; -export declare function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string; -/** 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 declare enum FieldOptions_CType { - /** STRING - Default mode. - */ - STRING = 0, - 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; -/** 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; export declare const FileDescriptorSet: { encode(message: FileDescriptorSet, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): FileDescriptorSet; + decode(input: Reader | Uint8Array, length?: number | undefined): FileDescriptorSet; fromJSON(object: any): FileDescriptorSet; fromPartial(object: DeepPartial): FileDescriptorSet; toJSON(message: FileDescriptorSet): unknown; }; export declare const FileDescriptorProto: { encode(message: FileDescriptorProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): FileDescriptorProto; + decode(input: Reader | Uint8Array, length?: number | undefined): FileDescriptorProto; fromJSON(object: any): FileDescriptorProto; fromPartial(object: DeepPartial): FileDescriptorProto; toJSON(message: FileDescriptorProto): unknown; }; export declare const DescriptorProto: { encode(message: DescriptorProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): DescriptorProto; + decode(input: Reader | Uint8Array, length?: number | undefined): DescriptorProto; fromJSON(object: any): DescriptorProto; fromPartial(object: DeepPartial): DescriptorProto; toJSON(message: DescriptorProto): unknown; }; export declare const DescriptorProto_ExtensionRange: { encode(message: DescriptorProto_ExtensionRange, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): DescriptorProto_ExtensionRange; + decode(input: Reader | Uint8Array, length?: number | undefined): DescriptorProto_ExtensionRange; fromJSON(object: any): DescriptorProto_ExtensionRange; fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange; toJSON(message: DescriptorProto_ExtensionRange): unknown; }; export declare const DescriptorProto_ReservedRange: { encode(message: DescriptorProto_ReservedRange, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): DescriptorProto_ReservedRange; + decode(input: Reader | Uint8Array, length?: number | undefined): DescriptorProto_ReservedRange; fromJSON(object: any): DescriptorProto_ReservedRange; fromPartial(object: DeepPartial): DescriptorProto_ReservedRange; toJSON(message: DescriptorProto_ReservedRange): unknown; }; export declare const ExtensionRangeOptions: { encode(message: ExtensionRangeOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): ExtensionRangeOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): ExtensionRangeOptions; fromJSON(object: any): ExtensionRangeOptions; fromPartial(object: DeepPartial): ExtensionRangeOptions; toJSON(message: ExtensionRangeOptions): unknown; }; export declare const FieldDescriptorProto: { encode(message: FieldDescriptorProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): FieldDescriptorProto; + decode(input: Reader | Uint8Array, length?: number | undefined): FieldDescriptorProto; fromJSON(object: any): FieldDescriptorProto; fromPartial(object: DeepPartial): FieldDescriptorProto; toJSON(message: FieldDescriptorProto): unknown; }; export declare const OneofDescriptorProto: { encode(message: OneofDescriptorProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): OneofDescriptorProto; + decode(input: Reader | Uint8Array, length?: number | undefined): OneofDescriptorProto; fromJSON(object: any): OneofDescriptorProto; fromPartial(object: DeepPartial): OneofDescriptorProto; toJSON(message: OneofDescriptorProto): unknown; }; export declare const EnumDescriptorProto: { encode(message: EnumDescriptorProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): EnumDescriptorProto; + decode(input: Reader | Uint8Array, length?: number | undefined): EnumDescriptorProto; fromJSON(object: any): EnumDescriptorProto; fromPartial(object: DeepPartial): EnumDescriptorProto; toJSON(message: EnumDescriptorProto): unknown; }; export declare const EnumDescriptorProto_EnumReservedRange: { encode(message: EnumDescriptorProto_EnumReservedRange, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): EnumDescriptorProto_EnumReservedRange; + decode(input: Reader | Uint8Array, length?: number | undefined): EnumDescriptorProto_EnumReservedRange; fromJSON(object: any): EnumDescriptorProto_EnumReservedRange; fromPartial( object: DeepPartial, @@ -973,124 +901,124 @@ export declare const EnumDescriptorProto_EnumReservedRange: { }; export declare const EnumValueDescriptorProto: { encode(message: EnumValueDescriptorProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): EnumValueDescriptorProto; + decode(input: Reader | Uint8Array, length?: number | undefined): EnumValueDescriptorProto; fromJSON(object: any): EnumValueDescriptorProto; fromPartial(object: DeepPartial): EnumValueDescriptorProto; toJSON(message: EnumValueDescriptorProto): unknown; }; export declare const ServiceDescriptorProto: { encode(message: ServiceDescriptorProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): ServiceDescriptorProto; + decode(input: Reader | Uint8Array, length?: number | undefined): ServiceDescriptorProto; fromJSON(object: any): ServiceDescriptorProto; fromPartial(object: DeepPartial): ServiceDescriptorProto; toJSON(message: ServiceDescriptorProto): unknown; }; export declare const MethodDescriptorProto: { encode(message: MethodDescriptorProto, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): MethodDescriptorProto; + decode(input: Reader | Uint8Array, length?: number | undefined): MethodDescriptorProto; fromJSON(object: any): MethodDescriptorProto; fromPartial(object: DeepPartial): MethodDescriptorProto; toJSON(message: MethodDescriptorProto): unknown; }; export declare const FileOptions: { encode(message: FileOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): FileOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): FileOptions; fromJSON(object: any): FileOptions; fromPartial(object: DeepPartial): FileOptions; toJSON(message: FileOptions): unknown; }; export declare const MessageOptions: { encode(message: MessageOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): MessageOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): MessageOptions; fromJSON(object: any): MessageOptions; fromPartial(object: DeepPartial): MessageOptions; toJSON(message: MessageOptions): unknown; }; export declare const FieldOptions: { encode(message: FieldOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): FieldOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): FieldOptions; fromJSON(object: any): FieldOptions; fromPartial(object: DeepPartial): FieldOptions; toJSON(message: FieldOptions): unknown; }; export declare const OneofOptions: { encode(message: OneofOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): OneofOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): OneofOptions; fromJSON(object: any): OneofOptions; fromPartial(object: DeepPartial): OneofOptions; toJSON(message: OneofOptions): unknown; }; export declare const EnumOptions: { encode(message: EnumOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): EnumOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): EnumOptions; fromJSON(object: any): EnumOptions; fromPartial(object: DeepPartial): EnumOptions; toJSON(message: EnumOptions): unknown; }; export declare const EnumValueOptions: { encode(message: EnumValueOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): EnumValueOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): EnumValueOptions; fromJSON(object: any): EnumValueOptions; fromPartial(object: DeepPartial): EnumValueOptions; toJSON(message: EnumValueOptions): unknown; }; export declare const ServiceOptions: { encode(message: ServiceOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): ServiceOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): ServiceOptions; fromJSON(object: any): ServiceOptions; fromPartial(object: DeepPartial): ServiceOptions; toJSON(message: ServiceOptions): unknown; }; export declare const MethodOptions: { encode(message: MethodOptions, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): MethodOptions; + decode(input: Reader | Uint8Array, length?: number | undefined): MethodOptions; fromJSON(object: any): MethodOptions; fromPartial(object: DeepPartial): MethodOptions; toJSON(message: MethodOptions): unknown; }; export declare const UninterpretedOption: { encode(message: UninterpretedOption, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): UninterpretedOption; + decode(input: Reader | Uint8Array, length?: number | undefined): UninterpretedOption; fromJSON(object: any): UninterpretedOption; fromPartial(object: DeepPartial): UninterpretedOption; toJSON(message: UninterpretedOption): unknown; }; export declare const UninterpretedOption_NamePart: { encode(message: UninterpretedOption_NamePart, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): UninterpretedOption_NamePart; + decode(input: Reader | Uint8Array, length?: number | undefined): UninterpretedOption_NamePart; fromJSON(object: any): UninterpretedOption_NamePart; fromPartial(object: DeepPartial): UninterpretedOption_NamePart; toJSON(message: UninterpretedOption_NamePart): unknown; }; export declare const SourceCodeInfo: { encode(message: SourceCodeInfo, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SourceCodeInfo; + decode(input: Reader | Uint8Array, length?: number | undefined): SourceCodeInfo; fromJSON(object: any): SourceCodeInfo; fromPartial(object: DeepPartial): SourceCodeInfo; toJSON(message: SourceCodeInfo): unknown; }; export declare const SourceCodeInfo_Location: { encode(message: SourceCodeInfo_Location, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): SourceCodeInfo_Location; + decode(input: Reader | Uint8Array, length?: number | undefined): SourceCodeInfo_Location; fromJSON(object: any): SourceCodeInfo_Location; fromPartial(object: DeepPartial): SourceCodeInfo_Location; toJSON(message: SourceCodeInfo_Location): unknown; }; export declare const GeneratedCodeInfo: { encode(message: GeneratedCodeInfo, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): GeneratedCodeInfo; + decode(input: Reader | Uint8Array, length?: number | undefined): GeneratedCodeInfo; fromJSON(object: any): GeneratedCodeInfo; fromPartial(object: DeepPartial): GeneratedCodeInfo; toJSON(message: GeneratedCodeInfo): unknown; }; export declare const GeneratedCodeInfo_Annotation: { encode(message: GeneratedCodeInfo_Annotation, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): GeneratedCodeInfo_Annotation; + decode(input: Reader | Uint8Array, length?: number | undefined): GeneratedCodeInfo_Annotation; fromJSON(object: any): GeneratedCodeInfo_Annotation; fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation; toJSON(message: GeneratedCodeInfo_Annotation): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array diff --git a/packages/proto-signing/types/codec/tendermint/crypto/keys.d.ts b/packages/proto-signing/types/codec/tendermint/crypto/keys.d.ts index 662c0b81..d47404bf 100644 --- a/packages/proto-signing/types/codec/tendermint/crypto/keys.d.ts +++ b/packages/proto-signing/types/codec/tendermint/crypto/keys.d.ts @@ -1,20 +1,19 @@ import { Writer, Reader } from "protobufjs/minimal"; -/** - * PublicKey defines the keys available for use with Tendermint Validators - */ +import * as Long from "long"; +export declare const protobufPackage = "tendermint.crypto"; +/** PublicKey defines the keys available for use with Tendermint Validators */ export interface PublicKey { ed25519: Uint8Array | undefined; secp256k1: Uint8Array | undefined; } -export declare const protobufPackage = "tendermint.crypto"; export declare const PublicKey: { encode(message: PublicKey, writer?: Writer): Writer; - decode(input: Uint8Array | Reader, length?: number | undefined): PublicKey; + decode(input: Reader | Uint8Array, length?: number | undefined): PublicKey; fromJSON(object: any): PublicKey; fromPartial(object: DeepPartial): PublicKey; toJSON(message: PublicKey): unknown; }; -declare type Builtin = Date | Function | Uint8Array | string | number | undefined; +declare type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; export declare type DeepPartial = T extends Builtin ? T : T extends Array