stargate: Add ts-proto-generated codec

This commit is contained in:
willclarktech 2021-01-20 15:38:34 +00:00
parent 6f005798b7
commit d188182ac2
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
40 changed files with 31446 additions and 39385 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,363 @@
/* eslint-disable */
import { Any } from "../../../google/protobuf/any";
import * as Long from "long";
import { Writer, Reader } from "protobufjs/minimal";
/**
* BaseAccount defines a base account type. It contains all the necessary fields
* for basic account functionality. Any custom account type should extend this
* type for additional functionality (e.g. vesting).
*/
export interface BaseAccount {
address: string;
pubKey?: Any;
accountNumber: Long;
sequence: Long;
}
/**
* ModuleAccount defines an account for modules that holds coins on a pool.
*/
export interface ModuleAccount {
baseAccount?: BaseAccount;
name: string;
permissions: string[];
}
/**
* Params defines the parameters for the auth module.
*/
export interface Params {
maxMemoCharacters: Long;
txSigLimit: Long;
txSizeCostPerByte: Long;
sigVerifyCostEd25519: Long;
sigVerifyCostSecp256k1: Long;
}
const baseBaseAccount: object = {
address: "",
accountNumber: Long.UZERO,
sequence: Long.UZERO,
};
const baseModuleAccount: object = {
name: "",
permissions: "",
};
const baseParams: object = {
maxMemoCharacters: Long.UZERO,
txSigLimit: Long.UZERO,
txSizeCostPerByte: Long.UZERO,
sigVerifyCostEd25519: Long.UZERO,
sigVerifyCostSecp256k1: Long.UZERO,
};
export const protobufPackage = "cosmos.auth.v1beta1";
export const BaseAccount = {
encode(message: BaseAccount, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.address);
if (message.pubKey !== undefined && message.pubKey !== undefined) {
Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim();
}
writer.uint32(24).uint64(message.accountNumber);
writer.uint32(32).uint64(message.sequence);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): BaseAccount {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseBaseAccount } as BaseAccount;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
case 2:
message.pubKey = Any.decode(reader, reader.uint32());
break;
case 3:
message.accountNumber = reader.uint64() as Long;
break;
case 4:
message.sequence = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): BaseAccount {
const message = { ...baseBaseAccount } as BaseAccount;
if (object.address !== undefined && object.address !== null) {
message.address = String(object.address);
} else {
message.address = "";
}
if (object.pubKey !== undefined && object.pubKey !== null) {
message.pubKey = Any.fromJSON(object.pubKey);
} else {
message.pubKey = undefined;
}
if (object.accountNumber !== undefined && object.accountNumber !== null) {
message.accountNumber = Long.fromString(object.accountNumber);
} else {
message.accountNumber = Long.UZERO;
}
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = Long.fromString(object.sequence);
} else {
message.sequence = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<BaseAccount>): BaseAccount {
const message = { ...baseBaseAccount } as BaseAccount;
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = "";
}
if (object.pubKey !== undefined && object.pubKey !== null) {
message.pubKey = Any.fromPartial(object.pubKey);
} else {
message.pubKey = undefined;
}
if (object.accountNumber !== undefined && object.accountNumber !== null) {
message.accountNumber = object.accountNumber as Long;
} else {
message.accountNumber = Long.UZERO;
}
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = object.sequence as Long;
} else {
message.sequence = Long.UZERO;
}
return message;
},
toJSON(message: BaseAccount): unknown {
const obj: any = {};
message.address !== undefined && (obj.address = message.address);
message.pubKey !== undefined && (obj.pubKey = message.pubKey ? Any.toJSON(message.pubKey) : undefined);
message.accountNumber !== undefined &&
(obj.accountNumber = (message.accountNumber || Long.UZERO).toString());
message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString());
return obj;
},
};
export const ModuleAccount = {
encode(message: ModuleAccount, writer: Writer = Writer.create()): Writer {
if (message.baseAccount !== undefined && message.baseAccount !== undefined) {
BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim();
}
writer.uint32(18).string(message.name);
for (const v of message.permissions) {
writer.uint32(26).string(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ModuleAccount {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseModuleAccount } as ModuleAccount;
message.permissions = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.baseAccount = BaseAccount.decode(reader, reader.uint32());
break;
case 2:
message.name = reader.string();
break;
case 3:
message.permissions.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ModuleAccount {
const message = { ...baseModuleAccount } as ModuleAccount;
message.permissions = [];
if (object.baseAccount !== undefined && object.baseAccount !== null) {
message.baseAccount = BaseAccount.fromJSON(object.baseAccount);
} else {
message.baseAccount = undefined;
}
if (object.name !== undefined && object.name !== null) {
message.name = String(object.name);
} else {
message.name = "";
}
if (object.permissions !== undefined && object.permissions !== null) {
for (const e of object.permissions) {
message.permissions.push(String(e));
}
}
return message;
},
fromPartial(object: DeepPartial<ModuleAccount>): ModuleAccount {
const message = { ...baseModuleAccount } as ModuleAccount;
message.permissions = [];
if (object.baseAccount !== undefined && object.baseAccount !== null) {
message.baseAccount = BaseAccount.fromPartial(object.baseAccount);
} else {
message.baseAccount = undefined;
}
if (object.name !== undefined && object.name !== null) {
message.name = object.name;
} else {
message.name = "";
}
if (object.permissions !== undefined && object.permissions !== null) {
for (const e of object.permissions) {
message.permissions.push(e);
}
}
return message;
},
toJSON(message: ModuleAccount): unknown {
const obj: any = {};
message.baseAccount !== undefined &&
(obj.baseAccount = message.baseAccount ? BaseAccount.toJSON(message.baseAccount) : undefined);
message.name !== undefined && (obj.name = message.name);
if (message.permissions) {
obj.permissions = message.permissions.map((e) => e);
} else {
obj.permissions = [];
}
return obj;
},
};
export const Params = {
encode(message: Params, writer: Writer = Writer.create()): Writer {
writer.uint32(8).uint64(message.maxMemoCharacters);
writer.uint32(16).uint64(message.txSigLimit);
writer.uint32(24).uint64(message.txSizeCostPerByte);
writer.uint32(32).uint64(message.sigVerifyCostEd25519);
writer.uint32(40).uint64(message.sigVerifyCostSecp256k1);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Params {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseParams } as Params;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.maxMemoCharacters = reader.uint64() as Long;
break;
case 2:
message.txSigLimit = reader.uint64() as Long;
break;
case 3:
message.txSizeCostPerByte = reader.uint64() as Long;
break;
case 4:
message.sigVerifyCostEd25519 = reader.uint64() as Long;
break;
case 5:
message.sigVerifyCostSecp256k1 = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Params {
const message = { ...baseParams } as Params;
if (object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null) {
message.maxMemoCharacters = Long.fromString(object.maxMemoCharacters);
} else {
message.maxMemoCharacters = Long.UZERO;
}
if (object.txSigLimit !== undefined && object.txSigLimit !== null) {
message.txSigLimit = Long.fromString(object.txSigLimit);
} else {
message.txSigLimit = Long.UZERO;
}
if (object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null) {
message.txSizeCostPerByte = Long.fromString(object.txSizeCostPerByte);
} else {
message.txSizeCostPerByte = Long.UZERO;
}
if (object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null) {
message.sigVerifyCostEd25519 = Long.fromString(object.sigVerifyCostEd25519);
} else {
message.sigVerifyCostEd25519 = Long.UZERO;
}
if (object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null) {
message.sigVerifyCostSecp256k1 = Long.fromString(object.sigVerifyCostSecp256k1);
} else {
message.sigVerifyCostSecp256k1 = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<Params>): Params {
const message = { ...baseParams } as Params;
if (object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null) {
message.maxMemoCharacters = object.maxMemoCharacters as Long;
} else {
message.maxMemoCharacters = Long.UZERO;
}
if (object.txSigLimit !== undefined && object.txSigLimit !== null) {
message.txSigLimit = object.txSigLimit as Long;
} else {
message.txSigLimit = Long.UZERO;
}
if (object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null) {
message.txSizeCostPerByte = object.txSizeCostPerByte as Long;
} else {
message.txSizeCostPerByte = Long.UZERO;
}
if (object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null) {
message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 as Long;
} else {
message.sigVerifyCostEd25519 = Long.UZERO;
}
if (object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null) {
message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 as Long;
} else {
message.sigVerifyCostSecp256k1 = Long.UZERO;
}
return message;
},
toJSON(message: Params): unknown {
const obj: any = {};
message.maxMemoCharacters !== undefined &&
(obj.maxMemoCharacters = (message.maxMemoCharacters || Long.UZERO).toString());
message.txSigLimit !== undefined && (obj.txSigLimit = (message.txSigLimit || Long.UZERO).toString());
message.txSizeCostPerByte !== undefined &&
(obj.txSizeCostPerByte = (message.txSizeCostPerByte || Long.UZERO).toString());
message.sigVerifyCostEd25519 !== undefined &&
(obj.sigVerifyCostEd25519 = (message.sigVerifyCostEd25519 || Long.UZERO).toString());
message.sigVerifyCostSecp256k1 !== undefined &&
(obj.sigVerifyCostSecp256k1 = (message.sigVerifyCostSecp256k1 || Long.UZERO).toString());
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,279 @@
/* eslint-disable */
import { Any } from "../../../google/protobuf/any";
import { Params } from "../../../cosmos/auth/v1beta1/auth";
import { Reader, Writer } from "protobufjs/minimal";
/**
* QueryAccountRequest is the request type for the Query/Account RPC method.
*/
export interface QueryAccountRequest {
/**
* address defines the address to query for.
*/
address: string;
}
/**
* QueryAccountResponse is the response type for the Query/Account RPC method.
*/
export interface QueryAccountResponse {
/**
* account defines the account of the corresponding address.
*/
account?: Any;
}
/**
* QueryParamsRequest is the request type for the Query/Params RPC method.
*/
export interface QueryParamsRequest {}
/**
* QueryParamsResponse is the response type for the Query/Params RPC method.
*/
export interface QueryParamsResponse {
/**
* params defines the parameters of the module.
*/
params?: Params;
}
const baseQueryAccountRequest: object = {
address: "",
};
const baseQueryAccountResponse: object = {};
const baseQueryParamsRequest: object = {};
const baseQueryParamsResponse: object = {};
/**
* Query defines the gRPC querier service.
*/
export interface Query {
/**
* Account returns account details based on address.
*/
Account(request: QueryAccountRequest): Promise<QueryAccountResponse>;
/**
* Params queries all parameters.
*/
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
}
export class QueryClientImpl implements Query {
private readonly rpc: Rpc;
constructor(rpc: Rpc) {
this.rpc = rpc;
}
Account(request: QueryAccountRequest): Promise<QueryAccountResponse> {
const data = QueryAccountRequest.encode(request).finish();
const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Account", data);
return promise.then((data) => QueryAccountResponse.decode(new Reader(data)));
}
Params(request: QueryParamsRequest): Promise<QueryParamsResponse> {
const data = QueryParamsRequest.encode(request).finish();
const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Params", data);
return promise.then((data) => QueryParamsResponse.decode(new Reader(data)));
}
}
interface Rpc {
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}
export const protobufPackage = "cosmos.auth.v1beta1";
export const QueryAccountRequest = {
encode(message: QueryAccountRequest, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.address);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryAccountRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryAccountRequest } as QueryAccountRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryAccountRequest {
const message = { ...baseQueryAccountRequest } as QueryAccountRequest;
if (object.address !== undefined && object.address !== null) {
message.address = String(object.address);
} else {
message.address = "";
}
return message;
},
fromPartial(object: DeepPartial<QueryAccountRequest>): QueryAccountRequest {
const message = { ...baseQueryAccountRequest } as QueryAccountRequest;
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = "";
}
return message;
},
toJSON(message: QueryAccountRequest): unknown {
const obj: any = {};
message.address !== undefined && (obj.address = message.address);
return obj;
},
};
export const QueryAccountResponse = {
encode(message: QueryAccountResponse, writer: Writer = Writer.create()): Writer {
if (message.account !== undefined && message.account !== undefined) {
Any.encode(message.account, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryAccountResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryAccountResponse } as QueryAccountResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.account = Any.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryAccountResponse {
const message = { ...baseQueryAccountResponse } as QueryAccountResponse;
if (object.account !== undefined && object.account !== null) {
message.account = Any.fromJSON(object.account);
} else {
message.account = undefined;
}
return message;
},
fromPartial(object: DeepPartial<QueryAccountResponse>): QueryAccountResponse {
const message = { ...baseQueryAccountResponse } as QueryAccountResponse;
if (object.account !== undefined && object.account !== null) {
message.account = Any.fromPartial(object.account);
} else {
message.account = undefined;
}
return message;
},
toJSON(message: QueryAccountResponse): unknown {
const obj: any = {};
message.account !== undefined &&
(obj.account = message.account ? Any.toJSON(message.account) : undefined);
return obj;
},
};
export const QueryParamsRequest = {
encode(_: QueryParamsRequest, writer: Writer = Writer.create()): Writer {
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryParamsRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): QueryParamsRequest {
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
return message;
},
fromPartial(_: DeepPartial<QueryParamsRequest>): QueryParamsRequest {
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
return message;
},
toJSON(_: QueryParamsRequest): unknown {
const obj: any = {};
return obj;
},
};
export const QueryParamsResponse = {
encode(message: QueryParamsResponse, writer: Writer = Writer.create()): Writer {
if (message.params !== undefined && message.params !== undefined) {
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryParamsResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.params = Params.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryParamsResponse {
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
if (object.params !== undefined && object.params !== null) {
message.params = Params.fromJSON(object.params);
} else {
message.params = undefined;
}
return message;
},
fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse {
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
if (object.params !== undefined && object.params !== null) {
message.params = Params.fromPartial(object.params);
} else {
message.params = undefined;
}
return message;
},
toJSON(message: QueryParamsResponse): unknown {
const obj: any = {};
message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,650 @@
/* eslint-disable */
import { Coin } from "../../../cosmos/base/v1beta1/coin";
import { Writer, Reader } from "protobufjs/minimal";
/**
* 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).
*/
export interface SendEnabled {
denom: string;
enabled: boolean;
}
/**
* Input models transaction input.
*/
export interface Input {
address: string;
coins: Coin[];
}
/**
* 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.
*/
export interface Supply {
total: Coin[];
}
/**
* DenomUnit represents a struct that describes a given
* denomination unit of the basic token.
*/
export interface DenomUnit {
/**
* denom represents the string name of the given denom unit (e.g uatom).
*/
denom: string;
/**
* exponent represents power of 10 exponent that one must
* raise the base_denom to in order to equal the given DenomUnit's denom
* 1 denom = 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: string[];
}
/**
* Metadata represents a struct that describes
* a basic token.
*/
export interface Metadata {
description: string;
/**
* denom_units represents the list of DenomUnit's for a given coin
*/
denomUnits: DenomUnit[];
/**
* base represents the base denom (should be the DenomUnit with exponent = 0).
*/
base: string;
/**
* display indicates the suggested denom that should be
* displayed in clients.
*/
display: string;
}
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";
export const Params = {
encode(message: Params, writer: Writer = Writer.create()): Writer {
for (const v of message.sendEnabled) {
SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim();
}
writer.uint32(16).bool(message.defaultSendEnabled);
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.sendEnabled = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32()));
break;
case 2:
message.defaultSendEnabled = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Params {
const message = { ...baseParams } as Params;
message.sendEnabled = [];
if (object.sendEnabled !== undefined && object.sendEnabled !== null) {
for (const e of object.sendEnabled) {
message.sendEnabled.push(SendEnabled.fromJSON(e));
}
}
if (object.defaultSendEnabled !== undefined && object.defaultSendEnabled !== null) {
message.defaultSendEnabled = Boolean(object.defaultSendEnabled);
} else {
message.defaultSendEnabled = false;
}
return message;
},
fromPartial(object: DeepPartial<Params>): Params {
const message = { ...baseParams } as Params;
message.sendEnabled = [];
if (object.sendEnabled !== undefined && object.sendEnabled !== null) {
for (const e of object.sendEnabled) {
message.sendEnabled.push(SendEnabled.fromPartial(e));
}
}
if (object.defaultSendEnabled !== undefined && object.defaultSendEnabled !== null) {
message.defaultSendEnabled = object.defaultSendEnabled;
} else {
message.defaultSendEnabled = false;
}
return message;
},
toJSON(message: Params): unknown {
const obj: any = {};
if (message.sendEnabled) {
obj.sendEnabled = message.sendEnabled.map((e) => (e ? SendEnabled.toJSON(e) : undefined));
} else {
obj.sendEnabled = [];
}
message.defaultSendEnabled !== undefined && (obj.defaultSendEnabled = message.defaultSendEnabled);
return obj;
},
};
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 {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseSendEnabled } as SendEnabled;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.denom = reader.string();
break;
case 2:
message.enabled = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): SendEnabled {
const message = { ...baseSendEnabled } as SendEnabled;
if (object.denom !== undefined && object.denom !== null) {
message.denom = String(object.denom);
} else {
message.denom = "";
}
if (object.enabled !== undefined && object.enabled !== null) {
message.enabled = Boolean(object.enabled);
} else {
message.enabled = false;
}
return message;
},
fromPartial(object: DeepPartial<SendEnabled>): SendEnabled {
const message = { ...baseSendEnabled } as SendEnabled;
if (object.denom !== undefined && object.denom !== null) {
message.denom = object.denom;
} else {
message.denom = "";
}
if (object.enabled !== undefined && object.enabled !== null) {
message.enabled = object.enabled;
} else {
message.enabled = false;
}
return message;
},
toJSON(message: SendEnabled): unknown {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
message.enabled !== undefined && (obj.enabled = message.enabled);
return obj;
},
};
export const Input = {
encode(message: Input, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.address);
for (const v of message.coins) {
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.coins = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
case 2:
message.coins.push(Coin.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Input {
const message = { ...baseInput } as Input;
message.coins = [];
if (object.address !== undefined && object.address !== null) {
message.address = String(object.address);
} else {
message.address = "";
}
if (object.coins !== undefined && object.coins !== null) {
for (const e of object.coins) {
message.coins.push(Coin.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<Input>): Input {
const message = { ...baseInput } as Input;
message.coins = [];
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = "";
}
if (object.coins !== undefined && object.coins !== null) {
for (const e of object.coins) {
message.coins.push(Coin.fromPartial(e));
}
}
return message;
},
toJSON(message: Input): unknown {
const obj: any = {};
message.address !== undefined && (obj.address = message.address);
if (message.coins) {
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
} else {
obj.coins = [];
}
return obj;
},
};
export const Output = {
encode(message: Output, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.address);
for (const v of message.coins) {
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.coins = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
case 2:
message.coins.push(Coin.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Output {
const message = { ...baseOutput } as Output;
message.coins = [];
if (object.address !== undefined && object.address !== null) {
message.address = String(object.address);
} else {
message.address = "";
}
if (object.coins !== undefined && object.coins !== null) {
for (const e of object.coins) {
message.coins.push(Coin.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<Output>): Output {
const message = { ...baseOutput } as Output;
message.coins = [];
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = "";
}
if (object.coins !== undefined && object.coins !== null) {
for (const e of object.coins) {
message.coins.push(Coin.fromPartial(e));
}
}
return message;
},
toJSON(message: Output): unknown {
const obj: any = {};
message.address !== undefined && (obj.address = message.address);
if (message.coins) {
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
} else {
obj.coins = [];
}
return obj;
},
};
export const Supply = {
encode(message: Supply, writer: Writer = Writer.create()): Writer {
for (const v of message.total) {
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.total = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.total.push(Coin.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Supply {
const message = { ...baseSupply } as Supply;
message.total = [];
if (object.total !== undefined && object.total !== null) {
for (const e of object.total) {
message.total.push(Coin.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<Supply>): Supply {
const message = { ...baseSupply } as Supply;
message.total = [];
if (object.total !== undefined && object.total !== null) {
for (const e of object.total) {
message.total.push(Coin.fromPartial(e));
}
}
return message;
},
toJSON(message: Supply): unknown {
const obj: any = {};
if (message.total) {
obj.total = message.total.map((e) => (e ? Coin.toJSON(e) : undefined));
} else {
obj.total = [];
}
return obj;
},
};
export const DenomUnit = {
encode(message: DenomUnit, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.denom);
writer.uint32(16).uint32(message.exponent);
for (const v of message.aliases) {
writer.uint32(26).string(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.aliases = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.denom = reader.string();
break;
case 2:
message.exponent = reader.uint32();
break;
case 3:
message.aliases.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): DenomUnit {
const message = { ...baseDenomUnit } as DenomUnit;
message.aliases = [];
if (object.denom !== undefined && object.denom !== null) {
message.denom = String(object.denom);
} else {
message.denom = "";
}
if (object.exponent !== undefined && object.exponent !== null) {
message.exponent = Number(object.exponent);
} else {
message.exponent = 0;
}
if (object.aliases !== undefined && object.aliases !== null) {
for (const e of object.aliases) {
message.aliases.push(String(e));
}
}
return message;
},
fromPartial(object: DeepPartial<DenomUnit>): DenomUnit {
const message = { ...baseDenomUnit } as DenomUnit;
message.aliases = [];
if (object.denom !== undefined && object.denom !== null) {
message.denom = object.denom;
} else {
message.denom = "";
}
if (object.exponent !== undefined && object.exponent !== null) {
message.exponent = object.exponent;
} else {
message.exponent = 0;
}
if (object.aliases !== undefined && object.aliases !== null) {
for (const e of object.aliases) {
message.aliases.push(e);
}
}
return message;
},
toJSON(message: DenomUnit): unknown {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
message.exponent !== undefined && (obj.exponent = message.exponent);
if (message.aliases) {
obj.aliases = message.aliases.map((e) => e);
} else {
obj.aliases = [];
}
return obj;
},
};
export const Metadata = {
encode(message: Metadata, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.description);
for (const v of message.denomUnits) {
DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim();
}
writer.uint32(26).string(message.base);
writer.uint32(34).string(message.display);
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.denomUnits = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.description = reader.string();
break;
case 2:
message.denomUnits.push(DenomUnit.decode(reader, reader.uint32()));
break;
case 3:
message.base = reader.string();
break;
case 4:
message.display = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Metadata {
const message = { ...baseMetadata } as Metadata;
message.denomUnits = [];
if (object.description !== undefined && object.description !== null) {
message.description = String(object.description);
} else {
message.description = "";
}
if (object.denomUnits !== undefined && object.denomUnits !== null) {
for (const e of object.denomUnits) {
message.denomUnits.push(DenomUnit.fromJSON(e));
}
}
if (object.base !== undefined && object.base !== null) {
message.base = String(object.base);
} else {
message.base = "";
}
if (object.display !== undefined && object.display !== null) {
message.display = String(object.display);
} else {
message.display = "";
}
return message;
},
fromPartial(object: DeepPartial<Metadata>): Metadata {
const message = { ...baseMetadata } as Metadata;
message.denomUnits = [];
if (object.description !== undefined && object.description !== null) {
message.description = object.description;
} else {
message.description = "";
}
if (object.denomUnits !== undefined && object.denomUnits !== null) {
for (const e of object.denomUnits) {
message.denomUnits.push(DenomUnit.fromPartial(e));
}
}
if (object.base !== undefined && object.base !== null) {
message.base = object.base;
} else {
message.base = "";
}
if (object.display !== undefined && object.display !== null) {
message.display = object.display;
} else {
message.display = "";
}
return message;
},
toJSON(message: Metadata): unknown {
const obj: any = {};
message.description !== undefined && (obj.description = message.description);
if (message.denomUnits) {
obj.denomUnits = message.denomUnits.map((e) => (e ? DenomUnit.toJSON(e) : undefined));
} else {
obj.denomUnits = [];
}
message.base !== undefined && (obj.base = message.base);
message.display !== undefined && (obj.display = message.display);
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,735 @@
/* eslint-disable */
import { Coin } from "../../../cosmos/base/v1beta1/coin";
import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination";
import { Params } from "../../../cosmos/bank/v1beta1/bank";
import { Reader, Writer } from "protobufjs/minimal";
/**
* QueryBalanceRequest is the request type for the Query/Balance RPC method.
*/
export interface QueryBalanceRequest {
/**
* address is the address to query balances for.
*/
address: string;
/**
* denom is the coin denom to query balances for.
*/
denom: string;
}
/**
* QueryBalanceResponse is the response type for the Query/Balance RPC method.
*/
export interface QueryBalanceResponse {
/**
* balance is the balance of the coin.
*/
balance?: Coin;
}
/**
* QueryBalanceRequest is the request type for the Query/AllBalances RPC method.
*/
export interface QueryAllBalancesRequest {
/**
* address is the address to query balances for.
*/
address: string;
/**
* pagination defines an optional pagination for the request.
*/
pagination?: PageRequest;
}
/**
* QueryAllBalancesResponse is the response type for the Query/AllBalances RPC
* method.
*/
export interface QueryAllBalancesResponse {
/**
* balances is the balances of all the coins.
*/
balances: Coin[];
/**
* pagination defines the pagination in the response.
*/
pagination?: PageResponse;
}
/**
* QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
* method.
*/
export interface QueryTotalSupplyRequest {}
/**
* QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC
* method
*/
export interface QueryTotalSupplyResponse {
/**
* supply is the supply of the coins
*/
supply: Coin[];
}
/**
* QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method.
*/
export interface QuerySupplyOfRequest {
/**
* denom is the coin denom to query balances for.
*/
denom: string;
}
/**
* QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method.
*/
export interface QuerySupplyOfResponse {
/**
* amount is the supply of the coin.
*/
amount?: Coin;
}
/**
* QueryParamsRequest defines the request type for querying x/bank parameters.
*/
export interface QueryParamsRequest {}
/**
* QueryParamsResponse defines the response type for querying x/bank parameters.
*/
export interface QueryParamsResponse {
params?: Params;
}
const baseQueryBalanceRequest: object = {
address: "",
denom: "",
};
const baseQueryBalanceResponse: object = {};
const baseQueryAllBalancesRequest: object = {
address: "",
};
const baseQueryAllBalancesResponse: object = {};
const baseQueryTotalSupplyRequest: object = {};
const baseQueryTotalSupplyResponse: object = {};
const baseQuerySupplyOfRequest: object = {
denom: "",
};
const baseQuerySupplyOfResponse: object = {};
const baseQueryParamsRequest: object = {};
const baseQueryParamsResponse: object = {};
/**
* Query defines the gRPC querier service.
*/
export interface Query {
/**
* Balance queries the balance of a single coin for a single account.
*/
Balance(request: QueryBalanceRequest): Promise<QueryBalanceResponse>;
/**
* AllBalances queries the balance of all coins for a single account.
*/
AllBalances(request: QueryAllBalancesRequest): Promise<QueryAllBalancesResponse>;
/**
* TotalSupply queries the total supply of all coins.
*/
TotalSupply(request: QueryTotalSupplyRequest): Promise<QueryTotalSupplyResponse>;
/**
* SupplyOf queries the supply of a single coin.
*/
SupplyOf(request: QuerySupplyOfRequest): Promise<QuerySupplyOfResponse>;
/**
* Params queries the parameters of x/bank module.
*/
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
}
export class QueryClientImpl implements Query {
private readonly rpc: Rpc;
constructor(rpc: Rpc) {
this.rpc = rpc;
}
Balance(request: QueryBalanceRequest): Promise<QueryBalanceResponse> {
const data = QueryBalanceRequest.encode(request).finish();
const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "Balance", data);
return promise.then((data) => QueryBalanceResponse.decode(new Reader(data)));
}
AllBalances(request: QueryAllBalancesRequest): Promise<QueryAllBalancesResponse> {
const data = QueryAllBalancesRequest.encode(request).finish();
const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "AllBalances", data);
return promise.then((data) => QueryAllBalancesResponse.decode(new Reader(data)));
}
TotalSupply(request: QueryTotalSupplyRequest): Promise<QueryTotalSupplyResponse> {
const data = QueryTotalSupplyRequest.encode(request).finish();
const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "TotalSupply", data);
return promise.then((data) => QueryTotalSupplyResponse.decode(new Reader(data)));
}
SupplyOf(request: QuerySupplyOfRequest): Promise<QuerySupplyOfResponse> {
const data = QuerySupplyOfRequest.encode(request).finish();
const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SupplyOf", data);
return promise.then((data) => QuerySupplyOfResponse.decode(new Reader(data)));
}
Params(request: QueryParamsRequest): Promise<QueryParamsResponse> {
const data = QueryParamsRequest.encode(request).finish();
const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "Params", data);
return promise.then((data) => QueryParamsResponse.decode(new Reader(data)));
}
}
interface Rpc {
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}
export const protobufPackage = "cosmos.bank.v1beta1";
export const QueryBalanceRequest = {
encode(message: QueryBalanceRequest, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.address);
writer.uint32(18).string(message.denom);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryBalanceRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryBalanceRequest } as QueryBalanceRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
case 2:
message.denom = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryBalanceRequest {
const message = { ...baseQueryBalanceRequest } as QueryBalanceRequest;
if (object.address !== undefined && object.address !== null) {
message.address = String(object.address);
} else {
message.address = "";
}
if (object.denom !== undefined && object.denom !== null) {
message.denom = String(object.denom);
} else {
message.denom = "";
}
return message;
},
fromPartial(object: DeepPartial<QueryBalanceRequest>): QueryBalanceRequest {
const message = { ...baseQueryBalanceRequest } as QueryBalanceRequest;
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = "";
}
if (object.denom !== undefined && object.denom !== null) {
message.denom = object.denom;
} else {
message.denom = "";
}
return message;
},
toJSON(message: QueryBalanceRequest): unknown {
const obj: any = {};
message.address !== undefined && (obj.address = message.address);
message.denom !== undefined && (obj.denom = message.denom);
return obj;
},
};
export const QueryBalanceResponse = {
encode(message: QueryBalanceResponse, writer: Writer = Writer.create()): Writer {
if (message.balance !== undefined && message.balance !== undefined) {
Coin.encode(message.balance, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryBalanceResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryBalanceResponse } as QueryBalanceResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.balance = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryBalanceResponse {
const message = { ...baseQueryBalanceResponse } as QueryBalanceResponse;
if (object.balance !== undefined && object.balance !== null) {
message.balance = Coin.fromJSON(object.balance);
} else {
message.balance = undefined;
}
return message;
},
fromPartial(object: DeepPartial<QueryBalanceResponse>): QueryBalanceResponse {
const message = { ...baseQueryBalanceResponse } as QueryBalanceResponse;
if (object.balance !== undefined && object.balance !== null) {
message.balance = Coin.fromPartial(object.balance);
} else {
message.balance = undefined;
}
return message;
},
toJSON(message: QueryBalanceResponse): unknown {
const obj: any = {};
message.balance !== undefined &&
(obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined);
return obj;
},
};
export const QueryAllBalancesRequest = {
encode(message: QueryAllBalancesRequest, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.address);
if (message.pagination !== undefined && message.pagination !== undefined) {
PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryAllBalancesRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryAllBalancesRequest } as QueryAllBalancesRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
case 2:
message.pagination = PageRequest.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryAllBalancesRequest {
const message = { ...baseQueryAllBalancesRequest } as QueryAllBalancesRequest;
if (object.address !== undefined && object.address !== null) {
message.address = String(object.address);
} else {
message.address = "";
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromJSON(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
fromPartial(object: DeepPartial<QueryAllBalancesRequest>): QueryAllBalancesRequest {
const message = { ...baseQueryAllBalancesRequest } as QueryAllBalancesRequest;
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = "";
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromPartial(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
toJSON(message: QueryAllBalancesRequest): unknown {
const obj: any = {};
message.address !== undefined && (obj.address = message.address);
message.pagination !== undefined &&
(obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
return obj;
},
};
export const QueryAllBalancesResponse = {
encode(message: QueryAllBalancesResponse, writer: Writer = Writer.create()): Writer {
for (const v of message.balances) {
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.pagination !== undefined && message.pagination !== undefined) {
PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryAllBalancesResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryAllBalancesResponse } as QueryAllBalancesResponse;
message.balances = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.balances.push(Coin.decode(reader, reader.uint32()));
break;
case 2:
message.pagination = PageResponse.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryAllBalancesResponse {
const message = { ...baseQueryAllBalancesResponse } as QueryAllBalancesResponse;
message.balances = [];
if (object.balances !== undefined && object.balances !== null) {
for (const e of object.balances) {
message.balances.push(Coin.fromJSON(e));
}
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromJSON(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
fromPartial(object: DeepPartial<QueryAllBalancesResponse>): QueryAllBalancesResponse {
const message = { ...baseQueryAllBalancesResponse } as QueryAllBalancesResponse;
message.balances = [];
if (object.balances !== undefined && object.balances !== null) {
for (const e of object.balances) {
message.balances.push(Coin.fromPartial(e));
}
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromPartial(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
toJSON(message: QueryAllBalancesResponse): unknown {
const obj: any = {};
if (message.balances) {
obj.balances = message.balances.map((e) => (e ? Coin.toJSON(e) : undefined));
} else {
obj.balances = [];
}
message.pagination !== undefined &&
(obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
return obj;
},
};
export const QueryTotalSupplyRequest = {
encode(_: QueryTotalSupplyRequest, writer: Writer = Writer.create()): Writer {
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryTotalSupplyRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryTotalSupplyRequest } as QueryTotalSupplyRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): QueryTotalSupplyRequest {
const message = { ...baseQueryTotalSupplyRequest } as QueryTotalSupplyRequest;
return message;
},
fromPartial(_: DeepPartial<QueryTotalSupplyRequest>): QueryTotalSupplyRequest {
const message = { ...baseQueryTotalSupplyRequest } as QueryTotalSupplyRequest;
return message;
},
toJSON(_: QueryTotalSupplyRequest): unknown {
const obj: any = {};
return obj;
},
};
export const QueryTotalSupplyResponse = {
encode(message: QueryTotalSupplyResponse, writer: Writer = Writer.create()): Writer {
for (const v of message.supply) {
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryTotalSupplyResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryTotalSupplyResponse } as QueryTotalSupplyResponse;
message.supply = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.supply.push(Coin.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryTotalSupplyResponse {
const message = { ...baseQueryTotalSupplyResponse } as QueryTotalSupplyResponse;
message.supply = [];
if (object.supply !== undefined && object.supply !== null) {
for (const e of object.supply) {
message.supply.push(Coin.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<QueryTotalSupplyResponse>): QueryTotalSupplyResponse {
const message = { ...baseQueryTotalSupplyResponse } as QueryTotalSupplyResponse;
message.supply = [];
if (object.supply !== undefined && object.supply !== null) {
for (const e of object.supply) {
message.supply.push(Coin.fromPartial(e));
}
}
return message;
},
toJSON(message: QueryTotalSupplyResponse): unknown {
const obj: any = {};
if (message.supply) {
obj.supply = message.supply.map((e) => (e ? Coin.toJSON(e) : undefined));
} else {
obj.supply = [];
}
return obj;
},
};
export const QuerySupplyOfRequest = {
encode(message: QuerySupplyOfRequest, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.denom);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QuerySupplyOfRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQuerySupplyOfRequest } as QuerySupplyOfRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.denom = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QuerySupplyOfRequest {
const message = { ...baseQuerySupplyOfRequest } as QuerySupplyOfRequest;
if (object.denom !== undefined && object.denom !== null) {
message.denom = String(object.denom);
} else {
message.denom = "";
}
return message;
},
fromPartial(object: DeepPartial<QuerySupplyOfRequest>): QuerySupplyOfRequest {
const message = { ...baseQuerySupplyOfRequest } as QuerySupplyOfRequest;
if (object.denom !== undefined && object.denom !== null) {
message.denom = object.denom;
} else {
message.denom = "";
}
return message;
},
toJSON(message: QuerySupplyOfRequest): unknown {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
return obj;
},
};
export const QuerySupplyOfResponse = {
encode(message: QuerySupplyOfResponse, writer: Writer = Writer.create()): Writer {
if (message.amount !== undefined && message.amount !== undefined) {
Coin.encode(message.amount, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QuerySupplyOfResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQuerySupplyOfResponse } as QuerySupplyOfResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.amount = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QuerySupplyOfResponse {
const message = { ...baseQuerySupplyOfResponse } as QuerySupplyOfResponse;
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromJSON(object.amount);
} else {
message.amount = undefined;
}
return message;
},
fromPartial(object: DeepPartial<QuerySupplyOfResponse>): QuerySupplyOfResponse {
const message = { ...baseQuerySupplyOfResponse } as QuerySupplyOfResponse;
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromPartial(object.amount);
} else {
message.amount = undefined;
}
return message;
},
toJSON(message: QuerySupplyOfResponse): unknown {
const obj: any = {};
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
return obj;
},
};
export const QueryParamsRequest = {
encode(_: QueryParamsRequest, writer: Writer = Writer.create()): Writer {
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryParamsRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): QueryParamsRequest {
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
return message;
},
fromPartial(_: DeepPartial<QueryParamsRequest>): QueryParamsRequest {
const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
return message;
},
toJSON(_: QueryParamsRequest): unknown {
const obj: any = {};
return obj;
},
};
export const QueryParamsResponse = {
encode(message: QueryParamsResponse, writer: Writer = Writer.create()): Writer {
if (message.params !== undefined && message.params !== undefined) {
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): QueryParamsResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.params = Params.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryParamsResponse {
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
if (object.params !== undefined && object.params !== null) {
message.params = Params.fromJSON(object.params);
} else {
message.params = undefined;
}
return message;
},
fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse {
const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
if (object.params !== undefined && object.params !== null) {
message.params = Params.fromPartial(object.params);
} else {
message.params = undefined;
}
return message;
},
toJSON(message: QueryParamsResponse): unknown {
const obj: any = {};
message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,324 @@
/* eslint-disable */
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.
*/
export interface MsgSend {
fromAddress: string;
toAddress: string;
amount: Coin[];
}
/**
* MsgSendResponse defines the Msg/Send response type.
*/
export interface MsgSendResponse {}
/**
* MsgMultiSend represents an arbitrary multi-in, multi-out send message.
*/
export interface MsgMultiSend {
inputs: Input[];
outputs: Output[];
}
/**
* 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<MsgSendResponse>;
/**
* MultiSend defines a method for sending coins from some accounts to other accounts.
*/
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;
constructor(rpc: Rpc) {
this.rpc = rpc;
}
Send(request: MsgSend): Promise<MsgSendResponse> {
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<MsgMultiSendResponse> {
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<Uint8Array>;
}
export const protobufPackage = "cosmos.bank.v1beta1";
export const MsgSend = {
encode(message: MsgSend, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.fromAddress);
writer.uint32(18).string(message.toAddress);
for (const v of message.amount) {
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.amount = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.fromAddress = reader.string();
break;
case 2:
message.toAddress = reader.string();
break;
case 3:
message.amount.push(Coin.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgSend {
const message = { ...baseMsgSend } as MsgSend;
message.amount = [];
if (object.fromAddress !== undefined && object.fromAddress !== null) {
message.fromAddress = String(object.fromAddress);
} else {
message.fromAddress = "";
}
if (object.toAddress !== undefined && object.toAddress !== null) {
message.toAddress = String(object.toAddress);
} else {
message.toAddress = "";
}
if (object.amount !== undefined && object.amount !== null) {
for (const e of object.amount) {
message.amount.push(Coin.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<MsgSend>): MsgSend {
const message = { ...baseMsgSend } as MsgSend;
message.amount = [];
if (object.fromAddress !== undefined && object.fromAddress !== null) {
message.fromAddress = object.fromAddress;
} else {
message.fromAddress = "";
}
if (object.toAddress !== undefined && object.toAddress !== null) {
message.toAddress = object.toAddress;
} else {
message.toAddress = "";
}
if (object.amount !== undefined && object.amount !== null) {
for (const e of object.amount) {
message.amount.push(Coin.fromPartial(e));
}
}
return message;
},
toJSON(message: MsgSend): unknown {
const obj: any = {};
message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress);
message.toAddress !== undefined && (obj.toAddress = message.toAddress);
if (message.amount) {
obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined));
} else {
obj.amount = [];
}
return obj;
},
};
export const MsgSendResponse = {
encode(_: MsgSendResponse, writer: Writer = Writer.create()): Writer {
return writer;
},
decode(input: Uint8Array | Reader, 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;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgSendResponse {
const message = { ...baseMsgSendResponse } as MsgSendResponse;
return message;
},
fromPartial(_: DeepPartial<MsgSendResponse>): MsgSendResponse {
const message = { ...baseMsgSendResponse } as MsgSendResponse;
return message;
},
toJSON(_: MsgSendResponse): unknown {
const obj: any = {};
return obj;
},
};
export const MsgMultiSend = {
encode(message: MsgMultiSend, writer: Writer = Writer.create()): Writer {
for (const v of message.inputs) {
Input.encode(v!, writer.uint32(10).fork()).ldelim();
}
for (const v of message.outputs) {
Output.encode(v!, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.inputs = [];
message.outputs = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.inputs.push(Input.decode(reader, reader.uint32()));
break;
case 2:
message.outputs.push(Output.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgMultiSend {
const message = { ...baseMsgMultiSend } as MsgMultiSend;
message.inputs = [];
message.outputs = [];
if (object.inputs !== undefined && object.inputs !== null) {
for (const e of object.inputs) {
message.inputs.push(Input.fromJSON(e));
}
}
if (object.outputs !== undefined && object.outputs !== null) {
for (const e of object.outputs) {
message.outputs.push(Output.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<MsgMultiSend>): MsgMultiSend {
const message = { ...baseMsgMultiSend } as MsgMultiSend;
message.inputs = [];
message.outputs = [];
if (object.inputs !== undefined && object.inputs !== null) {
for (const e of object.inputs) {
message.inputs.push(Input.fromPartial(e));
}
}
if (object.outputs !== undefined && object.outputs !== null) {
for (const e of object.outputs) {
message.outputs.push(Output.fromPartial(e));
}
}
return message;
},
toJSON(message: MsgMultiSend): unknown {
const obj: any = {};
if (message.inputs) {
obj.inputs = message.inputs.map((e) => (e ? Input.toJSON(e) : undefined));
} else {
obj.inputs = [];
}
if (message.outputs) {
obj.outputs = message.outputs.map((e) => (e ? Output.toJSON(e) : undefined));
} else {
obj.outputs = [];
}
return obj;
},
};
export const MsgMultiSendResponse = {
encode(_: MsgMultiSendResponse, writer: Writer = Writer.create()): Writer {
return writer;
},
decode(input: Uint8Array | Reader, 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;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgMultiSendResponse {
const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse;
return message;
},
fromPartial(_: DeepPartial<MsgMultiSendResponse>): MsgMultiSendResponse {
const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse;
return message;
},
toJSON(_: MsgMultiSendResponse): unknown {
const obj: any = {};
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,261 @@
/* eslint-disable */
import * as Long from "long";
import { Writer, Reader } from "protobufjs/minimal";
/**
* PageRequest is to be embedded in gRPC request messages for efficient
* pagination. Ex:
*
* message SomeRequest {
* Foo some_parameter = 1;
* PageRequest pagination = 2;
* }
*/
export interface PageRequest {
/**
* key is a value returned in PageResponse.next_key to begin
* querying the next page most efficiently. Only one of offset or key
* should be set.
*/
key: Uint8Array;
/**
* offset is a numeric offset that can be used when key is unavailable.
* It is less efficient than using key. Only one of offset or key should
* be set.
*/
offset: Long;
/**
* limit is the total number of results to be returned in the result page.
* If left empty it will default to a value to be set by each app.
*/
limit: Long;
/**
* count_total is set to true to indicate that the result set should include
* a count of the total number of items available for pagination in UIs.
* count_total is only respected when offset is used. It is ignored when key
* is set.
*/
countTotal: boolean;
}
/**
* PageResponse is to be embedded in gRPC response messages where the
* corresponding request message has used PageRequest.
*
* message SomeResponse {
* repeated Bar results = 1;
* PageResponse page = 2;
* }
*/
export interface PageResponse {
/**
* next_key is the key to be passed to PageRequest.key to
* query the next page most efficiently
*/
nextKey: Uint8Array;
/**
* total is total number of results available if PageRequest.count_total
* was set, its value is undefined otherwise
*/
total: Long;
}
const basePageRequest: object = {
offset: Long.UZERO,
limit: Long.UZERO,
countTotal: false,
};
const basePageResponse: object = {
total: Long.UZERO,
};
export const protobufPackage = "cosmos.base.query.v1beta1";
export const PageRequest = {
encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
writer.uint32(10).bytes(message.key);
writer.uint32(16).uint64(message.offset);
writer.uint32(24).uint64(message.limit);
writer.uint32(32).bool(message.countTotal);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): PageRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...basePageRequest } as PageRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.key = reader.bytes();
break;
case 2:
message.offset = reader.uint64() as Long;
break;
case 3:
message.limit = reader.uint64() as Long;
break;
case 4:
message.countTotal = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): PageRequest {
const message = { ...basePageRequest } as PageRequest;
if (object.key !== undefined && object.key !== null) {
message.key = bytesFromBase64(object.key);
}
if (object.offset !== undefined && object.offset !== null) {
message.offset = Long.fromString(object.offset);
} else {
message.offset = Long.UZERO;
}
if (object.limit !== undefined && object.limit !== null) {
message.limit = Long.fromString(object.limit);
} else {
message.limit = Long.UZERO;
}
if (object.countTotal !== undefined && object.countTotal !== null) {
message.countTotal = Boolean(object.countTotal);
} else {
message.countTotal = false;
}
return message;
},
fromPartial(object: DeepPartial<PageRequest>): PageRequest {
const message = { ...basePageRequest } as PageRequest;
if (object.key !== undefined && object.key !== null) {
message.key = object.key;
} else {
message.key = new Uint8Array();
}
if (object.offset !== undefined && object.offset !== null) {
message.offset = object.offset as Long;
} else {
message.offset = Long.UZERO;
}
if (object.limit !== undefined && object.limit !== null) {
message.limit = object.limit as Long;
} else {
message.limit = Long.UZERO;
}
if (object.countTotal !== undefined && object.countTotal !== null) {
message.countTotal = object.countTotal;
} else {
message.countTotal = false;
}
return message;
},
toJSON(message: PageRequest): unknown {
const obj: any = {};
message.key !== undefined &&
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
message.offset !== undefined && (obj.offset = (message.offset || Long.UZERO).toString());
message.limit !== undefined && (obj.limit = (message.limit || Long.UZERO).toString());
message.countTotal !== undefined && (obj.countTotal = message.countTotal);
return obj;
},
};
export const PageResponse = {
encode(message: PageResponse, writer: Writer = Writer.create()): Writer {
writer.uint32(10).bytes(message.nextKey);
writer.uint32(16).uint64(message.total);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): PageResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...basePageResponse } as PageResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.nextKey = reader.bytes();
break;
case 2:
message.total = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): PageResponse {
const message = { ...basePageResponse } as PageResponse;
if (object.nextKey !== undefined && object.nextKey !== null) {
message.nextKey = bytesFromBase64(object.nextKey);
}
if (object.total !== undefined && object.total !== null) {
message.total = Long.fromString(object.total);
} else {
message.total = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<PageResponse>): PageResponse {
const message = { ...basePageResponse } as PageResponse;
if (object.nextKey !== undefined && object.nextKey !== null) {
message.nextKey = object.nextKey;
} else {
message.nextKey = new Uint8Array();
}
if (object.total !== undefined && object.total !== null) {
message.total = object.total as Long;
} else {
message.total = Long.UZERO;
}
return message;
},
toJSON(message: PageResponse): unknown {
const obj: any = {};
message.nextKey !== undefined &&
(obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array()));
message.total !== undefined && (obj.total = (message.total || Long.UZERO).toString());
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,287 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
/**
* Coin defines a token with a denomination and an amount.
*
* NOTE: The amount field is an Int which implements the custom method
* signatures required by gogoproto.
*/
export interface Coin {
denom: string;
amount: string;
}
/**
* DecCoin defines a token with a denomination and a decimal amount.
*
* NOTE: The amount field is an Dec which implements the custom method
* signatures required by gogoproto.
*/
export interface DecCoin {
denom: string;
amount: string;
}
/**
* IntProto defines a Protobuf wrapper around an Int object.
*/
export interface IntProto {
int: string;
}
/**
* DecProto defines a Protobuf wrapper around a Dec object.
*/
export interface DecProto {
dec: string;
}
const baseCoin: object = {
denom: "",
amount: "",
};
const baseDecCoin: object = {
denom: "",
amount: "",
};
const baseIntProto: object = {
int: "",
};
const baseDecProto: object = {
dec: "",
};
export const protobufPackage = "cosmos.base.v1beta1";
export const Coin = {
encode(message: Coin, 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): Coin {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseCoin } as Coin;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.denom = reader.string();
break;
case 2:
message.amount = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Coin {
const message = { ...baseCoin } as Coin;
if (object.denom !== undefined && object.denom !== null) {
message.denom = String(object.denom);
} else {
message.denom = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = String(object.amount);
} else {
message.amount = "";
}
return message;
},
fromPartial(object: DeepPartial<Coin>): Coin {
const message = { ...baseCoin } as Coin;
if (object.denom !== undefined && object.denom !== null) {
message.denom = object.denom;
} else {
message.denom = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = object.amount;
} else {
message.amount = "";
}
return message;
},
toJSON(message: Coin): unknown {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
message.amount !== undefined && (obj.amount = message.amount);
return obj;
},
};
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 {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseDecCoin } as DecCoin;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.denom = reader.string();
break;
case 2:
message.amount = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): DecCoin {
const message = { ...baseDecCoin } as DecCoin;
if (object.denom !== undefined && object.denom !== null) {
message.denom = String(object.denom);
} else {
message.denom = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = String(object.amount);
} else {
message.amount = "";
}
return message;
},
fromPartial(object: DeepPartial<DecCoin>): DecCoin {
const message = { ...baseDecCoin } as DecCoin;
if (object.denom !== undefined && object.denom !== null) {
message.denom = object.denom;
} else {
message.denom = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = object.amount;
} else {
message.amount = "";
}
return message;
},
toJSON(message: DecCoin): unknown {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
message.amount !== undefined && (obj.amount = message.amount);
return obj;
},
};
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 {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseIntProto } as IntProto;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.int = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): IntProto {
const message = { ...baseIntProto } as IntProto;
if (object.int !== undefined && object.int !== null) {
message.int = String(object.int);
} else {
message.int = "";
}
return message;
},
fromPartial(object: DeepPartial<IntProto>): IntProto {
const message = { ...baseIntProto } as IntProto;
if (object.int !== undefined && object.int !== null) {
message.int = object.int;
} else {
message.int = "";
}
return message;
},
toJSON(message: IntProto): unknown {
const obj: any = {};
message.int !== undefined && (obj.int = message.int);
return obj;
},
};
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 {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseDecProto } as DecProto;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.dec = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): DecProto {
const message = { ...baseDecProto } as DecProto;
if (object.dec !== undefined && object.dec !== null) {
message.dec = String(object.dec);
} else {
message.dec = "";
}
return message;
},
fromPartial(object: DeepPartial<DecProto>): DecProto {
const message = { ...baseDecProto } as DecProto;
if (object.dec !== undefined && object.dec !== null) {
message.dec = object.dec;
} else {
message.dec = "";
}
return message;
},
toJSON(message: DecProto): unknown {
const obj: any = {};
message.dec !== undefined && (obj.dec = message.dec);
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,183 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
/**
* 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.
*/
export interface CompactBitArray {
extraBitsStored: number;
elems: Uint8Array;
}
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) {
writer.uint32(10).bytes(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.signatures = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.signatures.push(reader.bytes());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MultiSignature {
const message = { ...baseMultiSignature } as MultiSignature;
message.signatures = [];
if (object.signatures !== undefined && object.signatures !== null) {
for (const e of object.signatures) {
message.signatures.push(bytesFromBase64(e));
}
}
return message;
},
fromPartial(object: DeepPartial<MultiSignature>): MultiSignature {
const message = { ...baseMultiSignature } as MultiSignature;
message.signatures = [];
if (object.signatures !== undefined && object.signatures !== null) {
for (const e of object.signatures) {
message.signatures.push(e);
}
}
return message;
},
toJSON(message: MultiSignature): unknown {
const obj: any = {};
if (message.signatures) {
obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array()));
} else {
obj.signatures = [];
}
return obj;
},
};
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 {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseCompactBitArray } as CompactBitArray;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.extraBitsStored = reader.uint32();
break;
case 2:
message.elems = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): CompactBitArray {
const message = { ...baseCompactBitArray } as CompactBitArray;
if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) {
message.extraBitsStored = Number(object.extraBitsStored);
} else {
message.extraBitsStored = 0;
}
if (object.elems !== undefined && object.elems !== null) {
message.elems = bytesFromBase64(object.elems);
}
return message;
},
fromPartial(object: DeepPartial<CompactBitArray>): CompactBitArray {
const message = { ...baseCompactBitArray } as CompactBitArray;
if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) {
message.extraBitsStored = object.extraBitsStored;
} else {
message.extraBitsStored = 0;
}
if (object.elems !== undefined && object.elems !== null) {
message.elems = object.elems;
} else {
message.elems = new Uint8Array();
}
return message;
},
toJSON(message: CompactBitArray): unknown {
const obj: any = {};
message.extraBitsStored !== undefined && (obj.extraBitsStored = message.extraBitsStored);
message.elems !== undefined &&
(obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array()));
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,154 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
/**
* 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.
*/
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 {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...basePubKey } as PubKey;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.key = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): PubKey {
const message = { ...basePubKey } as PubKey;
if (object.key !== undefined && object.key !== null) {
message.key = bytesFromBase64(object.key);
}
return message;
},
fromPartial(object: DeepPartial<PubKey>): PubKey {
const message = { ...basePubKey } as PubKey;
if (object.key !== undefined && object.key !== null) {
message.key = object.key;
} else {
message.key = new Uint8Array();
}
return message;
},
toJSON(message: PubKey): unknown {
const obj: any = {};
message.key !== undefined &&
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
return obj;
},
};
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 {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...basePrivKey } as PrivKey;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.key = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): PrivKey {
const message = { ...basePrivKey } as PrivKey;
if (object.key !== undefined && object.key !== null) {
message.key = bytesFromBase64(object.key);
}
return message;
},
fromPartial(object: DeepPartial<PrivKey>): PrivKey {
const message = { ...basePrivKey } as PrivKey;
if (object.key !== undefined && object.key !== null) {
message.key = object.key;
} else {
message.key = new Uint8Array();
}
return message;
},
toJSON(message: PrivKey): unknown {
const obj: any = {};
message.key !== undefined &&
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,945 @@
/* eslint-disable */
import { Description, CommissionRates } from "../../../cosmos/staking/v1beta1/staking";
import { Any } from "../../../google/protobuf/any";
import { Coin } from "../../../cosmos/base/v1beta1/coin";
import { Reader, Writer, util, configure } from "protobufjs/minimal";
import { Timestamp } from "../../../google/protobuf/timestamp";
import * as Long from "long";
/**
* MsgCreateValidator defines a SDK message for creating a new validator.
*/
export interface MsgCreateValidator {
description?: Description;
commission?: CommissionRates;
minSelfDelegation: string;
delegatorAddress: string;
validatorAddress: string;
pubkey?: Any;
value?: Coin;
}
/**
* MsgCreateValidatorResponse defines the Msg/CreateValidator response type.
*/
export interface MsgCreateValidatorResponse {}
/**
* MsgEditValidator defines a SDK message for editing an existing validator.
*/
export interface MsgEditValidator {
description?: Description;
validatorAddress: string;
/**
* We pass a reference to the new commission rate and min self delegation as
* it's not mandatory to update. If not updated, the deserialized rate will be
* zero with no way to distinguish if an update was intended.
* REF: #2373
*/
commissionRate: string;
minSelfDelegation: string;
}
/**
* MsgEditValidatorResponse defines the Msg/EditValidator response type.
*/
export interface MsgEditValidatorResponse {}
/**
* MsgDelegate defines a SDK message for performing a delegation of coins
* from a delegator to a validator.
*/
export interface MsgDelegate {
delegatorAddress: string;
validatorAddress: string;
amount?: Coin;
}
/**
* MsgDelegateResponse defines the Msg/Delegate response type.
*/
export interface MsgDelegateResponse {}
/**
* MsgBeginRedelegate defines a SDK message for performing a redelegation
* of coins from a delegator and source validator to a destination validator.
*/
export interface MsgBeginRedelegate {
delegatorAddress: string;
validatorSrcAddress: string;
validatorDstAddress: string;
amount?: Coin;
}
/**
* MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type.
*/
export interface MsgBeginRedelegateResponse {
completionTime?: Date;
}
/**
* MsgUndelegate defines a SDK message for performing an undelegation from a
* delegate and a validator.
*/
export interface MsgUndelegate {
delegatorAddress: string;
validatorAddress: string;
amount?: Coin;
}
/**
* MsgUndelegateResponse defines the Msg/Undelegate response type.
*/
export interface MsgUndelegateResponse {
completionTime?: Date;
}
const baseMsgCreateValidator: object = {
minSelfDelegation: "",
delegatorAddress: "",
validatorAddress: "",
};
const baseMsgCreateValidatorResponse: object = {};
const baseMsgEditValidator: object = {
validatorAddress: "",
commissionRate: "",
minSelfDelegation: "",
};
const baseMsgEditValidatorResponse: object = {};
const baseMsgDelegate: object = {
delegatorAddress: "",
validatorAddress: "",
};
const baseMsgDelegateResponse: object = {};
const baseMsgBeginRedelegate: object = {
delegatorAddress: "",
validatorSrcAddress: "",
validatorDstAddress: "",
};
const baseMsgBeginRedelegateResponse: object = {};
const baseMsgUndelegate: object = {
delegatorAddress: "",
validatorAddress: "",
};
const baseMsgUndelegateResponse: object = {};
/**
* Msg defines the staking Msg service.
*/
export interface Msg {
/**
* CreateValidator defines a method for creating a new validator.
*/
CreateValidator(request: MsgCreateValidator): Promise<MsgCreateValidatorResponse>;
/**
* EditValidator defines a method for editing an existing validator.
*/
EditValidator(request: MsgEditValidator): Promise<MsgEditValidatorResponse>;
/**
* Delegate defines a method for performing a delegation of coins
* from a delegator to a validator.
*/
Delegate(request: MsgDelegate): Promise<MsgDelegateResponse>;
/**
* BeginRedelegate defines a method for performing a redelegation
* of coins from a delegator and source validator to a destination validator.
*/
BeginRedelegate(request: MsgBeginRedelegate): Promise<MsgBeginRedelegateResponse>;
/**
* Undelegate defines a method for performing an undelegation from a
* delegate and a validator.
*/
Undelegate(request: MsgUndelegate): Promise<MsgUndelegateResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;
constructor(rpc: Rpc) {
this.rpc = rpc;
}
CreateValidator(request: MsgCreateValidator): Promise<MsgCreateValidatorResponse> {
const data = MsgCreateValidator.encode(request).finish();
const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "CreateValidator", data);
return promise.then((data) => MsgCreateValidatorResponse.decode(new Reader(data)));
}
EditValidator(request: MsgEditValidator): Promise<MsgEditValidatorResponse> {
const data = MsgEditValidator.encode(request).finish();
const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "EditValidator", data);
return promise.then((data) => MsgEditValidatorResponse.decode(new Reader(data)));
}
Delegate(request: MsgDelegate): Promise<MsgDelegateResponse> {
const data = MsgDelegate.encode(request).finish();
const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "Delegate", data);
return promise.then((data) => MsgDelegateResponse.decode(new Reader(data)));
}
BeginRedelegate(request: MsgBeginRedelegate): Promise<MsgBeginRedelegateResponse> {
const data = MsgBeginRedelegate.encode(request).finish();
const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "BeginRedelegate", data);
return promise.then((data) => MsgBeginRedelegateResponse.decode(new Reader(data)));
}
Undelegate(request: MsgUndelegate): Promise<MsgUndelegateResponse> {
const data = MsgUndelegate.encode(request).finish();
const promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "Undelegate", data);
return promise.then((data) => MsgUndelegateResponse.decode(new Reader(data)));
}
}
interface Rpc {
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}
function fromJsonTimestamp(o: any): Date {
if (o instanceof Date) {
return o;
} else if (typeof o === "string") {
return new Date(o);
} else {
return fromTimestamp(Timestamp.fromJSON(o));
}
}
function toTimestamp(date: Date): Timestamp {
const seconds = numberToLong(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
function fromTimestamp(t: Timestamp): Date {
let millis = t.seconds.toNumber() * 1_000;
millis += t.nanos / 1_000_000;
return new Date(millis);
}
function numberToLong(number: number) {
return Long.fromNumber(number);
}
export const protobufPackage = "cosmos.staking.v1beta1";
export const MsgCreateValidator = {
encode(message: MsgCreateValidator, writer: Writer = Writer.create()): Writer {
if (message.description !== undefined && message.description !== undefined) {
Description.encode(message.description, writer.uint32(10).fork()).ldelim();
}
if (message.commission !== undefined && message.commission !== undefined) {
CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim();
}
writer.uint32(26).string(message.minSelfDelegation);
writer.uint32(34).string(message.delegatorAddress);
writer.uint32(42).string(message.validatorAddress);
if (message.pubkey !== undefined && message.pubkey !== undefined) {
Any.encode(message.pubkey, writer.uint32(50).fork()).ldelim();
}
if (message.value !== undefined && message.value !== undefined) {
Coin.encode(message.value, writer.uint32(58).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgCreateValidator {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgCreateValidator } as MsgCreateValidator;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.description = Description.decode(reader, reader.uint32());
break;
case 2:
message.commission = CommissionRates.decode(reader, reader.uint32());
break;
case 3:
message.minSelfDelegation = reader.string();
break;
case 4:
message.delegatorAddress = reader.string();
break;
case 5:
message.validatorAddress = reader.string();
break;
case 6:
message.pubkey = Any.decode(reader, reader.uint32());
break;
case 7:
message.value = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgCreateValidator {
const message = { ...baseMsgCreateValidator } as MsgCreateValidator;
if (object.description !== undefined && object.description !== null) {
message.description = Description.fromJSON(object.description);
} else {
message.description = undefined;
}
if (object.commission !== undefined && object.commission !== null) {
message.commission = CommissionRates.fromJSON(object.commission);
} else {
message.commission = undefined;
}
if (object.minSelfDelegation !== undefined && object.minSelfDelegation !== null) {
message.minSelfDelegation = String(object.minSelfDelegation);
} else {
message.minSelfDelegation = "";
}
if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
message.delegatorAddress = String(object.delegatorAddress);
} else {
message.delegatorAddress = "";
}
if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
message.validatorAddress = String(object.validatorAddress);
} else {
message.validatorAddress = "";
}
if (object.pubkey !== undefined && object.pubkey !== null) {
message.pubkey = Any.fromJSON(object.pubkey);
} else {
message.pubkey = undefined;
}
if (object.value !== undefined && object.value !== null) {
message.value = Coin.fromJSON(object.value);
} else {
message.value = undefined;
}
return message;
},
fromPartial(object: DeepPartial<MsgCreateValidator>): MsgCreateValidator {
const message = { ...baseMsgCreateValidator } as MsgCreateValidator;
if (object.description !== undefined && object.description !== null) {
message.description = Description.fromPartial(object.description);
} else {
message.description = undefined;
}
if (object.commission !== undefined && object.commission !== null) {
message.commission = CommissionRates.fromPartial(object.commission);
} else {
message.commission = undefined;
}
if (object.minSelfDelegation !== undefined && object.minSelfDelegation !== null) {
message.minSelfDelegation = object.minSelfDelegation;
} else {
message.minSelfDelegation = "";
}
if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
message.delegatorAddress = object.delegatorAddress;
} else {
message.delegatorAddress = "";
}
if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
message.validatorAddress = object.validatorAddress;
} else {
message.validatorAddress = "";
}
if (object.pubkey !== undefined && object.pubkey !== null) {
message.pubkey = Any.fromPartial(object.pubkey);
} else {
message.pubkey = undefined;
}
if (object.value !== undefined && object.value !== null) {
message.value = Coin.fromPartial(object.value);
} else {
message.value = undefined;
}
return message;
},
toJSON(message: MsgCreateValidator): unknown {
const obj: any = {};
message.description !== undefined &&
(obj.description = message.description ? Description.toJSON(message.description) : undefined);
message.commission !== undefined &&
(obj.commission = message.commission ? CommissionRates.toJSON(message.commission) : undefined);
message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation);
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined);
message.value !== undefined && (obj.value = message.value ? Coin.toJSON(message.value) : undefined);
return obj;
},
};
export const MsgCreateValidatorResponse = {
encode(_: MsgCreateValidatorResponse, writer: Writer = Writer.create()): Writer {
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgCreateValidatorResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgCreateValidatorResponse } as MsgCreateValidatorResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgCreateValidatorResponse {
const message = { ...baseMsgCreateValidatorResponse } as MsgCreateValidatorResponse;
return message;
},
fromPartial(_: DeepPartial<MsgCreateValidatorResponse>): MsgCreateValidatorResponse {
const message = { ...baseMsgCreateValidatorResponse } as MsgCreateValidatorResponse;
return message;
},
toJSON(_: MsgCreateValidatorResponse): unknown {
const obj: any = {};
return obj;
},
};
export const MsgEditValidator = {
encode(message: MsgEditValidator, writer: Writer = Writer.create()): Writer {
if (message.description !== undefined && message.description !== undefined) {
Description.encode(message.description, writer.uint32(10).fork()).ldelim();
}
writer.uint32(18).string(message.validatorAddress);
writer.uint32(26).string(message.commissionRate);
writer.uint32(34).string(message.minSelfDelegation);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgEditValidator {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgEditValidator } as MsgEditValidator;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.description = Description.decode(reader, reader.uint32());
break;
case 2:
message.validatorAddress = reader.string();
break;
case 3:
message.commissionRate = reader.string();
break;
case 4:
message.minSelfDelegation = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgEditValidator {
const message = { ...baseMsgEditValidator } as MsgEditValidator;
if (object.description !== undefined && object.description !== null) {
message.description = Description.fromJSON(object.description);
} else {
message.description = undefined;
}
if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
message.validatorAddress = String(object.validatorAddress);
} else {
message.validatorAddress = "";
}
if (object.commissionRate !== undefined && object.commissionRate !== null) {
message.commissionRate = String(object.commissionRate);
} else {
message.commissionRate = "";
}
if (object.minSelfDelegation !== undefined && object.minSelfDelegation !== null) {
message.minSelfDelegation = String(object.minSelfDelegation);
} else {
message.minSelfDelegation = "";
}
return message;
},
fromPartial(object: DeepPartial<MsgEditValidator>): MsgEditValidator {
const message = { ...baseMsgEditValidator } as MsgEditValidator;
if (object.description !== undefined && object.description !== null) {
message.description = Description.fromPartial(object.description);
} else {
message.description = undefined;
}
if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
message.validatorAddress = object.validatorAddress;
} else {
message.validatorAddress = "";
}
if (object.commissionRate !== undefined && object.commissionRate !== null) {
message.commissionRate = object.commissionRate;
} else {
message.commissionRate = "";
}
if (object.minSelfDelegation !== undefined && object.minSelfDelegation !== null) {
message.minSelfDelegation = object.minSelfDelegation;
} else {
message.minSelfDelegation = "";
}
return message;
},
toJSON(message: MsgEditValidator): unknown {
const obj: any = {};
message.description !== undefined &&
(obj.description = message.description ? Description.toJSON(message.description) : undefined);
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
message.commissionRate !== undefined && (obj.commissionRate = message.commissionRate);
message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation);
return obj;
},
};
export const MsgEditValidatorResponse = {
encode(_: MsgEditValidatorResponse, writer: Writer = Writer.create()): Writer {
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgEditValidatorResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgEditValidatorResponse } as MsgEditValidatorResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgEditValidatorResponse {
const message = { ...baseMsgEditValidatorResponse } as MsgEditValidatorResponse;
return message;
},
fromPartial(_: DeepPartial<MsgEditValidatorResponse>): MsgEditValidatorResponse {
const message = { ...baseMsgEditValidatorResponse } as MsgEditValidatorResponse;
return message;
},
toJSON(_: MsgEditValidatorResponse): unknown {
const obj: any = {};
return obj;
},
};
export const MsgDelegate = {
encode(message: MsgDelegate, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.delegatorAddress);
writer.uint32(18).string(message.validatorAddress);
if (message.amount !== undefined && message.amount !== undefined) {
Coin.encode(message.amount, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgDelegate {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgDelegate } as MsgDelegate;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.delegatorAddress = reader.string();
break;
case 2:
message.validatorAddress = reader.string();
break;
case 3:
message.amount = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgDelegate {
const message = { ...baseMsgDelegate } as MsgDelegate;
if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
message.delegatorAddress = String(object.delegatorAddress);
} else {
message.delegatorAddress = "";
}
if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
message.validatorAddress = String(object.validatorAddress);
} else {
message.validatorAddress = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromJSON(object.amount);
} else {
message.amount = undefined;
}
return message;
},
fromPartial(object: DeepPartial<MsgDelegate>): MsgDelegate {
const message = { ...baseMsgDelegate } as MsgDelegate;
if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
message.delegatorAddress = object.delegatorAddress;
} else {
message.delegatorAddress = "";
}
if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
message.validatorAddress = object.validatorAddress;
} else {
message.validatorAddress = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromPartial(object.amount);
} else {
message.amount = undefined;
}
return message;
},
toJSON(message: MsgDelegate): unknown {
const obj: any = {};
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
return obj;
},
};
export const MsgDelegateResponse = {
encode(_: MsgDelegateResponse, writer: Writer = Writer.create()): Writer {
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgDelegateResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgDelegateResponse } as MsgDelegateResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgDelegateResponse {
const message = { ...baseMsgDelegateResponse } as MsgDelegateResponse;
return message;
},
fromPartial(_: DeepPartial<MsgDelegateResponse>): MsgDelegateResponse {
const message = { ...baseMsgDelegateResponse } as MsgDelegateResponse;
return message;
},
toJSON(_: MsgDelegateResponse): unknown {
const obj: any = {};
return obj;
},
};
export const MsgBeginRedelegate = {
encode(message: MsgBeginRedelegate, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.delegatorAddress);
writer.uint32(18).string(message.validatorSrcAddress);
writer.uint32(26).string(message.validatorDstAddress);
if (message.amount !== undefined && message.amount !== undefined) {
Coin.encode(message.amount, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgBeginRedelegate {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgBeginRedelegate } as MsgBeginRedelegate;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.delegatorAddress = reader.string();
break;
case 2:
message.validatorSrcAddress = reader.string();
break;
case 3:
message.validatorDstAddress = reader.string();
break;
case 4:
message.amount = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgBeginRedelegate {
const message = { ...baseMsgBeginRedelegate } as MsgBeginRedelegate;
if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
message.delegatorAddress = String(object.delegatorAddress);
} else {
message.delegatorAddress = "";
}
if (object.validatorSrcAddress !== undefined && object.validatorSrcAddress !== null) {
message.validatorSrcAddress = String(object.validatorSrcAddress);
} else {
message.validatorSrcAddress = "";
}
if (object.validatorDstAddress !== undefined && object.validatorDstAddress !== null) {
message.validatorDstAddress = String(object.validatorDstAddress);
} else {
message.validatorDstAddress = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromJSON(object.amount);
} else {
message.amount = undefined;
}
return message;
},
fromPartial(object: DeepPartial<MsgBeginRedelegate>): MsgBeginRedelegate {
const message = { ...baseMsgBeginRedelegate } as MsgBeginRedelegate;
if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
message.delegatorAddress = object.delegatorAddress;
} else {
message.delegatorAddress = "";
}
if (object.validatorSrcAddress !== undefined && object.validatorSrcAddress !== null) {
message.validatorSrcAddress = object.validatorSrcAddress;
} else {
message.validatorSrcAddress = "";
}
if (object.validatorDstAddress !== undefined && object.validatorDstAddress !== null) {
message.validatorDstAddress = object.validatorDstAddress;
} else {
message.validatorDstAddress = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromPartial(object.amount);
} else {
message.amount = undefined;
}
return message;
},
toJSON(message: MsgBeginRedelegate): unknown {
const obj: any = {};
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress);
message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress);
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
return obj;
},
};
export const MsgBeginRedelegateResponse = {
encode(message: MsgBeginRedelegateResponse, writer: Writer = Writer.create()): Writer {
if (message.completionTime !== undefined && message.completionTime !== undefined) {
Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgBeginRedelegateResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgBeginRedelegateResponse } as MsgBeginRedelegateResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgBeginRedelegateResponse {
const message = { ...baseMsgBeginRedelegateResponse } as MsgBeginRedelegateResponse;
if (object.completionTime !== undefined && object.completionTime !== null) {
message.completionTime = fromJsonTimestamp(object.completionTime);
} else {
message.completionTime = undefined;
}
return message;
},
fromPartial(object: DeepPartial<MsgBeginRedelegateResponse>): MsgBeginRedelegateResponse {
const message = { ...baseMsgBeginRedelegateResponse } as MsgBeginRedelegateResponse;
if (object.completionTime !== undefined && object.completionTime !== null) {
message.completionTime = object.completionTime;
} else {
message.completionTime = undefined;
}
return message;
},
toJSON(message: MsgBeginRedelegateResponse): unknown {
const obj: any = {};
message.completionTime !== undefined &&
(obj.completionTime =
message.completionTime !== undefined ? message.completionTime.toISOString() : null);
return obj;
},
};
export const MsgUndelegate = {
encode(message: MsgUndelegate, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.delegatorAddress);
writer.uint32(18).string(message.validatorAddress);
if (message.amount !== undefined && message.amount !== undefined) {
Coin.encode(message.amount, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgUndelegate {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgUndelegate } as MsgUndelegate;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.delegatorAddress = reader.string();
break;
case 2:
message.validatorAddress = reader.string();
break;
case 3:
message.amount = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgUndelegate {
const message = { ...baseMsgUndelegate } as MsgUndelegate;
if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
message.delegatorAddress = String(object.delegatorAddress);
} else {
message.delegatorAddress = "";
}
if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
message.validatorAddress = String(object.validatorAddress);
} else {
message.validatorAddress = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromJSON(object.amount);
} else {
message.amount = undefined;
}
return message;
},
fromPartial(object: DeepPartial<MsgUndelegate>): MsgUndelegate {
const message = { ...baseMsgUndelegate } as MsgUndelegate;
if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
message.delegatorAddress = object.delegatorAddress;
} else {
message.delegatorAddress = "";
}
if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
message.validatorAddress = object.validatorAddress;
} else {
message.validatorAddress = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromPartial(object.amount);
} else {
message.amount = undefined;
}
return message;
},
toJSON(message: MsgUndelegate): unknown {
const obj: any = {};
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
return obj;
},
};
export const MsgUndelegateResponse = {
encode(message: MsgUndelegateResponse, writer: Writer = Writer.create()): Writer {
if (message.completionTime !== undefined && message.completionTime !== undefined) {
Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MsgUndelegateResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgUndelegateResponse } as MsgUndelegateResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgUndelegateResponse {
const message = { ...baseMsgUndelegateResponse } as MsgUndelegateResponse;
if (object.completionTime !== undefined && object.completionTime !== null) {
message.completionTime = fromJsonTimestamp(object.completionTime);
} else {
message.completionTime = undefined;
}
return message;
},
fromPartial(object: DeepPartial<MsgUndelegateResponse>): MsgUndelegateResponse {
const message = { ...baseMsgUndelegateResponse } as MsgUndelegateResponse;
if (object.completionTime !== undefined && object.completionTime !== null) {
message.completionTime = object.completionTime;
} else {
message.completionTime = undefined;
}
return message;
},
toJSON(message: MsgUndelegateResponse): unknown {
const obj: any = {};
message.completionTime !== undefined &&
(obj.completionTime =
message.completionTime !== undefined ? message.completionTime.toISOString() : null);
return obj;
},
};
if (util.Long !== (Long as any)) {
util.Long = Long as any;
configure();
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,532 @@
/* eslint-disable */
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[];
}
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.
*/
export enum SignMode {
/** SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be
rejected
*/
SIGN_MODE_UNSPECIFIED = 0,
/** SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is
verified with raw bytes from Tx
*/
SIGN_MODE_DIRECT = 1,
/** SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some
human-readable textual representation on top of the binary representation
from SIGN_MODE_DIRECT
*/
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 = 127,
UNRECOGNIZED = -1,
}
export function signModeFromJSON(object: any): SignMode {
switch (object) {
case 0:
case "SIGN_MODE_UNSPECIFIED":
return SignMode.SIGN_MODE_UNSPECIFIED;
case 1:
case "SIGN_MODE_DIRECT":
return SignMode.SIGN_MODE_DIRECT;
case 2:
case "SIGN_MODE_TEXTUAL":
return SignMode.SIGN_MODE_TEXTUAL;
case 127:
case "SIGN_MODE_LEGACY_AMINO_JSON":
return SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
case -1:
case "UNRECOGNIZED":
default:
return SignMode.UNRECOGNIZED;
}
}
export function signModeToJSON(object: SignMode): string {
switch (object) {
case SignMode.SIGN_MODE_UNSPECIFIED:
return "SIGN_MODE_UNSPECIFIED";
case SignMode.SIGN_MODE_DIRECT:
return "SIGN_MODE_DIRECT";
case SignMode.SIGN_MODE_TEXTUAL:
return "SIGN_MODE_TEXTUAL";
case SignMode.SIGN_MODE_LEGACY_AMINO_JSON:
return "SIGN_MODE_LEGACY_AMINO_JSON";
default:
return "UNKNOWN";
}
}
export const SignatureDescriptors = {
encode(message: SignatureDescriptors, writer: Writer = Writer.create()): Writer {
for (const v of message.signatures) {
SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.signatures = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): SignatureDescriptors {
const message = { ...baseSignatureDescriptors } as SignatureDescriptors;
message.signatures = [];
if (object.signatures !== undefined && object.signatures !== null) {
for (const e of object.signatures) {
message.signatures.push(SignatureDescriptor.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<SignatureDescriptors>): SignatureDescriptors {
const message = { ...baseSignatureDescriptors } as SignatureDescriptors;
message.signatures = [];
if (object.signatures !== undefined && object.signatures !== null) {
for (const e of object.signatures) {
message.signatures.push(SignatureDescriptor.fromPartial(e));
}
}
return message;
},
toJSON(message: SignatureDescriptors): unknown {
const obj: any = {};
if (message.signatures) {
obj.signatures = message.signatures.map((e) => (e ? SignatureDescriptor.toJSON(e) : undefined));
} else {
obj.signatures = [];
}
return obj;
},
};
export const SignatureDescriptor = {
encode(message: SignatureDescriptor, writer: Writer = Writer.create()): Writer {
if (message.publicKey !== undefined && message.publicKey !== undefined) {
Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim();
}
if (message.data !== undefined && message.data !== undefined) {
SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim();
}
writer.uint32(24).uint64(message.sequence);
return writer;
},
decode(input: Uint8Array | Reader, 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;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.publicKey = Any.decode(reader, reader.uint32());
break;
case 2:
message.data = SignatureDescriptor_Data.decode(reader, reader.uint32());
break;
case 3:
message.sequence = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): SignatureDescriptor {
const message = { ...baseSignatureDescriptor } as SignatureDescriptor;
if (object.publicKey !== undefined && object.publicKey !== null) {
message.publicKey = Any.fromJSON(object.publicKey);
} else {
message.publicKey = undefined;
}
if (object.data !== undefined && object.data !== null) {
message.data = SignatureDescriptor_Data.fromJSON(object.data);
} else {
message.data = undefined;
}
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = Long.fromString(object.sequence);
} else {
message.sequence = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<SignatureDescriptor>): SignatureDescriptor {
const message = { ...baseSignatureDescriptor } as SignatureDescriptor;
if (object.publicKey !== undefined && object.publicKey !== null) {
message.publicKey = Any.fromPartial(object.publicKey);
} else {
message.publicKey = undefined;
}
if (object.data !== undefined && object.data !== null) {
message.data = SignatureDescriptor_Data.fromPartial(object.data);
} else {
message.data = undefined;
}
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = object.sequence as Long;
} else {
message.sequence = Long.UZERO;
}
return message;
},
toJSON(message: SignatureDescriptor): unknown {
const obj: any = {};
message.publicKey !== undefined &&
(obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined);
message.data !== undefined &&
(obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined);
message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString());
return obj;
},
};
export const SignatureDescriptor_Data = {
encode(message: SignatureDescriptor_Data, writer: Writer = Writer.create()): Writer {
if (message.single !== undefined) {
SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).ldelim();
}
if (message.multi !== undefined) {
SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32());
break;
case 2:
message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): SignatureDescriptor_Data {
const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data;
if (object.single !== undefined && object.single !== null) {
message.single = SignatureDescriptor_Data_Single.fromJSON(object.single);
} else {
message.single = undefined;
}
if (object.multi !== undefined && object.multi !== null) {
message.multi = SignatureDescriptor_Data_Multi.fromJSON(object.multi);
} else {
message.multi = undefined;
}
return message;
},
fromPartial(object: DeepPartial<SignatureDescriptor_Data>): SignatureDescriptor_Data {
const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data;
if (object.single !== undefined && object.single !== null) {
message.single = SignatureDescriptor_Data_Single.fromPartial(object.single);
} else {
message.single = undefined;
}
if (object.multi !== undefined && object.multi !== null) {
message.multi = SignatureDescriptor_Data_Multi.fromPartial(object.multi);
} else {
message.multi = undefined;
}
return message;
},
toJSON(message: SignatureDescriptor_Data): unknown {
const obj: any = {};
message.single !== undefined &&
(obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined);
message.multi !== undefined &&
(obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined);
return obj;
},
};
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 {
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;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.mode = reader.int32() as any;
break;
case 2:
message.signature = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): SignatureDescriptor_Data_Single {
const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single;
if (object.mode !== undefined && object.mode !== null) {
message.mode = signModeFromJSON(object.mode);
} else {
message.mode = 0;
}
if (object.signature !== undefined && object.signature !== null) {
message.signature = bytesFromBase64(object.signature);
}
return message;
},
fromPartial(object: DeepPartial<SignatureDescriptor_Data_Single>): SignatureDescriptor_Data_Single {
const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single;
if (object.mode !== undefined && object.mode !== null) {
message.mode = object.mode;
} else {
message.mode = 0;
}
if (object.signature !== undefined && object.signature !== null) {
message.signature = object.signature;
} else {
message.signature = new Uint8Array();
}
return message;
},
toJSON(message: SignatureDescriptor_Data_Single): unknown {
const obj: any = {};
message.mode !== undefined && (obj.mode = signModeToJSON(message.mode));
message.signature !== undefined &&
(obj.signature = base64FromBytes(
message.signature !== undefined ? message.signature : new Uint8Array(),
));
return obj;
},
};
export const SignatureDescriptor_Data_Multi = {
encode(message: SignatureDescriptor_Data_Multi, writer: Writer = Writer.create()): Writer {
if (message.bitarray !== undefined && message.bitarray !== undefined) {
CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim();
}
for (const v of message.signatures) {
SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.signatures = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.bitarray = CompactBitArray.decode(reader, reader.uint32());
break;
case 2:
message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): SignatureDescriptor_Data_Multi {
const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi;
message.signatures = [];
if (object.bitarray !== undefined && object.bitarray !== null) {
message.bitarray = CompactBitArray.fromJSON(object.bitarray);
} else {
message.bitarray = undefined;
}
if (object.signatures !== undefined && object.signatures !== null) {
for (const e of object.signatures) {
message.signatures.push(SignatureDescriptor_Data.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<SignatureDescriptor_Data_Multi>): SignatureDescriptor_Data_Multi {
const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi;
message.signatures = [];
if (object.bitarray !== undefined && object.bitarray !== null) {
message.bitarray = CompactBitArray.fromPartial(object.bitarray);
} else {
message.bitarray = undefined;
}
if (object.signatures !== undefined && object.signatures !== null) {
for (const e of object.signatures) {
message.signatures.push(SignatureDescriptor_Data.fromPartial(e));
}
}
return message;
},
toJSON(message: SignatureDescriptor_Data_Multi): unknown {
const obj: any = {};
message.bitarray !== undefined &&
(obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined);
if (message.signatures) {
obj.signatures = message.signatures.map((e) => (e ? SignatureDescriptor_Data.toJSON(e) : undefined));
} else {
obj.signatures = [];
}
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
/* eslint-disable */
export const protobufPackage = "cosmos_proto";

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
/* eslint-disable */
export const protobufPackage = "gogoproto";

View File

@ -0,0 +1,3 @@
/* eslint-disable */
export const protobufPackage = "google.api";

View File

@ -0,0 +1,679 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
/**
* Defines the HTTP configuration for an API service. It contains a list of
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
* to one or more HTTP REST API methods.
*/
export interface Http {
/**
* A list of HTTP configuration rules that apply to individual API methods.
*
* **NOTE:** All service configuration rules follow "last one wins" order.
*/
rules: HttpRule[];
/**
* When set to true, URL path parmeters will be fully URI-decoded except in
* cases of single segment matches in reserved expansion, where "%2F" will be
* left encoded.
*
* The default behavior is to not decode RFC 6570 reserved characters in multi
* segment matches.
*/
fullyDecodeReservedExpansion: boolean;
}
/**
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
* REST API methods. The mapping specifies how different portions of the RPC
* request message are mapped to URL path, URL query parameters, and
* HTTP request body. The mapping is typically specified as an
* `google.api.http` annotation on the RPC method,
* see "google/api/annotations.proto" for details.
*
* The mapping consists of a field specifying the path template and
* method kind. The path template can refer to fields in the request
* message, as in the example below which describes a REST GET
* operation on a resource collection of messages:
*
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
* }
* }
* message GetMessageRequest {
* message SubMessage {
* string subfield = 1;
* }
* string message_id = 1; // mapped to the URL
* SubMessage sub = 2; // `sub.subfield` is url-mapped
* }
* message Message {
* string text = 1; // content of the resource
* }
*
* The same http annotation can alternatively be expressed inside the
* `GRPC API Configuration` YAML file.
*
* http:
* rules:
* - selector: <proto_package_name>.Messaging.GetMessage
* get: /v1/messages/{message_id}/{sub.subfield}
*
* This definition enables an automatic, bidrectional mapping of HTTP
* JSON to RPC. Example:
*
* HTTP | RPC
* -----|-----
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
*
* In general, not only fields but also field paths can be referenced
* from a path pattern. Fields mapped to the path pattern cannot be
* repeated and must have a primitive (non-message) type.
*
* Any fields in the request message which are not bound by the path
* pattern automatically become (optional) HTTP query
* parameters. Assume the following definition of the request message:
*
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http).get = "/v1/messages/{message_id}";
* }
* }
* message GetMessageRequest {
* message SubMessage {
* string subfield = 1;
* }
* string message_id = 1; // mapped to the URL
* int64 revision = 2; // becomes a parameter
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
* }
*
*
* This enables a HTTP JSON to RPC mapping as below:
*
* HTTP | RPC
* -----|-----
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
*
* Note that fields which are mapped to HTTP parameters must have a
* primitive type or a repeated primitive type. Message types are not
* allowed. In the case of a repeated type, the parameter can be
* repeated in the URL, as in `...?param=A&param=B`.
*
* For HTTP method kinds which allow a request body, the `body` field
* specifies the mapping. Consider a REST update method on the
* message resource collection:
*
*
* service Messaging {
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
* option (google.api.http) = {
* put: "/v1/messages/{message_id}"
* body: "message"
* };
* }
* }
* message UpdateMessageRequest {
* string message_id = 1; // mapped to the URL
* Message message = 2; // mapped to the body
* }
*
*
* The following HTTP JSON to RPC mapping is enabled, where the
* representation of the JSON in the request body is determined by
* protos JSON encoding:
*
* HTTP | RPC
* -----|-----
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
*
* The special name `*` can be used in the body mapping to define that
* every field not bound by the path template should be mapped to the
* request body. This enables the following alternative definition of
* the update method:
*
* service Messaging {
* rpc UpdateMessage(Message) returns (Message) {
* option (google.api.http) = {
* put: "/v1/messages/{message_id}"
* body: "*"
* };
* }
* }
* message Message {
* string message_id = 1;
* string text = 2;
* }
*
*
* The following HTTP JSON to RPC mapping is enabled:
*
* HTTP | RPC
* -----|-----
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
*
* Note that when using `*` in the body mapping, it is not possible to
* have HTTP parameters, as all fields not bound by the path end in
* the body. This makes this option more rarely used in practice of
* defining REST APIs. The common usage of `*` is in custom methods
* which don't use the URL at all for transferring data.
*
* It is possible to define multiple HTTP methods for one RPC by using
* the `additional_bindings` option. Example:
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http) = {
* get: "/v1/messages/{message_id}"
* additional_bindings {
* get: "/v1/users/{user_id}/messages/{message_id}"
* }
* };
* }
* }
* message GetMessageRequest {
* string message_id = 1;
* string user_id = 2;
* }
*
*
* This enables the following two alternative HTTP JSON to RPC
* mappings:
*
* HTTP | RPC
* -----|-----
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
*
* # Rules for HTTP mapping
*
* The rules for mapping HTTP path, query parameters, and body fields
* to the request message are as follows:
*
* 1. The `body` field specifies either `*` or a field path, or is
* omitted. If omitted, it indicates there is no HTTP request body.
* 2. Leaf fields (recursive expansion of nested messages in the
* request) can be classified into three types:
* (a) Matched in the URL template.
* (b) Covered by body (if body is `*`, everything except (a) fields;
* else everything under the body field)
* (c) All other fields.
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
* 4. Any body sent with an HTTP request can contain only (b) fields.
*
* The syntax of the path template is as follows:
*
* Template = "/" Segments [ Verb ] ;
* Segments = Segment { "/" Segment } ;
* Segment = "*" | "**" | LITERAL | Variable ;
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
* FieldPath = IDENT { "." IDENT } ;
* Verb = ":" LITERAL ;
*
* The syntax `*` matches a single path segment. The syntax `**` matches zero
* or more path segments, which must be the last part of the path except the
* `Verb`. The syntax `LITERAL` matches literal text in the path.
*
* The syntax `Variable` matches part of the URL path as specified by its
* template. A variable template must not contain other variables. If a variable
* matches a single path segment, its template may be omitted, e.g. `{var}`
* is equivalent to `{var=*}`.
*
* If a variable contains exactly one path segment, such as `"{var}"` or
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
* Discovery Document as `{var}`.
*
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
* show up in the Discovery Document as `{+var}`.
*
* NOTE: While the single segment variable matches the semantics of
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
* Simple String Expansion, the multi segment variable **does not** match
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
* does not expand special characters like `?` and `#`, which would lead
* to invalid URLs.
*
* NOTE: the field paths in variables and in the `body` must not refer to
* repeated fields or map fields.
*/
export interface HttpRule {
/**
* Selects methods to which this rule applies.
*
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
*/
selector: string;
/**
* Used for listing and getting information about resources.
*/
get: string | undefined;
/**
* Used for updating a resource.
*/
put: string | undefined;
/**
* Used for creating a resource.
*/
post: string | undefined;
/**
* Used for deleting a resource.
*/
delete: string | undefined;
/**
* Used for updating a resource.
*/
patch: string | undefined;
/**
* The custom pattern is used for specifying an HTTP method that is not
* included in the `pattern` field, such as HEAD, or "*" to leave the
* HTTP method unspecified for this rule. The wild-card rule is useful
* for services that provide content to Web (HTML) clients.
*/
custom?: CustomHttpPattern | undefined;
/**
* The name of the request field whose value is mapped to the HTTP body, or
* `*` for mapping all fields not captured by the path pattern to the HTTP
* body. NOTE: the referred field must not be a repeated field and must be
* present at the top-level of request message type.
*/
body: string;
/**
* Optional. The name of the response field whose value is mapped to the HTTP
* body of response. Other response fields are ignored. When
* not set, the response message will be used as HTTP body of response.
*/
responseBody: string;
/**
* Additional HTTP bindings for the selector. Nested bindings must
* not contain an `additional_bindings` field themselves (that is,
* the nesting may only be one level deep).
*/
additionalBindings: HttpRule[];
}
/**
* A custom pattern is used for defining custom HTTP verb.
*/
export interface CustomHttpPattern {
/**
* The name of this custom HTTP verb.
*/
kind: string;
/**
* The path matched by this custom verb.
*/
path: string;
}
const baseHttp: object = {
fullyDecodeReservedExpansion: false,
};
const baseHttpRule: object = {
selector: "",
body: "",
responseBody: "",
};
const baseCustomHttpPattern: object = {
kind: "",
path: "",
};
export const protobufPackage = "google.api";
export const Http = {
encode(message: Http, writer: Writer = Writer.create()): Writer {
for (const v of message.rules) {
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
}
writer.uint32(16).bool(message.fullyDecodeReservedExpansion);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Http {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseHttp } as Http;
message.rules = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.rules.push(HttpRule.decode(reader, reader.uint32()));
break;
case 2:
message.fullyDecodeReservedExpansion = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Http {
const message = { ...baseHttp } as Http;
message.rules = [];
if (object.rules !== undefined && object.rules !== null) {
for (const e of object.rules) {
message.rules.push(HttpRule.fromJSON(e));
}
}
if (object.fullyDecodeReservedExpansion !== undefined && object.fullyDecodeReservedExpansion !== null) {
message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion);
} else {
message.fullyDecodeReservedExpansion = false;
}
return message;
},
fromPartial(object: DeepPartial<Http>): Http {
const message = { ...baseHttp } as Http;
message.rules = [];
if (object.rules !== undefined && object.rules !== null) {
for (const e of object.rules) {
message.rules.push(HttpRule.fromPartial(e));
}
}
if (object.fullyDecodeReservedExpansion !== undefined && object.fullyDecodeReservedExpansion !== null) {
message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion;
} else {
message.fullyDecodeReservedExpansion = false;
}
return message;
},
toJSON(message: Http): unknown {
const obj: any = {};
if (message.rules) {
obj.rules = message.rules.map((e) => (e ? HttpRule.toJSON(e) : undefined));
} else {
obj.rules = [];
}
message.fullyDecodeReservedExpansion !== undefined &&
(obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion);
return obj;
},
};
export const HttpRule = {
encode(message: HttpRule, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.selector);
if (message.get !== undefined) {
writer.uint32(18).string(message.get);
}
if (message.put !== undefined) {
writer.uint32(26).string(message.put);
}
if (message.post !== undefined) {
writer.uint32(34).string(message.post);
}
if (message.delete !== undefined) {
writer.uint32(42).string(message.delete);
}
if (message.patch !== undefined) {
writer.uint32(50).string(message.patch);
}
if (message.custom !== undefined) {
CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim();
}
writer.uint32(58).string(message.body);
writer.uint32(98).string(message.responseBody);
for (const v of message.additionalBindings) {
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): HttpRule {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseHttpRule } as HttpRule;
message.additionalBindings = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.selector = reader.string();
break;
case 2:
message.get = reader.string();
break;
case 3:
message.put = reader.string();
break;
case 4:
message.post = reader.string();
break;
case 5:
message.delete = reader.string();
break;
case 6:
message.patch = reader.string();
break;
case 8:
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
break;
case 7:
message.body = reader.string();
break;
case 12:
message.responseBody = reader.string();
break;
case 11:
message.additionalBindings.push(HttpRule.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): HttpRule {
const message = { ...baseHttpRule } as HttpRule;
message.additionalBindings = [];
if (object.selector !== undefined && object.selector !== null) {
message.selector = String(object.selector);
} else {
message.selector = "";
}
if (object.get !== undefined && object.get !== null) {
message.get = String(object.get);
} else {
message.get = undefined;
}
if (object.put !== undefined && object.put !== null) {
message.put = String(object.put);
} else {
message.put = undefined;
}
if (object.post !== undefined && object.post !== null) {
message.post = String(object.post);
} else {
message.post = undefined;
}
if (object.delete !== undefined && object.delete !== null) {
message.delete = String(object.delete);
} else {
message.delete = undefined;
}
if (object.patch !== undefined && object.patch !== null) {
message.patch = String(object.patch);
} else {
message.patch = undefined;
}
if (object.custom !== undefined && object.custom !== null) {
message.custom = CustomHttpPattern.fromJSON(object.custom);
} else {
message.custom = undefined;
}
if (object.body !== undefined && object.body !== null) {
message.body = String(object.body);
} else {
message.body = "";
}
if (object.responseBody !== undefined && object.responseBody !== null) {
message.responseBody = String(object.responseBody);
} else {
message.responseBody = "";
}
if (object.additionalBindings !== undefined && object.additionalBindings !== null) {
for (const e of object.additionalBindings) {
message.additionalBindings.push(HttpRule.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<HttpRule>): HttpRule {
const message = { ...baseHttpRule } as HttpRule;
message.additionalBindings = [];
if (object.selector !== undefined && object.selector !== null) {
message.selector = object.selector;
} else {
message.selector = "";
}
if (object.get !== undefined && object.get !== null) {
message.get = object.get;
} else {
message.get = undefined;
}
if (object.put !== undefined && object.put !== null) {
message.put = object.put;
} else {
message.put = undefined;
}
if (object.post !== undefined && object.post !== null) {
message.post = object.post;
} else {
message.post = undefined;
}
if (object.delete !== undefined && object.delete !== null) {
message.delete = object.delete;
} else {
message.delete = undefined;
}
if (object.patch !== undefined && object.patch !== null) {
message.patch = object.patch;
} else {
message.patch = undefined;
}
if (object.custom !== undefined && object.custom !== null) {
message.custom = CustomHttpPattern.fromPartial(object.custom);
} else {
message.custom = undefined;
}
if (object.body !== undefined && object.body !== null) {
message.body = object.body;
} else {
message.body = "";
}
if (object.responseBody !== undefined && object.responseBody !== null) {
message.responseBody = object.responseBody;
} else {
message.responseBody = "";
}
if (object.additionalBindings !== undefined && object.additionalBindings !== null) {
for (const e of object.additionalBindings) {
message.additionalBindings.push(HttpRule.fromPartial(e));
}
}
return message;
},
toJSON(message: HttpRule): unknown {
const obj: any = {};
message.selector !== undefined && (obj.selector = message.selector);
message.get !== undefined && (obj.get = message.get);
message.put !== undefined && (obj.put = message.put);
message.post !== undefined && (obj.post = message.post);
message.delete !== undefined && (obj.delete = message.delete);
message.patch !== undefined && (obj.patch = message.patch);
message.custom !== undefined &&
(obj.custom = message.custom ? CustomHttpPattern.toJSON(message.custom) : undefined);
message.body !== undefined && (obj.body = message.body);
message.responseBody !== undefined && (obj.responseBody = message.responseBody);
if (message.additionalBindings) {
obj.additionalBindings = message.additionalBindings.map((e) => (e ? HttpRule.toJSON(e) : undefined));
} else {
obj.additionalBindings = [];
}
return obj;
},
};
export const CustomHttpPattern = {
encode(message: CustomHttpPattern, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.kind);
writer.uint32(18).string(message.path);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): CustomHttpPattern {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.kind = reader.string();
break;
case 2:
message.path = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): CustomHttpPattern {
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
if (object.kind !== undefined && object.kind !== null) {
message.kind = String(object.kind);
} else {
message.kind = "";
}
if (object.path !== undefined && object.path !== null) {
message.path = String(object.path);
} else {
message.path = "";
}
return message;
},
fromPartial(object: DeepPartial<CustomHttpPattern>): CustomHttpPattern {
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
if (object.kind !== undefined && object.kind !== null) {
message.kind = object.kind;
} else {
message.kind = "";
}
if (object.path !== undefined && object.path !== null) {
message.path = object.path;
} else {
message.path = "";
}
return message;
},
toJSON(message: CustomHttpPattern): unknown {
const obj: any = {};
message.kind !== undefined && (obj.kind = message.kind);
message.path !== undefined && (obj.path = message.path);
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,225 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
/**
* `Any` contains an arbitrary serialized protocol buffer message along with a
* URL that describes the type of the serialized message.
*
* Protobuf library provides support to pack/unpack Any values in the form
* of utility functions or additional generated methods of the Any type.
*
* Example 1: Pack and unpack a message in C++.
*
* Foo foo = ...;
* Any any;
* any.PackFrom(foo);
* ...
* if (any.UnpackTo(&foo)) {
* ...
* }
*
* Example 2: Pack and unpack a message in Java.
*
* Foo foo = ...;
* Any any = Any.pack(foo);
* ...
* if (any.is(Foo.class)) {
* foo = any.unpack(Foo.class);
* }
*
* Example 3: Pack and unpack a message in Python.
*
* foo = Foo(...)
* any = Any()
* any.Pack(foo)
* ...
* if any.Is(Foo.DESCRIPTOR):
* any.Unpack(foo)
* ...
*
* Example 4: Pack and unpack a message in Go
*
* foo := &pb.Foo{...}
* any, err := ptypes.MarshalAny(foo)
* ...
* foo := &pb.Foo{}
* if err := ptypes.UnmarshalAny(any, foo); err != nil {
* ...
* }
*
* The pack methods provided by protobuf library will by default use
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
* methods only use the fully qualified type name after the last '/'
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
* name "y.z".
*
*
* JSON
* ====
* The JSON representation of an `Any` value uses the regular
* representation of the deserialized, embedded message, with an
* additional field `@type` which contains the type URL. Example:
*
* package google.profile;
* message Person {
* string first_name = 1;
* string last_name = 2;
* }
*
* {
* "@type": "type.googleapis.com/google.profile.Person",
* "firstName": <string>,
* "lastName": <string>
* }
*
* If the embedded message type is well-known and has a custom JSON
* representation, that representation will be embedded adding a field
* `value` which holds the custom JSON in addition to the `@type`
* field. Example (for message [google.protobuf.Duration][]):
*
* {
* "@type": "type.googleapis.com/google.protobuf.Duration",
* "value": "1.212s"
* }
*
*/
export interface Any {
/**
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. This string must contain at least
* one "/" character. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
* URL, or have them precompiled into a binary to avoid any
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
*/
typeUrl: string;
/**
* Must be a valid serialized protocol buffer of the above specified type.
*/
value: Uint8Array;
}
const baseAny: object = {
typeUrl: "",
};
export const protobufPackage = "google.protobuf";
export const Any = {
encode(message: Any, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.typeUrl);
writer.uint32(18).bytes(message.value);
return writer;
},
decode(input: Uint8Array | Reader, 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;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.typeUrl = reader.string();
break;
case 2:
message.value = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Any {
const message = { ...baseAny } as Any;
if (object.typeUrl !== undefined && object.typeUrl !== null) {
message.typeUrl = String(object.typeUrl);
} else {
message.typeUrl = "";
}
if (object.value !== undefined && object.value !== null) {
message.value = bytesFromBase64(object.value);
}
return message;
},
fromPartial(object: DeepPartial<Any>): Any {
const message = { ...baseAny } as Any;
if (object.typeUrl !== undefined && object.typeUrl !== null) {
message.typeUrl = object.typeUrl;
} else {
message.typeUrl = "";
}
if (object.value !== undefined && object.value !== null) {
message.value = object.value;
} else {
message.value = new Uint8Array();
}
return message;
},
toJSON(message: Any): unknown {
const obj: any = {};
message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl);
message.value !== undefined &&
(obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array()));
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
/* eslint-disable */
import * as Long from "long";
import { Writer, Reader } from "protobufjs/minimal";
/**
* A Duration represents a signed, fixed-length span of time represented
* as a count of seconds and fractions of seconds at nanosecond
* resolution. It is independent of any calendar and concepts like "day"
* or "month". It is related to Timestamp in that the difference between
* two Timestamp values is a Duration and it can be added or subtracted
* from a Timestamp. Range is approximately +-10,000 years.
*
* # Examples
*
* Example 1: Compute Duration from two Timestamps in pseudo code.
*
* Timestamp start = ...;
* Timestamp end = ...;
* Duration duration = ...;
*
* duration.seconds = end.seconds - start.seconds;
* duration.nanos = end.nanos - start.nanos;
*
* if (duration.seconds < 0 && duration.nanos > 0) {
* duration.seconds += 1;
* duration.nanos -= 1000000000;
* } else if (duration.seconds > 0 && duration.nanos < 0) {
* duration.seconds -= 1;
* duration.nanos += 1000000000;
* }
*
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
*
* Timestamp start = ...;
* Duration duration = ...;
* Timestamp end = ...;
*
* end.seconds = start.seconds + duration.seconds;
* end.nanos = start.nanos + duration.nanos;
*
* if (end.nanos < 0) {
* end.seconds -= 1;
* end.nanos += 1000000000;
* } else if (end.nanos >= 1000000000) {
* end.seconds += 1;
* end.nanos -= 1000000000;
* }
*
* Example 3: Compute Duration from datetime.timedelta in Python.
*
* td = datetime.timedelta(days=3, minutes=10)
* duration = Duration()
* duration.FromTimedelta(td)
*
* # JSON Mapping
*
* In JSON format, the Duration type is encoded as a string rather than an
* object, where the string ends in the suffix "s" (indicating seconds) and
* is preceded by the number of seconds, with nanoseconds expressed as
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
* microsecond should be expressed in JSON format as "3.000001s".
*
*
*/
export interface Duration {
/**
* Signed seconds of the span of time. Must be from -315,576,000,000
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
*/
seconds: Long;
/**
* Signed fractions of a second at nanosecond resolution of the span
* of time. Durations less than one second are represented with a 0
* `seconds` field and a positive or negative `nanos` field. For durations
* of one second or more, a non-zero value for the `nanos` field must be
* of the same sign as the `seconds` field. Must be from -999,999,999
* to +999,999,999 inclusive.
*/
nanos: number;
}
const baseDuration: object = {
seconds: Long.ZERO,
nanos: 0,
};
export const protobufPackage = "google.protobuf";
export const Duration = {
encode(message: Duration, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int64(message.seconds);
writer.uint32(16).int32(message.nanos);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Duration {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseDuration } as Duration;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.seconds = reader.int64() as Long;
break;
case 2:
message.nanos = reader.int32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Duration {
const message = { ...baseDuration } as Duration;
if (object.seconds !== undefined && object.seconds !== null) {
message.seconds = Long.fromString(object.seconds);
} else {
message.seconds = Long.ZERO;
}
if (object.nanos !== undefined && object.nanos !== null) {
message.nanos = Number(object.nanos);
} else {
message.nanos = 0;
}
return message;
},
fromPartial(object: DeepPartial<Duration>): Duration {
const message = { ...baseDuration } as Duration;
if (object.seconds !== undefined && object.seconds !== null) {
message.seconds = object.seconds as Long;
} else {
message.seconds = Long.ZERO;
}
if (object.nanos !== undefined && object.nanos !== null) {
message.nanos = object.nanos;
} else {
message.nanos = 0;
}
return message;
},
toJSON(message: Duration): unknown {
const obj: any = {};
message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString());
message.nanos !== undefined && (obj.nanos = message.nanos);
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,185 @@
/* eslint-disable */
import * as Long from "long";
import { Writer, Reader } from "protobufjs/minimal";
/**
* A Timestamp represents a point in time independent of any time zone or local
* calendar, encoded as a count of seconds and fractions of seconds at
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
* January 1, 1970, in the proleptic Gregorian calendar which extends the
* Gregorian calendar backwards to year one.
*
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
* second table is needed for interpretation, using a [24-hour linear
* smear](https://developers.google.com/time/smear).
*
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
* restricting to that range, we ensure that we can convert to and from [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
*
* # Examples
*
* Example 1: Compute Timestamp from POSIX `time()`.
*
* Timestamp timestamp;
* timestamp.set_seconds(time(NULL));
* timestamp.set_nanos(0);
*
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
*
* struct timeval tv;
* gettimeofday(&tv, NULL);
*
* Timestamp timestamp;
* timestamp.set_seconds(tv.tv_sec);
* timestamp.set_nanos(tv.tv_usec * 1000);
*
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
*
* FILETIME ft;
* GetSystemTimeAsFileTime(&ft);
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
*
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
* Timestamp timestamp;
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
*
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
*
* long millis = System.currentTimeMillis();
*
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
* .setNanos((int) ((millis % 1000) * 1000000)).build();
*
*
* Example 5: Compute Timestamp from current time in Python.
*
* timestamp = Timestamp()
* timestamp.GetCurrentTime()
*
* # JSON Mapping
*
* In JSON format, the Timestamp type is encoded as a string in the
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
* where {year} is always expressed using four digits while {month}, {day},
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
* is required. A proto3 JSON serializer should always use UTC (as indicated by
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
* able to accept both UTC and other timezones (as indicated by an offset).
*
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
* 01:30 UTC on January 15, 2017.
*
* In JavaScript, one can convert a Date object to this format using the
* standard
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
* method. In Python, a standard `datetime.datetime` object can be converted
* to this format using
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
* ) to obtain a formatter capable of generating timestamps in this format.
*
*
*/
export interface Timestamp {
/**
* Represents seconds of UTC time since Unix epoch
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
* 9999-12-31T23:59:59Z inclusive.
*/
seconds: Long;
/**
* Non-negative fractions of a second at nanosecond resolution. Negative
* second values with fractions must still have non-negative nanos values
* that count forward in time. Must be from 0 to 999,999,999
* inclusive.
*/
nanos: number;
}
const baseTimestamp: object = {
seconds: Long.ZERO,
nanos: 0,
};
export const protobufPackage = "google.protobuf";
export const Timestamp = {
encode(message: Timestamp, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int64(message.seconds);
writer.uint32(16).int32(message.nanos);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Timestamp {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseTimestamp } as Timestamp;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.seconds = reader.int64() as Long;
break;
case 2:
message.nanos = reader.int32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Timestamp {
const message = { ...baseTimestamp } as Timestamp;
if (object.seconds !== undefined && object.seconds !== null) {
message.seconds = Long.fromString(object.seconds);
} else {
message.seconds = Long.ZERO;
}
if (object.nanos !== undefined && object.nanos !== null) {
message.nanos = Number(object.nanos);
} else {
message.nanos = 0;
}
return message;
},
fromPartial(object: DeepPartial<Timestamp>): Timestamp {
const message = { ...baseTimestamp } as Timestamp;
if (object.seconds !== undefined && object.seconds !== null) {
message.seconds = object.seconds as Long;
} else {
message.seconds = Long.ZERO;
}
if (object.nanos !== undefined && object.nanos !== null) {
message.nanos = object.nanos;
} else {
message.nanos = 0;
}
return message;
},
toJSON(message: Timestamp): unknown {
const obj: any = {};
message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString());
message.nanos !== undefined && (obj.nanos = message.nanos);
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,991 @@
/* eslint-disable */
import * as Long from "long";
import { Height } from "../../../../ibc/core/client/v1/client";
import { Writer, Reader } from "protobufjs/minimal";
/**
* Channel defines pipeline for exactly-once packet delivery between specific
* modules on separate blockchains, which has at least one end capable of
* sending packets and one end capable of receiving packets.
*/
export interface Channel {
/**
* current state of the channel end
*/
state: State;
/**
* whether the channel is ordered or unordered
*/
ordering: Order;
/**
* counterparty channel end
*/
counterparty?: Counterparty;
/**
* list of connection identifiers, in order, along which packets sent on
* this channel will travel
*/
connectionHops: string[];
/**
* opaque channel version, which is agreed upon during the handshake
*/
version: string;
}
/**
* IdentifiedChannel defines a channel with additional port and channel
* identifier fields.
*/
export interface IdentifiedChannel {
/**
* current state of the channel end
*/
state: State;
/**
* whether the channel is ordered or unordered
*/
ordering: Order;
/**
* counterparty channel end
*/
counterparty?: Counterparty;
/**
* list of connection identifiers, in order, along which packets sent on
* this channel will travel
*/
connectionHops: string[];
/**
* opaque channel version, which is agreed upon during the handshake
*/
version: string;
/**
* port identifier
*/
portId: string;
/**
* channel identifier
*/
channelId: string;
}
/**
* Counterparty defines a channel end counterparty
*/
export interface Counterparty {
/**
* port on the counterparty chain which owns the other end of the channel.
*/
portId: string;
/**
* channel end on the counterparty chain
*/
channelId: string;
}
/**
* Packet defines a type that carries data across different chains through IBC
*/
export interface Packet {
/**
* number corresponds to the order of sends and receives, where a Packet
* with an earlier sequence number must be sent and received before a Packet
* with a later sequence number.
*/
sequence: Long;
/**
* identifies the port on the sending chain.
*/
sourcePort: string;
/**
* identifies the channel end on the sending chain.
*/
sourceChannel: string;
/**
* identifies the port on the receiving chain.
*/
destinationPort: string;
/**
* identifies the channel end on the receiving chain.
*/
destinationChannel: string;
/**
* actual opaque bytes transferred directly to the application module
*/
data: Uint8Array;
/**
* block height after which the packet times out
*/
timeoutHeight?: Height;
/**
* block timestamp (in nanoseconds) after which the packet times out
*/
timeoutTimestamp: Long;
}
/**
* PacketState defines the generic type necessary to retrieve and store
* packet commitments, acknowledgements, and receipts.
* Caller is responsible for knowing the context necessary to interpret this
* state as a commitment, acknowledgement, or a receipt.
*/
export interface PacketState {
/**
* channel port identifier.
*/
portId: string;
/**
* channel unique identifier.
*/
channelId: string;
/**
* packet sequence.
*/
sequence: Long;
/**
* embedded data that represents packet state.
*/
data: Uint8Array;
}
/**
* Acknowledgement is the recommended acknowledgement format to be used by
* app-specific protocols.
* NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental
* conflicts with other protobuf message formats used for acknowledgements.
* The first byte of any message with this format will be the non-ASCII values
* `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS:
* https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#acknowledgement-envelope
*/
export interface Acknowledgement {
result: Uint8Array | undefined;
error: string | undefined;
}
const baseChannel: object = {
state: 0,
ordering: 0,
connectionHops: "",
version: "",
};
const baseIdentifiedChannel: object = {
state: 0,
ordering: 0,
connectionHops: "",
version: "",
portId: "",
channelId: "",
};
const baseCounterparty: object = {
portId: "",
channelId: "",
};
const basePacket: object = {
sequence: Long.UZERO,
sourcePort: "",
sourceChannel: "",
destinationPort: "",
destinationChannel: "",
timeoutTimestamp: Long.UZERO,
};
const basePacketState: object = {
portId: "",
channelId: "",
sequence: Long.UZERO,
};
const baseAcknowledgement: object = {};
export const protobufPackage = "ibc.core.channel.v1";
/** State defines if a channel is in one of the following states:
CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED.
*/
export enum State {
/** STATE_UNINITIALIZED_UNSPECIFIED - Default State
*/
STATE_UNINITIALIZED_UNSPECIFIED = 0,
/** STATE_INIT - A channel has just started the opening handshake.
*/
STATE_INIT = 1,
/** STATE_TRYOPEN - A channel has acknowledged the handshake step on the counterparty chain.
*/
STATE_TRYOPEN = 2,
/** STATE_OPEN - A channel has completed the handshake. Open channels are
ready to send and receive packets.
*/
STATE_OPEN = 3,
/** STATE_CLOSED - A channel has been closed and can no longer be used to send or receive
packets.
*/
STATE_CLOSED = 4,
UNRECOGNIZED = -1,
}
export function stateFromJSON(object: any): State {
switch (object) {
case 0:
case "STATE_UNINITIALIZED_UNSPECIFIED":
return State.STATE_UNINITIALIZED_UNSPECIFIED;
case 1:
case "STATE_INIT":
return State.STATE_INIT;
case 2:
case "STATE_TRYOPEN":
return State.STATE_TRYOPEN;
case 3:
case "STATE_OPEN":
return State.STATE_OPEN;
case 4:
case "STATE_CLOSED":
return State.STATE_CLOSED;
case -1:
case "UNRECOGNIZED":
default:
return State.UNRECOGNIZED;
}
}
export function stateToJSON(object: State): string {
switch (object) {
case State.STATE_UNINITIALIZED_UNSPECIFIED:
return "STATE_UNINITIALIZED_UNSPECIFIED";
case State.STATE_INIT:
return "STATE_INIT";
case State.STATE_TRYOPEN:
return "STATE_TRYOPEN";
case State.STATE_OPEN:
return "STATE_OPEN";
case State.STATE_CLOSED:
return "STATE_CLOSED";
default:
return "UNKNOWN";
}
}
/** Order defines if a channel is ORDERED or UNORDERED
*/
export enum Order {
/** ORDER_NONE_UNSPECIFIED - zero-value for channel ordering
*/
ORDER_NONE_UNSPECIFIED = 0,
/** ORDER_UNORDERED - packets can be delivered in any order, which may differ from the order in
which they were sent.
*/
ORDER_UNORDERED = 1,
/** ORDER_ORDERED - packets are delivered exactly in the order which they were sent
*/
ORDER_ORDERED = 2,
UNRECOGNIZED = -1,
}
export function orderFromJSON(object: any): Order {
switch (object) {
case 0:
case "ORDER_NONE_UNSPECIFIED":
return Order.ORDER_NONE_UNSPECIFIED;
case 1:
case "ORDER_UNORDERED":
return Order.ORDER_UNORDERED;
case 2:
case "ORDER_ORDERED":
return Order.ORDER_ORDERED;
case -1:
case "UNRECOGNIZED":
default:
return Order.UNRECOGNIZED;
}
}
export function orderToJSON(object: Order): string {
switch (object) {
case Order.ORDER_NONE_UNSPECIFIED:
return "ORDER_NONE_UNSPECIFIED";
case Order.ORDER_UNORDERED:
return "ORDER_UNORDERED";
case Order.ORDER_ORDERED:
return "ORDER_ORDERED";
default:
return "UNKNOWN";
}
}
export const Channel = {
encode(message: Channel, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int32(message.state);
writer.uint32(16).int32(message.ordering);
if (message.counterparty !== undefined && message.counterparty !== undefined) {
Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim();
}
for (const v of message.connectionHops) {
writer.uint32(34).string(v!);
}
writer.uint32(42).string(message.version);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Channel {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseChannel } as Channel;
message.connectionHops = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.state = reader.int32() as any;
break;
case 2:
message.ordering = reader.int32() as any;
break;
case 3:
message.counterparty = Counterparty.decode(reader, reader.uint32());
break;
case 4:
message.connectionHops.push(reader.string());
break;
case 5:
message.version = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Channel {
const message = { ...baseChannel } as Channel;
message.connectionHops = [];
if (object.state !== undefined && object.state !== null) {
message.state = stateFromJSON(object.state);
} else {
message.state = 0;
}
if (object.ordering !== undefined && object.ordering !== null) {
message.ordering = orderFromJSON(object.ordering);
} else {
message.ordering = 0;
}
if (object.counterparty !== undefined && object.counterparty !== null) {
message.counterparty = Counterparty.fromJSON(object.counterparty);
} else {
message.counterparty = undefined;
}
if (object.connectionHops !== undefined && object.connectionHops !== null) {
for (const e of object.connectionHops) {
message.connectionHops.push(String(e));
}
}
if (object.version !== undefined && object.version !== null) {
message.version = String(object.version);
} else {
message.version = "";
}
return message;
},
fromPartial(object: DeepPartial<Channel>): Channel {
const message = { ...baseChannel } as Channel;
message.connectionHops = [];
if (object.state !== undefined && object.state !== null) {
message.state = object.state;
} else {
message.state = 0;
}
if (object.ordering !== undefined && object.ordering !== null) {
message.ordering = object.ordering;
} else {
message.ordering = 0;
}
if (object.counterparty !== undefined && object.counterparty !== null) {
message.counterparty = Counterparty.fromPartial(object.counterparty);
} else {
message.counterparty = undefined;
}
if (object.connectionHops !== undefined && object.connectionHops !== null) {
for (const e of object.connectionHops) {
message.connectionHops.push(e);
}
}
if (object.version !== undefined && object.version !== null) {
message.version = object.version;
} else {
message.version = "";
}
return message;
},
toJSON(message: Channel): unknown {
const obj: any = {};
message.state !== undefined && (obj.state = stateToJSON(message.state));
message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering));
message.counterparty !== undefined &&
(obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined);
if (message.connectionHops) {
obj.connectionHops = message.connectionHops.map((e) => e);
} else {
obj.connectionHops = [];
}
message.version !== undefined && (obj.version = message.version);
return obj;
},
};
export const IdentifiedChannel = {
encode(message: IdentifiedChannel, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int32(message.state);
writer.uint32(16).int32(message.ordering);
if (message.counterparty !== undefined && message.counterparty !== undefined) {
Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim();
}
for (const v of message.connectionHops) {
writer.uint32(34).string(v!);
}
writer.uint32(42).string(message.version);
writer.uint32(50).string(message.portId);
writer.uint32(58).string(message.channelId);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): IdentifiedChannel {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseIdentifiedChannel } as IdentifiedChannel;
message.connectionHops = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.state = reader.int32() as any;
break;
case 2:
message.ordering = reader.int32() as any;
break;
case 3:
message.counterparty = Counterparty.decode(reader, reader.uint32());
break;
case 4:
message.connectionHops.push(reader.string());
break;
case 5:
message.version = reader.string();
break;
case 6:
message.portId = reader.string();
break;
case 7:
message.channelId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): IdentifiedChannel {
const message = { ...baseIdentifiedChannel } as IdentifiedChannel;
message.connectionHops = [];
if (object.state !== undefined && object.state !== null) {
message.state = stateFromJSON(object.state);
} else {
message.state = 0;
}
if (object.ordering !== undefined && object.ordering !== null) {
message.ordering = orderFromJSON(object.ordering);
} else {
message.ordering = 0;
}
if (object.counterparty !== undefined && object.counterparty !== null) {
message.counterparty = Counterparty.fromJSON(object.counterparty);
} else {
message.counterparty = undefined;
}
if (object.connectionHops !== undefined && object.connectionHops !== null) {
for (const e of object.connectionHops) {
message.connectionHops.push(String(e));
}
}
if (object.version !== undefined && object.version !== null) {
message.version = String(object.version);
} else {
message.version = "";
}
if (object.portId !== undefined && object.portId !== null) {
message.portId = String(object.portId);
} else {
message.portId = "";
}
if (object.channelId !== undefined && object.channelId !== null) {
message.channelId = String(object.channelId);
} else {
message.channelId = "";
}
return message;
},
fromPartial(object: DeepPartial<IdentifiedChannel>): IdentifiedChannel {
const message = { ...baseIdentifiedChannel } as IdentifiedChannel;
message.connectionHops = [];
if (object.state !== undefined && object.state !== null) {
message.state = object.state;
} else {
message.state = 0;
}
if (object.ordering !== undefined && object.ordering !== null) {
message.ordering = object.ordering;
} else {
message.ordering = 0;
}
if (object.counterparty !== undefined && object.counterparty !== null) {
message.counterparty = Counterparty.fromPartial(object.counterparty);
} else {
message.counterparty = undefined;
}
if (object.connectionHops !== undefined && object.connectionHops !== null) {
for (const e of object.connectionHops) {
message.connectionHops.push(e);
}
}
if (object.version !== undefined && object.version !== null) {
message.version = object.version;
} else {
message.version = "";
}
if (object.portId !== undefined && object.portId !== null) {
message.portId = object.portId;
} else {
message.portId = "";
}
if (object.channelId !== undefined && object.channelId !== null) {
message.channelId = object.channelId;
} else {
message.channelId = "";
}
return message;
},
toJSON(message: IdentifiedChannel): unknown {
const obj: any = {};
message.state !== undefined && (obj.state = stateToJSON(message.state));
message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering));
message.counterparty !== undefined &&
(obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined);
if (message.connectionHops) {
obj.connectionHops = message.connectionHops.map((e) => e);
} else {
obj.connectionHops = [];
}
message.version !== undefined && (obj.version = message.version);
message.portId !== undefined && (obj.portId = message.portId);
message.channelId !== undefined && (obj.channelId = message.channelId);
return obj;
},
};
export const Counterparty = {
encode(message: Counterparty, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.portId);
writer.uint32(18).string(message.channelId);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Counterparty {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseCounterparty } as Counterparty;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.portId = reader.string();
break;
case 2:
message.channelId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Counterparty {
const message = { ...baseCounterparty } as Counterparty;
if (object.portId !== undefined && object.portId !== null) {
message.portId = String(object.portId);
} else {
message.portId = "";
}
if (object.channelId !== undefined && object.channelId !== null) {
message.channelId = String(object.channelId);
} else {
message.channelId = "";
}
return message;
},
fromPartial(object: DeepPartial<Counterparty>): Counterparty {
const message = { ...baseCounterparty } as Counterparty;
if (object.portId !== undefined && object.portId !== null) {
message.portId = object.portId;
} else {
message.portId = "";
}
if (object.channelId !== undefined && object.channelId !== null) {
message.channelId = object.channelId;
} else {
message.channelId = "";
}
return message;
},
toJSON(message: Counterparty): unknown {
const obj: any = {};
message.portId !== undefined && (obj.portId = message.portId);
message.channelId !== undefined && (obj.channelId = message.channelId);
return obj;
},
};
export const Packet = {
encode(message: Packet, writer: Writer = Writer.create()): Writer {
writer.uint32(8).uint64(message.sequence);
writer.uint32(18).string(message.sourcePort);
writer.uint32(26).string(message.sourceChannel);
writer.uint32(34).string(message.destinationPort);
writer.uint32(42).string(message.destinationChannel);
writer.uint32(50).bytes(message.data);
if (message.timeoutHeight !== undefined && message.timeoutHeight !== undefined) {
Height.encode(message.timeoutHeight, writer.uint32(58).fork()).ldelim();
}
writer.uint32(64).uint64(message.timeoutTimestamp);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Packet {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...basePacket } as Packet;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.sequence = reader.uint64() as Long;
break;
case 2:
message.sourcePort = reader.string();
break;
case 3:
message.sourceChannel = reader.string();
break;
case 4:
message.destinationPort = reader.string();
break;
case 5:
message.destinationChannel = reader.string();
break;
case 6:
message.data = reader.bytes();
break;
case 7:
message.timeoutHeight = Height.decode(reader, reader.uint32());
break;
case 8:
message.timeoutTimestamp = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Packet {
const message = { ...basePacket } as Packet;
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = Long.fromString(object.sequence);
} else {
message.sequence = Long.UZERO;
}
if (object.sourcePort !== undefined && object.sourcePort !== null) {
message.sourcePort = String(object.sourcePort);
} else {
message.sourcePort = "";
}
if (object.sourceChannel !== undefined && object.sourceChannel !== null) {
message.sourceChannel = String(object.sourceChannel);
} else {
message.sourceChannel = "";
}
if (object.destinationPort !== undefined && object.destinationPort !== null) {
message.destinationPort = String(object.destinationPort);
} else {
message.destinationPort = "";
}
if (object.destinationChannel !== undefined && object.destinationChannel !== null) {
message.destinationChannel = String(object.destinationChannel);
} else {
message.destinationChannel = "";
}
if (object.data !== undefined && object.data !== null) {
message.data = bytesFromBase64(object.data);
}
if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) {
message.timeoutHeight = Height.fromJSON(object.timeoutHeight);
} else {
message.timeoutHeight = undefined;
}
if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) {
message.timeoutTimestamp = Long.fromString(object.timeoutTimestamp);
} else {
message.timeoutTimestamp = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<Packet>): Packet {
const message = { ...basePacket } as Packet;
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = object.sequence as Long;
} else {
message.sequence = Long.UZERO;
}
if (object.sourcePort !== undefined && object.sourcePort !== null) {
message.sourcePort = object.sourcePort;
} else {
message.sourcePort = "";
}
if (object.sourceChannel !== undefined && object.sourceChannel !== null) {
message.sourceChannel = object.sourceChannel;
} else {
message.sourceChannel = "";
}
if (object.destinationPort !== undefined && object.destinationPort !== null) {
message.destinationPort = object.destinationPort;
} else {
message.destinationPort = "";
}
if (object.destinationChannel !== undefined && object.destinationChannel !== null) {
message.destinationChannel = object.destinationChannel;
} else {
message.destinationChannel = "";
}
if (object.data !== undefined && object.data !== null) {
message.data = object.data;
} else {
message.data = new Uint8Array();
}
if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) {
message.timeoutHeight = Height.fromPartial(object.timeoutHeight);
} else {
message.timeoutHeight = undefined;
}
if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) {
message.timeoutTimestamp = object.timeoutTimestamp as Long;
} else {
message.timeoutTimestamp = Long.UZERO;
}
return message;
},
toJSON(message: Packet): unknown {
const obj: any = {};
message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString());
message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort);
message.sourceChannel !== undefined && (obj.sourceChannel = message.sourceChannel);
message.destinationPort !== undefined && (obj.destinationPort = message.destinationPort);
message.destinationChannel !== undefined && (obj.destinationChannel = message.destinationChannel);
message.data !== undefined &&
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
message.timeoutHeight !== undefined &&
(obj.timeoutHeight = message.timeoutHeight ? Height.toJSON(message.timeoutHeight) : undefined);
message.timeoutTimestamp !== undefined &&
(obj.timeoutTimestamp = (message.timeoutTimestamp || Long.UZERO).toString());
return obj;
},
};
export const PacketState = {
encode(message: PacketState, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.portId);
writer.uint32(18).string(message.channelId);
writer.uint32(24).uint64(message.sequence);
writer.uint32(34).bytes(message.data);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): PacketState {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...basePacketState } as PacketState;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.portId = reader.string();
break;
case 2:
message.channelId = reader.string();
break;
case 3:
message.sequence = reader.uint64() as Long;
break;
case 4:
message.data = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): PacketState {
const message = { ...basePacketState } as PacketState;
if (object.portId !== undefined && object.portId !== null) {
message.portId = String(object.portId);
} else {
message.portId = "";
}
if (object.channelId !== undefined && object.channelId !== null) {
message.channelId = String(object.channelId);
} else {
message.channelId = "";
}
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = Long.fromString(object.sequence);
} else {
message.sequence = Long.UZERO;
}
if (object.data !== undefined && object.data !== null) {
message.data = bytesFromBase64(object.data);
}
return message;
},
fromPartial(object: DeepPartial<PacketState>): PacketState {
const message = { ...basePacketState } as PacketState;
if (object.portId !== undefined && object.portId !== null) {
message.portId = object.portId;
} else {
message.portId = "";
}
if (object.channelId !== undefined && object.channelId !== null) {
message.channelId = object.channelId;
} else {
message.channelId = "";
}
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = object.sequence as Long;
} else {
message.sequence = Long.UZERO;
}
if (object.data !== undefined && object.data !== null) {
message.data = object.data;
} else {
message.data = new Uint8Array();
}
return message;
},
toJSON(message: PacketState): unknown {
const obj: any = {};
message.portId !== undefined && (obj.portId = message.portId);
message.channelId !== undefined && (obj.channelId = message.channelId);
message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString());
message.data !== undefined &&
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
return obj;
},
};
export const Acknowledgement = {
encode(message: Acknowledgement, writer: Writer = Writer.create()): Writer {
if (message.result !== undefined) {
writer.uint32(170).bytes(message.result);
}
if (message.error !== undefined) {
writer.uint32(178).string(message.error);
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Acknowledgement {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseAcknowledgement } as Acknowledgement;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 21:
message.result = reader.bytes();
break;
case 22:
message.error = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Acknowledgement {
const message = { ...baseAcknowledgement } as Acknowledgement;
if (object.result !== undefined && object.result !== null) {
message.result = bytesFromBase64(object.result);
}
if (object.error !== undefined && object.error !== null) {
message.error = String(object.error);
} else {
message.error = undefined;
}
return message;
},
fromPartial(object: DeepPartial<Acknowledgement>): Acknowledgement {
const message = { ...baseAcknowledgement } as Acknowledgement;
if (object.result !== undefined && object.result !== null) {
message.result = object.result;
} else {
message.result = undefined;
}
if (object.error !== undefined && object.error !== null) {
message.error = object.error;
} else {
message.error = undefined;
}
return message;
},
toJSON(message: Acknowledgement): unknown {
const obj: any = {};
message.result !== undefined &&
(obj.result = message.result !== undefined ? base64FromBytes(message.result) : undefined);
message.error !== undefined && (obj.error = message.error);
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,561 @@
/* eslint-disable */
import { Any } from "../../../../google/protobuf/any";
import * as Long from "long";
import { Writer, Reader } from "protobufjs/minimal";
/**
* IdentifiedClientState defines a client state with an additional client
* identifier field.
*/
export interface IdentifiedClientState {
/**
* client identifier
*/
clientId: string;
/**
* client state
*/
clientState?: Any;
}
/**
* ConsensusStateWithHeight defines a consensus state with an additional height field.
*/
export interface ConsensusStateWithHeight {
/**
* consensus state height
*/
height?: Height;
/**
* consensus state
*/
consensusState?: Any;
}
/**
* ClientConsensusStates defines all the stored consensus states for a given
* client.
*/
export interface ClientConsensusStates {
/**
* client identifier
*/
clientId: string;
/**
* consensus states and their heights associated with the client
*/
consensusStates: ConsensusStateWithHeight[];
}
/**
* ClientUpdateProposal is a governance proposal. If it passes, the client is
* updated with the provided header. The update may fail if the header is not
* valid given certain conditions specified by the client implementation.
*/
export interface ClientUpdateProposal {
/**
* the title of the update proposal
*/
title: string;
/**
* the description of the proposal
*/
description: string;
/**
* the client identifier for the client to be updated if the proposal passes
*/
clientId: string;
/**
* the header used to update the client if the proposal passes
*/
header?: Any;
}
/**
* Height is a monotonically increasing data type
* that can be compared against another Height for the purposes of updating and
* freezing clients
*
* Normally the RevisionHeight is incremented at each height while keeping RevisionNumber
* the same. However some consensus algorithms may choose to reset the
* height in certain conditions e.g. hard forks, state-machine breaking changes
* In these cases, the RevisionNumber is incremented so that height continues to
* be monitonically increasing even as the RevisionHeight gets reset
*/
export interface Height {
/**
* the revision that the client is currently on
*/
revisionNumber: Long;
/**
* the height within the given revision
*/
revisionHeight: Long;
}
/**
* Params defines the set of IBC light client parameters.
*/
export interface Params {
/**
* allowed_clients defines the list of allowed client state types.
*/
allowedClients: string[];
}
const baseIdentifiedClientState: object = {
clientId: "",
};
const baseConsensusStateWithHeight: object = {};
const baseClientConsensusStates: object = {
clientId: "",
};
const baseClientUpdateProposal: object = {
title: "",
description: "",
clientId: "",
};
const baseHeight: object = {
revisionNumber: Long.UZERO,
revisionHeight: Long.UZERO,
};
const baseParams: object = {
allowedClients: "",
};
export const protobufPackage = "ibc.core.client.v1";
export const IdentifiedClientState = {
encode(message: IdentifiedClientState, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.clientId);
if (message.clientState !== undefined && message.clientState !== undefined) {
Any.encode(message.clientState, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): IdentifiedClientState {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseIdentifiedClientState } as IdentifiedClientState;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.clientId = reader.string();
break;
case 2:
message.clientState = Any.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): IdentifiedClientState {
const message = { ...baseIdentifiedClientState } as IdentifiedClientState;
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = String(object.clientId);
} else {
message.clientId = "";
}
if (object.clientState !== undefined && object.clientState !== null) {
message.clientState = Any.fromJSON(object.clientState);
} else {
message.clientState = undefined;
}
return message;
},
fromPartial(object: DeepPartial<IdentifiedClientState>): IdentifiedClientState {
const message = { ...baseIdentifiedClientState } as IdentifiedClientState;
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = object.clientId;
} else {
message.clientId = "";
}
if (object.clientState !== undefined && object.clientState !== null) {
message.clientState = Any.fromPartial(object.clientState);
} else {
message.clientState = undefined;
}
return message;
},
toJSON(message: IdentifiedClientState): unknown {
const obj: any = {};
message.clientId !== undefined && (obj.clientId = message.clientId);
message.clientState !== undefined &&
(obj.clientState = message.clientState ? Any.toJSON(message.clientState) : undefined);
return obj;
},
};
export const ConsensusStateWithHeight = {
encode(message: ConsensusStateWithHeight, writer: Writer = Writer.create()): Writer {
if (message.height !== undefined && message.height !== undefined) {
Height.encode(message.height, writer.uint32(10).fork()).ldelim();
}
if (message.consensusState !== undefined && message.consensusState !== undefined) {
Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ConsensusStateWithHeight {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseConsensusStateWithHeight } as ConsensusStateWithHeight;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.height = Height.decode(reader, reader.uint32());
break;
case 2:
message.consensusState = Any.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ConsensusStateWithHeight {
const message = { ...baseConsensusStateWithHeight } as ConsensusStateWithHeight;
if (object.height !== undefined && object.height !== null) {
message.height = Height.fromJSON(object.height);
} else {
message.height = undefined;
}
if (object.consensusState !== undefined && object.consensusState !== null) {
message.consensusState = Any.fromJSON(object.consensusState);
} else {
message.consensusState = undefined;
}
return message;
},
fromPartial(object: DeepPartial<ConsensusStateWithHeight>): ConsensusStateWithHeight {
const message = { ...baseConsensusStateWithHeight } as ConsensusStateWithHeight;
if (object.height !== undefined && object.height !== null) {
message.height = Height.fromPartial(object.height);
} else {
message.height = undefined;
}
if (object.consensusState !== undefined && object.consensusState !== null) {
message.consensusState = Any.fromPartial(object.consensusState);
} else {
message.consensusState = undefined;
}
return message;
},
toJSON(message: ConsensusStateWithHeight): unknown {
const obj: any = {};
message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined);
message.consensusState !== undefined &&
(obj.consensusState = message.consensusState ? Any.toJSON(message.consensusState) : undefined);
return obj;
},
};
export const ClientConsensusStates = {
encode(message: ClientConsensusStates, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.clientId);
for (const v of message.consensusStates) {
ConsensusStateWithHeight.encode(v!, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ClientConsensusStates {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseClientConsensusStates } as ClientConsensusStates;
message.consensusStates = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.clientId = reader.string();
break;
case 2:
message.consensusStates.push(ConsensusStateWithHeight.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ClientConsensusStates {
const message = { ...baseClientConsensusStates } as ClientConsensusStates;
message.consensusStates = [];
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = String(object.clientId);
} else {
message.clientId = "";
}
if (object.consensusStates !== undefined && object.consensusStates !== null) {
for (const e of object.consensusStates) {
message.consensusStates.push(ConsensusStateWithHeight.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<ClientConsensusStates>): ClientConsensusStates {
const message = { ...baseClientConsensusStates } as ClientConsensusStates;
message.consensusStates = [];
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = object.clientId;
} else {
message.clientId = "";
}
if (object.consensusStates !== undefined && object.consensusStates !== null) {
for (const e of object.consensusStates) {
message.consensusStates.push(ConsensusStateWithHeight.fromPartial(e));
}
}
return message;
},
toJSON(message: ClientConsensusStates): unknown {
const obj: any = {};
message.clientId !== undefined && (obj.clientId = message.clientId);
if (message.consensusStates) {
obj.consensusStates = message.consensusStates.map((e) =>
e ? ConsensusStateWithHeight.toJSON(e) : undefined,
);
} else {
obj.consensusStates = [];
}
return obj;
},
};
export const ClientUpdateProposal = {
encode(message: ClientUpdateProposal, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.title);
writer.uint32(18).string(message.description);
writer.uint32(26).string(message.clientId);
if (message.header !== undefined && message.header !== undefined) {
Any.encode(message.header, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ClientUpdateProposal {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseClientUpdateProposal } as ClientUpdateProposal;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.title = reader.string();
break;
case 2:
message.description = reader.string();
break;
case 3:
message.clientId = reader.string();
break;
case 4:
message.header = Any.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ClientUpdateProposal {
const message = { ...baseClientUpdateProposal } as ClientUpdateProposal;
if (object.title !== undefined && object.title !== null) {
message.title = String(object.title);
} else {
message.title = "";
}
if (object.description !== undefined && object.description !== null) {
message.description = String(object.description);
} else {
message.description = "";
}
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = String(object.clientId);
} else {
message.clientId = "";
}
if (object.header !== undefined && object.header !== null) {
message.header = Any.fromJSON(object.header);
} else {
message.header = undefined;
}
return message;
},
fromPartial(object: DeepPartial<ClientUpdateProposal>): ClientUpdateProposal {
const message = { ...baseClientUpdateProposal } as ClientUpdateProposal;
if (object.title !== undefined && object.title !== null) {
message.title = object.title;
} else {
message.title = "";
}
if (object.description !== undefined && object.description !== null) {
message.description = object.description;
} else {
message.description = "";
}
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = object.clientId;
} else {
message.clientId = "";
}
if (object.header !== undefined && object.header !== null) {
message.header = Any.fromPartial(object.header);
} else {
message.header = undefined;
}
return message;
},
toJSON(message: ClientUpdateProposal): unknown {
const obj: any = {};
message.title !== undefined && (obj.title = message.title);
message.description !== undefined && (obj.description = message.description);
message.clientId !== undefined && (obj.clientId = message.clientId);
message.header !== undefined && (obj.header = message.header ? Any.toJSON(message.header) : undefined);
return obj;
},
};
export const Height = {
encode(message: Height, writer: Writer = Writer.create()): Writer {
writer.uint32(8).uint64(message.revisionNumber);
writer.uint32(16).uint64(message.revisionHeight);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Height {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseHeight } as Height;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.revisionNumber = reader.uint64() as Long;
break;
case 2:
message.revisionHeight = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Height {
const message = { ...baseHeight } as Height;
if (object.revisionNumber !== undefined && object.revisionNumber !== null) {
message.revisionNumber = Long.fromString(object.revisionNumber);
} else {
message.revisionNumber = Long.UZERO;
}
if (object.revisionHeight !== undefined && object.revisionHeight !== null) {
message.revisionHeight = Long.fromString(object.revisionHeight);
} else {
message.revisionHeight = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<Height>): Height {
const message = { ...baseHeight } as Height;
if (object.revisionNumber !== undefined && object.revisionNumber !== null) {
message.revisionNumber = object.revisionNumber as Long;
} else {
message.revisionNumber = Long.UZERO;
}
if (object.revisionHeight !== undefined && object.revisionHeight !== null) {
message.revisionHeight = object.revisionHeight as Long;
} else {
message.revisionHeight = Long.UZERO;
}
return message;
},
toJSON(message: Height): unknown {
const obj: any = {};
message.revisionNumber !== undefined &&
(obj.revisionNumber = (message.revisionNumber || Long.UZERO).toString());
message.revisionHeight !== undefined &&
(obj.revisionHeight = (message.revisionHeight || Long.UZERO).toString());
return obj;
},
};
export const Params = {
encode(message: Params, writer: Writer = Writer.create()): Writer {
for (const v of message.allowedClients) {
writer.uint32(10).string(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
message.allowedClients = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.allowedClients.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Params {
const message = { ...baseParams } as Params;
message.allowedClients = [];
if (object.allowedClients !== undefined && object.allowedClients !== null) {
for (const e of object.allowedClients) {
message.allowedClients.push(String(e));
}
}
return message;
},
fromPartial(object: DeepPartial<Params>): Params {
const message = { ...baseParams } as Params;
message.allowedClients = [];
if (object.allowedClients !== undefined && object.allowedClients !== null) {
for (const e of object.allowedClients) {
message.allowedClients.push(e);
}
}
return message;
},
toJSON(message: Params): unknown {
const obj: any = {};
if (message.allowedClients) {
obj.allowedClients = message.allowedClients.map((e) => e);
} else {
obj.allowedClients = [];
}
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,294 @@
/* eslint-disable */
import { CommitmentProof } from "../../../../confio/proofs";
import { Writer, Reader } from "protobufjs/minimal";
/**
* MerkleRoot defines a merkle root hash.
* In the Cosmos SDK, the AppHash of a block header becomes the root.
*/
export interface MerkleRoot {
hash: Uint8Array;
}
/**
* MerklePrefix is merkle path prefixed to the key.
* The constructed key from the Path and the key will be append(Path.KeyPath,
* append(Path.KeyPrefix, key...))
*/
export interface MerklePrefix {
keyPrefix: Uint8Array;
}
/**
* MerklePath is the path used to verify commitment proofs, which can be an
* arbitrary structured object (defined by a commitment type).
* MerklePath is represented from root-to-leaf
*/
export interface MerklePath {
keyPath: string[];
}
/**
* MerkleProof is a wrapper type over a chain of CommitmentProofs.
* It demonstrates membership or non-membership for an element or set of
* elements, verifiable in conjunction with a known commitment root. Proofs
* should be succinct.
* MerkleProofs are ordered from leaf-to-root
*/
export interface MerkleProof {
proofs: CommitmentProof[];
}
const baseMerkleRoot: object = {};
const baseMerklePrefix: object = {};
const baseMerklePath: object = {
keyPath: "",
};
const baseMerkleProof: object = {};
export const protobufPackage = "ibc.core.commitment.v1";
export const MerkleRoot = {
encode(message: MerkleRoot, writer: Writer = Writer.create()): Writer {
writer.uint32(10).bytes(message.hash);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MerkleRoot {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMerkleRoot } as MerkleRoot;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.hash = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MerkleRoot {
const message = { ...baseMerkleRoot } as MerkleRoot;
if (object.hash !== undefined && object.hash !== null) {
message.hash = bytesFromBase64(object.hash);
}
return message;
},
fromPartial(object: DeepPartial<MerkleRoot>): MerkleRoot {
const message = { ...baseMerkleRoot } as MerkleRoot;
if (object.hash !== undefined && object.hash !== null) {
message.hash = object.hash;
} else {
message.hash = new Uint8Array();
}
return message;
},
toJSON(message: MerkleRoot): unknown {
const obj: any = {};
message.hash !== undefined &&
(obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array()));
return obj;
},
};
export const MerklePrefix = {
encode(message: MerklePrefix, writer: Writer = Writer.create()): Writer {
writer.uint32(10).bytes(message.keyPrefix);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MerklePrefix {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMerklePrefix } as MerklePrefix;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.keyPrefix = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MerklePrefix {
const message = { ...baseMerklePrefix } as MerklePrefix;
if (object.keyPrefix !== undefined && object.keyPrefix !== null) {
message.keyPrefix = bytesFromBase64(object.keyPrefix);
}
return message;
},
fromPartial(object: DeepPartial<MerklePrefix>): MerklePrefix {
const message = { ...baseMerklePrefix } as MerklePrefix;
if (object.keyPrefix !== undefined && object.keyPrefix !== null) {
message.keyPrefix = object.keyPrefix;
} else {
message.keyPrefix = new Uint8Array();
}
return message;
},
toJSON(message: MerklePrefix): unknown {
const obj: any = {};
message.keyPrefix !== undefined &&
(obj.keyPrefix = base64FromBytes(
message.keyPrefix !== undefined ? message.keyPrefix : new Uint8Array(),
));
return obj;
},
};
export const MerklePath = {
encode(message: MerklePath, writer: Writer = Writer.create()): Writer {
for (const v of message.keyPath) {
writer.uint32(10).string(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MerklePath {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMerklePath } as MerklePath;
message.keyPath = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.keyPath.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MerklePath {
const message = { ...baseMerklePath } as MerklePath;
message.keyPath = [];
if (object.keyPath !== undefined && object.keyPath !== null) {
for (const e of object.keyPath) {
message.keyPath.push(String(e));
}
}
return message;
},
fromPartial(object: DeepPartial<MerklePath>): MerklePath {
const message = { ...baseMerklePath } as MerklePath;
message.keyPath = [];
if (object.keyPath !== undefined && object.keyPath !== null) {
for (const e of object.keyPath) {
message.keyPath.push(e);
}
}
return message;
},
toJSON(message: MerklePath): unknown {
const obj: any = {};
if (message.keyPath) {
obj.keyPath = message.keyPath.map((e) => e);
} else {
obj.keyPath = [];
}
return obj;
},
};
export const MerkleProof = {
encode(message: MerkleProof, writer: Writer = Writer.create()): Writer {
for (const v of message.proofs) {
CommitmentProof.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): MerkleProof {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMerkleProof } as MerkleProof;
message.proofs = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.proofs.push(CommitmentProof.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MerkleProof {
const message = { ...baseMerkleProof } as MerkleProof;
message.proofs = [];
if (object.proofs !== undefined && object.proofs !== null) {
for (const e of object.proofs) {
message.proofs.push(CommitmentProof.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<MerkleProof>): MerkleProof {
const message = { ...baseMerkleProof } as MerkleProof;
message.proofs = [];
if (object.proofs !== undefined && object.proofs !== null) {
for (const e of object.proofs) {
message.proofs.push(CommitmentProof.fromPartial(e));
}
}
return message;
},
toJSON(message: MerkleProof): unknown {
const obj: any = {};
if (message.proofs) {
obj.proofs = message.proofs.map((e) => (e ? CommitmentProof.toJSON(e) : undefined));
} else {
obj.proofs = [];
}
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,758 @@
/* eslint-disable */
import * as Long from "long";
import { MerklePrefix } from "../../../../ibc/core/commitment/v1/commitment";
import { Writer, Reader } from "protobufjs/minimal";
/**
* ConnectionEnd defines a stateful object on a chain connected to another
* separate one.
* NOTE: there must only be 2 defined ConnectionEnds to establish
* a connection between two chains.
*/
export interface ConnectionEnd {
/**
* client associated with this connection.
*/
clientId: string;
/**
* IBC version which can be utilised to determine encodings or protocols for
* channels or packets utilising this connection.
*/
versions: Version[];
/**
* current state of the connection end.
*/
state: State;
/**
* counterparty chain associated with this connection.
*/
counterparty?: Counterparty;
/**
* delay period that must pass before a consensus state can be used for packet-verification
* NOTE: delay period logic is only implemented by some clients.
*/
delayPeriod: Long;
}
/**
* IdentifiedConnection defines a connection with additional connection
* identifier field.
*/
export interface IdentifiedConnection {
/**
* connection identifier.
*/
id: string;
/**
* client associated with this connection.
*/
clientId: string;
/**
* IBC version which can be utilised to determine encodings or protocols for
* channels or packets utilising this connection
*/
versions: Version[];
/**
* current state of the connection end.
*/
state: State;
/**
* counterparty chain associated with this connection.
*/
counterparty?: Counterparty;
/**
* delay period associated with this connection.
*/
delayPeriod: Long;
}
/**
* Counterparty defines the counterparty chain associated with a connection end.
*/
export interface Counterparty {
/**
* identifies the client on the counterparty chain associated with a given
* connection.
*/
clientId: string;
/**
* identifies the connection end on the counterparty chain associated with a
* given connection.
*/
connectionId: string;
/**
* commitment merkle prefix of the counterparty chain.
*/
prefix?: MerklePrefix;
}
/**
* ClientPaths define all the connection paths for a client state.
*/
export interface ClientPaths {
/**
* list of connection paths
*/
paths: string[];
}
/**
* ConnectionPaths define all the connection paths for a given client state.
*/
export interface ConnectionPaths {
/**
* client state unique identifier
*/
clientId: string;
/**
* list of connection paths
*/
paths: string[];
}
/**
* Version defines the versioning scheme used to negotiate the IBC verison in
* the connection handshake.
*/
export interface Version {
/**
* unique version identifier
*/
identifier: string;
/**
* list of features compatible with the specified identifier
*/
features: string[];
}
const baseConnectionEnd: object = {
clientId: "",
state: 0,
delayPeriod: Long.UZERO,
};
const baseIdentifiedConnection: object = {
id: "",
clientId: "",
state: 0,
delayPeriod: Long.UZERO,
};
const baseCounterparty: object = {
clientId: "",
connectionId: "",
};
const baseClientPaths: object = {
paths: "",
};
const baseConnectionPaths: object = {
clientId: "",
paths: "",
};
const baseVersion: object = {
identifier: "",
features: "",
};
export const protobufPackage = "ibc.core.connection.v1";
/** State defines if a connection is in one of the following states:
INIT, TRYOPEN, OPEN or UNINITIALIZED.
*/
export enum State {
/** STATE_UNINITIALIZED_UNSPECIFIED - Default State
*/
STATE_UNINITIALIZED_UNSPECIFIED = 0,
/** STATE_INIT - A connection end has just started the opening handshake.
*/
STATE_INIT = 1,
/** STATE_TRYOPEN - A connection end has acknowledged the handshake step on the counterparty
chain.
*/
STATE_TRYOPEN = 2,
/** STATE_OPEN - A connection end has completed the handshake.
*/
STATE_OPEN = 3,
UNRECOGNIZED = -1,
}
export function stateFromJSON(object: any): State {
switch (object) {
case 0:
case "STATE_UNINITIALIZED_UNSPECIFIED":
return State.STATE_UNINITIALIZED_UNSPECIFIED;
case 1:
case "STATE_INIT":
return State.STATE_INIT;
case 2:
case "STATE_TRYOPEN":
return State.STATE_TRYOPEN;
case 3:
case "STATE_OPEN":
return State.STATE_OPEN;
case -1:
case "UNRECOGNIZED":
default:
return State.UNRECOGNIZED;
}
}
export function stateToJSON(object: State): string {
switch (object) {
case State.STATE_UNINITIALIZED_UNSPECIFIED:
return "STATE_UNINITIALIZED_UNSPECIFIED";
case State.STATE_INIT:
return "STATE_INIT";
case State.STATE_TRYOPEN:
return "STATE_TRYOPEN";
case State.STATE_OPEN:
return "STATE_OPEN";
default:
return "UNKNOWN";
}
}
export const ConnectionEnd = {
encode(message: ConnectionEnd, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.clientId);
for (const v of message.versions) {
Version.encode(v!, writer.uint32(18).fork()).ldelim();
}
writer.uint32(24).int32(message.state);
if (message.counterparty !== undefined && message.counterparty !== undefined) {
Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim();
}
writer.uint32(40).uint64(message.delayPeriod);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ConnectionEnd {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseConnectionEnd } as ConnectionEnd;
message.versions = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.clientId = reader.string();
break;
case 2:
message.versions.push(Version.decode(reader, reader.uint32()));
break;
case 3:
message.state = reader.int32() as any;
break;
case 4:
message.counterparty = Counterparty.decode(reader, reader.uint32());
break;
case 5:
message.delayPeriod = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ConnectionEnd {
const message = { ...baseConnectionEnd } as ConnectionEnd;
message.versions = [];
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = String(object.clientId);
} else {
message.clientId = "";
}
if (object.versions !== undefined && object.versions !== null) {
for (const e of object.versions) {
message.versions.push(Version.fromJSON(e));
}
}
if (object.state !== undefined && object.state !== null) {
message.state = stateFromJSON(object.state);
} else {
message.state = 0;
}
if (object.counterparty !== undefined && object.counterparty !== null) {
message.counterparty = Counterparty.fromJSON(object.counterparty);
} else {
message.counterparty = undefined;
}
if (object.delayPeriod !== undefined && object.delayPeriod !== null) {
message.delayPeriod = Long.fromString(object.delayPeriod);
} else {
message.delayPeriod = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<ConnectionEnd>): ConnectionEnd {
const message = { ...baseConnectionEnd } as ConnectionEnd;
message.versions = [];
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = object.clientId;
} else {
message.clientId = "";
}
if (object.versions !== undefined && object.versions !== null) {
for (const e of object.versions) {
message.versions.push(Version.fromPartial(e));
}
}
if (object.state !== undefined && object.state !== null) {
message.state = object.state;
} else {
message.state = 0;
}
if (object.counterparty !== undefined && object.counterparty !== null) {
message.counterparty = Counterparty.fromPartial(object.counterparty);
} else {
message.counterparty = undefined;
}
if (object.delayPeriod !== undefined && object.delayPeriod !== null) {
message.delayPeriod = object.delayPeriod as Long;
} else {
message.delayPeriod = Long.UZERO;
}
return message;
},
toJSON(message: ConnectionEnd): unknown {
const obj: any = {};
message.clientId !== undefined && (obj.clientId = message.clientId);
if (message.versions) {
obj.versions = message.versions.map((e) => (e ? Version.toJSON(e) : undefined));
} else {
obj.versions = [];
}
message.state !== undefined && (obj.state = stateToJSON(message.state));
message.counterparty !== undefined &&
(obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined);
message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || Long.UZERO).toString());
return obj;
},
};
export const IdentifiedConnection = {
encode(message: IdentifiedConnection, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.id);
writer.uint32(18).string(message.clientId);
for (const v of message.versions) {
Version.encode(v!, writer.uint32(26).fork()).ldelim();
}
writer.uint32(32).int32(message.state);
if (message.counterparty !== undefined && message.counterparty !== undefined) {
Counterparty.encode(message.counterparty, writer.uint32(42).fork()).ldelim();
}
writer.uint32(48).uint64(message.delayPeriod);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): IdentifiedConnection {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseIdentifiedConnection } as IdentifiedConnection;
message.versions = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id = reader.string();
break;
case 2:
message.clientId = reader.string();
break;
case 3:
message.versions.push(Version.decode(reader, reader.uint32()));
break;
case 4:
message.state = reader.int32() as any;
break;
case 5:
message.counterparty = Counterparty.decode(reader, reader.uint32());
break;
case 6:
message.delayPeriod = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): IdentifiedConnection {
const message = { ...baseIdentifiedConnection } as IdentifiedConnection;
message.versions = [];
if (object.id !== undefined && object.id !== null) {
message.id = String(object.id);
} else {
message.id = "";
}
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = String(object.clientId);
} else {
message.clientId = "";
}
if (object.versions !== undefined && object.versions !== null) {
for (const e of object.versions) {
message.versions.push(Version.fromJSON(e));
}
}
if (object.state !== undefined && object.state !== null) {
message.state = stateFromJSON(object.state);
} else {
message.state = 0;
}
if (object.counterparty !== undefined && object.counterparty !== null) {
message.counterparty = Counterparty.fromJSON(object.counterparty);
} else {
message.counterparty = undefined;
}
if (object.delayPeriod !== undefined && object.delayPeriod !== null) {
message.delayPeriod = Long.fromString(object.delayPeriod);
} else {
message.delayPeriod = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<IdentifiedConnection>): IdentifiedConnection {
const message = { ...baseIdentifiedConnection } as IdentifiedConnection;
message.versions = [];
if (object.id !== undefined && object.id !== null) {
message.id = object.id;
} else {
message.id = "";
}
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = object.clientId;
} else {
message.clientId = "";
}
if (object.versions !== undefined && object.versions !== null) {
for (const e of object.versions) {
message.versions.push(Version.fromPartial(e));
}
}
if (object.state !== undefined && object.state !== null) {
message.state = object.state;
} else {
message.state = 0;
}
if (object.counterparty !== undefined && object.counterparty !== null) {
message.counterparty = Counterparty.fromPartial(object.counterparty);
} else {
message.counterparty = undefined;
}
if (object.delayPeriod !== undefined && object.delayPeriod !== null) {
message.delayPeriod = object.delayPeriod as Long;
} else {
message.delayPeriod = Long.UZERO;
}
return message;
},
toJSON(message: IdentifiedConnection): unknown {
const obj: any = {};
message.id !== undefined && (obj.id = message.id);
message.clientId !== undefined && (obj.clientId = message.clientId);
if (message.versions) {
obj.versions = message.versions.map((e) => (e ? Version.toJSON(e) : undefined));
} else {
obj.versions = [];
}
message.state !== undefined && (obj.state = stateToJSON(message.state));
message.counterparty !== undefined &&
(obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined);
message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || Long.UZERO).toString());
return obj;
},
};
export const Counterparty = {
encode(message: Counterparty, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.clientId);
writer.uint32(18).string(message.connectionId);
if (message.prefix !== undefined && message.prefix !== undefined) {
MerklePrefix.encode(message.prefix, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Counterparty {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseCounterparty } as Counterparty;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.clientId = reader.string();
break;
case 2:
message.connectionId = reader.string();
break;
case 3:
message.prefix = MerklePrefix.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Counterparty {
const message = { ...baseCounterparty } as Counterparty;
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = String(object.clientId);
} else {
message.clientId = "";
}
if (object.connectionId !== undefined && object.connectionId !== null) {
message.connectionId = String(object.connectionId);
} else {
message.connectionId = "";
}
if (object.prefix !== undefined && object.prefix !== null) {
message.prefix = MerklePrefix.fromJSON(object.prefix);
} else {
message.prefix = undefined;
}
return message;
},
fromPartial(object: DeepPartial<Counterparty>): Counterparty {
const message = { ...baseCounterparty } as Counterparty;
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = object.clientId;
} else {
message.clientId = "";
}
if (object.connectionId !== undefined && object.connectionId !== null) {
message.connectionId = object.connectionId;
} else {
message.connectionId = "";
}
if (object.prefix !== undefined && object.prefix !== null) {
message.prefix = MerklePrefix.fromPartial(object.prefix);
} else {
message.prefix = undefined;
}
return message;
},
toJSON(message: Counterparty): unknown {
const obj: any = {};
message.clientId !== undefined && (obj.clientId = message.clientId);
message.connectionId !== undefined && (obj.connectionId = message.connectionId);
message.prefix !== undefined &&
(obj.prefix = message.prefix ? MerklePrefix.toJSON(message.prefix) : undefined);
return obj;
},
};
export const ClientPaths = {
encode(message: ClientPaths, writer: Writer = Writer.create()): Writer {
for (const v of message.paths) {
writer.uint32(10).string(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ClientPaths {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseClientPaths } as ClientPaths;
message.paths = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.paths.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ClientPaths {
const message = { ...baseClientPaths } as ClientPaths;
message.paths = [];
if (object.paths !== undefined && object.paths !== null) {
for (const e of object.paths) {
message.paths.push(String(e));
}
}
return message;
},
fromPartial(object: DeepPartial<ClientPaths>): ClientPaths {
const message = { ...baseClientPaths } as ClientPaths;
message.paths = [];
if (object.paths !== undefined && object.paths !== null) {
for (const e of object.paths) {
message.paths.push(e);
}
}
return message;
},
toJSON(message: ClientPaths): unknown {
const obj: any = {};
if (message.paths) {
obj.paths = message.paths.map((e) => e);
} else {
obj.paths = [];
}
return obj;
},
};
export const ConnectionPaths = {
encode(message: ConnectionPaths, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.clientId);
for (const v of message.paths) {
writer.uint32(18).string(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ConnectionPaths {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseConnectionPaths } as ConnectionPaths;
message.paths = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.clientId = reader.string();
break;
case 2:
message.paths.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ConnectionPaths {
const message = { ...baseConnectionPaths } as ConnectionPaths;
message.paths = [];
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = String(object.clientId);
} else {
message.clientId = "";
}
if (object.paths !== undefined && object.paths !== null) {
for (const e of object.paths) {
message.paths.push(String(e));
}
}
return message;
},
fromPartial(object: DeepPartial<ConnectionPaths>): ConnectionPaths {
const message = { ...baseConnectionPaths } as ConnectionPaths;
message.paths = [];
if (object.clientId !== undefined && object.clientId !== null) {
message.clientId = object.clientId;
} else {
message.clientId = "";
}
if (object.paths !== undefined && object.paths !== null) {
for (const e of object.paths) {
message.paths.push(e);
}
}
return message;
},
toJSON(message: ConnectionPaths): unknown {
const obj: any = {};
message.clientId !== undefined && (obj.clientId = message.clientId);
if (message.paths) {
obj.paths = message.paths.map((e) => e);
} else {
obj.paths = [];
}
return obj;
},
};
export const Version = {
encode(message: Version, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.identifier);
for (const v of message.features) {
writer.uint32(18).string(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Version {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseVersion } as Version;
message.features = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.identifier = reader.string();
break;
case 2:
message.features.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Version {
const message = { ...baseVersion } as Version;
message.features = [];
if (object.identifier !== undefined && object.identifier !== null) {
message.identifier = String(object.identifier);
} else {
message.identifier = "";
}
if (object.features !== undefined && object.features !== null) {
for (const e of object.features) {
message.features.push(String(e));
}
}
return message;
},
fromPartial(object: DeepPartial<Version>): Version {
const message = { ...baseVersion } as Version;
message.features = [];
if (object.identifier !== undefined && object.identifier !== null) {
message.identifier = object.identifier;
} else {
message.identifier = "";
}
if (object.features !== undefined && object.features !== null) {
for (const e of object.features) {
message.features.push(e);
}
}
return message;
},
toJSON(message: Version): unknown {
const obj: any = {};
message.identifier !== undefined && (obj.identifier = message.identifier);
if (message.features) {
obj.features = message.features.map((e) => e);
} else {
obj.features = [];
}
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
/**
* This codec is derived from the Cosmos SDK protocol buffer definitions and can change at any time.
* @packageDocumentation
*/
import Long from "long";
import protobuf from "protobufjs/minimal";
// Ensure the protobuf module has a Long implementation, which otherwise only works
// in Node.js (see https://github.com/protobufjs/protobuf.js/issues/921#issuecomment-334925145)
protobuf.util.Long = Long;
protobuf.configure();
export * from "./generated/codecimpl";

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,114 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
/**
* PublicKey defines the keys available for use with Tendermint Validators
*/
export interface PublicKey {
ed25519: Uint8Array | undefined;
secp256k1: Uint8Array | undefined;
}
const basePublicKey: object = {};
export const protobufPackage = "tendermint.crypto";
export const PublicKey = {
encode(message: PublicKey, writer: Writer = Writer.create()): Writer {
if (message.ed25519 !== undefined) {
writer.uint32(10).bytes(message.ed25519);
}
if (message.secp256k1 !== undefined) {
writer.uint32(18).bytes(message.secp256k1);
}
return writer;
},
decode(input: Uint8Array | Reader, 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;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.ed25519 = reader.bytes();
break;
case 2:
message.secp256k1 = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): PublicKey {
const message = { ...basePublicKey } as PublicKey;
if (object.ed25519 !== undefined && object.ed25519 !== null) {
message.ed25519 = bytesFromBase64(object.ed25519);
}
if (object.secp256k1 !== undefined && object.secp256k1 !== null) {
message.secp256k1 = bytesFromBase64(object.secp256k1);
}
return message;
},
fromPartial(object: DeepPartial<PublicKey>): PublicKey {
const message = { ...basePublicKey } as PublicKey;
if (object.ed25519 !== undefined && object.ed25519 !== null) {
message.ed25519 = object.ed25519;
} else {
message.ed25519 = undefined;
}
if (object.secp256k1 !== undefined && object.secp256k1 !== null) {
message.secp256k1 = object.secp256k1;
} else {
message.secp256k1 = undefined;
}
return message;
},
toJSON(message: PublicKey): unknown {
const obj: any = {};
message.ed25519 !== undefined &&
(obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined);
message.secp256k1 !== undefined &&
(obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined);
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,473 @@
/* eslint-disable */
import * as Long from "long";
import { Writer, Reader } from "protobufjs/minimal";
export interface Proof {
total: Long;
index: Long;
leafHash: Uint8Array;
aunts: Uint8Array[];
}
export interface ValueOp {
/**
* Encoded in ProofOp.Key.
*/
key: Uint8Array;
/**
* To encode in ProofOp.Data
*/
proof?: Proof;
}
export interface DominoOp {
key: string;
input: string;
output: string;
}
/**
* ProofOp defines an operation used for calculating Merkle root
* The data could be arbitrary format, providing nessecary data
* for example neighbouring node hash
*/
export interface ProofOp {
type: string;
key: Uint8Array;
data: Uint8Array;
}
/**
* ProofOps is Merkle proof defined by the list of ProofOps
*/
export interface ProofOps {
ops: ProofOp[];
}
const baseProof: object = {
total: Long.ZERO,
index: Long.ZERO,
};
const baseValueOp: object = {};
const baseDominoOp: object = {
key: "",
input: "",
output: "",
};
const baseProofOp: object = {
type: "",
};
const baseProofOps: object = {};
export const protobufPackage = "tendermint.crypto";
export const Proof = {
encode(message: Proof, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int64(message.total);
writer.uint32(16).int64(message.index);
writer.uint32(26).bytes(message.leafHash);
for (const v of message.aunts) {
writer.uint32(34).bytes(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Proof {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseProof } as Proof;
message.aunts = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.total = reader.int64() as Long;
break;
case 2:
message.index = reader.int64() as Long;
break;
case 3:
message.leafHash = reader.bytes();
break;
case 4:
message.aunts.push(reader.bytes());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Proof {
const message = { ...baseProof } as Proof;
message.aunts = [];
if (object.total !== undefined && object.total !== null) {
message.total = Long.fromString(object.total);
} else {
message.total = Long.ZERO;
}
if (object.index !== undefined && object.index !== null) {
message.index = Long.fromString(object.index);
} else {
message.index = Long.ZERO;
}
if (object.leafHash !== undefined && object.leafHash !== null) {
message.leafHash = bytesFromBase64(object.leafHash);
}
if (object.aunts !== undefined && object.aunts !== null) {
for (const e of object.aunts) {
message.aunts.push(bytesFromBase64(e));
}
}
return message;
},
fromPartial(object: DeepPartial<Proof>): Proof {
const message = { ...baseProof } as Proof;
message.aunts = [];
if (object.total !== undefined && object.total !== null) {
message.total = object.total as Long;
} else {
message.total = Long.ZERO;
}
if (object.index !== undefined && object.index !== null) {
message.index = object.index as Long;
} else {
message.index = Long.ZERO;
}
if (object.leafHash !== undefined && object.leafHash !== null) {
message.leafHash = object.leafHash;
} else {
message.leafHash = new Uint8Array();
}
if (object.aunts !== undefined && object.aunts !== null) {
for (const e of object.aunts) {
message.aunts.push(e);
}
}
return message;
},
toJSON(message: Proof): unknown {
const obj: any = {};
message.total !== undefined && (obj.total = (message.total || Long.ZERO).toString());
message.index !== undefined && (obj.index = (message.index || Long.ZERO).toString());
message.leafHash !== undefined &&
(obj.leafHash = base64FromBytes(message.leafHash !== undefined ? message.leafHash : new Uint8Array()));
if (message.aunts) {
obj.aunts = message.aunts.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array()));
} else {
obj.aunts = [];
}
return obj;
},
};
export const ValueOp = {
encode(message: ValueOp, writer: Writer = Writer.create()): Writer {
writer.uint32(10).bytes(message.key);
if (message.proof !== undefined && message.proof !== undefined) {
Proof.encode(message.proof, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ValueOp {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseValueOp } as ValueOp;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.key = reader.bytes();
break;
case 2:
message.proof = Proof.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ValueOp {
const message = { ...baseValueOp } as ValueOp;
if (object.key !== undefined && object.key !== null) {
message.key = bytesFromBase64(object.key);
}
if (object.proof !== undefined && object.proof !== null) {
message.proof = Proof.fromJSON(object.proof);
} else {
message.proof = undefined;
}
return message;
},
fromPartial(object: DeepPartial<ValueOp>): ValueOp {
const message = { ...baseValueOp } as ValueOp;
if (object.key !== undefined && object.key !== null) {
message.key = object.key;
} else {
message.key = new Uint8Array();
}
if (object.proof !== undefined && object.proof !== null) {
message.proof = Proof.fromPartial(object.proof);
} else {
message.proof = undefined;
}
return message;
},
toJSON(message: ValueOp): unknown {
const obj: any = {};
message.key !== undefined &&
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined);
return obj;
},
};
export const DominoOp = {
encode(message: DominoOp, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.key);
writer.uint32(18).string(message.input);
writer.uint32(26).string(message.output);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): DominoOp {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseDominoOp } as DominoOp;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.key = reader.string();
break;
case 2:
message.input = reader.string();
break;
case 3:
message.output = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): DominoOp {
const message = { ...baseDominoOp } as DominoOp;
if (object.key !== undefined && object.key !== null) {
message.key = String(object.key);
} else {
message.key = "";
}
if (object.input !== undefined && object.input !== null) {
message.input = String(object.input);
} else {
message.input = "";
}
if (object.output !== undefined && object.output !== null) {
message.output = String(object.output);
} else {
message.output = "";
}
return message;
},
fromPartial(object: DeepPartial<DominoOp>): DominoOp {
const message = { ...baseDominoOp } as DominoOp;
if (object.key !== undefined && object.key !== null) {
message.key = object.key;
} else {
message.key = "";
}
if (object.input !== undefined && object.input !== null) {
message.input = object.input;
} else {
message.input = "";
}
if (object.output !== undefined && object.output !== null) {
message.output = object.output;
} else {
message.output = "";
}
return message;
},
toJSON(message: DominoOp): unknown {
const obj: any = {};
message.key !== undefined && (obj.key = message.key);
message.input !== undefined && (obj.input = message.input);
message.output !== undefined && (obj.output = message.output);
return obj;
},
};
export const ProofOp = {
encode(message: ProofOp, writer: Writer = Writer.create()): Writer {
writer.uint32(10).string(message.type);
writer.uint32(18).bytes(message.key);
writer.uint32(26).bytes(message.data);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ProofOp {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseProofOp } as ProofOp;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.type = reader.string();
break;
case 2:
message.key = reader.bytes();
break;
case 3:
message.data = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ProofOp {
const message = { ...baseProofOp } as ProofOp;
if (object.type !== undefined && object.type !== null) {
message.type = String(object.type);
} else {
message.type = "";
}
if (object.key !== undefined && object.key !== null) {
message.key = bytesFromBase64(object.key);
}
if (object.data !== undefined && object.data !== null) {
message.data = bytesFromBase64(object.data);
}
return message;
},
fromPartial(object: DeepPartial<ProofOp>): ProofOp {
const message = { ...baseProofOp } as ProofOp;
if (object.type !== undefined && object.type !== null) {
message.type = object.type;
} else {
message.type = "";
}
if (object.key !== undefined && object.key !== null) {
message.key = object.key;
} else {
message.key = new Uint8Array();
}
if (object.data !== undefined && object.data !== null) {
message.data = object.data;
} else {
message.data = new Uint8Array();
}
return message;
},
toJSON(message: ProofOp): unknown {
const obj: any = {};
message.type !== undefined && (obj.type = message.type);
message.key !== undefined &&
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
message.data !== undefined &&
(obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
return obj;
},
};
export const ProofOps = {
encode(message: ProofOps, writer: Writer = Writer.create()): Writer {
for (const v of message.ops) {
ProofOp.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ProofOps {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseProofOps } as ProofOps;
message.ops = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.ops.push(ProofOp.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ProofOps {
const message = { ...baseProofOps } as ProofOps;
message.ops = [];
if (object.ops !== undefined && object.ops !== null) {
for (const e of object.ops) {
message.ops.push(ProofOp.fromJSON(e));
}
}
return message;
},
fromPartial(object: DeepPartial<ProofOps>): ProofOps {
const message = { ...baseProofOps } as ProofOps;
message.ops = [];
if (object.ops !== undefined && object.ops !== null) {
for (const e of object.ops) {
message.ops.push(ProofOp.fromPartial(e));
}
}
return message;
},
toJSON(message: ProofOps): unknown {
const obj: any = {};
if (message.ops) {
obj.ops = message.ops.map((e) => (e ? ProofOp.toJSON(e) : undefined));
} else {
obj.ops = [];
}
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,106 @@
/* eslint-disable */
import * as Long from "long";
import { Writer, Reader } from "protobufjs/minimal";
export interface BitArray {
bits: Long;
elems: Long[];
}
const baseBitArray: object = {
bits: Long.ZERO,
elems: Long.UZERO,
};
export const protobufPackage = "tendermint.libs.bits";
export const BitArray = {
encode(message: BitArray, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int64(message.bits);
writer.uint32(18).fork();
for (const v of message.elems) {
writer.uint64(v);
}
writer.ldelim();
return writer;
},
decode(input: Uint8Array | Reader, length?: number): BitArray {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseBitArray } as BitArray;
message.elems = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.bits = reader.int64() as Long;
break;
case 2:
if ((tag & 7) === 2) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.elems.push(reader.uint64() as Long);
}
} else {
message.elems.push(reader.uint64() as Long);
}
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): BitArray {
const message = { ...baseBitArray } as BitArray;
message.elems = [];
if (object.bits !== undefined && object.bits !== null) {
message.bits = Long.fromString(object.bits);
} else {
message.bits = Long.ZERO;
}
if (object.elems !== undefined && object.elems !== null) {
for (const e of object.elems) {
message.elems.push(Long.fromString(e));
}
}
return message;
},
fromPartial(object: DeepPartial<BitArray>): BitArray {
const message = { ...baseBitArray } as BitArray;
message.elems = [];
if (object.bits !== undefined && object.bits !== null) {
message.bits = object.bits as Long;
} else {
message.bits = Long.ZERO;
}
if (object.elems !== undefined && object.elems !== null) {
for (const e of object.elems) {
message.elems.push(e);
}
}
return message;
},
toJSON(message: BitArray): unknown {
const obj: any = {};
message.bits !== undefined && (obj.bits = (message.bits || Long.ZERO).toString());
if (message.elems) {
obj.elems = message.elems.map((e) => (e || Long.UZERO).toString());
} else {
obj.elems = [];
}
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,557 @@
/* eslint-disable */
import * as Long from "long";
import { Duration } from "../../google/protobuf/duration";
import { Writer, Reader } from "protobufjs/minimal";
/**
* ConsensusParams contains consensus critical parameters that determine the
* validity of blocks.
*/
export interface ConsensusParams {
block?: BlockParams;
evidence?: EvidenceParams;
validator?: ValidatorParams;
version?: VersionParams;
}
/**
* BlockParams contains limits on the block size.
*/
export interface BlockParams {
/**
* Max block size, in bytes.
* Note: must be greater than 0
*/
maxBytes: Long;
/**
* Max gas per block.
* Note: must be greater or equal to -1
*/
maxGas: Long;
/**
* Minimum time increment between consecutive blocks (in milliseconds) If the
* block header timestamp is ahead of the system clock, decrease this value.
*
* Not exposed to the application.
*/
timeIotaMs: Long;
}
/**
* EvidenceParams determine how we handle evidence of malfeasance.
*/
export interface EvidenceParams {
/**
* Max age of evidence, in blocks.
*
* The basic formula for calculating this is: MaxAgeDuration / {average block
* time}.
*/
maxAgeNumBlocks: Long;
/**
* Max age of evidence, in time.
*
* It should correspond with an app's "unbonding period" or other similar
* mechanism for handling [Nothing-At-Stake
* attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed).
*/
maxAgeDuration?: Duration;
/**
* This sets the maximum size of total evidence in bytes that can be committed in a single block.
* and should fall comfortably under the max block bytes.
* Default is 1048576 or 1MB
*/
maxBytes: Long;
}
/**
* ValidatorParams restrict the public key types validators can use.
* NOTE: uses ABCI pubkey naming, not Amino names.
*/
export interface ValidatorParams {
pubKeyTypes: string[];
}
/**
* VersionParams contains the ABCI application version.
*/
export interface VersionParams {
appVersion: Long;
}
/**
* HashedParams is a subset of ConsensusParams.
*
* It is hashed into the Header.ConsensusHash.
*/
export interface HashedParams {
blockMaxBytes: Long;
blockMaxGas: Long;
}
const baseConsensusParams: object = {};
const baseBlockParams: object = {
maxBytes: Long.ZERO,
maxGas: Long.ZERO,
timeIotaMs: Long.ZERO,
};
const baseEvidenceParams: object = {
maxAgeNumBlocks: Long.ZERO,
maxBytes: Long.ZERO,
};
const baseValidatorParams: object = {
pubKeyTypes: "",
};
const baseVersionParams: object = {
appVersion: Long.UZERO,
};
const baseHashedParams: object = {
blockMaxBytes: Long.ZERO,
blockMaxGas: Long.ZERO,
};
export const protobufPackage = "tendermint.types";
export const ConsensusParams = {
encode(message: ConsensusParams, writer: Writer = Writer.create()): Writer {
if (message.block !== undefined && message.block !== undefined) {
BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim();
}
if (message.evidence !== undefined && message.evidence !== undefined) {
EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim();
}
if (message.validator !== undefined && message.validator !== undefined) {
ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim();
}
if (message.version !== undefined && message.version !== undefined) {
VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ConsensusParams {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseConsensusParams } as ConsensusParams;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.block = BlockParams.decode(reader, reader.uint32());
break;
case 2:
message.evidence = EvidenceParams.decode(reader, reader.uint32());
break;
case 3:
message.validator = ValidatorParams.decode(reader, reader.uint32());
break;
case 4:
message.version = VersionParams.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ConsensusParams {
const message = { ...baseConsensusParams } as ConsensusParams;
if (object.block !== undefined && object.block !== null) {
message.block = BlockParams.fromJSON(object.block);
} else {
message.block = undefined;
}
if (object.evidence !== undefined && object.evidence !== null) {
message.evidence = EvidenceParams.fromJSON(object.evidence);
} else {
message.evidence = undefined;
}
if (object.validator !== undefined && object.validator !== null) {
message.validator = ValidatorParams.fromJSON(object.validator);
} else {
message.validator = undefined;
}
if (object.version !== undefined && object.version !== null) {
message.version = VersionParams.fromJSON(object.version);
} else {
message.version = undefined;
}
return message;
},
fromPartial(object: DeepPartial<ConsensusParams>): ConsensusParams {
const message = { ...baseConsensusParams } as ConsensusParams;
if (object.block !== undefined && object.block !== null) {
message.block = BlockParams.fromPartial(object.block);
} else {
message.block = undefined;
}
if (object.evidence !== undefined && object.evidence !== null) {
message.evidence = EvidenceParams.fromPartial(object.evidence);
} else {
message.evidence = undefined;
}
if (object.validator !== undefined && object.validator !== null) {
message.validator = ValidatorParams.fromPartial(object.validator);
} else {
message.validator = undefined;
}
if (object.version !== undefined && object.version !== null) {
message.version = VersionParams.fromPartial(object.version);
} else {
message.version = undefined;
}
return message;
},
toJSON(message: ConsensusParams): unknown {
const obj: any = {};
message.block !== undefined &&
(obj.block = message.block ? BlockParams.toJSON(message.block) : undefined);
message.evidence !== undefined &&
(obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined);
message.validator !== undefined &&
(obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined);
message.version !== undefined &&
(obj.version = message.version ? VersionParams.toJSON(message.version) : undefined);
return obj;
},
};
export const BlockParams = {
encode(message: BlockParams, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int64(message.maxBytes);
writer.uint32(16).int64(message.maxGas);
writer.uint32(24).int64(message.timeIotaMs);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): BlockParams {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseBlockParams } as BlockParams;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.maxBytes = reader.int64() as Long;
break;
case 2:
message.maxGas = reader.int64() as Long;
break;
case 3:
message.timeIotaMs = reader.int64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): BlockParams {
const message = { ...baseBlockParams } as BlockParams;
if (object.maxBytes !== undefined && object.maxBytes !== null) {
message.maxBytes = Long.fromString(object.maxBytes);
} else {
message.maxBytes = Long.ZERO;
}
if (object.maxGas !== undefined && object.maxGas !== null) {
message.maxGas = Long.fromString(object.maxGas);
} else {
message.maxGas = Long.ZERO;
}
if (object.timeIotaMs !== undefined && object.timeIotaMs !== null) {
message.timeIotaMs = Long.fromString(object.timeIotaMs);
} else {
message.timeIotaMs = Long.ZERO;
}
return message;
},
fromPartial(object: DeepPartial<BlockParams>): BlockParams {
const message = { ...baseBlockParams } as BlockParams;
if (object.maxBytes !== undefined && object.maxBytes !== null) {
message.maxBytes = object.maxBytes as Long;
} else {
message.maxBytes = Long.ZERO;
}
if (object.maxGas !== undefined && object.maxGas !== null) {
message.maxGas = object.maxGas as Long;
} else {
message.maxGas = Long.ZERO;
}
if (object.timeIotaMs !== undefined && object.timeIotaMs !== null) {
message.timeIotaMs = object.timeIotaMs as Long;
} else {
message.timeIotaMs = Long.ZERO;
}
return message;
},
toJSON(message: BlockParams): unknown {
const obj: any = {};
message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || Long.ZERO).toString());
message.maxGas !== undefined && (obj.maxGas = (message.maxGas || Long.ZERO).toString());
message.timeIotaMs !== undefined && (obj.timeIotaMs = (message.timeIotaMs || Long.ZERO).toString());
return obj;
},
};
export const EvidenceParams = {
encode(message: EvidenceParams, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int64(message.maxAgeNumBlocks);
if (message.maxAgeDuration !== undefined && message.maxAgeDuration !== undefined) {
Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim();
}
writer.uint32(24).int64(message.maxBytes);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): EvidenceParams {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseEvidenceParams } as EvidenceParams;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.maxAgeNumBlocks = reader.int64() as Long;
break;
case 2:
message.maxAgeDuration = Duration.decode(reader, reader.uint32());
break;
case 3:
message.maxBytes = reader.int64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): EvidenceParams {
const message = { ...baseEvidenceParams } as EvidenceParams;
if (object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null) {
message.maxAgeNumBlocks = Long.fromString(object.maxAgeNumBlocks);
} else {
message.maxAgeNumBlocks = Long.ZERO;
}
if (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null) {
message.maxAgeDuration = Duration.fromJSON(object.maxAgeDuration);
} else {
message.maxAgeDuration = undefined;
}
if (object.maxBytes !== undefined && object.maxBytes !== null) {
message.maxBytes = Long.fromString(object.maxBytes);
} else {
message.maxBytes = Long.ZERO;
}
return message;
},
fromPartial(object: DeepPartial<EvidenceParams>): EvidenceParams {
const message = { ...baseEvidenceParams } as EvidenceParams;
if (object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null) {
message.maxAgeNumBlocks = object.maxAgeNumBlocks as Long;
} else {
message.maxAgeNumBlocks = Long.ZERO;
}
if (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null) {
message.maxAgeDuration = Duration.fromPartial(object.maxAgeDuration);
} else {
message.maxAgeDuration = undefined;
}
if (object.maxBytes !== undefined && object.maxBytes !== null) {
message.maxBytes = object.maxBytes as Long;
} else {
message.maxBytes = Long.ZERO;
}
return message;
},
toJSON(message: EvidenceParams): unknown {
const obj: any = {};
message.maxAgeNumBlocks !== undefined &&
(obj.maxAgeNumBlocks = (message.maxAgeNumBlocks || Long.ZERO).toString());
message.maxAgeDuration !== undefined &&
(obj.maxAgeDuration = message.maxAgeDuration ? Duration.toJSON(message.maxAgeDuration) : undefined);
message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || Long.ZERO).toString());
return obj;
},
};
export const ValidatorParams = {
encode(message: ValidatorParams, writer: Writer = Writer.create()): Writer {
for (const v of message.pubKeyTypes) {
writer.uint32(10).string(v!);
}
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ValidatorParams {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseValidatorParams } as ValidatorParams;
message.pubKeyTypes = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.pubKeyTypes.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ValidatorParams {
const message = { ...baseValidatorParams } as ValidatorParams;
message.pubKeyTypes = [];
if (object.pubKeyTypes !== undefined && object.pubKeyTypes !== null) {
for (const e of object.pubKeyTypes) {
message.pubKeyTypes.push(String(e));
}
}
return message;
},
fromPartial(object: DeepPartial<ValidatorParams>): ValidatorParams {
const message = { ...baseValidatorParams } as ValidatorParams;
message.pubKeyTypes = [];
if (object.pubKeyTypes !== undefined && object.pubKeyTypes !== null) {
for (const e of object.pubKeyTypes) {
message.pubKeyTypes.push(e);
}
}
return message;
},
toJSON(message: ValidatorParams): unknown {
const obj: any = {};
if (message.pubKeyTypes) {
obj.pubKeyTypes = message.pubKeyTypes.map((e) => e);
} else {
obj.pubKeyTypes = [];
}
return obj;
},
};
export const VersionParams = {
encode(message: VersionParams, writer: Writer = Writer.create()): Writer {
writer.uint32(8).uint64(message.appVersion);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): VersionParams {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseVersionParams } as VersionParams;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.appVersion = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): VersionParams {
const message = { ...baseVersionParams } as VersionParams;
if (object.appVersion !== undefined && object.appVersion !== null) {
message.appVersion = Long.fromString(object.appVersion);
} else {
message.appVersion = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<VersionParams>): VersionParams {
const message = { ...baseVersionParams } as VersionParams;
if (object.appVersion !== undefined && object.appVersion !== null) {
message.appVersion = object.appVersion as Long;
} else {
message.appVersion = Long.UZERO;
}
return message;
},
toJSON(message: VersionParams): unknown {
const obj: any = {};
message.appVersion !== undefined && (obj.appVersion = (message.appVersion || Long.UZERO).toString());
return obj;
},
};
export const HashedParams = {
encode(message: HashedParams, writer: Writer = Writer.create()): Writer {
writer.uint32(8).int64(message.blockMaxBytes);
writer.uint32(16).int64(message.blockMaxGas);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): HashedParams {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseHashedParams } as HashedParams;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.blockMaxBytes = reader.int64() as Long;
break;
case 2:
message.blockMaxGas = reader.int64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): HashedParams {
const message = { ...baseHashedParams } as HashedParams;
if (object.blockMaxBytes !== undefined && object.blockMaxBytes !== null) {
message.blockMaxBytes = Long.fromString(object.blockMaxBytes);
} else {
message.blockMaxBytes = Long.ZERO;
}
if (object.blockMaxGas !== undefined && object.blockMaxGas !== null) {
message.blockMaxGas = Long.fromString(object.blockMaxGas);
} else {
message.blockMaxGas = Long.ZERO;
}
return message;
},
fromPartial(object: DeepPartial<HashedParams>): HashedParams {
const message = { ...baseHashedParams } as HashedParams;
if (object.blockMaxBytes !== undefined && object.blockMaxBytes !== null) {
message.blockMaxBytes = object.blockMaxBytes as Long;
} else {
message.blockMaxBytes = Long.ZERO;
}
if (object.blockMaxGas !== undefined && object.blockMaxGas !== null) {
message.blockMaxGas = object.blockMaxGas as Long;
} else {
message.blockMaxGas = Long.ZERO;
}
return message;
},
toJSON(message: HashedParams): unknown {
const obj: any = {};
message.blockMaxBytes !== undefined &&
(obj.blockMaxBytes = (message.blockMaxBytes || Long.ZERO).toString());
message.blockMaxGas !== undefined && (obj.blockMaxGas = (message.blockMaxGas || Long.ZERO).toString());
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,323 @@
/* eslint-disable */
import * as Long from "long";
import { PublicKey } from "../../tendermint/crypto/keys";
import { Writer, Reader } from "protobufjs/minimal";
export interface ValidatorSet {
validators: Validator[];
proposer?: Validator;
totalVotingPower: Long;
}
export interface Validator {
address: Uint8Array;
pubKey?: PublicKey;
votingPower: Long;
proposerPriority: Long;
}
export interface SimpleValidator {
pubKey?: PublicKey;
votingPower: Long;
}
const baseValidatorSet: object = {
totalVotingPower: Long.ZERO,
};
const baseValidator: object = {
votingPower: Long.ZERO,
proposerPriority: Long.ZERO,
};
const baseSimpleValidator: object = {
votingPower: Long.ZERO,
};
export const protobufPackage = "tendermint.types";
export const ValidatorSet = {
encode(message: ValidatorSet, writer: Writer = Writer.create()): Writer {
for (const v of message.validators) {
Validator.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.proposer !== undefined && message.proposer !== undefined) {
Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim();
}
writer.uint32(24).int64(message.totalVotingPower);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): ValidatorSet {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseValidatorSet } as ValidatorSet;
message.validators = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.validators.push(Validator.decode(reader, reader.uint32()));
break;
case 2:
message.proposer = Validator.decode(reader, reader.uint32());
break;
case 3:
message.totalVotingPower = reader.int64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): ValidatorSet {
const message = { ...baseValidatorSet } as ValidatorSet;
message.validators = [];
if (object.validators !== undefined && object.validators !== null) {
for (const e of object.validators) {
message.validators.push(Validator.fromJSON(e));
}
}
if (object.proposer !== undefined && object.proposer !== null) {
message.proposer = Validator.fromJSON(object.proposer);
} else {
message.proposer = undefined;
}
if (object.totalVotingPower !== undefined && object.totalVotingPower !== null) {
message.totalVotingPower = Long.fromString(object.totalVotingPower);
} else {
message.totalVotingPower = Long.ZERO;
}
return message;
},
fromPartial(object: DeepPartial<ValidatorSet>): ValidatorSet {
const message = { ...baseValidatorSet } as ValidatorSet;
message.validators = [];
if (object.validators !== undefined && object.validators !== null) {
for (const e of object.validators) {
message.validators.push(Validator.fromPartial(e));
}
}
if (object.proposer !== undefined && object.proposer !== null) {
message.proposer = Validator.fromPartial(object.proposer);
} else {
message.proposer = undefined;
}
if (object.totalVotingPower !== undefined && object.totalVotingPower !== null) {
message.totalVotingPower = object.totalVotingPower as Long;
} else {
message.totalVotingPower = Long.ZERO;
}
return message;
},
toJSON(message: ValidatorSet): unknown {
const obj: any = {};
if (message.validators) {
obj.validators = message.validators.map((e) => (e ? Validator.toJSON(e) : undefined));
} else {
obj.validators = [];
}
message.proposer !== undefined &&
(obj.proposer = message.proposer ? Validator.toJSON(message.proposer) : undefined);
message.totalVotingPower !== undefined &&
(obj.totalVotingPower = (message.totalVotingPower || Long.ZERO).toString());
return obj;
},
};
export const Validator = {
encode(message: Validator, writer: Writer = Writer.create()): Writer {
writer.uint32(10).bytes(message.address);
if (message.pubKey !== undefined && message.pubKey !== undefined) {
PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim();
}
writer.uint32(24).int64(message.votingPower);
writer.uint32(32).int64(message.proposerPriority);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Validator {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseValidator } as Validator;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.bytes();
break;
case 2:
message.pubKey = PublicKey.decode(reader, reader.uint32());
break;
case 3:
message.votingPower = reader.int64() as Long;
break;
case 4:
message.proposerPriority = reader.int64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Validator {
const message = { ...baseValidator } as Validator;
if (object.address !== undefined && object.address !== null) {
message.address = bytesFromBase64(object.address);
}
if (object.pubKey !== undefined && object.pubKey !== null) {
message.pubKey = PublicKey.fromJSON(object.pubKey);
} else {
message.pubKey = undefined;
}
if (object.votingPower !== undefined && object.votingPower !== null) {
message.votingPower = Long.fromString(object.votingPower);
} else {
message.votingPower = Long.ZERO;
}
if (object.proposerPriority !== undefined && object.proposerPriority !== null) {
message.proposerPriority = Long.fromString(object.proposerPriority);
} else {
message.proposerPriority = Long.ZERO;
}
return message;
},
fromPartial(object: DeepPartial<Validator>): Validator {
const message = { ...baseValidator } as Validator;
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = new Uint8Array();
}
if (object.pubKey !== undefined && object.pubKey !== null) {
message.pubKey = PublicKey.fromPartial(object.pubKey);
} else {
message.pubKey = undefined;
}
if (object.votingPower !== undefined && object.votingPower !== null) {
message.votingPower = object.votingPower as Long;
} else {
message.votingPower = Long.ZERO;
}
if (object.proposerPriority !== undefined && object.proposerPriority !== null) {
message.proposerPriority = object.proposerPriority as Long;
} else {
message.proposerPriority = Long.ZERO;
}
return message;
},
toJSON(message: Validator): unknown {
const obj: any = {};
message.address !== undefined &&
(obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array()));
message.pubKey !== undefined &&
(obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined);
message.votingPower !== undefined && (obj.votingPower = (message.votingPower || Long.ZERO).toString());
message.proposerPriority !== undefined &&
(obj.proposerPriority = (message.proposerPriority || Long.ZERO).toString());
return obj;
},
};
export const SimpleValidator = {
encode(message: SimpleValidator, writer: Writer = Writer.create()): Writer {
if (message.pubKey !== undefined && message.pubKey !== undefined) {
PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim();
}
writer.uint32(16).int64(message.votingPower);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): SimpleValidator {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseSimpleValidator } as SimpleValidator;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.pubKey = PublicKey.decode(reader, reader.uint32());
break;
case 2:
message.votingPower = reader.int64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): SimpleValidator {
const message = { ...baseSimpleValidator } as SimpleValidator;
if (object.pubKey !== undefined && object.pubKey !== null) {
message.pubKey = PublicKey.fromJSON(object.pubKey);
} else {
message.pubKey = undefined;
}
if (object.votingPower !== undefined && object.votingPower !== null) {
message.votingPower = Long.fromString(object.votingPower);
} else {
message.votingPower = Long.ZERO;
}
return message;
},
fromPartial(object: DeepPartial<SimpleValidator>): SimpleValidator {
const message = { ...baseSimpleValidator } as SimpleValidator;
if (object.pubKey !== undefined && object.pubKey !== null) {
message.pubKey = PublicKey.fromPartial(object.pubKey);
} else {
message.pubKey = undefined;
}
if (object.votingPower !== undefined && object.votingPower !== null) {
message.votingPower = object.votingPower as Long;
} else {
message.votingPower = Long.ZERO;
}
return message;
},
toJSON(message: SimpleValidator): unknown {
const obj: any = {};
message.pubKey !== undefined &&
(obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined);
message.votingPower !== undefined && (obj.votingPower = (message.votingPower || Long.ZERO).toString());
return obj;
},
};
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"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,170 @@
/* eslint-disable */
import * as Long from "long";
import { Writer, Reader } from "protobufjs/minimal";
/**
* App includes the protocol and software version for the application.
* This information is included in ResponseInfo. The App.Protocol can be
* updated in ResponseEndBlock.
*/
export interface App {
protocol: Long;
software: string;
}
/**
* Consensus captures the consensus rules for processing a block in the blockchain,
* including all blockchain data structures and the rules of the application's
* state transition machine.
*/
export interface Consensus {
block: Long;
app: Long;
}
const baseApp: object = {
protocol: Long.UZERO,
software: "",
};
const baseConsensus: object = {
block: Long.UZERO,
app: Long.UZERO,
};
export const protobufPackage = "tendermint.version";
export const App = {
encode(message: App, writer: Writer = Writer.create()): Writer {
writer.uint32(8).uint64(message.protocol);
writer.uint32(18).string(message.software);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): App {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseApp } as App;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.protocol = reader.uint64() as Long;
break;
case 2:
message.software = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): App {
const message = { ...baseApp } as App;
if (object.protocol !== undefined && object.protocol !== null) {
message.protocol = Long.fromString(object.protocol);
} else {
message.protocol = Long.UZERO;
}
if (object.software !== undefined && object.software !== null) {
message.software = String(object.software);
} else {
message.software = "";
}
return message;
},
fromPartial(object: DeepPartial<App>): App {
const message = { ...baseApp } as App;
if (object.protocol !== undefined && object.protocol !== null) {
message.protocol = object.protocol as Long;
} else {
message.protocol = Long.UZERO;
}
if (object.software !== undefined && object.software !== null) {
message.software = object.software;
} else {
message.software = "";
}
return message;
},
toJSON(message: App): unknown {
const obj: any = {};
message.protocol !== undefined && (obj.protocol = (message.protocol || Long.UZERO).toString());
message.software !== undefined && (obj.software = message.software);
return obj;
},
};
export const Consensus = {
encode(message: Consensus, writer: Writer = Writer.create()): Writer {
writer.uint32(8).uint64(message.block);
writer.uint32(16).uint64(message.app);
return writer;
},
decode(input: Uint8Array | Reader, length?: number): Consensus {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseConsensus } as Consensus;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.block = reader.uint64() as Long;
break;
case 2:
message.app = reader.uint64() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Consensus {
const message = { ...baseConsensus } as Consensus;
if (object.block !== undefined && object.block !== null) {
message.block = Long.fromString(object.block);
} else {
message.block = Long.UZERO;
}
if (object.app !== undefined && object.app !== null) {
message.app = Long.fromString(object.app);
} else {
message.app = Long.UZERO;
}
return message;
},
fromPartial(object: DeepPartial<Consensus>): Consensus {
const message = { ...baseConsensus } as Consensus;
if (object.block !== undefined && object.block !== null) {
message.block = object.block as Long;
} else {
message.block = Long.UZERO;
}
if (object.app !== undefined && object.app !== null) {
message.app = object.app as Long;
} else {
message.app = Long.UZERO;
}
return message;
},
toJSON(message: Consensus): unknown {
const obj: any = {};
message.block !== undefined && (obj.block = (message.block || Long.UZERO).toString());
message.app !== undefined && (obj.app = (message.app || Long.UZERO).toString());
return obj;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;