From 584fad35b201d0de7f826aa2ed4d2815db1adc82 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Thu, 15 Jun 2023 16:21:52 -0500 Subject: [PATCH 1/4] feat(cosmic-proto): add vstorage query --- .../dist/agoric/vstorage/query.d.ts | 438 ++++++++++++++++++ .../dist/agoric/vstorage/query.js | 250 ++++++++++ packages/cosmic-proto/package.json | 6 +- packages/cosmic-proto/test/sanity-test.js | 1 + 4 files changed, 694 insertions(+), 1 deletion(-) create mode 100644 packages/cosmic-proto/dist/agoric/vstorage/query.d.ts create mode 100644 packages/cosmic-proto/dist/agoric/vstorage/query.js diff --git a/packages/cosmic-proto/dist/agoric/vstorage/query.d.ts b/packages/cosmic-proto/dist/agoric/vstorage/query.d.ts new file mode 100644 index 00000000000..2a7a4265016 --- /dev/null +++ b/packages/cosmic-proto/dist/agoric/vstorage/query.d.ts @@ -0,0 +1,438 @@ +import Long from 'long'; +import _m0 from 'protobufjs/minimal.js'; +import { + PageRequest, + PageResponse, +} from '../../cosmos/base/query/v1beta1/pagination.js'; +export declare const protobufPackage = 'agoric.vstorage'; +/** QueryDataRequest is the vstorage path data query. */ +export interface QueryDataRequest { + path: string; +} +/** QueryDataResponse is the vstorage path data response. */ +export interface QueryDataResponse { + value: string; +} +/** QueryChildrenRequest is the vstorage path children query. */ +export interface QueryChildrenRequest { + path: string; + pagination?: PageRequest; +} +/** QueryChildrenResponse is the vstorage path children response. */ +export interface QueryChildrenResponse { + children: string[]; + pagination?: PageResponse; +} +export declare const QueryDataRequest: { + encode(message: QueryDataRequest, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDataRequest; + fromJSON(object: any): QueryDataRequest; + toJSON(message: QueryDataRequest): unknown; + fromPartial< + I extends { + path?: string | undefined; + } & { + path?: string | undefined; + } & { [K in Exclude]: never }, + >( + object: I, + ): QueryDataRequest; +}; +export declare const QueryDataResponse: { + encode(message: QueryDataResponse, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDataResponse; + fromJSON(object: any): QueryDataResponse; + toJSON(message: QueryDataResponse): unknown; + fromPartial< + I extends { + value?: string | undefined; + } & { + value?: string | undefined; + } & { [K in Exclude]: never }, + >( + object: I, + ): QueryDataResponse; +}; +export declare const QueryChildrenRequest: { + encode(message: QueryChildrenRequest, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): QueryChildrenRequest; + fromJSON(object: any): QueryChildrenRequest; + toJSON(message: QueryChildrenRequest): unknown; + fromPartial< + I extends { + path?: string | undefined; + pagination?: + | { + key?: Uint8Array | undefined; + offset?: string | number | Long | undefined; + limit?: string | number | Long | undefined; + countTotal?: boolean | undefined; + reverse?: boolean | undefined; + } + | undefined; + } & { + path?: string | undefined; + pagination?: + | ({ + key?: Uint8Array | undefined; + offset?: string | number | Long | undefined; + limit?: string | number | Long | undefined; + countTotal?: boolean | undefined; + reverse?: boolean | undefined; + } & { + key?: Uint8Array | undefined; + offset?: + | string + | number + | (Long & { + high: number; + low: number; + unsigned: boolean; + add: (addend: string | number | Long) => Long; + and: (other: string | number | Long) => Long; + compare: (other: string | number | Long) => number; + comp: (other: string | number | Long) => number; + divide: (divisor: string | number | Long) => Long; + div: (divisor: string | number | Long) => Long; + equals: (other: string | number | Long) => boolean; + eq: (other: string | number | Long) => boolean; + getHighBits: () => number; + getHighBitsUnsigned: () => number; + getLowBits: () => number; + getLowBitsUnsigned: () => number; + getNumBitsAbs: () => number; + greaterThan: (other: string | number | Long) => boolean; + gt: (other: string | number | Long) => boolean; + greaterThanOrEqual: ( + other: string | number | Long, + ) => boolean; + gte: (other: string | number | Long) => boolean; + ge: (other: string | number | Long) => boolean; + isEven: () => boolean; + isNegative: () => boolean; + isOdd: () => boolean; + isPositive: () => boolean; + isZero: () => boolean; + eqz: () => boolean; + lessThan: (other: string | number | Long) => boolean; + lt: (other: string | number | Long) => boolean; + lessThanOrEqual: (other: string | number | Long) => boolean; + lte: (other: string | number | Long) => boolean; + le: (other: string | number | Long) => boolean; + modulo: (other: string | number | Long) => Long; + mod: (other: string | number | Long) => Long; + rem: (other: string | number | Long) => Long; + multiply: (multiplier: string | number | Long) => Long; + mul: (multiplier: string | number | Long) => Long; + negate: () => Long; + neg: () => Long; + not: () => Long; + countLeadingZeros: () => number; + clz: () => number; + countTrailingZeros: () => number; + ctz: () => number; + notEquals: (other: string | number | Long) => boolean; + neq: (other: string | number | Long) => boolean; + ne: (other: string | number | Long) => boolean; + or: (other: string | number | Long) => Long; + shiftLeft: (numBits: number | Long) => Long; + shl: (numBits: number | Long) => Long; + shiftRight: (numBits: number | Long) => Long; + shr: (numBits: number | Long) => Long; + shiftRightUnsigned: (numBits: number | Long) => Long; + shru: (numBits: number | Long) => Long; + shr_u: (numBits: number | Long) => Long; + rotateLeft: (numBits: number | Long) => Long; + rotl: (numBits: number | Long) => Long; + rotateRight: (numBits: number | Long) => Long; + rotr: (numBits: number | Long) => Long; + subtract: (subtrahend: string | number | Long) => Long; + sub: (subtrahend: string | number | Long) => Long; + toInt: () => number; + toNumber: () => number; + toBytes: (le?: boolean | undefined) => number[]; + toBytesLE: () => number[]; + toBytesBE: () => number[]; + toSigned: () => Long; + toString: (radix?: number | undefined) => string; + toUnsigned: () => Long; + xor: (other: string | number | Long) => Long; + } & { + [K in Exclude< + keyof I['pagination']['offset'], + keyof Long + >]: never; + }) + | undefined; + limit?: + | string + | number + | (Long & { + high: number; + low: number; + unsigned: boolean; + add: (addend: string | number | Long) => Long; + and: (other: string | number | Long) => Long; + compare: (other: string | number | Long) => number; + comp: (other: string | number | Long) => number; + divide: (divisor: string | number | Long) => Long; + div: (divisor: string | number | Long) => Long; + equals: (other: string | number | Long) => boolean; + eq: (other: string | number | Long) => boolean; + getHighBits: () => number; + getHighBitsUnsigned: () => number; + getLowBits: () => number; + getLowBitsUnsigned: () => number; + getNumBitsAbs: () => number; + greaterThan: (other: string | number | Long) => boolean; + gt: (other: string | number | Long) => boolean; + greaterThanOrEqual: ( + other: string | number | Long, + ) => boolean; + gte: (other: string | number | Long) => boolean; + ge: (other: string | number | Long) => boolean; + isEven: () => boolean; + isNegative: () => boolean; + isOdd: () => boolean; + isPositive: () => boolean; + isZero: () => boolean; + eqz: () => boolean; + lessThan: (other: string | number | Long) => boolean; + lt: (other: string | number | Long) => boolean; + lessThanOrEqual: (other: string | number | Long) => boolean; + lte: (other: string | number | Long) => boolean; + le: (other: string | number | Long) => boolean; + modulo: (other: string | number | Long) => Long; + mod: (other: string | number | Long) => Long; + rem: (other: string | number | Long) => Long; + multiply: (multiplier: string | number | Long) => Long; + mul: (multiplier: string | number | Long) => Long; + negate: () => Long; + neg: () => Long; + not: () => Long; + countLeadingZeros: () => number; + clz: () => number; + countTrailingZeros: () => number; + ctz: () => number; + notEquals: (other: string | number | Long) => boolean; + neq: (other: string | number | Long) => boolean; + ne: (other: string | number | Long) => boolean; + or: (other: string | number | Long) => Long; + shiftLeft: (numBits: number | Long) => Long; + shl: (numBits: number | Long) => Long; + shiftRight: (numBits: number | Long) => Long; + shr: (numBits: number | Long) => Long; + shiftRightUnsigned: (numBits: number | Long) => Long; + shru: (numBits: number | Long) => Long; + shr_u: (numBits: number | Long) => Long; + rotateLeft: (numBits: number | Long) => Long; + rotl: (numBits: number | Long) => Long; + rotateRight: (numBits: number | Long) => Long; + rotr: (numBits: number | Long) => Long; + subtract: (subtrahend: string | number | Long) => Long; + sub: (subtrahend: string | number | Long) => Long; + toInt: () => number; + toNumber: () => number; + toBytes: (le?: boolean | undefined) => number[]; + toBytesLE: () => number[]; + toBytesBE: () => number[]; + toSigned: () => Long; + toString: (radix?: number | undefined) => string; + toUnsigned: () => Long; + xor: (other: string | number | Long) => Long; + } & { + [K_1 in Exclude< + keyof I['pagination']['limit'], + keyof Long + >]: never; + }) + | undefined; + countTotal?: boolean | undefined; + reverse?: boolean | undefined; + } & { + [K_2 in Exclude]: never; + }) + | undefined; + } & { [K_3 in Exclude]: never }, + >( + object: I, + ): QueryChildrenRequest; +}; +export declare const QueryChildrenResponse: { + encode(message: QueryChildrenResponse, writer?: _m0.Writer): _m0.Writer; + decode( + input: _m0.Reader | Uint8Array, + length?: number, + ): QueryChildrenResponse; + fromJSON(object: any): QueryChildrenResponse; + toJSON(message: QueryChildrenResponse): unknown; + fromPartial< + I extends { + children?: string[] | undefined; + pagination?: + | { + nextKey?: Uint8Array | undefined; + total?: string | number | Long | undefined; + } + | undefined; + } & { + children?: + | (string[] & + string[] & { + [K in Exclude]: never; + }) + | undefined; + pagination?: + | ({ + nextKey?: Uint8Array | undefined; + total?: string | number | Long | undefined; + } & { + nextKey?: Uint8Array | undefined; + total?: + | string + | number + | (Long & { + high: number; + low: number; + unsigned: boolean; + add: (addend: string | number | Long) => Long; + and: (other: string | number | Long) => Long; + compare: (other: string | number | Long) => number; + comp: (other: string | number | Long) => number; + divide: (divisor: string | number | Long) => Long; + div: (divisor: string | number | Long) => Long; + equals: (other: string | number | Long) => boolean; + eq: (other: string | number | Long) => boolean; + getHighBits: () => number; + getHighBitsUnsigned: () => number; + getLowBits: () => number; + getLowBitsUnsigned: () => number; + getNumBitsAbs: () => number; + greaterThan: (other: string | number | Long) => boolean; + gt: (other: string | number | Long) => boolean; + greaterThanOrEqual: ( + other: string | number | Long, + ) => boolean; + gte: (other: string | number | Long) => boolean; + ge: (other: string | number | Long) => boolean; + isEven: () => boolean; + isNegative: () => boolean; + isOdd: () => boolean; + isPositive: () => boolean; + isZero: () => boolean; + eqz: () => boolean; + lessThan: (other: string | number | Long) => boolean; + lt: (other: string | number | Long) => boolean; + lessThanOrEqual: (other: string | number | Long) => boolean; + lte: (other: string | number | Long) => boolean; + le: (other: string | number | Long) => boolean; + modulo: (other: string | number | Long) => Long; + mod: (other: string | number | Long) => Long; + rem: (other: string | number | Long) => Long; + multiply: (multiplier: string | number | Long) => Long; + mul: (multiplier: string | number | Long) => Long; + negate: () => Long; + neg: () => Long; + not: () => Long; + countLeadingZeros: () => number; + clz: () => number; + countTrailingZeros: () => number; + ctz: () => number; + notEquals: (other: string | number | Long) => boolean; + neq: (other: string | number | Long) => boolean; + ne: (other: string | number | Long) => boolean; + or: (other: string | number | Long) => Long; + shiftLeft: (numBits: number | Long) => Long; + shl: (numBits: number | Long) => Long; + shiftRight: (numBits: number | Long) => Long; + shr: (numBits: number | Long) => Long; + shiftRightUnsigned: (numBits: number | Long) => Long; + shru: (numBits: number | Long) => Long; + shr_u: (numBits: number | Long) => Long; + rotateLeft: (numBits: number | Long) => Long; + rotl: (numBits: number | Long) => Long; + rotateRight: (numBits: number | Long) => Long; + rotr: (numBits: number | Long) => Long; + subtract: (subtrahend: string | number | Long) => Long; + sub: (subtrahend: string | number | Long) => Long; + toInt: () => number; + toNumber: () => number; + toBytes: (le?: boolean | undefined) => number[]; + toBytesLE: () => number[]; + toBytesBE: () => number[]; + toSigned: () => Long; + toString: (radix?: number | undefined) => string; + toUnsigned: () => Long; + xor: (other: string | number | Long) => Long; + } & { + [K_1 in Exclude< + keyof I['pagination']['total'], + keyof Long + >]: never; + }) + | undefined; + } & { + [K_2 in Exclude]: never; + }) + | undefined; + } & { [K_3 in Exclude]: never }, + >( + object: I, + ): QueryChildrenResponse; +}; +/** Query defines the gRPC querier service */ +export interface Query { + /** Return an arbitrary vstorage datum. */ + Data(request: QueryDataRequest): Promise; + /** Return the children of a given vstorage path. */ + Children(request: QueryChildrenRequest): Promise; +} +export declare class QueryClientImpl implements Query { + private readonly rpc; + private readonly service; + constructor( + rpc: Rpc, + opts?: { + service?: string; + }, + ); + Data(request: QueryDataRequest): Promise; + Children(request: QueryChildrenRequest): Promise; +} +interface Rpc { + request( + service: string, + method: string, + data: Uint8Array, + ): Promise; +} +declare type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | boolean + | undefined; +export declare type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { + [K in keyof T]?: DeepPartial; + } + : Partial; +declare type KeysOfUnion = T extends T ? keyof T : never; +export declare type Exact = P extends Builtin + ? P + : P & { + [K in keyof P]: Exact; + } & { + [K in Exclude>]: never; + }; +export {}; diff --git a/packages/cosmic-proto/dist/agoric/vstorage/query.js b/packages/cosmic-proto/dist/agoric/vstorage/query.js new file mode 100644 index 00000000000..8d795ca8c03 --- /dev/null +++ b/packages/cosmic-proto/dist/agoric/vstorage/query.js @@ -0,0 +1,250 @@ +/* eslint-disable */ +import Long from 'long'; +import _m0 from 'protobufjs/minimal.js'; +import { + PageRequest, + PageResponse, +} from '../../cosmos/base/query/v1beta1/pagination.js'; +export const protobufPackage = 'agoric.vstorage'; +function createBaseQueryDataRequest() { + return { path: '' }; +} +export const QueryDataRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.path !== '') { + writer.uint32(10).string(message.path); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { path: isSet(object.path) ? String(object.path) : '' }; + }, + toJSON(message) { + const obj = {}; + message.path !== undefined && (obj.path = message.path); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDataRequest(); + message.path = object.path ?? ''; + return message; + }, +}; +function createBaseQueryDataResponse() { + return { value: '' }; +} +export const QueryDataResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.value !== '') { + writer.uint32(10).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { value: isSet(object.value) ? String(object.value) : '' }; + }, + toJSON(message) { + const obj = {}; + message.value !== undefined && (obj.value = message.value); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryDataResponse(); + message.value = object.value ?? ''; + return message; + }, +}; +function createBaseQueryChildrenRequest() { + return { path: '', pagination: undefined }; +} +export const QueryChildrenRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChildrenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + path: isSet(object.path) ? String(object.path) : '', + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.path !== undefined && (obj.path = message.path); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChildrenRequest(); + message.path = object.path ?? ''; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +function createBaseQueryChildrenResponse() { + return { children: [], pagination: undefined }; +} +export const QueryChildrenResponse = { + encode(message, writer = _m0.Writer.create()) { + for (const v of message.children) { + writer.uint32(10).string(v); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork(), + ).ldelim(); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryChildrenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.children.push(reader.string()); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + children: Array.isArray(object?.children) + ? object.children.map((e) => String(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + if (message.children) { + obj.children = message.children.map((e) => e); + } else { + obj.children = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryChildrenResponse(); + message.children = object.children?.map((e) => e) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, +}; +export class QueryClientImpl { + rpc; + service; + constructor(rpc, opts) { + this.service = opts?.service || 'agoric.vstorage.Query'; + this.rpc = rpc; + this.Data = this.Data.bind(this); + this.Children = this.Children.bind(this); + } + Data(request) { + const data = QueryDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, 'Data', data); + return promise.then((data) => + QueryDataResponse.decode(new _m0.Reader(data)), + ); + } + Children(request) { + const data = QueryChildrenRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, 'Children', data); + return promise.then((data) => + QueryChildrenResponse.decode(new _m0.Reader(data)), + ); + } +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/packages/cosmic-proto/package.json b/packages/cosmic-proto/package.json index 4b8fec2f7b2..41abb5eb132 100644 --- a/packages/cosmic-proto/package.json +++ b/packages/cosmic-proto/package.json @@ -24,6 +24,10 @@ "types": "./dist/agoric/swingset/query.d.ts", "default": "./dist/agoric/swingset/query.js" }, + "./vstorage/query.js": { + "types": "./dist/agoric/vstorage/query.d.ts", + "default": "./dist/agoric/vstorage/query.js" + }, "./swingset/swingset.js": { "types": "./dist/agoric/swingset/swingset.d.ts", "default": "./dist/agoric/swingset/swingset.js" @@ -32,7 +36,7 @@ "scripts": { "build": "echo Use yarn rebuild to update dist output", "rebuild": "rm -rf gen && mkdir -p gen && yarn generate && tsc --build && yarn prettier -w dist/agoric && rm -rf gen", - "generate": "protoc --plugin=node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt='esModuleInterop=true,forceLong=long,useOptionals=messages' --ts_proto_out=./gen --ts_proto_opt=importSuffix=.js ./proto/agoric/swingset/msgs.proto ./proto/agoric/swingset/query.proto -I./proto", + "generate": "protoc --plugin=node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt='esModuleInterop=true,forceLong=long,useOptionals=messages' --ts_proto_out=./gen --ts_proto_opt=importSuffix=.js ./proto/agoric/swingset/msgs.proto ./proto/agoric/swingset/query.proto ./proto/agoric/vstorage/query.proto -I./proto", "test": "node test/sanity-test.js", "test:xs": "exit 0", "lint": "exit 0", diff --git a/packages/cosmic-proto/test/sanity-test.js b/packages/cosmic-proto/test/sanity-test.js index db3495231a8..96487d96409 100644 --- a/packages/cosmic-proto/test/sanity-test.js +++ b/packages/cosmic-proto/test/sanity-test.js @@ -1,3 +1,4 @@ /* eslint-disable import/no-extraneous-dependencies -- bug in rule thinks this package depends on itself */ import '@agoric/cosmic-proto/swingset/msgs.js'; import '@agoric/cosmic-proto/swingset/query.js'; +import '@agoric/cosmic-proto/vstorage/query.js'; From e8e5d2640040cf3a6ccd210c67906b175599b328 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 20 Feb 2024 17:37:49 +0000 Subject: [PATCH 2/4] fix(cosmic-proto): add missing `cosmos_proto` dep --- packages/cosmic-proto/MAINTAINERS.md | 1 + packages/cosmic-proto/proto/cosmos_proto | 1 + 2 files changed, 2 insertions(+) create mode 120000 packages/cosmic-proto/proto/cosmos_proto diff --git a/packages/cosmic-proto/MAINTAINERS.md b/packages/cosmic-proto/MAINTAINERS.md index c1a25730bb8..0a8cdf45d6f 100644 --- a/packages/cosmic-proto/MAINTAINERS.md +++ b/packages/cosmic-proto/MAINTAINERS.md @@ -28,6 +28,7 @@ mkdir -p proto cd proto ln -s ../../../golang/cosmos/proto/agoric . ln -s ../../../golang/cosmos/third_party/proto/gogoproto . +ln -s ../../../golang/cosmos/third_party/proto/cosmos_proto . ln -s ../node_modules/protobufjs/google . ``` diff --git a/packages/cosmic-proto/proto/cosmos_proto b/packages/cosmic-proto/proto/cosmos_proto new file mode 120000 index 00000000000..5f57b79469a --- /dev/null +++ b/packages/cosmic-proto/proto/cosmos_proto @@ -0,0 +1 @@ +../../../golang/cosmos/third_party/proto/cosmos_proto \ No newline at end of file From 58a2810952125a201d3f6b0f3289854909ae3858 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 20 Feb 2024 19:17:30 +0000 Subject: [PATCH 3/4] fix(cosmic-proto): do not git ignore all generated files --- .gitignore | 1 + packages/cosmic-proto/.gitignore | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 packages/cosmic-proto/.gitignore diff --git a/.gitignore b/.gitignore index 46114b99308..704fabe891b 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ bundles bundle-*.js compiled dist +!packages/cosmic-proto/dist # misc /.vagrant diff --git a/packages/cosmic-proto/.gitignore b/packages/cosmic-proto/.gitignore new file mode 100644 index 00000000000..784280d10f7 --- /dev/null +++ b/packages/cosmic-proto/.gitignore @@ -0,0 +1,2 @@ +dist/gogoproto +dist/google \ No newline at end of file From 6776ff05d7e594ee9b8b81a6dcecd1c29e7e2e6d Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 20 Feb 2024 20:32:29 +0000 Subject: [PATCH 4/4] chore(cosmic-proto): rebuild --- .../dist/agoric/swingset/msgs.d.ts | 90 ++++- .../cosmic-proto/dist/agoric/swingset/msgs.js | 40 ++- .../dist/agoric/swingset/swingset.d.ts | 31 +- .../dist/agoric/swingset/swingset.js | 8 +- .../dist/agoric/vstorage/query.d.ts | 79 ++++- .../dist/agoric/vstorage/query.js | 134 ++++++++ .../cosmos/base/query/v1beta1/pagination.d.ts | 322 ++++++++++++++++++ .../cosmos/base/query/v1beta1/pagination.js | 186 ++++++++++ .../dist/cosmos_proto/cosmos.d.ts | 99 ++++++ .../cosmic-proto/dist/cosmos_proto/cosmos.js | 176 ++++++++++ 10 files changed, 1141 insertions(+), 24 deletions(-) create mode 100644 packages/cosmic-proto/dist/cosmos/base/query/v1beta1/pagination.d.ts create mode 100644 packages/cosmic-proto/dist/cosmos/base/query/v1beta1/pagination.js create mode 100644 packages/cosmic-proto/dist/cosmos_proto/cosmos.d.ts create mode 100644 packages/cosmic-proto/dist/cosmos_proto/cosmos.js diff --git a/packages/cosmic-proto/dist/agoric/swingset/msgs.d.ts b/packages/cosmic-proto/dist/agoric/swingset/msgs.d.ts index 5d5f60d6c65..335e15cffeb 100644 --- a/packages/cosmic-proto/dist/agoric/swingset/msgs.d.ts +++ b/packages/cosmic-proto/dist/agoric/swingset/msgs.d.ts @@ -47,6 +47,13 @@ export interface MsgProvisionResponse {} export interface MsgInstallBundle { bundle: string; submitter: Uint8Array; + /** + * Either bundle or compressed_bundle will be set. + * Default compression algorithm is gzip. + */ + compressedBundle: Uint8Array; + /** Size in bytes of uncompression of compressed_bundle. */ + uncompressedSize: Long; } /** * MsgInstallBundleResponse is an empty acknowledgement that an install bundle @@ -355,10 +362,91 @@ export declare const MsgInstallBundle: { I extends { bundle?: string | undefined; submitter?: Uint8Array | undefined; + compressedBundle?: Uint8Array | undefined; + uncompressedSize?: string | number | Long | undefined; } & { bundle?: string | undefined; submitter?: Uint8Array | undefined; - } & { [K in Exclude]: never }, + compressedBundle?: Uint8Array | undefined; + uncompressedSize?: + | string + | number + | (Long & { + high: number; + low: number; + unsigned: boolean; + add: (addend: string | number | Long) => Long; + and: (other: string | number | Long) => Long; + compare: (other: string | number | Long) => number; + comp: (other: string | number | Long) => number; + divide: (divisor: string | number | Long) => Long; + div: (divisor: string | number | Long) => Long; + equals: (other: string | number | Long) => boolean; + eq: (other: string | number | Long) => boolean; + getHighBits: () => number; + getHighBitsUnsigned: () => number; + getLowBits: () => number; + getLowBitsUnsigned: () => number; + getNumBitsAbs: () => number; + greaterThan: (other: string | number | Long) => boolean; + gt: (other: string | number | Long) => boolean; + greaterThanOrEqual: (other: string | number | Long) => boolean; + gte: (other: string | number | Long) => boolean; + ge: (other: string | number | Long) => boolean; + isEven: () => boolean; + isNegative: () => boolean; + isOdd: () => boolean; + isPositive: () => boolean; + isZero: () => boolean; + eqz: () => boolean; + lessThan: (other: string | number | Long) => boolean; + lt: (other: string | number | Long) => boolean; + lessThanOrEqual: (other: string | number | Long) => boolean; + lte: (other: string | number | Long) => boolean; + le: (other: string | number | Long) => boolean; + modulo: (other: string | number | Long) => Long; + mod: (other: string | number | Long) => Long; + rem: (other: string | number | Long) => Long; + multiply: (multiplier: string | number | Long) => Long; + mul: (multiplier: string | number | Long) => Long; + negate: () => Long; + neg: () => Long; + not: () => Long; + countLeadingZeros: () => number; + clz: () => number; + countTrailingZeros: () => number; + ctz: () => number; + notEquals: (other: string | number | Long) => boolean; + neq: (other: string | number | Long) => boolean; + ne: (other: string | number | Long) => boolean; + or: (other: string | number | Long) => Long; + shiftLeft: (numBits: number | Long) => Long; + shl: (numBits: number | Long) => Long; + shiftRight: (numBits: number | Long) => Long; + shr: (numBits: number | Long) => Long; + shiftRightUnsigned: (numBits: number | Long) => Long; + shru: (numBits: number | Long) => Long; + shr_u: (numBits: number | Long) => Long; + rotateLeft: (numBits: number | Long) => Long; + rotl: (numBits: number | Long) => Long; + rotateRight: (numBits: number | Long) => Long; + rotr: (numBits: number | Long) => Long; + subtract: (subtrahend: string | number | Long) => Long; + sub: (subtrahend: string | number | Long) => Long; + toInt: () => number; + toNumber: () => number; + toBytes: (le?: boolean | undefined) => number[]; + toBytesLE: () => number[]; + toBytesBE: () => number[]; + toSigned: () => Long; + toString: (radix?: number | undefined) => string; + toUnsigned: () => Long; + xor: (other: string | number | Long) => Long; + } & { + [K in Exclude]: never; + }) + | undefined; + } & { [K_1 in Exclude]: never }, >( object: I, ): MsgInstallBundle; diff --git a/packages/cosmic-proto/dist/agoric/swingset/msgs.js b/packages/cosmic-proto/dist/agoric/swingset/msgs.js index 878d26bb4c4..249b885f471 100644 --- a/packages/cosmic-proto/dist/agoric/swingset/msgs.js +++ b/packages/cosmic-proto/dist/agoric/swingset/msgs.js @@ -446,7 +446,12 @@ export const MsgProvisionResponse = { }, }; function createBaseMsgInstallBundle() { - return { bundle: '', submitter: new Uint8Array() }; + return { + bundle: '', + submitter: new Uint8Array(), + compressedBundle: new Uint8Array(), + uncompressedSize: Long.ZERO, + }; } export const MsgInstallBundle = { encode(message, writer = _m0.Writer.create()) { @@ -456,6 +461,12 @@ export const MsgInstallBundle = { if (message.submitter.length !== 0) { writer.uint32(18).bytes(message.submitter); } + if (message.compressedBundle.length !== 0) { + writer.uint32(26).bytes(message.compressedBundle); + } + if (!message.uncompressedSize.isZero()) { + writer.uint32(32).int64(message.uncompressedSize); + } return writer; }, decode(input, length) { @@ -471,6 +482,12 @@ export const MsgInstallBundle = { case 2: message.submitter = reader.bytes(); break; + case 3: + message.compressedBundle = reader.bytes(); + break; + case 4: + message.uncompressedSize = reader.int64(); + break; default: reader.skipType(tag & 7); break; @@ -484,6 +501,12 @@ export const MsgInstallBundle = { submitter: isSet(object.submitter) ? bytesFromBase64(object.submitter) : new Uint8Array(), + compressedBundle: isSet(object.compressedBundle) + ? bytesFromBase64(object.compressedBundle) + : new Uint8Array(), + uncompressedSize: isSet(object.uncompressedSize) + ? Long.fromValue(object.uncompressedSize) + : Long.ZERO, }; }, toJSON(message) { @@ -493,12 +516,27 @@ export const MsgInstallBundle = { (obj.submitter = base64FromBytes( message.submitter !== undefined ? message.submitter : new Uint8Array(), )); + message.compressedBundle !== undefined && + (obj.compressedBundle = base64FromBytes( + message.compressedBundle !== undefined + ? message.compressedBundle + : new Uint8Array(), + )); + message.uncompressedSize !== undefined && + (obj.uncompressedSize = ( + message.uncompressedSize || Long.ZERO + ).toString()); return obj; }, fromPartial(object) { const message = createBaseMsgInstallBundle(); message.bundle = object.bundle ?? ''; message.submitter = object.submitter ?? new Uint8Array(); + message.compressedBundle = object.compressedBundle ?? new Uint8Array(); + message.uncompressedSize = + object.uncompressedSize !== undefined && object.uncompressedSize !== null + ? Long.fromValue(object.uncompressedSize) + : Long.ZERO; return message; }, }; diff --git a/packages/cosmic-proto/dist/agoric/swingset/swingset.d.ts b/packages/cosmic-proto/dist/agoric/swingset/swingset.d.ts index 9b2e99c6a60..94b97d01b85 100644 --- a/packages/cosmic-proto/dist/agoric/swingset/swingset.d.ts +++ b/packages/cosmic-proto/dist/agoric/swingset/swingset.d.ts @@ -111,8 +111,13 @@ export interface Egress { /** TODO: Remove these power flags as they are deprecated and have no effect. */ powerFlags: string[]; } -/** The payload messages used by swingset state-sync */ -export interface ExtensionSnapshotterArtifactPayload { +/** + * SwingStoreArtifact encodes an artifact of a swing-store export. + * Artifacts may be stored or transmitted in any order. Most handlers do + * maintain the artifact order from their original source as an effect of how + * they handle the artifacts. + */ +export interface SwingStoreArtifact { name: string; data: Uint8Array; } @@ -514,17 +519,11 @@ export declare const Egress: { object: I, ): Egress; }; -export declare const ExtensionSnapshotterArtifactPayload: { - encode( - message: ExtensionSnapshotterArtifactPayload, - writer?: _m0.Writer, - ): _m0.Writer; - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): ExtensionSnapshotterArtifactPayload; - fromJSON(object: any): ExtensionSnapshotterArtifactPayload; - toJSON(message: ExtensionSnapshotterArtifactPayload): unknown; +export declare const SwingStoreArtifact: { + encode(message: SwingStoreArtifact, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): SwingStoreArtifact; + fromJSON(object: any): SwingStoreArtifact; + toJSON(message: SwingStoreArtifact): unknown; fromPartial< I extends { name?: string | undefined; @@ -532,12 +531,10 @@ export declare const ExtensionSnapshotterArtifactPayload: { } & { name?: string | undefined; data?: Uint8Array | undefined; - } & { - [K in Exclude]: never; - }, + } & { [K in Exclude]: never }, >( object: I, - ): ExtensionSnapshotterArtifactPayload; + ): SwingStoreArtifact; }; declare type Builtin = | Date diff --git a/packages/cosmic-proto/dist/agoric/swingset/swingset.js b/packages/cosmic-proto/dist/agoric/swingset/swingset.js index d425ff80482..fdf2dacc938 100644 --- a/packages/cosmic-proto/dist/agoric/swingset/swingset.js +++ b/packages/cosmic-proto/dist/agoric/swingset/swingset.js @@ -540,10 +540,10 @@ export const Egress = { return message; }, }; -function createBaseExtensionSnapshotterArtifactPayload() { +function createBaseSwingStoreArtifact() { return { name: '', data: new Uint8Array() }; } -export const ExtensionSnapshotterArtifactPayload = { +export const SwingStoreArtifact = { encode(message, writer = _m0.Writer.create()) { if (message.name !== '') { writer.uint32(10).string(message.name); @@ -556,7 +556,7 @@ export const ExtensionSnapshotterArtifactPayload = { decode(input, length) { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseExtensionSnapshotterArtifactPayload(); + const message = createBaseSwingStoreArtifact(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -591,7 +591,7 @@ export const ExtensionSnapshotterArtifactPayload = { return obj; }, fromPartial(object) { - const message = createBaseExtensionSnapshotterArtifactPayload(); + const message = createBaseSwingStoreArtifact(); message.name = object.name ?? ''; message.data = object.data ?? new Uint8Array(); return message; diff --git a/packages/cosmic-proto/dist/agoric/vstorage/query.d.ts b/packages/cosmic-proto/dist/agoric/vstorage/query.d.ts index 2a7a4265016..f2276072da7 100644 --- a/packages/cosmic-proto/dist/agoric/vstorage/query.d.ts +++ b/packages/cosmic-proto/dist/agoric/vstorage/query.d.ts @@ -13,6 +13,39 @@ export interface QueryDataRequest { export interface QueryDataResponse { value: string; } +/** QueryCapDataRequest contains a path and formatting configuration. */ +export interface QueryCapDataRequest { + path: string; + /** + * mediaType must be an actual media type in the registry at + * https://www.iana.org/assignments/media-types/media-types.xhtml + * or a special value that does not conflict with the media type syntax. + * The only valid value is "JSON Lines", which is also the default. + */ + mediaType: string; + /** + * itemFormat, if present, must be the special value "flat" to indicate that + * the deep structure of each item should be flattened into a single level + * with kebab-case keys (e.g., `{ "metrics": { "min": 0, "max": 88 } }` as + * `{ "metrics-min": 0, "metrics-max": 88 }`). + */ + itemFormat: string; + /** + * remotableValueFormat indicates how to transform references to opaque but + * distinguishable Remotables into readable embedded representations. + * * "object" represents each Remotable as an `{ id, allegedName }` object, e.g. `{ "id": "board007", "allegedName": "IST brand" }`. + * * "string" represents each Remotable as a string with bracket-wrapped contents including its alleged name and id, e.g. "[Alleged: IST brand ]". + */ + remotableValueFormat: string; +} +/** + * QueryCapDataResponse represents the result with the requested formatting, + * reserving space for future metadata such as media type. + */ +export interface QueryCapDataResponse { + blockHeight: string; + value: string; +} /** QueryChildrenRequest is the vstorage path children query. */ export interface QueryChildrenRequest { path: string; @@ -53,6 +86,44 @@ export declare const QueryDataResponse: { object: I, ): QueryDataResponse; }; +export declare const QueryCapDataRequest: { + encode(message: QueryCapDataRequest, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCapDataRequest; + fromJSON(object: any): QueryCapDataRequest; + toJSON(message: QueryCapDataRequest): unknown; + fromPartial< + I extends { + path?: string | undefined; + mediaType?: string | undefined; + itemFormat?: string | undefined; + remotableValueFormat?: string | undefined; + } & { + path?: string | undefined; + mediaType?: string | undefined; + itemFormat?: string | undefined; + remotableValueFormat?: string | undefined; + } & { [K in Exclude]: never }, + >( + object: I, + ): QueryCapDataRequest; +}; +export declare const QueryCapDataResponse: { + encode(message: QueryCapDataResponse, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCapDataResponse; + fromJSON(object: any): QueryCapDataResponse; + toJSON(message: QueryCapDataResponse): unknown; + fromPartial< + I extends { + blockHeight?: string | undefined; + value?: string | undefined; + } & { + blockHeight?: string | undefined; + value?: string | undefined; + } & { [K in Exclude]: never }, + >( + object: I, + ): QueryCapDataResponse; +}; export declare const QueryChildrenRequest: { encode(message: QueryChildrenRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): QueryChildrenRequest; @@ -382,8 +453,13 @@ export declare const QueryChildrenResponse: { }; /** Query defines the gRPC querier service */ export interface Query { - /** Return an arbitrary vstorage datum. */ + /** Return the raw string value of an arbitrary vstorage datum. */ Data(request: QueryDataRequest): Promise; + /** + * Return a formatted representation of a vstorage datum that must be + * a valid StreamCell with CapData values, or standalone CapData. + */ + CapData(request: QueryCapDataRequest): Promise; /** Return the children of a given vstorage path. */ Children(request: QueryChildrenRequest): Promise; } @@ -397,6 +473,7 @@ export declare class QueryClientImpl implements Query { }, ); Data(request: QueryDataRequest): Promise; + CapData(request: QueryCapDataRequest): Promise; Children(request: QueryChildrenRequest): Promise; } interface Rpc { diff --git a/packages/cosmic-proto/dist/agoric/vstorage/query.js b/packages/cosmic-proto/dist/agoric/vstorage/query.js index 8d795ca8c03..cc7eef017e6 100644 --- a/packages/cosmic-proto/dist/agoric/vstorage/query.js +++ b/packages/cosmic-proto/dist/agoric/vstorage/query.js @@ -88,6 +88,132 @@ export const QueryDataResponse = { return message; }, }; +function createBaseQueryCapDataRequest() { + return { path: '', mediaType: '', itemFormat: '', remotableValueFormat: '' }; +} +export const QueryCapDataRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.path !== '') { + writer.uint32(10).string(message.path); + } + if (message.mediaType !== '') { + writer.uint32(18).string(message.mediaType); + } + if (message.itemFormat !== '') { + writer.uint32(26).string(message.itemFormat); + } + if (message.remotableValueFormat !== '') { + writer.uint32(82).string(message.remotableValueFormat); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCapDataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.mediaType = reader.string(); + break; + case 3: + message.itemFormat = reader.string(); + break; + case 10: + message.remotableValueFormat = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + path: isSet(object.path) ? String(object.path) : '', + mediaType: isSet(object.mediaType) ? String(object.mediaType) : '', + itemFormat: isSet(object.itemFormat) ? String(object.itemFormat) : '', + remotableValueFormat: isSet(object.remotableValueFormat) + ? String(object.remotableValueFormat) + : '', + }; + }, + toJSON(message) { + const obj = {}; + message.path !== undefined && (obj.path = message.path); + message.mediaType !== undefined && (obj.mediaType = message.mediaType); + message.itemFormat !== undefined && (obj.itemFormat = message.itemFormat); + message.remotableValueFormat !== undefined && + (obj.remotableValueFormat = message.remotableValueFormat); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryCapDataRequest(); + message.path = object.path ?? ''; + message.mediaType = object.mediaType ?? ''; + message.itemFormat = object.itemFormat ?? ''; + message.remotableValueFormat = object.remotableValueFormat ?? ''; + return message; + }, +}; +function createBaseQueryCapDataResponse() { + return { blockHeight: '', value: '' }; +} +export const QueryCapDataResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.blockHeight !== '') { + writer.uint32(10).string(message.blockHeight); + } + if (message.value !== '') { + writer.uint32(82).string(message.value); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCapDataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockHeight = reader.string(); + break; + case 10: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + blockHeight: isSet(object.blockHeight) ? String(object.blockHeight) : '', + value: isSet(object.value) ? String(object.value) : '', + }; + }, + toJSON(message) { + const obj = {}; + message.blockHeight !== undefined && + (obj.blockHeight = message.blockHeight); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + fromPartial(object) { + const message = createBaseQueryCapDataResponse(); + message.blockHeight = object.blockHeight ?? ''; + message.value = object.value ?? ''; + return message; + }, +}; function createBaseQueryChildrenRequest() { return { path: '', pagination: undefined }; } @@ -224,6 +350,7 @@ export class QueryClientImpl { this.service = opts?.service || 'agoric.vstorage.Query'; this.rpc = rpc; this.Data = this.Data.bind(this); + this.CapData = this.CapData.bind(this); this.Children = this.Children.bind(this); } Data(request) { @@ -233,6 +360,13 @@ export class QueryClientImpl { QueryDataResponse.decode(new _m0.Reader(data)), ); } + CapData(request) { + const data = QueryCapDataRequest.encode(request).finish(); + const promise = this.rpc.request(this.service, 'CapData', data); + return promise.then((data) => + QueryCapDataResponse.decode(new _m0.Reader(data)), + ); + } Children(request) { const data = QueryChildrenRequest.encode(request).finish(); const promise = this.rpc.request(this.service, 'Children', data); diff --git a/packages/cosmic-proto/dist/cosmos/base/query/v1beta1/pagination.d.ts b/packages/cosmic-proto/dist/cosmos/base/query/v1beta1/pagination.d.ts new file mode 100644 index 00000000000..142b8c2038d --- /dev/null +++ b/packages/cosmic-proto/dist/cosmos/base/query/v1beta1/pagination.d.ts @@ -0,0 +1,322 @@ +import Long from "long"; +import _m0 from "protobufjs/minimal.js"; +export declare const protobufPackage = "cosmos.base.query.v1beta1"; +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: 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; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: Long; +} +export declare const PageRequest: { + encode(message: PageRequest, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest; + fromJSON(object: any): PageRequest; + toJSON(message: PageRequest): unknown; + fromPartial Long; + and: (other: string | number | Long) => Long; + compare: (other: string | number | Long) => number; + comp: (other: string | number | Long) => number; + divide: (divisor: string | number | Long) => Long; + div: (divisor: string | number | Long) => Long; + equals: (other: string | number | Long) => boolean; + eq: (other: string | number | Long) => boolean; + getHighBits: () => number; + getHighBitsUnsigned: () => number; + getLowBits: () => number; + getLowBitsUnsigned: () => number; + getNumBitsAbs: () => number; + greaterThan: (other: string | number | Long) => boolean; + gt: (other: string | number | Long) => boolean; + greaterThanOrEqual: (other: string | number | Long) => boolean; + gte: (other: string | number | Long) => boolean; + ge: (other: string | number | Long) => boolean; + isEven: () => boolean; + isNegative: () => boolean; + isOdd: () => boolean; + isPositive: () => boolean; + isZero: () => boolean; + eqz: () => boolean; + lessThan: (other: string | number | Long) => boolean; + lt: (other: string | number | Long) => boolean; + lessThanOrEqual: (other: string | number | Long) => boolean; + lte: (other: string | number | Long) => boolean; + le: (other: string | number | Long) => boolean; + modulo: (other: string | number | Long) => Long; + mod: (other: string | number | Long) => Long; + rem: (other: string | number | Long) => Long; + multiply: (multiplier: string | number | Long) => Long; + mul: (multiplier: string | number | Long) => Long; + negate: () => Long; + neg: () => Long; + not: () => Long; + countLeadingZeros: () => number; + clz: () => number; + countTrailingZeros: () => number; + ctz: () => number; + notEquals: (other: string | number | Long) => boolean; + neq: (other: string | number | Long) => boolean; + ne: (other: string | number | Long) => boolean; + or: (other: string | number | Long) => Long; + shiftLeft: (numBits: number | Long) => Long; + shl: (numBits: number | Long) => Long; + shiftRight: (numBits: number | Long) => Long; + shr: (numBits: number | Long) => Long; + shiftRightUnsigned: (numBits: number | Long) => Long; + shru: (numBits: number | Long) => Long; + shr_u: (numBits: number | Long) => Long; + rotateLeft: (numBits: number | Long) => Long; + rotl: (numBits: number | Long) => Long; + rotateRight: (numBits: number | Long) => Long; + rotr: (numBits: number | Long) => Long; + subtract: (subtrahend: string | number | Long) => Long; + sub: (subtrahend: string | number | Long) => Long; + toInt: () => number; + toNumber: () => number; + toBytes: (le?: boolean | undefined) => number[]; + toBytesLE: () => number[]; + toBytesBE: () => number[]; + toSigned: () => Long; + toString: (radix?: number | undefined) => string; + toUnsigned: () => Long; + xor: (other: string | number | Long) => Long; + } & { [K in Exclude]: never; }) | undefined; + limit?: string | number | (Long & { + high: number; + low: number; + unsigned: boolean; + add: (addend: string | number | Long) => Long; + and: (other: string | number | Long) => Long; + compare: (other: string | number | Long) => number; + comp: (other: string | number | Long) => number; + divide: (divisor: string | number | Long) => Long; + div: (divisor: string | number | Long) => Long; + equals: (other: string | number | Long) => boolean; + eq: (other: string | number | Long) => boolean; + getHighBits: () => number; + getHighBitsUnsigned: () => number; + getLowBits: () => number; + getLowBitsUnsigned: () => number; + getNumBitsAbs: () => number; + greaterThan: (other: string | number | Long) => boolean; + gt: (other: string | number | Long) => boolean; + greaterThanOrEqual: (other: string | number | Long) => boolean; + gte: (other: string | number | Long) => boolean; + ge: (other: string | number | Long) => boolean; + isEven: () => boolean; + isNegative: () => boolean; + isOdd: () => boolean; + isPositive: () => boolean; + isZero: () => boolean; + eqz: () => boolean; + lessThan: (other: string | number | Long) => boolean; + lt: (other: string | number | Long) => boolean; + lessThanOrEqual: (other: string | number | Long) => boolean; + lte: (other: string | number | Long) => boolean; + le: (other: string | number | Long) => boolean; + modulo: (other: string | number | Long) => Long; + mod: (other: string | number | Long) => Long; + rem: (other: string | number | Long) => Long; + multiply: (multiplier: string | number | Long) => Long; + mul: (multiplier: string | number | Long) => Long; + negate: () => Long; + neg: () => Long; + not: () => Long; + countLeadingZeros: () => number; + clz: () => number; + countTrailingZeros: () => number; + ctz: () => number; + notEquals: (other: string | number | Long) => boolean; + neq: (other: string | number | Long) => boolean; + ne: (other: string | number | Long) => boolean; + or: (other: string | number | Long) => Long; + shiftLeft: (numBits: number | Long) => Long; + shl: (numBits: number | Long) => Long; + shiftRight: (numBits: number | Long) => Long; + shr: (numBits: number | Long) => Long; + shiftRightUnsigned: (numBits: number | Long) => Long; + shru: (numBits: number | Long) => Long; + shr_u: (numBits: number | Long) => Long; + rotateLeft: (numBits: number | Long) => Long; + rotl: (numBits: number | Long) => Long; + rotateRight: (numBits: number | Long) => Long; + rotr: (numBits: number | Long) => Long; + subtract: (subtrahend: string | number | Long) => Long; + sub: (subtrahend: string | number | Long) => Long; + toInt: () => number; + toNumber: () => number; + toBytes: (le?: boolean | undefined) => number[]; + toBytesLE: () => number[]; + toBytesBE: () => number[]; + toSigned: () => Long; + toString: (radix?: number | undefined) => string; + toUnsigned: () => Long; + xor: (other: string | number | Long) => Long; + } & { [K_1 in Exclude]: never; }) | undefined; + countTotal?: boolean | undefined; + reverse?: boolean | undefined; + } & { [K_2 in Exclude]: never; }>(object: I): PageRequest; +}; +export declare const PageResponse: { + encode(message: PageResponse, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse; + fromJSON(object: any): PageResponse; + toJSON(message: PageResponse): unknown; + fromPartial Long; + and: (other: string | number | Long) => Long; + compare: (other: string | number | Long) => number; + comp: (other: string | number | Long) => number; + divide: (divisor: string | number | Long) => Long; + div: (divisor: string | number | Long) => Long; + equals: (other: string | number | Long) => boolean; + eq: (other: string | number | Long) => boolean; + getHighBits: () => number; + getHighBitsUnsigned: () => number; + getLowBits: () => number; + getLowBitsUnsigned: () => number; + getNumBitsAbs: () => number; + greaterThan: (other: string | number | Long) => boolean; + gt: (other: string | number | Long) => boolean; + greaterThanOrEqual: (other: string | number | Long) => boolean; + gte: (other: string | number | Long) => boolean; + ge: (other: string | number | Long) => boolean; + isEven: () => boolean; + isNegative: () => boolean; + isOdd: () => boolean; + isPositive: () => boolean; + isZero: () => boolean; + eqz: () => boolean; + lessThan: (other: string | number | Long) => boolean; + lt: (other: string | number | Long) => boolean; + lessThanOrEqual: (other: string | number | Long) => boolean; + lte: (other: string | number | Long) => boolean; + le: (other: string | number | Long) => boolean; + modulo: (other: string | number | Long) => Long; + mod: (other: string | number | Long) => Long; + rem: (other: string | number | Long) => Long; + multiply: (multiplier: string | number | Long) => Long; + mul: (multiplier: string | number | Long) => Long; + negate: () => Long; + neg: () => Long; + not: () => Long; + countLeadingZeros: () => number; + clz: () => number; + countTrailingZeros: () => number; + ctz: () => number; + notEquals: (other: string | number | Long) => boolean; + neq: (other: string | number | Long) => boolean; + ne: (other: string | number | Long) => boolean; + or: (other: string | number | Long) => Long; + shiftLeft: (numBits: number | Long) => Long; + shl: (numBits: number | Long) => Long; + shiftRight: (numBits: number | Long) => Long; + shr: (numBits: number | Long) => Long; + shiftRightUnsigned: (numBits: number | Long) => Long; + shru: (numBits: number | Long) => Long; + shr_u: (numBits: number | Long) => Long; + rotateLeft: (numBits: number | Long) => Long; + rotl: (numBits: number | Long) => Long; + rotateRight: (numBits: number | Long) => Long; + rotr: (numBits: number | Long) => Long; + subtract: (subtrahend: string | number | Long) => Long; + sub: (subtrahend: string | number | Long) => Long; + toInt: () => number; + toNumber: () => number; + toBytes: (le?: boolean | undefined) => number[]; + toBytesLE: () => number[]; + toBytesBE: () => number[]; + toSigned: () => Long; + toString: (radix?: number | undefined) => string; + toUnsigned: () => Long; + xor: (other: string | number | Long) => Long; + } & { [K in Exclude]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(object: I): PageResponse; +}; +declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export declare type DeepPartial = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +declare type KeysOfUnion = T extends T ? keyof T : never; +export declare type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/packages/cosmic-proto/dist/cosmos/base/query/v1beta1/pagination.js b/packages/cosmic-proto/dist/cosmos/base/query/v1beta1/pagination.js new file mode 100644 index 00000000000..8ce3adb3fab --- /dev/null +++ b/packages/cosmic-proto/dist/cosmos/base/query/v1beta1/pagination.js @@ -0,0 +1,186 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal.js"; +export const protobufPackage = "cosmos.base.query.v1beta1"; +function createBasePageRequest() { + return { key: new Uint8Array(), offset: Long.UZERO, limit: Long.UZERO, countTotal: false, reverse: false }; +} +export const PageRequest = { + encode(message, writer = _m0.Writer.create()) { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (!message.offset.isZero()) { + writer.uint32(16).uint64(message.offset); + } + if (!message.limit.isZero()) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.offset = reader.uint64(); + break; + case 3: + message.limit = reader.uint64(); + break; + case 4: + message.countTotal = reader.bool(); + break; + case 5: + message.reverse = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), + offset: isSet(object.offset) ? Long.fromValue(object.offset) : Long.UZERO, + limit: isSet(object.limit) ? Long.fromValue(object.limit) : Long.UZERO, + countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false, + reverse: isSet(object.reverse) ? Boolean(object.reverse) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.offset !== undefined && (obj.offset = (message.offset || Long.UZERO).toString()); + message.limit !== undefined && (obj.limit = (message.limit || Long.UZERO).toString()); + message.countTotal !== undefined && (obj.countTotal = message.countTotal); + message.reverse !== undefined && (obj.reverse = message.reverse); + return obj; + }, + fromPartial(object) { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = (object.offset !== undefined && object.offset !== null) + ? Long.fromValue(object.offset) + : Long.UZERO; + message.limit = (object.limit !== undefined && object.limit !== null) ? Long.fromValue(object.limit) : Long.UZERO; + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; +function createBasePageResponse() { + return { nextKey: new Uint8Array(), total: Long.UZERO }; +} +export const PageResponse = { + encode(message, writer = _m0.Writer.create()) { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (!message.total.isZero()) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextKey = reader.bytes(); + break; + case 2: + message.total = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(), + total: isSet(object.total) ? Long.fromValue(object.total) : Long.UZERO, + }; + }, + toJSON(message) { + const obj = {}; + 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; + }, + fromPartial(object) { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(); + message.total = (object.total !== undefined && object.total !== null) ? Long.fromValue(object.total) : Long.UZERO; + return message; + }, +}; +var globalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); +function bytesFromBase64(b64) { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } + else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/packages/cosmic-proto/dist/cosmos_proto/cosmos.d.ts b/packages/cosmic-proto/dist/cosmos_proto/cosmos.d.ts new file mode 100644 index 00000000000..8d37a798bd1 --- /dev/null +++ b/packages/cosmic-proto/dist/cosmos_proto/cosmos.d.ts @@ -0,0 +1,99 @@ +import Long from "long"; +import _m0 from "protobufjs/minimal.js"; +export declare const protobufPackage = "cosmos_proto"; +export declare enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1 +} +export declare function scalarTypeFromJSON(object: any): ScalarType; +export declare function scalarTypeToJSON(object: ScalarType): string; +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} +export declare const InterfaceDescriptor: { + encode(message: InterfaceDescriptor, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor; + fromJSON(object: any): InterfaceDescriptor; + toJSON(message: InterfaceDescriptor): unknown; + fromPartial]: never; }>(object: I): InterfaceDescriptor; +}; +export declare const ScalarDescriptor: { + encode(message: ScalarDescriptor, writer?: _m0.Writer): _m0.Writer; + decode(input: _m0.Reader | Uint8Array, length?: number): ScalarDescriptor; + fromJSON(object: any): ScalarDescriptor; + toJSON(message: ScalarDescriptor): unknown; + fromPartial]: never; }) | undefined; + } & { [K_1 in Exclude]: never; }>(object: I): ScalarDescriptor; +}; +declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; +export declare type DeepPartial = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { + [K in keyof T]?: DeepPartial; +} : Partial; +declare type KeysOfUnion = T extends T ? keyof T : never; +export declare type Exact = P extends Builtin ? P : P & { + [K in keyof P]: Exact; +} & { + [K in Exclude>]: never; +}; +export {}; diff --git a/packages/cosmic-proto/dist/cosmos_proto/cosmos.js b/packages/cosmic-proto/dist/cosmos_proto/cosmos.js new file mode 100644 index 00000000000..9d1a08f3f20 --- /dev/null +++ b/packages/cosmic-proto/dist/cosmos_proto/cosmos.js @@ -0,0 +1,176 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal.js"; +export const protobufPackage = "cosmos_proto"; +export var ScalarType; +(function (ScalarType) { + ScalarType[ScalarType["SCALAR_TYPE_UNSPECIFIED"] = 0] = "SCALAR_TYPE_UNSPECIFIED"; + ScalarType[ScalarType["SCALAR_TYPE_STRING"] = 1] = "SCALAR_TYPE_STRING"; + ScalarType[ScalarType["SCALAR_TYPE_BYTES"] = 2] = "SCALAR_TYPE_BYTES"; + ScalarType[ScalarType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; +})(ScalarType || (ScalarType = {})); +export function scalarTypeFromJSON(object) { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} +export function scalarTypeToJSON(object) { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +function createBaseInterfaceDescriptor() { + return { name: "", description: "" }; +} +export const InterfaceDescriptor = { + encode(message, writer = _m0.Writer.create()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + fromPartial(object) { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; +function createBaseScalarDescriptor() { + return { name: "", description: "", fieldType: [] }; +} +export const ScalarDescriptor = { + encode(message, writer = _m0.Writer.create()) { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + decode(input, length) { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push(reader.int32()); + } + } + else { + message.fieldType.push(reader.int32()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + description: isSet(object.description) ? String(object.description) : "", + fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e) => scalarTypeFromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.description !== undefined && (obj.description = message.description); + if (message.fieldType) { + obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e)); + } + else { + obj.fieldType = []; + } + return obj; + }, + fromPartial(object) { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map((e) => e) || []; + return message; + }, +}; +if (_m0.util.Long !== Long) { + _m0.util.Long = Long; + _m0.configure(); +} +function isSet(value) { + return value !== null && value !== undefined; +}